blob: 66598afb9785aa269c3fffdc446a7c5ee5435f97 [file] [log] [blame]
Reid Spencer6f407902007-01-13 05:00:46 +00001/* A Bison parser, made by GNU Bison 2.1. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Reid Spencer6f407902007-01-13 05:00:46 +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
Anton Korobeynikov178a3522007-01-12 19:22:51 +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.
10
11 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
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
20
Reid Spencer6f407902007-01-13 05:00:46 +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. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +000025
Reid Spencer6f407902007-01-13 05:00:46 +000026/* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +000028
29/* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36/* Identify Bison output. */
37#define YYBISON 1
38
39/* Bison version. */
Reid Spencer6f407902007-01-13 05:00:46 +000040#define YYBISON_VERSION "2.1"
Anton Korobeynikov178a3522007-01-12 19:22:51 +000041
42/* Skeleton name. */
43#define YYSKELETON_NAME "yacc.c"
44
45/* Pure parsers. */
46#define YYPURE 0
47
48/* Using locations. */
49#define YYLSP_NEEDED 0
50
51/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000052#define yyparse llvmAsmparse
Anton Korobeynikov178a3522007-01-12 19:22:51 +000053#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000054#define yyerror llvmAsmerror
Anton Korobeynikov178a3522007-01-12 19:22:51 +000055#define yylval llvmAsmlval
56#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000057#define yydebug llvmAsmdebug
58#define yynerrs llvmAsmnerrs
59
Anton Korobeynikov178a3522007-01-12 19:22:51 +000060
61/* Tokens. */
62#ifndef YYTOKENTYPE
63# define YYTOKENTYPE
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
65 know about them. */
66 enum yytokentype {
67 ESINT64VAL = 258,
68 EUINT64VAL = 259,
69 SINTVAL = 260,
70 UINTVAL = 261,
71 FPVAL = 262,
72 VOID = 263,
Reid Spencer6f407902007-01-13 05:00:46 +000073 INTTYPE = 264,
74 FLOAT = 265,
75 DOUBLE = 266,
76 LABEL = 267,
77 TYPE = 268,
78 VAR_ID = 269,
79 LABELSTR = 270,
80 STRINGCONSTANT = 271,
81 IMPLEMENTATION = 272,
82 ZEROINITIALIZER = 273,
83 TRUETOK = 274,
84 FALSETOK = 275,
85 BEGINTOK = 276,
86 ENDTOK = 277,
87 DECLARE = 278,
88 DEFINE = 279,
89 GLOBAL = 280,
90 CONSTANT = 281,
91 SECTION = 282,
92 VOLATILE = 283,
93 TO = 284,
94 DOTDOTDOT = 285,
95 NULL_TOK = 286,
96 UNDEF = 287,
97 INTERNAL = 288,
98 LINKONCE = 289,
99 WEAK = 290,
100 APPENDING = 291,
101 DLLIMPORT = 292,
102 DLLEXPORT = 293,
103 EXTERN_WEAK = 294,
104 OPAQUE = 295,
105 EXTERNAL = 296,
106 TARGET = 297,
107 TRIPLE = 298,
108 ENDIAN = 299,
109 POINTERSIZE = 300,
110 LITTLE = 301,
111 BIG = 302,
112 ALIGN = 303,
113 DEPLIBS = 304,
114 CALL = 305,
115 TAIL = 306,
116 ASM_TOK = 307,
117 MODULE = 308,
118 SIDEEFFECT = 309,
119 CC_TOK = 310,
120 CCC_TOK = 311,
121 CSRETCC_TOK = 312,
122 FASTCC_TOK = 313,
123 COLDCC_TOK = 314,
124 X86_STDCALLCC_TOK = 315,
125 X86_FASTCALLCC_TOK = 316,
126 DATALAYOUT = 317,
127 RET = 318,
128 BR = 319,
129 SWITCH = 320,
130 INVOKE = 321,
131 UNWIND = 322,
132 UNREACHABLE = 323,
133 ADD = 324,
134 SUB = 325,
135 MUL = 326,
136 UDIV = 327,
137 SDIV = 328,
138 FDIV = 329,
139 UREM = 330,
140 SREM = 331,
141 FREM = 332,
142 AND = 333,
143 OR = 334,
144 XOR = 335,
145 ICMP = 336,
146 FCMP = 337,
147 EQ = 338,
148 NE = 339,
149 SLT = 340,
150 SGT = 341,
151 SLE = 342,
152 SGE = 343,
153 ULT = 344,
154 UGT = 345,
155 ULE = 346,
156 UGE = 347,
157 OEQ = 348,
158 ONE = 349,
159 OLT = 350,
160 OGT = 351,
161 OLE = 352,
162 OGE = 353,
163 ORD = 354,
164 UNO = 355,
165 UEQ = 356,
166 UNE = 357,
167 MALLOC = 358,
168 ALLOCA = 359,
169 FREE = 360,
170 LOAD = 361,
171 STORE = 362,
172 GETELEMENTPTR = 363,
173 TRUNC = 364,
174 ZEXT = 365,
175 SEXT = 366,
176 FPTRUNC = 367,
177 FPEXT = 368,
178 BITCAST = 369,
179 UITOFP = 370,
180 SITOFP = 371,
181 FPTOUI = 372,
182 FPTOSI = 373,
183 INTTOPTR = 374,
184 PTRTOINT = 375,
185 PHI_TOK = 376,
186 SELECT = 377,
187 SHL = 378,
188 LSHR = 379,
189 ASHR = 380,
190 VAARG = 381,
191 EXTRACTELEMENT = 382,
192 INSERTELEMENT = 383,
193 SHUFFLEVECTOR = 384,
194 NORETURN = 385,
195 DEFAULT = 386,
196 HIDDEN = 387
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000197 };
198#endif
199/* Tokens. */
200#define ESINT64VAL 258
201#define EUINT64VAL 259
202#define SINTVAL 260
203#define UINTVAL 261
204#define FPVAL 262
205#define VOID 263
Reid Spencer6f407902007-01-13 05:00:46 +0000206#define INTTYPE 264
207#define FLOAT 265
208#define DOUBLE 266
209#define LABEL 267
210#define TYPE 268
211#define VAR_ID 269
212#define LABELSTR 270
213#define STRINGCONSTANT 271
214#define IMPLEMENTATION 272
215#define ZEROINITIALIZER 273
216#define TRUETOK 274
217#define FALSETOK 275
218#define BEGINTOK 276
219#define ENDTOK 277
220#define DECLARE 278
221#define DEFINE 279
222#define GLOBAL 280
223#define CONSTANT 281
224#define SECTION 282
225#define VOLATILE 283
226#define TO 284
227#define DOTDOTDOT 285
228#define NULL_TOK 286
229#define UNDEF 287
230#define INTERNAL 288
231#define LINKONCE 289
232#define WEAK 290
233#define APPENDING 291
234#define DLLIMPORT 292
235#define DLLEXPORT 293
236#define EXTERN_WEAK 294
237#define OPAQUE 295
238#define EXTERNAL 296
239#define TARGET 297
240#define TRIPLE 298
241#define ENDIAN 299
242#define POINTERSIZE 300
243#define LITTLE 301
244#define BIG 302
245#define ALIGN 303
246#define DEPLIBS 304
247#define CALL 305
248#define TAIL 306
249#define ASM_TOK 307
250#define MODULE 308
251#define SIDEEFFECT 309
252#define CC_TOK 310
253#define CCC_TOK 311
254#define CSRETCC_TOK 312
255#define FASTCC_TOK 313
256#define COLDCC_TOK 314
257#define X86_STDCALLCC_TOK 315
258#define X86_FASTCALLCC_TOK 316
259#define DATALAYOUT 317
260#define RET 318
261#define BR 319
262#define SWITCH 320
263#define INVOKE 321
264#define UNWIND 322
265#define UNREACHABLE 323
266#define ADD 324
267#define SUB 325
268#define MUL 326
269#define UDIV 327
270#define SDIV 328
271#define FDIV 329
272#define UREM 330
273#define SREM 331
274#define FREM 332
275#define AND 333
276#define OR 334
277#define XOR 335
278#define ICMP 336
279#define FCMP 337
280#define EQ 338
281#define NE 339
282#define SLT 340
283#define SGT 341
284#define SLE 342
285#define SGE 343
286#define ULT 344
287#define UGT 345
288#define ULE 346
289#define UGE 347
290#define OEQ 348
291#define ONE 349
292#define OLT 350
293#define OGT 351
294#define OLE 352
295#define OGE 353
296#define ORD 354
297#define UNO 355
298#define UEQ 356
299#define UNE 357
300#define MALLOC 358
301#define ALLOCA 359
302#define FREE 360
303#define LOAD 361
304#define STORE 362
305#define GETELEMENTPTR 363
306#define TRUNC 364
307#define ZEXT 365
308#define SEXT 366
309#define FPTRUNC 367
310#define FPEXT 368
311#define BITCAST 369
312#define UITOFP 370
313#define SITOFP 371
314#define FPTOUI 372
315#define FPTOSI 373
316#define INTTOPTR 374
317#define PTRTOINT 375
318#define PHI_TOK 376
319#define SELECT 377
320#define SHL 378
321#define LSHR 379
322#define ASHR 380
323#define VAARG 381
324#define EXTRACTELEMENT 382
325#define INSERTELEMENT 383
326#define SHUFFLEVECTOR 384
327#define NORETURN 385
328#define DEFAULT 386
329#define HIDDEN 387
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000330
331
332
333
334/* Copy the first part of user declarations. */
Reid Spencer6f407902007-01-13 05:00:46 +0000335#line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000336
337#include "ParserInternals.h"
338#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000339#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000340#include "llvm/Instructions.h"
341#include "llvm/Module.h"
342#include "llvm/SymbolTable.h"
343#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000344#include "llvm/Support/CommandLine.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000345#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000346#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000347#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000348#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000349#include <list>
350#include <utility>
Reid Spencer14310612006-12-31 05:40:51 +0000351#ifndef NDEBUG
352#define YYDEBUG 1
353#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000354
Reid Spencere4f47592006-08-18 17:32:55 +0000355// The following is a gross hack. In order to rid the libAsmParser library of
356// exceptions, we have to have a way of getting the yyparse function to go into
357// an error situation. So, whenever we want an error to occur, the GenerateError
358// function (see bottom of file) sets TriggerError. Then, at the end of each
359// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
360// (a goto) to put YACC in error state. Furthermore, several calls to
361// GenerateError are made from inside productions and they must simulate the
362// previous exception behavior by exiting the production immediately. We have
363// replaced these with the GEN_ERROR macro which calls GeneratError and then
364// immediately invokes YYERROR. This would be so much cleaner if it was a
365// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000366static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000367#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000368#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
369
Reid Spencer68a24bd2005-08-27 18:50:39 +0000370int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
371int yylex(); // declaration" of xxx warnings.
372int yyparse();
373
374namespace llvm {
375 std::string CurFilename;
Reid Spencer14310612006-12-31 05:40:51 +0000376#if YYDEBUG
377static cl::opt<bool>
378Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
379 cl::Hidden, cl::init(false));
380#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000381}
382using namespace llvm;
383
384static Module *ParserResult;
385
386// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
387// relating to upreferences in the input stream.
388//
389//#define DEBUG_UPREFS 1
390#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000391#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000392#else
393#define UR_OUT(X)
394#endif
395
396#define YYERROR_VERBOSE 1
397
Chris Lattnerb475c422005-11-12 18:22:38 +0000398static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000399
400
401// This contains info used when building the body of a function. It is
402// destroyed when the function is completed.
403//
404typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000405
Reid Spencer68a24bd2005-08-27 18:50:39 +0000406static void
407ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
408 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
409
410static struct PerModuleInfo {
411 Module *CurrentModule;
412 std::map<const Type *, ValueList> Values; // Module level numbered definitions
413 std::map<const Type *,ValueList> LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000414 std::vector<PATypeHolder> Types;
415 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000416
417 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000418 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419 /// that we can resolve them later and print error messages as appropriate.
420 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
421
422 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
423 // references to global values. Global values may be referenced before they
424 // are defined, and if so, the temporary object that they represent is held
425 // here. This is used for forward references of GlobalValues.
426 //
427 typedef std::map<std::pair<const PointerType *,
428 ValID>, GlobalValue*> GlobalRefsType;
429 GlobalRefsType GlobalRefs;
430
431 void ModuleDone() {
432 // If we could not resolve some functions at function compilation time
433 // (calls to functions before they are defined), resolve them now... Types
434 // are resolved when the constant pool has been completely parsed.
435 //
436 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000437 if (TriggerError)
438 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000439
440 // Check to make sure that all global value forward references have been
441 // resolved!
442 //
443 if (!GlobalRefs.empty()) {
444 std::string UndefinedReferences = "Unresolved global references exist:\n";
445
446 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
447 I != E; ++I) {
448 UndefinedReferences += " " + I->first.first->getDescription() + " " +
449 I->first.second.getName() + "\n";
450 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000451 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000452 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000453 }
454
455 Values.clear(); // Clear out function local definitions
456 Types.clear();
457 CurrentModule = 0;
458 }
459
Reid Spencer68a24bd2005-08-27 18:50:39 +0000460 // GetForwardRefForGlobal - Check to see if there is a forward reference
461 // for this global. If so, remove it from the GlobalRefs map and return it.
462 // If not, just return null.
463 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
464 // Check to see if there is a forward reference to this global variable...
465 // if there is, eliminate it and patch the reference to use the new def'n.
466 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
467 GlobalValue *Ret = 0;
468 if (I != GlobalRefs.end()) {
469 Ret = I->second;
470 GlobalRefs.erase(I);
471 }
472 return Ret;
473 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000474
475 bool TypeIsUnresolved(PATypeHolder* PATy) {
476 // If it isn't abstract, its resolved
477 const Type* Ty = PATy->get();
478 if (!Ty->isAbstract())
479 return false;
480 // Traverse the type looking for abstract types. If it isn't abstract then
481 // we don't need to traverse that leg of the type.
482 std::vector<const Type*> WorkList, SeenList;
483 WorkList.push_back(Ty);
484 while (!WorkList.empty()) {
485 const Type* Ty = WorkList.back();
486 SeenList.push_back(Ty);
487 WorkList.pop_back();
488 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
489 // Check to see if this is an unresolved type
490 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
491 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
492 for ( ; I != E; ++I) {
493 if (I->second.get() == OpTy)
494 return true;
495 }
496 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
497 const Type* TheTy = SeqTy->getElementType();
498 if (TheTy->isAbstract() && TheTy != Ty) {
499 std::vector<const Type*>::iterator I = SeenList.begin(),
500 E = SeenList.end();
501 for ( ; I != E; ++I)
502 if (*I == TheTy)
503 break;
504 if (I == E)
505 WorkList.push_back(TheTy);
506 }
507 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
508 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
509 const Type* TheTy = StrTy->getElementType(i);
510 if (TheTy->isAbstract() && TheTy != Ty) {
511 std::vector<const Type*>::iterator I = SeenList.begin(),
512 E = SeenList.end();
513 for ( ; I != E; ++I)
514 if (*I == TheTy)
515 break;
516 if (I == E)
517 WorkList.push_back(TheTy);
518 }
519 }
520 }
521 }
522 return false;
523 }
524
525
Reid Spencer68a24bd2005-08-27 18:50:39 +0000526} CurModule;
527
528static struct PerFunctionInfo {
529 Function *CurrentFunction; // Pointer to current function being created
530
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000531 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
Reid Spencer68a24bd2005-08-27 18:50:39 +0000532 std::map<const Type*, ValueList> LateResolveValues;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000533 bool isDeclare; // Is this function a forward declararation?
534 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000535 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000536
537 /// BBForwardRefs - When we see forward references to basic blocks, keep
538 /// track of them here.
539 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
540 std::vector<BasicBlock*> NumberedBlocks;
541 unsigned NextBBNum;
542
543 inline PerFunctionInfo() {
544 CurrentFunction = 0;
545 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000546 Linkage = GlobalValue::ExternalLinkage;
547 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000548 }
549
550 inline void FunctionStart(Function *M) {
551 CurrentFunction = M;
552 NextBBNum = 0;
553 }
554
555 void FunctionDone() {
556 NumberedBlocks.clear();
557
558 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000559 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000560 GenerateError("Undefined reference to label " +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000561 BBForwardRefs.begin()->first->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000562 return;
563 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000564
565 // Resolve all forward references now.
566 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
567
568 Values.clear(); // Clear out function local definitions
569 CurrentFunction = 0;
570 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000571 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000572 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000573 }
574} CurFun; // Info for the current function...
575
576static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
577
578
579//===----------------------------------------------------------------------===//
580// Code to handle definitions of all the types
581//===----------------------------------------------------------------------===//
582
583static int InsertValue(Value *V,
584 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
585 if (V->hasName()) return -1; // Is this a numbered definition?
586
587 // Yes, insert the value into the value table...
588 ValueList &List = ValueTab[V->getType()];
589 List.push_back(V);
590 return List.size()-1;
591}
592
593static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
594 switch (D.Type) {
595 case ValID::NumberVal: // Is it a numbered definition?
596 // Module constants occupy the lowest numbered slots...
597 if ((unsigned)D.Num < CurModule.Types.size())
Reid Spencer861d9d62006-11-28 07:29:44 +0000598 return CurModule.Types[(unsigned)D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000599 break;
600 case ValID::NameVal: // Is it a named definition?
601 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
602 D.destroy(); // Free old strdup'd memory...
603 return N;
604 }
605 break;
606 default:
Reid Spencer61c83e02006-08-18 08:43:06 +0000607 GenerateError("Internal parser error: Invalid symbol type reference!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000608 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000609 }
610
611 // If we reached here, we referenced either a symbol that we don't know about
612 // or an id number that hasn't been read yet. We may be referencing something
613 // forward, so just create an entry to be resolved later and get to it...
614 //
615 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
616
617
618 if (inFunctionScope()) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000619 if (D.Type == ValID::NameVal) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000620 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000621 return 0;
622 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000623 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000624 return 0;
625 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000626 }
627
Reid Spencer861d9d62006-11-28 07:29:44 +0000628 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000629 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000630 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000631
Reid Spencer861d9d62006-11-28 07:29:44 +0000632 Type *Typ = OpaqueType::get();
633 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
634 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000635 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000636
637static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
638 SymbolTable &SymTab =
Reid Spencer78d033e2007-01-06 07:24:44 +0000639 inFunctionScope() ? CurFun.CurrentFunction->getValueSymbolTable() :
640 CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000641 return SymTab.lookup(Ty, Name);
642}
643
644// getValNonImprovising - Look up the value specified by the provided type and
645// the provided ValID. If the value exists and has already been defined, return
646// it. Otherwise return null.
647//
648static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000649 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000650 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000651 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000652 return 0;
653 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000654
655 switch (D.Type) {
656 case ValID::NumberVal: { // Is it a numbered definition?
657 unsigned Num = (unsigned)D.Num;
658
659 // Module constants occupy the lowest numbered slots...
660 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
661 if (VI != CurModule.Values.end()) {
662 if (Num < VI->second.size())
663 return VI->second[Num];
664 Num -= VI->second.size();
665 }
666
667 // Make sure that our type is within bounds
668 VI = CurFun.Values.find(Ty);
669 if (VI == CurFun.Values.end()) return 0;
670
671 // Check that the number is within bounds...
672 if (VI->second.size() <= Num) return 0;
673
674 return VI->second[Num];
675 }
676
677 case ValID::NameVal: { // Is it a named definition?
678 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
679 if (N == 0) return 0;
680
681 D.destroy(); // Free old strdup'd memory...
682 return N;
683 }
684
685 // Check to make sure that "Ty" is an integral type, and that our
686 // value will fit into the specified type...
687 case ValID::ConstSIntVal: // Is it a constant pool reference??
Reid Spencerb83eb642006-10-20 07:07:24 +0000688 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000689 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000690 itostr(D.ConstPool64) + "' is invalid for type '" +
691 Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000692 return 0;
693 }
Reid Spencerb83eb642006-10-20 07:07:24 +0000694 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000695
696 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Reid Spencerb83eb642006-10-20 07:07:24 +0000697 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
698 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000699 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000700 "' is invalid or out of range!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000701 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000702 } else { // This is really a signed reference. Transmogrify.
Reid Spencerb83eb642006-10-20 07:07:24 +0000703 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000704 }
705 } else {
Reid Spencerb83eb642006-10-20 07:07:24 +0000706 return ConstantInt::get(Ty, D.UConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000707 }
708
709 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000710 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000711 GenerateError("FP constant invalid for type!!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000712 return 0;
713 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000714 return ConstantFP::get(Ty, D.ConstPoolFP);
715
716 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000717 if (!isa<PointerType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000718 GenerateError("Cannot create a a non pointer null!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000719 return 0;
720 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000721 return ConstantPointerNull::get(cast<PointerType>(Ty));
722
723 case ValID::ConstUndefVal: // Is it an undef value?
724 return UndefValue::get(Ty);
725
Chris Lattner7aa61892005-12-21 17:53:23 +0000726 case ValID::ConstZeroVal: // Is it a zero value?
727 return Constant::getNullValue(Ty);
728
Reid Spencer68a24bd2005-08-27 18:50:39 +0000729 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000730 if (D.ConstantValue->getType() != Ty) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000731 GenerateError("Constant expression type different from required type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000732 return 0;
733 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000734 return D.ConstantValue;
735
Chris Lattner0e9c3762006-01-25 22:27:16 +0000736 case ValID::InlineAsmVal: { // Inline asm expression
737 const PointerType *PTy = dyn_cast<PointerType>(Ty);
738 const FunctionType *FTy =
739 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000740 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000741 GenerateError("Invalid type for asm constraint string!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000742 return 0;
743 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000744 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
745 D.IAD->HasSideEffects);
746 D.destroy(); // Free InlineAsmDescriptor.
747 return IA;
748 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000749 default:
750 assert(0 && "Unhandled case!");
751 return 0;
752 } // End of switch
753
754 assert(0 && "Unhandled case!");
755 return 0;
756}
757
758// getVal - This function is identical to getValNonImprovising, except that if a
759// value is not already defined, it "improvises" by creating a placeholder var
760// that looks and acts just like the requested variable. When the value is
761// defined later, all uses of the placeholder variable are replaced with the
762// real thing.
763//
764static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000765 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000766 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000767 return 0;
768 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000769
770 // See if the value has already been defined.
771 Value *V = getValNonImprovising(Ty, ID);
772 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000773 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000774
Reid Spencer5b7e7532006-09-28 19:28:24 +0000775 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000776 GenerateError("Invalid use of a composite type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000777 return 0;
778 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000779
780 // If we reached here, we referenced either a symbol that we don't know about
781 // or an id number that hasn't been read yet. We may be referencing something
782 // forward, so just create an entry to be resolved later and get to it...
783 //
784 V = new Argument(Ty);
785
786 // Remember where this forward reference came from. FIXME, shouldn't we try
787 // to recycle these things??
788 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
789 llvmAsmlineno)));
790
791 if (inFunctionScope())
792 InsertValue(V, CurFun.LateResolveValues);
793 else
794 InsertValue(V, CurModule.LateResolveValues);
795 return V;
796}
797
798/// getBBVal - This is used for two purposes:
799/// * If isDefinition is true, a new basic block with the specified ID is being
800/// defined.
801/// * If isDefinition is true, this is a reference to a basic block, which may
802/// or may not be a forward reference.
803///
804static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
805 assert(inFunctionScope() && "Can't get basic block at global scope!");
806
807 std::string Name;
808 BasicBlock *BB = 0;
809 switch (ID.Type) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000810 default:
811 GenerateError("Illegal label reference " + ID.getName());
812 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000813 case ValID::NumberVal: // Is it a numbered definition?
814 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
815 CurFun.NumberedBlocks.resize(ID.Num+1);
816 BB = CurFun.NumberedBlocks[ID.Num];
817 break;
818 case ValID::NameVal: // Is it a named definition?
819 Name = ID.Name;
820 if (Value *N = CurFun.CurrentFunction->
Reid Spencer78d033e2007-01-06 07:24:44 +0000821 getValueSymbolTable().lookup(Type::LabelTy, Name))
Reid Spencer68a24bd2005-08-27 18:50:39 +0000822 BB = cast<BasicBlock>(N);
823 break;
824 }
825
826 // See if the block has already been defined.
827 if (BB) {
828 // If this is the definition of the block, make sure the existing value was
829 // just a forward reference. If it was a forward reference, there will be
830 // an entry for it in the PlaceHolderInfo map.
Reid Spencer5b7e7532006-09-28 19:28:24 +0000831 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000832 // The existing value was a definition, not a forward reference.
Reid Spencer61c83e02006-08-18 08:43:06 +0000833 GenerateError("Redefinition of label " + ID.getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000834 return 0;
835 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000836
837 ID.destroy(); // Free strdup'd memory.
838 return BB;
839 }
840
841 // Otherwise this block has not been seen before.
842 BB = new BasicBlock("", CurFun.CurrentFunction);
843 if (ID.Type == ValID::NameVal) {
844 BB->setName(ID.Name);
845 } else {
846 CurFun.NumberedBlocks[ID.Num] = BB;
847 }
848
849 // If this is not a definition, keep track of it so we can use it as a forward
850 // reference.
851 if (!isDefinition) {
852 // Remember where this forward reference came from.
853 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
854 } else {
855 // The forward declaration could have been inserted anywhere in the
856 // function: insert it into the correct place now.
857 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
858 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
859 }
860 ID.destroy();
861 return BB;
862}
863
864
865//===----------------------------------------------------------------------===//
866// Code to handle forward references in instructions
867//===----------------------------------------------------------------------===//
868//
869// This code handles the late binding needed with statements that reference
870// values not defined yet... for example, a forward branch, or the PHI node for
871// a loop body.
872//
873// This keeps a table (CurFun.LateResolveValues) of all such forward references
874// and back patchs after we are done.
875//
876
877// ResolveDefinitions - If we could not resolve some defs at parsing
878// time (forward branches, phi functions for loops, etc...) resolve the
879// defs now...
880//
881static void
882ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
883 std::map<const Type*,ValueList> *FutureLateResolvers) {
884 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
885 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
886 E = LateResolvers.end(); LRI != E; ++LRI) {
887 ValueList &List = LRI->second;
888 while (!List.empty()) {
889 Value *V = List.back();
890 List.pop_back();
891
892 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
893 CurModule.PlaceHolderInfo.find(V);
894 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
895
896 ValID &DID = PHI->second.first;
897
898 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000899 if (TriggerError)
900 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000901 if (TheRealValue) {
902 V->replaceAllUsesWith(TheRealValue);
903 delete V;
904 CurModule.PlaceHolderInfo.erase(PHI);
905 } else if (FutureLateResolvers) {
906 // Functions have their unresolved items forwarded to the module late
907 // resolver table
908 InsertValue(V, *FutureLateResolvers);
909 } else {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000910 if (DID.Type == ValID::NameVal) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000911 GenerateError("Reference to an invalid definition: '" +DID.getName()+
Reid Spencer68a24bd2005-08-27 18:50:39 +0000912 "' of type '" + V->getType()->getDescription() + "'",
913 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000914 return;
915 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000916 GenerateError("Reference to an invalid definition: #" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000917 itostr(DID.Num) + " of type '" +
918 V->getType()->getDescription() + "'",
919 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000920 return;
921 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000922 }
923 }
924 }
925
926 LateResolvers.clear();
927}
928
929// ResolveTypeTo - A brand new type was just declared. This means that (if
930// name is not null) things referencing Name can be resolved. Otherwise, things
931// refering to the number can be resolved. Do this now.
932//
933static void ResolveTypeTo(char *Name, const Type *ToTy) {
934 ValID D;
935 if (Name) D = ValID::create(Name);
936 else D = ValID::create((int)CurModule.Types.size());
937
Reid Spencer861d9d62006-11-28 07:29:44 +0000938 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000939 CurModule.LateResolveTypes.find(D);
940 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +0000941 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000942 CurModule.LateResolveTypes.erase(I);
943 }
944}
945
946// setValueName - Set the specified value to the name given. The name may be
947// null potentially, in which case this is a noop. The string passed in is
948// assumed to be a malloc'd string buffer, and is free'd by this function.
949//
950static void setValueName(Value *V, char *NameStr) {
951 if (NameStr) {
952 std::string Name(NameStr); // Copy string
953 free(NameStr); // Free old string
954
Reid Spencer5b7e7532006-09-28 19:28:24 +0000955 if (V->getType() == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000956 GenerateError("Can't assign name '" + Name+"' to value with void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000957 return;
958 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000959
960 assert(inFunctionScope() && "Must be in function scope!");
Reid Spencer78d033e2007-01-06 07:24:44 +0000961 SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer5b7e7532006-09-28 19:28:24 +0000962 if (ST.lookup(V->getType(), Name)) {
Reid Spencer63c34452007-01-05 21:51:07 +0000963 GenerateError("Redefinition of value '" + Name + "' of type '" +
964 V->getType()->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000965 return;
966 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000967
968 // Set the name.
969 V->setName(Name);
970 }
971}
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()) {
998 ID = ValID::create((char*)Name.c_str());
999 } else {
1000 ID = ValID::create((int)CurModule.Values[PTy].size());
1001 }
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
Anton Korobeynikov178a3522007-01-12 19:22:51 +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
1218/* Enabling the token table. */
1219#ifndef YYTOKEN_TABLE
1220# define YYTOKEN_TABLE 0
1221#endif
1222
Reid Spencer6f407902007-01-13 05:00:46 +00001223#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1224#line 883 "/proj/llvm/llvm-4/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 Spencer1628cec2006-10-26 06:15:43 +00001267 llvm::Module::Endianness Endianness;
Reid Spencera132e042006-12-03 05:46:11 +00001268 llvm::ICmpInst::Predicate IPredicate;
1269 llvm::FCmpInst::Predicate FPredicate;
Reid Spencer6f407902007-01-13 05:00:46 +00001270} YYSTYPE;
1271/* Line 196 of yacc.c. */
1272#line 1273 "llvmAsmParser.tab.c"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001273# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1274# define YYSTYPE_IS_DECLARED 1
1275# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001276#endif
1277
1278
1279
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001280/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001281
1282
Reid Spencer6f407902007-01-13 05:00:46 +00001283/* Line 219 of yacc.c. */
1284#line 1285 "llvmAsmParser.tab.c"
Reid Spencere4d87aa2006-12-23 06:05:41 +00001285
Reid Spencer6f407902007-01-13 05:00:46 +00001286#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1287# define YYSIZE_T __SIZE_TYPE__
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00001288#endif
Reid Spencer6f407902007-01-13 05:00:46 +00001289#if ! defined (YYSIZE_T) && defined (size_t)
1290# define YYSIZE_T size_t
Andrew Lenharth6353e052006-12-08 18:07:09 +00001291#endif
Reid Spencer6f407902007-01-13 05:00:46 +00001292#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1293# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1294# define YYSIZE_T size_t
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001295#endif
Reid Spencer6f407902007-01-13 05:00:46 +00001296#if ! defined (YYSIZE_T)
1297# define YYSIZE_T unsigned int
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001298#endif
1299
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001300#ifndef YY_
1301# if YYENABLE_NLS
1302# if ENABLE_NLS
1303# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1304# define YY_(msgid) dgettext ("bison-runtime", msgid)
1305# endif
1306# endif
1307# ifndef YY_
1308# define YY_(msgid) msgid
1309# endif
1310#endif
1311
Reid Spencer6f407902007-01-13 05:00:46 +00001312#if ! defined (yyoverflow) || YYERROR_VERBOSE
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001313
1314/* The parser invokes alloca or malloc; define the necessary symbols. */
1315
1316# ifdef YYSTACK_USE_ALLOCA
1317# if YYSTACK_USE_ALLOCA
1318# ifdef __GNUC__
1319# define YYSTACK_ALLOC __builtin_alloca
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001320# else
1321# define YYSTACK_ALLOC alloca
Reid Spencer6f407902007-01-13 05:00:46 +00001322# if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001323# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Reid Spencer6f407902007-01-13 05:00:46 +00001324# define YYINCLUDED_STDLIB_H
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001325# endif
1326# endif
1327# endif
1328# endif
1329
1330# ifdef YYSTACK_ALLOC
Reid Spencer6f407902007-01-13 05:00:46 +00001331 /* Pacify GCC's `empty if-body' warning. */
1332# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001333# ifndef YYSTACK_ALLOC_MAXIMUM
1334 /* The OS might guarantee only one guard page at the bottom of the stack,
1335 and a page size can be as small as 4096 bytes. So we cannot safely
1336 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1337 to allow for a few compiler-allocated temporary stack slots. */
Reid Spencer6f407902007-01-13 05:00:46 +00001338# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001339# endif
1340# else
1341# define YYSTACK_ALLOC YYMALLOC
1342# define YYSTACK_FREE YYFREE
1343# ifndef YYSTACK_ALLOC_MAXIMUM
Reid Spencer6f407902007-01-13 05:00:46 +00001344# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001345# endif
Reid Spencer6f407902007-01-13 05:00:46 +00001346# ifdef __cplusplus
1347extern "C" {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001348# endif
1349# ifndef YYMALLOC
1350# define YYMALLOC malloc
Reid Spencer6f407902007-01-13 05:00:46 +00001351# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1352 && (defined (__STDC__) || defined (__cplusplus)))
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001353void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1354# endif
1355# endif
1356# ifndef YYFREE
1357# define YYFREE free
Reid Spencer6f407902007-01-13 05:00:46 +00001358# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1359 && (defined (__STDC__) || defined (__cplusplus)))
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001360void free (void *); /* INFRINGES ON USER NAME SPACE */
1361# endif
1362# endif
Reid Spencer6f407902007-01-13 05:00:46 +00001363# ifdef __cplusplus
1364}
1365# endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001366# endif
Reid Spencer6f407902007-01-13 05:00:46 +00001367#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001368
1369
Reid Spencer6f407902007-01-13 05:00:46 +00001370#if (! defined (yyoverflow) \
1371 && (! defined (__cplusplus) \
1372 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001373
1374/* A type that is properly aligned for any stack member. */
1375union yyalloc
1376{
Reid Spencer6f407902007-01-13 05:00:46 +00001377 short int yyss;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001378 YYSTYPE yyvs;
1379 };
1380
1381/* The size of the maximum gap between one aligned stack and the next. */
1382# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1383
1384/* The size of an array large to enough to hold all stacks, each with
1385 N elements. */
1386# define YYSTACK_BYTES(N) \
Reid Spencer6f407902007-01-13 05:00:46 +00001387 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001388 + YYSTACK_GAP_MAXIMUM)
1389
1390/* Copy COUNT objects from FROM to TO. The source and destination do
1391 not overlap. */
1392# ifndef YYCOPY
Reid Spencer6f407902007-01-13 05:00:46 +00001393# if defined (__GNUC__) && 1 < __GNUC__
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001394# define YYCOPY(To, From, Count) \
1395 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1396# else
1397# define YYCOPY(To, From, Count) \
1398 do \
1399 { \
1400 YYSIZE_T yyi; \
1401 for (yyi = 0; yyi < (Count); yyi++) \
1402 (To)[yyi] = (From)[yyi]; \
1403 } \
Reid Spencer6f407902007-01-13 05:00:46 +00001404 while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001405# endif
1406# endif
1407
1408/* Relocate STACK from its old location to the new one. The
1409 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1410 elements in the stack, and YYPTR gives the new location of the
1411 stack. Advance YYPTR to a properly aligned location for the next
1412 stack. */
1413# define YYSTACK_RELOCATE(Stack) \
1414 do \
1415 { \
1416 YYSIZE_T yynewbytes; \
1417 YYCOPY (&yyptr->Stack, Stack, yysize); \
1418 Stack = &yyptr->Stack; \
1419 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1420 yyptr += yynewbytes / sizeof (*yyptr); \
1421 } \
Reid Spencer6f407902007-01-13 05:00:46 +00001422 while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001423
1424#endif
1425
Reid Spencer6f407902007-01-13 05:00:46 +00001426#if defined (__STDC__) || defined (__cplusplus)
1427 typedef signed char yysigned_char;
1428#else
1429 typedef short int yysigned_char;
1430#endif
1431
1432/* YYFINAL -- State number of the termination state. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001433#define YYFINAL 36
1434/* YYLAST -- Last index in YYTABLE. */
Reid Spencer6f407902007-01-13 05:00:46 +00001435#define YYLAST 1357
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001436
Reid Spencer6f407902007-01-13 05:00:46 +00001437/* YYNTOKENS -- Number of terminals. */
1438#define YYNTOKENS 147
1439/* YYNNTS -- Number of nonterminals. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001440#define YYNNTS 79
Reid Spencer6f407902007-01-13 05:00:46 +00001441/* YYNRULES -- Number of rules. */
1442#define YYNRULES 285
1443/* YYNRULES -- Number of states. */
1444#define YYNSTATES 569
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001445
1446/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1447#define YYUNDEFTOK 2
Reid Spencer6f407902007-01-13 05:00:46 +00001448#define YYMAXUTOK 387
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001449
1450#define YYTRANSLATE(YYX) \
1451 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1452
1453/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
Reid Spencer6f407902007-01-13 05:00:46 +00001454static const unsigned char yytranslate[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001455{
1456 0, 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,
1459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer6f407902007-01-13 05:00:46 +00001460 137, 138, 135, 2, 134, 2, 2, 2, 2, 2,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer6f407902007-01-13 05:00:46 +00001462 142, 133, 143, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer6f407902007-01-13 05:00:46 +00001465 2, 139, 136, 141, 2, 2, 2, 2, 2, 146,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer6f407902007-01-13 05:00:46 +00001468 140, 2, 2, 144, 2, 145, 2, 2, 2, 2,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001469 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, 2, 2, 2, 2,
1481 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1482 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1483 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1484 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1485 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1486 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1487 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1488 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1489 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1490 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1491 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1492 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1493 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
Reid Spencer6f407902007-01-13 05:00:46 +00001494 125, 126, 127, 128, 129, 130, 131, 132
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001495};
1496
1497#if YYDEBUG
1498/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1499 YYRHS. */
Reid Spencer6f407902007-01-13 05:00:46 +00001500static const unsigned short int yyprhs[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001501{
1502 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1503 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1504 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1505 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1506 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1507 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1508 119, 122, 123, 125, 127, 129, 131, 133, 135, 137,
1509 139, 140, 142, 143, 145, 147, 148, 150, 152, 154,
1510 156, 157, 159, 161, 163, 165, 167, 169, 172, 174,
1511 176, 177, 180, 182, 184, 185, 188, 189, 192, 193,
1512 197, 200, 201, 203, 204, 208, 210, 213, 215, 217,
Reid Spencer6f407902007-01-13 05:00:46 +00001513 219, 221, 223, 225, 228, 230, 233, 239, 245, 251,
1514 257, 261, 264, 270, 275, 278, 280, 282, 284, 288,
1515 290, 294, 296, 297, 299, 303, 308, 312, 316, 321,
1516 326, 330, 337, 343, 346, 349, 352, 355, 358, 361,
1517 364, 367, 370, 373, 380, 386, 395, 402, 409, 417,
1518 425, 432, 439, 448, 457, 461, 463, 465, 467, 469,
1519 470, 472, 475, 476, 480, 481, 485, 489, 491, 495,
1520 499, 500, 507, 508, 516, 517, 525, 528, 532, 534,
1521 536, 538, 542, 546, 550, 554, 558, 562, 564, 565,
1522 567, 569, 571, 572, 578, 582, 584, 588, 590, 591,
1523 601, 603, 605, 610, 612, 614, 617, 621, 622, 624,
1524 626, 628, 630, 632, 634, 636, 638, 640, 644, 646,
1525 652, 654, 656, 658, 660, 663, 666, 669, 673, 676,
1526 677, 679, 682, 685, 689, 699, 709, 718, 733, 735,
1527 737, 744, 750, 753, 760, 768, 772, 778, 779, 780,
1528 784, 787, 789, 795, 801, 808, 815, 820, 825, 832,
1529 837, 842, 849, 856, 859, 868, 870, 872, 873, 877,
1530 884, 888, 895, 898, 903, 910
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001531};
1532
Reid Spencer6f407902007-01-13 05:00:46 +00001533/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1534static const short int yyrhs[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001535{
Reid Spencer6f407902007-01-13 05:00:46 +00001536 185, 0, -1, 5, -1, 6, -1, 69, -1, 70,
1537 -1, 71, -1, 72, -1, 73, -1, 74, -1, 75,
1538 -1, 76, -1, 77, -1, 78, -1, 79, -1, 80,
1539 -1, 109, -1, 110, -1, 111, -1, 112, -1, 113,
1540 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
1541 -1, 119, -1, 120, -1, 123, -1, 124, -1, 125,
1542 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1543 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1544 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1545 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1546 -1, 89, -1, 90, -1, 91, -1, 92, -1, 19,
1547 -1, 20, -1, 9, -1, 10, -1, 11, -1, 198,
1548 133, -1, -1, 33, -1, 35, -1, 34, -1, 36,
1549 -1, 38, -1, 37, -1, 39, -1, 41, -1, -1,
1550 132, -1, -1, 37, -1, 39, -1, -1, 33, -1,
1551 34, -1, 35, -1, 38, -1, -1, 56, -1, 57,
1552 -1, 58, -1, 59, -1, 60, -1, 61, -1, 55,
1553 4, -1, 110, -1, 111, -1, -1, 165, 164, -1,
1554 130, -1, 164, -1, -1, 167, 166, -1, -1, 48,
1555 4, -1, -1, 134, 48, 4, -1, 27, 16, -1,
1556 -1, 170, -1, -1, 134, 173, 172, -1, 170, -1,
1557 48, 4, -1, 9, -1, 10, -1, 11, -1, 12,
1558 -1, 40, -1, 174, -1, 175, 135, -1, 210, -1,
1559 136, 4, -1, 175, 137, 179, 138, 167, -1, 8,
1560 137, 179, 138, 167, -1, 139, 4, 140, 175, 141,
1561 -1, 142, 4, 140, 175, 143, -1, 144, 180, 145,
1562 -1, 144, 145, -1, 142, 144, 180, 145, 143, -1,
1563 142, 144, 145, 143, -1, 175, 165, -1, 175, -1,
1564 8, -1, 176, -1, 178, 134, 176, -1, 178, -1,
1565 178, 134, 30, -1, 30, -1, -1, 175, -1, 180,
1566 134, 175, -1, 175, 139, 183, 141, -1, 175, 139,
1567 141, -1, 175, 146, 16, -1, 175, 142, 183, 143,
1568 -1, 175, 144, 183, 145, -1, 175, 144, 145, -1,
1569 175, 142, 144, 183, 145, 143, -1, 175, 142, 144,
1570 145, 143, -1, 175, 31, -1, 175, 32, -1, 175,
1571 210, -1, 175, 182, -1, 175, 18, -1, 155, 3,
1572 -1, 155, 4, -1, 9, 19, -1, 9, 20, -1,
1573 156, 7, -1, 151, 137, 181, 29, 175, 138, -1,
1574 108, 137, 181, 221, 138, -1, 122, 137, 181, 134,
1575 181, 134, 181, 138, -1, 149, 137, 181, 134, 181,
1576 138, -1, 150, 137, 181, 134, 181, 138, -1, 81,
1577 153, 137, 181, 134, 181, 138, -1, 82, 154, 137,
1578 181, 134, 181, 138, -1, 152, 137, 181, 134, 181,
1579 138, -1, 127, 137, 181, 134, 181, 138, -1, 128,
1580 137, 181, 134, 181, 134, 181, 138, -1, 129, 137,
1581 181, 134, 181, 134, 181, 138, -1, 183, 134, 181,
1582 -1, 181, -1, 25, -1, 26, -1, 186, -1, -1,
1583 187, -1, 186, 187, -1, -1, 24, 188, 206, -1,
1584 -1, 23, 189, 207, -1, 53, 52, 193, -1, 17,
1585 -1, 157, 13, 175, -1, 157, 13, 8, -1, -1,
1586 157, 160, 184, 181, 190, 172, -1, -1, 157, 158,
1587 160, 184, 181, 191, 172, -1, -1, 157, 159, 160,
1588 184, 175, 192, 172, -1, 42, 195, -1, 49, 133,
1589 196, -1, 16, -1, 47, -1, 46, -1, 44, 133,
1590 194, -1, 45, 133, 4, -1, 43, 133, 16, -1,
1591 62, 133, 16, -1, 139, 197, 141, -1, 197, 134,
1592 16, -1, 16, -1, -1, 14, -1, 16, -1, 198,
1593 -1, -1, 200, 134, 175, 165, 199, -1, 175, 165,
1594 199, -1, 200, -1, 200, 134, 30, -1, 30, -1,
1595 -1, 163, 177, 198, 137, 201, 138, 167, 171, 168,
1596 -1, 21, -1, 144, -1, 162, 160, 202, 203, -1,
1597 22, -1, 145, -1, 213, 205, -1, 161, 160, 202,
1598 -1, -1, 54, -1, 3, -1, 4, -1, 7, -1,
1599 19, -1, 20, -1, 31, -1, 32, -1, 18, -1,
1600 142, 183, 143, -1, 182, -1, 52, 208, 16, 134,
1601 16, -1, 148, -1, 198, -1, 210, -1, 209, -1,
1602 175, 211, -1, 213, 214, -1, 204, 214, -1, 215,
1603 157, 216, -1, 215, 218, -1, -1, 15, -1, 63,
1604 212, -1, 63, 8, -1, 64, 12, 211, -1, 64,
1605 9, 211, 134, 12, 211, 134, 12, 211, -1, 65,
1606 155, 211, 134, 12, 211, 139, 217, 141, -1, 65,
1607 155, 211, 134, 12, 211, 139, 141, -1, 66, 163,
1608 177, 211, 137, 220, 138, 167, 29, 12, 211, 67,
1609 12, 211, -1, 67, -1, 68, -1, 217, 155, 209,
1610 134, 12, 211, -1, 155, 209, 134, 12, 211, -1,
1611 157, 223, -1, 175, 139, 211, 134, 211, 141, -1,
1612 219, 134, 139, 211, 134, 211, 141, -1, 175, 211,
1613 165, -1, 220, 134, 175, 211, 165, -1, -1, -1,
1614 221, 134, 212, -1, 51, 50, -1, 50, -1, 149,
1615 175, 211, 134, 211, -1, 150, 175, 211, 134, 211,
1616 -1, 81, 153, 175, 211, 134, 211, -1, 82, 154,
1617 175, 211, 134, 211, -1, 152, 212, 134, 212, -1,
1618 151, 212, 29, 175, -1, 122, 212, 134, 212, 134,
1619 212, -1, 126, 212, 134, 175, -1, 127, 212, 134,
1620 212, -1, 128, 212, 134, 212, 134, 212, -1, 129,
1621 212, 134, 212, 134, 212, -1, 121, 219, -1, 222,
1622 163, 177, 211, 137, 220, 138, 167, -1, 225, -1,
1623 28, -1, -1, 103, 175, 169, -1, 103, 175, 134,
1624 9, 211, 169, -1, 104, 175, 169, -1, 104, 175,
1625 134, 9, 211, 169, -1, 105, 212, -1, 224, 106,
1626 175, 211, -1, 224, 107, 212, 134, 175, 211, -1,
1627 108, 175, 211, 221, -1
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001628};
1629
1630/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Reid Spencer6f407902007-01-13 05:00:46 +00001631static const unsigned short int yyrline[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001632{
1633 0, 1031, 1031, 1032, 1042, 1042, 1042, 1042, 1042, 1042,
1634 1042, 1042, 1042, 1043, 1043, 1043, 1044, 1044, 1044, 1044,
1635 1044, 1044, 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046,
1636 1046, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052,
1637 1052, 1056, 1056, 1057, 1057, 1058, 1058, 1059, 1059, 1060,
1638 1060, 1061, 1061, 1062, 1062, 1063, 1064, 1069, 1070, 1070,
1639 1073, 1077, 1083, 1084, 1085, 1086, 1087, 1091, 1092, 1093,
1640 1097, 1098, 1102, 1103, 1104, 1108, 1109, 1110, 1111, 1112,
1641 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1129, 1130,
1642 1133, 1134, 1139, 1140, 1143, 1144, 1151, 1152, 1158, 1159,
1643 1167, 1175, 1176, 1181, 1182, 1183, 1188, 1201, 1201, 1201,
Reid Spencer6f407902007-01-13 05:00:46 +00001644 1201, 1204, 1208, 1212, 1219, 1224, 1232, 1250, 1268, 1273,
1645 1285, 1295, 1299, 1309, 1316, 1323, 1330, 1335, 1340, 1347,
1646 1348, 1355, 1362, 1370, 1375, 1386, 1414, 1430, 1459, 1487,
1647 1512, 1531, 1556, 1575, 1587, 1594, 1657, 1667, 1677, 1683,
1648 1689, 1694, 1699, 1707, 1721, 1742, 1750, 1756, 1767, 1772,
1649 1777, 1786, 1792, 1798, 1807, 1811, 1819, 1819, 1830, 1835,
1650 1843, 1844, 1848, 1848, 1852, 1852, 1855, 1858, 1870, 1894,
1651 1905, 1905, 1914, 1914, 1922, 1922, 1932, 1935, 1941, 1954,
1652 1955, 1957, 1961, 1970, 1974, 1979, 1981, 1986, 1991, 2000,
1653 2000, 2001, 2001, 2003, 2013, 2024, 2028, 2037, 2046, 2051,
1654 2157, 2157, 2159, 2168, 2168, 2170, 2175, 2187, 2191, 2196,
1655 2200, 2204, 2208, 2212, 2216, 2220, 2224, 2228, 2253, 2257,
1656 2271, 2275, 2281, 2281, 2287, 2296, 2300, 2309, 2320, 2329,
1657 2341, 2354, 2358, 2362, 2367, 2377, 2396, 2405, 2472, 2476,
1658 2483, 2494, 2507, 2516, 2527, 2537, 2545, 2553, 2556, 2557,
1659 2564, 2568, 2573, 2594, 2611, 2624, 2637, 2646, 2659, 2667,
1660 2674, 2680, 2686, 2692, 2707, 2770, 2775, 2779, 2786, 2793,
1661 2801, 2808, 2816, 2824, 2838, 2855
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001662};
1663#endif
1664
1665#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1666/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
Reid Spencer6f407902007-01-13 05:00:46 +00001667 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001668static const char *const yytname[] =
1669{
1670 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
Reid Spencer6f407902007-01-13 05:00:46 +00001671 "UINTVAL", "FPVAL", "VOID", "INTTYPE", "FLOAT", "DOUBLE", "LABEL",
1672 "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "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", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG",
1678 "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT",
1679 "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK",
1680 "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR",
1681 "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV",
1682 "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", "XOR", "ICMP",
1683 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1684 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1685 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1686 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1687 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1688 "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001689 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "DEFAULT", "HIDDEN", "'='",
1690 "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'",
1691 "'{'", "'}'", "'c'", "$accept", "INTVAL", "ArithmeticOps", "LogicalOps",
1692 "CastOps", "ShiftOps", "IPredicates", "FPredicates", "IntType", "FPType",
1693 "OptAssign", "GVInternalLinkage", "GVExternalLinkage",
1694 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1695 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1696 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1697 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1698 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1699 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1700 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1701 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1702 "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1703 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1704 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1705 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1706 "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList",
1707 "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0
1708};
1709#endif
1710
1711# ifdef YYPRINT
1712/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1713 token YYLEX-NUM. */
Reid Spencer6f407902007-01-13 05:00:46 +00001714static const unsigned short int yytoknum[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +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,
Reid Spencer6f407902007-01-13 05:00:46 +00001729 385, 386, 387, 61, 44, 42, 92, 40, 41, 91,
1730 120, 93, 60, 62, 123, 125, 99
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001731};
1732# endif
1733
1734/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Reid Spencer6f407902007-01-13 05:00:46 +00001735static const unsigned char yyr1[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001736{
Reid Spencer6f407902007-01-13 05:00:46 +00001737 0, 147, 148, 148, 149, 149, 149, 149, 149, 149,
1738 149, 149, 149, 150, 150, 150, 151, 151, 151, 151,
1739 151, 151, 151, 151, 151, 151, 151, 151, 152, 152,
1740 152, 153, 153, 153, 153, 153, 153, 153, 153, 153,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001741 153, 154, 154, 154, 154, 154, 154, 154, 154, 154,
Reid Spencer6f407902007-01-13 05:00:46 +00001742 154, 154, 154, 154, 154, 154, 154, 155, 156, 156,
1743 157, 157, 158, 158, 158, 158, 158, 159, 159, 159,
1744 160, 160, 161, 161, 161, 162, 162, 162, 162, 162,
1745 163, 163, 163, 163, 163, 163, 163, 163, 164, 164,
1746 165, 165, 166, 166, 167, 167, 168, 168, 169, 169,
1747 170, 171, 171, 172, 172, 173, 173, 174, 174, 174,
1748 174, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1749 175, 175, 175, 175, 176, 177, 177, 178, 178, 179,
1750 179, 179, 179, 180, 180, 181, 181, 181, 181, 181,
1751 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
1752 181, 181, 181, 182, 182, 182, 182, 182, 182, 182,
1753 182, 182, 182, 182, 183, 183, 184, 184, 185, 185,
1754 186, 186, 188, 187, 189, 187, 187, 187, 187, 187,
1755 190, 187, 191, 187, 192, 187, 187, 187, 193, 194,
1756 194, 195, 195, 195, 195, 196, 197, 197, 197, 198,
1757 198, 199, 199, 200, 200, 201, 201, 201, 201, 202,
1758 203, 203, 204, 205, 205, 206, 207, 208, 208, 209,
1759 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1760 210, 210, 211, 211, 212, 213, 213, 214, 215, 215,
1761 215, 216, 216, 216, 216, 216, 216, 216, 216, 216,
1762 217, 217, 218, 219, 219, 220, 220, 220, 221, 221,
1763 222, 222, 223, 223, 223, 223, 223, 223, 223, 223,
1764 223, 223, 223, 223, 223, 223, 224, 224, 225, 225,
1765 225, 225, 225, 225, 225, 225
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001766};
1767
1768/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
Reid Spencer6f407902007-01-13 05:00:46 +00001769static const unsigned char yyr2[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +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,
1777 2, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1778 0, 1, 0, 1, 1, 0, 1, 1, 1, 1,
1779 0, 1, 1, 1, 1, 1, 1, 2, 1, 1,
1780 0, 2, 1, 1, 0, 2, 0, 2, 0, 3,
1781 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
Reid Spencer6f407902007-01-13 05:00:46 +00001782 1, 1, 1, 2, 1, 2, 5, 5, 5, 5,
1783 3, 2, 5, 4, 2, 1, 1, 1, 3, 1,
1784 3, 1, 0, 1, 3, 4, 3, 3, 4, 4,
1785 3, 6, 5, 2, 2, 2, 2, 2, 2, 2,
1786 2, 2, 2, 6, 5, 8, 6, 6, 7, 7,
1787 6, 6, 8, 8, 3, 1, 1, 1, 1, 0,
1788 1, 2, 0, 3, 0, 3, 3, 1, 3, 3,
1789 0, 6, 0, 7, 0, 7, 2, 3, 1, 1,
1790 1, 3, 3, 3, 3, 3, 3, 1, 0, 1,
1791 1, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1792 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1793 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1794 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1795 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1796 6, 5, 2, 6, 7, 3, 5, 0, 0, 3,
1797 2, 1, 5, 5, 6, 6, 4, 4, 6, 4,
1798 4, 6, 6, 2, 8, 1, 1, 0, 3, 6,
1799 3, 6, 2, 4, 6, 4
Anton Korobeynikov178a3522007-01-12 19:22:51 +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 Spencer6f407902007-01-13 05:00:46 +00001805static const unsigned short int yydefact[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001806{
Reid Spencer6f407902007-01-13 05:00:46 +00001807 61, 199, 200, 177, 174, 172, 0, 0, 0, 70,
1808 0, 61, 170, 0, 72, 75, 0, 0, 0, 0,
1809 186, 0, 0, 0, 62, 64, 63, 65, 67, 66,
1810 68, 69, 71, 70, 70, 0, 1, 171, 60, 73,
1811 74, 70, 175, 76, 77, 78, 79, 70, 239, 173,
1812 239, 0, 0, 0, 0, 198, 187, 188, 176, 2,
1813 3, 179, 107, 108, 109, 110, 111, 0, 0, 0,
1814 0, 230, 112, 178, 231, 114, 0, 0, 166, 167,
1815 0, 80, 80, 240, 236, 61, 213, 214, 215, 235,
1816 193, 190, 189, 191, 192, 194, 197, 0, 132, 115,
1817 0, 0, 0, 0, 121, 133, 0, 113, 132, 0,
1818 0, 107, 108, 109, 0, 0, 0, 180, 0, 81,
1819 82, 83, 84, 85, 86, 0, 216, 0, 277, 238,
1820 0, 195, 131, 90, 127, 129, 0, 0, 0, 0,
1821 0, 0, 120, 0, 182, 184, 150, 151, 148, 149,
1822 152, 147, 143, 144, 4, 5, 6, 7, 8, 9,
1823 10, 11, 12, 13, 14, 15, 0, 0, 0, 16,
1824 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1825 27, 0, 28, 29, 30, 0, 0, 0, 0, 0,
1826 0, 0, 0, 0, 0, 0, 146, 145, 103, 87,
1827 126, 125, 0, 210, 211, 212, 276, 261, 0, 0,
1828 0, 0, 80, 248, 249, 0, 0, 0, 0, 0,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001829 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer6f407902007-01-13 05:00:46 +00001830 0, 237, 80, 252, 0, 275, 196, 124, 0, 94,
1831 0, 0, 123, 0, 134, 94, 103, 103, 31, 32,
1832 33, 34, 35, 36, 37, 38, 39, 40, 0, 55,
1833 56, 51, 52, 53, 54, 41, 42, 43, 44, 45,
1834 46, 47, 48, 49, 50, 0, 0, 0, 0, 0,
1835 0, 136, 165, 0, 0, 0, 140, 0, 137, 0,
1836 0, 0, 0, 0, 181, 0, 260, 242, 0, 241,
1837 0, 0, 57, 0, 0, 0, 0, 98, 98, 282,
1838 0, 0, 273, 0, 0, 0, 0, 0, 0, 0,
1839 0, 0, 0, 0, 0, 88, 89, 91, 130, 128,
1840 117, 118, 119, 122, 116, 183, 185, 0, 0, 258,
1841 0, 0, 0, 0, 0, 135, 121, 133, 0, 138,
1842 139, 0, 0, 0, 0, 0, 0, 105, 103, 208,
1843 219, 220, 221, 226, 222, 223, 224, 225, 217, 0,
1844 228, 233, 232, 234, 0, 243, 0, 0, 0, 0,
1845 0, 278, 0, 280, 258, 0, 0, 0, 0, 0,
1846 0, 0, 0, 0, 0, 0, 0, 0, 0, 92,
1847 93, 95, 0, 0, 0, 0, 0, 0, 0, 164,
1848 142, 0, 0, 0, 0, 0, 100, 106, 104, 207,
1849 90, 205, 0, 218, 0, 0, 0, 0, 0, 0,
1850 0, 0, 0, 0, 285, 0, 0, 0, 269, 270,
1851 0, 0, 0, 0, 267, 266, 0, 283, 0, 0,
1852 0, 0, 154, 0, 0, 0, 0, 141, 0, 0,
1853 0, 0, 202, 0, 94, 0, 227, 0, 0, 257,
1854 0, 0, 98, 99, 98, 0, 0, 0, 0, 0,
1855 262, 263, 257, 0, 0, 0, 259, 0, 161, 0,
1856 0, 156, 157, 153, 160, 201, 204, 206, 90, 101,
1857 0, 0, 0, 0, 0, 264, 265, 0, 279, 281,
1858 0, 0, 268, 271, 272, 0, 284, 158, 159, 0,
1859 0, 0, 202, 102, 96, 229, 0, 0, 90, 0,
1860 94, 253, 0, 94, 155, 162, 163, 203, 0, 209,
1861 0, 246, 0, 0, 255, 0, 0, 254, 274, 97,
1862 244, 0, 245, 0, 90, 0, 0, 0, 256, 0,
1863 0, 0, 0, 251, 0, 0, 250, 0, 247
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001864};
1865
Reid Spencer6f407902007-01-13 05:00:46 +00001866/* YYDEFGOTO[NTERM-NUM]. */
1867static const short int yydefgoto[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001868{
Reid Spencer6f407902007-01-13 05:00:46 +00001869 -1, 71, 192, 193, 194, 195, 258, 275, 114, 115,
1870 9, 33, 34, 35, 41, 47, 125, 327, 237, 401,
1871 330, 539, 381, 357, 524, 294, 358, 72, 116, 134,
1872 202, 135, 136, 106, 282, 370, 283, 80, 10, 11,
1873 12, 15, 14, 198, 246, 247, 58, 93, 20, 56,
1874 97, 74, 496, 421, 422, 126, 205, 48, 88, 49,
1875 42, 424, 371, 75, 373, 299, 50, 84, 85, 231,
1876 543, 129, 312, 504, 404, 232, 233, 234, 235
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001877};
1878
1879/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1880 STATE-NUM. */
Reid Spencer6f407902007-01-13 05:00:46 +00001881#define YYPACT_NINF -413
1882static const short int yypact[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001883{
Reid Spencer6f407902007-01-13 05:00:46 +00001884 401, -413, -413, -413, -413, -413, 110, -107, 30, 67,
1885 77, 527, -413, -43, 2, 238, -16, 8, 47, 84,
1886 -413, -4, 132, 791, -413, -413, -413, -413, -413, -413,
1887 -413, -413, -413, 91, 91, 149, -413, -413, -413, -413,
1888 -413, 91, -413, -413, -413, -413, -413, 91, 147, -413,
1889 20, 210, 208, 280, 226, 273, -413, -413, -413, -413,
1890 -413, 160, -413, -413, -413, -413, -413, 295, 299, 3,
1891 7, -413, -413, 140, -413, -413, 149, 149, -413, -413,
1892 954, 192, 192, -413, -413, 184, -413, -413, -413, -413,
1893 -413, -413, -413, -413, -413, -413, -413, -65, 549, -413,
1894 167, 171, 22, 160, -413, 140, -81, -413, 549, 954,
1895 1045, 95, 311, 312, 284, 313, 602, -413, 317, -413,
1896 -413, -413, -413, -413, -413, 1125, -413, -7, 1228, -413,
1897 306, -413, -413, 140, -413, 191, 193, 1045, 1045, 186,
1898 -64, 1045, -413, 194, -413, 140, -413, -413, -413, -413,
1899 -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,
1900 -413, -413, -413, -413, -413, -413, 251, 501, 207, -413,
1901 -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,
1902 -413, 209, -413, -413, -413, 214, 215, 216, 49, 1138,
1903 120, 314, 219, 222, 224, 225, -413, -413, 230, -413,
1904 160, 140, 184, -413, -413, -413, -413, -413, 315, 1185,
1905 175, 357, 192, -413, -413, 251, 501, 1045, 1045, 1045,
1906 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045,
1907 1045, -413, 192, -413, 195, -413, -413, 203, 693, -413,
1908 126, 46, -413, 228, 140, -413, 230, 230, -413, -413,
1909 -413, -413, -413, -413, -413, -413, -413, -413, 231, -413,
1910 -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,
1911 -413, -413, -413, -413, -413, 235, 954, 954, 954, 954,
1912 954, -413, -413, 29, 500, -24, -413, -27, -413, 954,
1913 954, 954, 954, 39, -413, 241, -413, 160, 746, -413,
1914 873, 873, -413, 873, 1125, 1045, 1045, 123, 159, -413,
1915 746, 146, 233, 245, 248, 249, 250, 252, 746, 746,
1916 356, 253, 1125, 1045, 1045, -413, -413, -413, -413, -413,
1917 -18, -413, -413, -413, -18, -413, -413, 954, 954, -413,
1918 254, 255, 256, 259, 954, -413, 262, 602, -12, -413,
1919 -413, 265, 274, 367, 275, 391, 407, -413, 230, 774,
1920 -413, -413, -413, -413, -413, -413, -413, -413, 358, 954,
1921 -413, -413, -413, -413, 282, -413, 285, 873, 746, 746,
1922 35, -413, 43, -413, -413, 873, 281, 1045, 1045, 1045,
1923 1045, 1045, 289, 292, 1045, 1045, 873, 746, 293, -413,
1924 -413, -413, 294, 301, -25, 954, 954, 954, 954, -413,
1925 -413, 271, 954, 954, 1045, 954, -413, -413, -413, -413,
1926 140, 302, 303, -413, 417, 25, 427, 428, 305, 310,
1927 318, 873, 441, 873, 319, 322, 873, 323, 140, -413,
1928 324, 325, 873, 873, 140, -413, 309, -413, 1045, 954,
1929 954, 1045, -413, 326, 328, 327, 335, -413, 332, 333,
1930 131, 336, 34, 1028, -413, 339, -413, 873, 873, 1045,
1931 873, 873, 341, -413, 341, 873, 342, 1045, 1045, 1045,
1932 -413, -413, 1045, 746, 340, 345, -413, 954, -413, 954,
1933 954, -413, -413, -413, -413, -413, -413, -413, 140, 10,
1934 431, 343, 346, 746, 63, -413, -413, 400, -413, -413,
1935 338, 873, -413, -413, -413, 144, -413, -413, -413, 351,
1936 352, 354, 34, -413, 403, -413, 472, -3, -413, 1045,
1937 -413, -413, 355, -413, -413, -413, -413, -413, 489, -413,
1938 873, -413, 1000, 15, 203, 746, 66, -413, -18, -413,
1939 -413, 361, -413, 1000, -413, 485, 486, 368, 203, 873,
1940 873, 491, 434, -413, 873, 492, -413, 873, -413
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001941};
1942
1943/* YYPGOTO[NTERM-NUM]. */
Reid Spencer6f407902007-01-13 05:00:46 +00001944static const short int yypgoto[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001945{
Reid Spencer6f407902007-01-13 05:00:46 +00001946 -413, -413, 379, 385, 389, 390, 304, 307, -210, -413,
1947 439, -413, -413, 145, -413, -413, -192, -305, -412, -413,
1948 -235, -413, -303, 26, -413, -201, -413, -413, -14, 288,
1949 -255, -413, 420, 429, -58, -112, -187, 239, -413, -413,
1950 518, -413, -413, -413, -413, -413, -413, -413, -413, -413,
1951 -413, 0, 11, -413, -413, 448, -413, -413, -413, -413,
1952 -413, -413, -403, -73, 103, -151, -413, 482, -413, -413,
1953 -413, -413, -413, 53, 153, -413, -413, -413, -413
Anton Korobeynikov178a3522007-01-12 19:22:51 +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.
1959 If YYTABLE_NINF, syntax error. */
Reid Spencer6f407902007-01-13 05:00:46 +00001960#define YYTABLE_NINF -170
1961static const short int yytable[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001962{
Reid Spencer6f407902007-01-13 05:00:46 +00001963 13, 303, 285, 287, 196, 383, 302, 101, 462, 73,
1964 334, 13, 59, 60, 203, 103, 62, 63, 64, 65,
1965 304, 1, 117, 2, 302, 400, 21, 59, 60, 400,
1966 103, 62, 63, 64, 65, 83, 1, 355, 2, 39,
1967 322, 40, 86, 197, 431, 335, 336, 66, 1, 377,
1968 2, 144, 433, 141, 59, 60, 105, 103, 111, 112,
1969 113, 65, 66, 1, 142, 2, 355, 396, 309, 130,
1970 141, 313, 314, 315, 316, 317, 131, 36, 320, 321,
1971 23, 243, 22, 432, 133, 13, 522, 356, 105, 66,
1972 38, 432, 325, 326, 133, 555, 145, 348, -57, -57,
1973 24, 25, 26, 27, 28, 29, 30, 344, 31, 451,
1974 344, 201, 399, 452, 146, 147, 544, 51, 350, 349,
1975 325, 326, 344, 240, 241, 59, 60, 244, 103, 111,
1976 112, 113, 65, 411, 1, 55, 2, 204, 541, 551,
1977 399, 52, 558, 67, 325, 326, 68, 102, 57, 69,
1978 557, 70, 104, 16, 17, 18, 552, 418, 67, 344,
1979 66, 68, 83, 344, 69, 87, 70, 139, 466, 508,
1980 345, 509, 19, 398, 78, 79, 325, 326, 76, 77,
1981 53, 107, 425, 108, 300, 67, 81, 301, 68, 332,
1982 281, 69, 82, 70, 400, 298, 399, 529, 1, 32,
1983 2, 530, 295, 307, 308, 298, 310, 311, 298, 298,
1984 298, 298, 298, 318, 319, 298, 298, 54, 339, 340,
1985 341, 342, 343, 32, 133, 372, 90, 372, 372, 499,
1986 372, 351, 352, 353, 354, 196, 437, 372, 439, 440,
1987 441, 400, 95, 400, 445, 372, 372, 118, 119, 120,
1988 121, 122, 123, 124, 91, 92, 67, 380, 107, 68,
1989 108, 107, 69, 108, 70, 286, 107, 331, 108, 493,
1990 347, 43, 44, 45, 197, 107, 46, 108, 529, 402,
1991 403, 107, 533, 108, 94, 385, 409, 148, 149, 96,
1992 201, 378, 379, 382, 107, 546, 108, 98, 548, 99,
1993 486, 323, 324, 100, 372, 372, 372, 137, 201, 397,
1994 298, 138, 372, 325, 326, 109, 110, 542, -58, -59,
1995 150, 199, 236, 372, 372, 238, 512, 513, 514, 242,
1996 288, 239, 245, 553, 248, 249, 250, 251, 252, 253,
1997 254, 255, 256, 257, 276, 420, 277, 453, 454, 455,
1998 456, 278, 279, 280, 458, 459, 289, 461, 372, 290,
1999 372, 291, 292, 372, 293, 296, 302, 386, 337, 372,
2000 372, 333, 338, 298, 438, 298, 298, 298, 359, 387,
2001 444, 298, 388, 389, 390, 394, 391, 395, 405, 406,
2002 407, 484, 485, 408, 372, 372, 414, 372, 372, 412,
2003 460, -169, 372, 374, 375, 410, 376, 416, 413, 415,
2004 372, 417, 423, 384, 457, 1, 426, 2, 3, 427,
2005 436, 392, 393, 442, 4, 5, 443, 448, 449, 519,
2006 372, 520, 521, 465, 483, 450, 463, 298, 372, 467,
2007 468, 464, 469, 6, 470, 473, 482, 525, 432, 498,
2008 7, 538, 471, 451, 8, 503, 475, 477, 478, 479,
2009 487, 489, 495, 298, 298, 298, 488, 372, 503, 490,
2010 491, 492, 372, 500, 494, 507, 511, 526, 517, 531,
2011 428, 429, 430, 518, 540, 527, 372, 372, 435, 534,
2012 535, 372, 536, 549, 372, 556, 547, 559, 560, 446,
2013 447, 565, 561, 564, 567, 59, 60, 227, 103, 111,
2014 112, 113, 65, 228, 1, 545, 2, 229, 230, 305,
2015 259, 260, 495, 306, 128, 523, 329, -168, 143, 37,
2016 127, 140, 89, 537, 472, 515, 474, 434, 0, 476,
2017 66, 1, 0, 2, 3, 480, 481, 0, 0, 0,
2018 4, 5, 0, 0, 59, 60, 0, 103, 62, 63,
2019 64, 65, 0, 1, 0, 2, 0, 0, 0, 6,
2020 501, 502, 0, 505, 506, 0, 7, 0, 510, 132,
2021 8, 0, 0, 0, 0, 0, 516, 0, 0, 66,
2022 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
2023 271, 272, 273, 274, 0, 0, 528, 59, 60, 0,
2024 0, 0, 0, 0, 532, 0, 1, 0, 2, 0,
2025 151, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2026 0, 0, 0, 152, 153, 0, 67, 0, 0, 68,
2027 0, 0, 69, 550, 70, 346, 0, 0, 554, 0,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer6f407902007-01-13 05:00:46 +00002029 0, 0, 562, 563, 0, 0, 0, 566, 0, 0,
2030 568, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2031 163, 164, 165, 166, 167, 67, 0, 0, 68, 0,
2032 0, 69, 0, 70, 0, 0, 0, 0, 59, 60,
2033 0, 103, 62, 63, 64, 65, 0, 1, 0, 2,
2034 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2035 178, 179, 180, 328, 181, 182, 183, 184, 0, 185,
2036 186, 187, 0, 66, 0, 0, 0, 107, 0, 108,
2037 0, 188, 0, 0, 189, 0, 190, 0, 191, 360,
2038 361, 59, 60, 362, 0, 0, 0, 0, 0, 0,
2039 1, 0, 2, 0, 363, 364, 365, 0, 0, 0,
2040 0, 0, 0, 0, 0, 0, 0, 366, 367, 59,
2041 60, 0, 103, 62, 63, 64, 65, 0, 1, 0,
2042 2, 0, 0, 0, 0, 0, 59, 60, 368, 61,
2043 62, 63, 64, 65, 419, 1, 0, 2, 0, 0,
2044 0, 0, 0, 0, 66, 154, 155, 156, 157, 158,
2045 159, 160, 161, 162, 163, 164, 165, 166, 167, 67,
2046 0, 66, 68, 0, 0, 69, 0, 70, 0, 0,
2047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2048 0, 0, 0, 0, 168, 169, 170, 171, 172, 173,
2049 174, 175, 176, 177, 178, 179, 180, 0, 181, 182,
2050 183, 184, 0, 185, 186, 187, 360, 361, 59, 60,
2051 362, 107, 0, 108, 0, 0, 0, 1, 369, 2,
2052 0, 363, 364, 365, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 0, 366, 367, 0, 0, 0, 0,
2054 67, 0, 0, 68, 0, 0, 69, 0, 70, 0,
2055 0, 0, 0, 0, 0, 368, 0, 67, 0, 0,
2056 68, 0, 0, 69, 0, 70, 0, 0, 0, 0,
2057 0, 0, 154, 155, 156, 157, 158, 159, 160, 161,
2058 162, 163, 164, 165, 166, 167, 0, 0, 0, 59,
2059 60, 0, 103, 111, 112, 113, 65, 0, 1, 0,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002060 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer6f407902007-01-13 05:00:46 +00002061 0, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2062 177, 178, 179, 180, 66, 181, 182, 183, 184, 0,
2063 185, 186, 187, 360, 361, 0, 0, 362, 0, 0,
2064 0, 0, 0, 0, 0, 369, 0, 0, 363, 364,
2065 365, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2066 0, 366, 367, 59, 60, 0, 103, 62, 63, 64,
2067 65, 0, 1, 0, 2, 0, 0, 0, 0, 0,
2068 59, 60, 368, 103, 62, 63, 64, 65, 497, 1,
2069 0, 2, 0, 0, 0, 0, 0, 0, 66, 154,
2070 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
2071 165, 166, 167, 0, 0, 66, 0, 0, 0, 0,
2072 67, 0, 0, 68, 0, 0, 69, 0, 70, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 168, 169,
2074 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
2075 180, 0, 181, 182, 183, 184, 0, 185, 186, 187,
2076 59, 60, 0, 200, 62, 63, 64, 65, 0, 1,
2077 0, 2, 369, 59, 60, 0, 103, 111, 112, 113,
2078 65, 0, 1, 0, 2, 0, 0, 0, 0, 0,
2079 0, 0, 0, 0, 67, 66, 0, 68, 0, 0,
2080 69, 0, 70, 0, 0, 0, 0, 0, 66, 0,
2081 0, 67, 0, 0, 68, 0, 0, 69, 0, 70,
2082 59, 60, 0, 297, 62, 63, 64, 65, 0, 1,
2083 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
2084 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2085 0, 0, 0, 0, 0, 66, 0, 0, 0, 0,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002086 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer6f407902007-01-13 05:00:46 +00002088 0, 0, 0, 0, 0, 0, 206, 0, 0, 0,
2089 0, 67, 0, 0, 68, 0, 0, 69, 0, 70,
2090 0, 0, 0, 0, 67, 0, 0, 68, 207, 208,
2091 69, 0, 284, 0, 0, 0, 0, 0, 0, 0,
2092 0, 209, 210, 211, 212, 213, 214, 154, 155, 156,
2093 157, 158, 159, 160, 161, 162, 163, 164, 165, 215,
2094 216, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2095 0, 67, 0, 0, 68, 0, 0, 69, 0, 70,
2096 0, 217, 218, 219, 0, 0, 220, 169, 170, 171,
2097 172, 173, 174, 175, 176, 177, 178, 179, 180, 221,
2098 222, 182, 183, 184, 223, 224, 225, 226
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002099};
2100
Reid Spencer6f407902007-01-13 05:00:46 +00002101static const short int yycheck[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002102{
Reid Spencer6f407902007-01-13 05:00:46 +00002103 0, 211, 189, 190, 116, 308, 9, 4, 420, 23,
2104 245, 11, 5, 6, 21, 8, 9, 10, 11, 12,
2105 212, 14, 80, 16, 9, 330, 133, 5, 6, 334,
2106 8, 9, 10, 11, 12, 15, 14, 27, 16, 37,
2107 232, 39, 22, 116, 9, 246, 247, 40, 14, 304,
2108 16, 109, 9, 134, 5, 6, 70, 8, 9, 10,
2109 11, 12, 40, 14, 145, 16, 27, 322, 219, 134,
2110 134, 222, 223, 224, 225, 226, 141, 0, 229, 230,
2111 13, 145, 52, 48, 98, 85, 498, 48, 102, 40,
2112 133, 48, 110, 111, 108, 29, 110, 284, 3, 4,
2113 33, 34, 35, 36, 37, 38, 39, 134, 41, 134,
2114 134, 125, 130, 138, 19, 20, 528, 133, 145, 143,
2115 110, 111, 134, 137, 138, 5, 6, 141, 8, 9,
2116 10, 11, 12, 145, 14, 139, 16, 144, 141, 542,
2117 130, 133, 554, 136, 110, 111, 139, 144, 16, 142,
2118 553, 144, 145, 43, 44, 45, 141, 358, 136, 134,
2119 40, 139, 15, 134, 142, 145, 144, 145, 143, 472,
2120 141, 474, 62, 324, 25, 26, 110, 111, 33, 34,
2121 133, 135, 369, 137, 9, 136, 41, 12, 139, 143,
2122 141, 142, 47, 144, 499, 209, 130, 134, 14, 132,
2123 16, 138, 202, 217, 218, 219, 220, 221, 222, 223,
2124 224, 225, 226, 227, 228, 229, 230, 133, 276, 277,
2125 278, 279, 280, 132, 238, 298, 16, 300, 301, 464,
2126 303, 289, 290, 291, 292, 347, 387, 310, 389, 390,
2127 391, 546, 16, 548, 395, 318, 319, 55, 56, 57,
2128 58, 59, 60, 61, 46, 47, 136, 134, 135, 139,
2129 137, 135, 142, 137, 144, 145, 135, 141, 137, 138,
2130 284, 33, 34, 35, 347, 135, 38, 137, 134, 337,
2131 338, 135, 138, 137, 4, 139, 344, 3, 4, 16,
2132 304, 305, 306, 134, 135, 530, 137, 137, 533, 4,
2133 451, 106, 107, 4, 377, 378, 379, 140, 322, 323,
2134 324, 140, 385, 110, 111, 76, 77, 527, 7, 7,
2135 7, 4, 16, 396, 397, 134, 477, 478, 479, 143,
2136 16, 138, 138, 543, 83, 84, 85, 86, 87, 88,
2137 89, 90, 91, 92, 137, 359, 137, 405, 406, 407,
2138 408, 137, 137, 137, 412, 413, 137, 415, 431, 137,
2139 433, 137, 137, 436, 134, 50, 9, 134, 137, 442,
2140 443, 143, 137, 387, 388, 389, 390, 391, 137, 134,
2141 394, 395, 134, 134, 134, 29, 134, 134, 134, 134,
2142 134, 449, 450, 134, 467, 468, 29, 470, 471, 134,
2143 414, 0, 475, 300, 301, 143, 303, 16, 134, 134,
2144 483, 4, 54, 310, 143, 14, 134, 16, 17, 134,
2145 139, 318, 319, 134, 23, 24, 134, 134, 134, 487,
2146 503, 489, 490, 16, 448, 134, 134, 451, 511, 12,
2147 12, 138, 137, 42, 134, 4, 137, 16, 48, 463,
2148 49, 48, 134, 134, 53, 469, 134, 134, 134, 134,
2149 134, 134, 462, 477, 478, 479, 138, 540, 482, 134,
2150 138, 138, 545, 134, 138, 134, 134, 134, 138, 141,
2151 377, 378, 379, 138, 12, 139, 559, 560, 385, 138,
2152 138, 564, 138, 4, 567, 134, 141, 12, 12, 396,
2153 397, 67, 134, 12, 12, 5, 6, 128, 8, 9,
2154 10, 11, 12, 128, 14, 529, 16, 128, 128, 215,
2155 19, 20, 522, 216, 85, 499, 238, 0, 108, 11,
2156 82, 102, 50, 522, 431, 482, 433, 384, -1, 436,
2157 40, 14, -1, 16, 17, 442, 443, -1, -1, -1,
2158 23, 24, -1, -1, 5, 6, -1, 8, 9, 10,
2159 11, 12, -1, 14, -1, 16, -1, -1, -1, 42,
2160 467, 468, -1, 470, 471, -1, 49, -1, 475, 30,
2161 53, -1, -1, -1, -1, -1, 483, -1, -1, 40,
2162 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
2163 99, 100, 101, 102, -1, -1, 503, 5, 6, -1,
2164 -1, -1, -1, -1, 511, -1, 14, -1, 16, -1,
2165 18, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2166 -1, -1, -1, 31, 32, -1, 136, -1, -1, 139,
2167 -1, -1, 142, 540, 144, 145, -1, -1, 545, -1,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002168 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer6f407902007-01-13 05:00:46 +00002169 -1, -1, 559, 560, -1, -1, -1, 564, -1, -1,
2170 567, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2171 78, 79, 80, 81, 82, 136, -1, -1, 139, -1,
2172 -1, 142, -1, 144, -1, -1, -1, -1, 5, 6,
2173 -1, 8, 9, 10, 11, 12, -1, 14, -1, 16,
2174 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2175 118, 119, 120, 30, 122, 123, 124, 125, -1, 127,
2176 128, 129, -1, 40, -1, -1, -1, 135, -1, 137,
2177 -1, 139, -1, -1, 142, -1, 144, -1, 146, 3,
2178 4, 5, 6, 7, -1, -1, -1, -1, -1, -1,
2179 14, -1, 16, -1, 18, 19, 20, -1, -1, -1,
2180 -1, -1, -1, -1, -1, -1, -1, 31, 32, 5,
2181 6, -1, 8, 9, 10, 11, 12, -1, 14, -1,
2182 16, -1, -1, -1, -1, -1, 5, 6, 52, 8,
2183 9, 10, 11, 12, 30, 14, -1, 16, -1, -1,
2184 -1, -1, -1, -1, 40, 69, 70, 71, 72, 73,
2185 74, 75, 76, 77, 78, 79, 80, 81, 82, 136,
2186 -1, 40, 139, -1, -1, 142, -1, 144, -1, -1,
2187 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2188 -1, -1, -1, -1, 108, 109, 110, 111, 112, 113,
2189 114, 115, 116, 117, 118, 119, 120, -1, 122, 123,
2190 124, 125, -1, 127, 128, 129, 3, 4, 5, 6,
2191 7, 135, -1, 137, -1, -1, -1, 14, 142, 16,
2192 -1, 18, 19, 20, -1, -1, -1, -1, -1, -1,
2193 -1, -1, -1, -1, 31, 32, -1, -1, -1, -1,
2194 136, -1, -1, 139, -1, -1, 142, -1, 144, -1,
2195 -1, -1, -1, -1, -1, 52, -1, 136, -1, -1,
2196 139, -1, -1, 142, -1, 144, -1, -1, -1, -1,
2197 -1, -1, 69, 70, 71, 72, 73, 74, 75, 76,
2198 77, 78, 79, 80, 81, 82, -1, -1, -1, 5,
2199 6, -1, 8, 9, 10, 11, 12, -1, 14, -1,
2200 16, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2201 -1, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2202 117, 118, 119, 120, 40, 122, 123, 124, 125, -1,
2203 127, 128, 129, 3, 4, -1, -1, 7, -1, -1,
2204 -1, -1, -1, -1, -1, 142, -1, -1, 18, 19,
2205 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2206 -1, 31, 32, 5, 6, -1, 8, 9, 10, 11,
2207 12, -1, 14, -1, 16, -1, -1, -1, -1, -1,
2208 5, 6, 52, 8, 9, 10, 11, 12, 30, 14,
2209 -1, 16, -1, -1, -1, -1, -1, -1, 40, 69,
2210 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2211 80, 81, 82, -1, -1, 40, -1, -1, -1, -1,
2212 136, -1, -1, 139, -1, -1, 142, -1, 144, -1,
2213 -1, -1, -1, -1, -1, -1, -1, -1, 108, 109,
2214 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2215 120, -1, 122, 123, 124, 125, -1, 127, 128, 129,
2216 5, 6, -1, 8, 9, 10, 11, 12, -1, 14,
2217 -1, 16, 142, 5, 6, -1, 8, 9, 10, 11,
2218 12, -1, 14, -1, 16, -1, -1, -1, -1, -1,
2219 -1, -1, -1, -1, 136, 40, -1, 139, -1, -1,
2220 142, -1, 144, -1, -1, -1, -1, -1, 40, -1,
2221 -1, 136, -1, -1, 139, -1, -1, 142, -1, 144,
2222 5, 6, -1, 8, 9, 10, 11, 12, -1, 14,
2223 -1, 16, -1, -1, -1, -1, -1, -1, -1, -1,
2224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2225 -1, -1, -1, -1, -1, 40, -1, -1, -1, -1,
2226 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2227 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2228 -1, -1, -1, -1, -1, -1, 28, -1, -1, -1,
2229 -1, 136, -1, -1, 139, -1, -1, 142, -1, 144,
2230 -1, -1, -1, -1, 136, -1, -1, 139, 50, 51,
2231 142, -1, 144, -1, -1, -1, -1, -1, -1, -1,
2232 -1, 63, 64, 65, 66, 67, 68, 69, 70, 71,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002233 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
Reid Spencer6f407902007-01-13 05:00:46 +00002234 82, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2235 -1, 136, -1, -1, 139, -1, -1, 142, -1, 144,
2236 -1, 103, 104, 105, -1, -1, 108, 109, 110, 111,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002237 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
Reid Spencer6f407902007-01-13 05:00:46 +00002238 122, 123, 124, 125, 126, 127, 128, 129
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002239};
2240
2241/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2242 symbol of state STATE-NUM. */
Reid Spencer6f407902007-01-13 05:00:46 +00002243static const unsigned char yystos[] =
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002244{
Reid Spencer6f407902007-01-13 05:00:46 +00002245 0, 14, 16, 17, 23, 24, 42, 49, 53, 157,
2246 185, 186, 187, 198, 189, 188, 43, 44, 45, 62,
2247 195, 133, 52, 13, 33, 34, 35, 36, 37, 38,
2248 39, 41, 132, 158, 159, 160, 0, 187, 133, 37,
2249 39, 161, 207, 33, 34, 35, 38, 162, 204, 206,
2250 213, 133, 133, 133, 133, 139, 196, 16, 193, 5,
2251 6, 8, 9, 10, 11, 12, 40, 136, 139, 142,
2252 144, 148, 174, 175, 198, 210, 160, 160, 25, 26,
2253 184, 160, 160, 15, 214, 215, 22, 145, 205, 214,
2254 16, 46, 47, 194, 4, 16, 16, 197, 137, 4,
2255 4, 4, 144, 8, 145, 175, 180, 135, 137, 184,
2256 184, 9, 10, 11, 155, 156, 175, 181, 55, 56,
2257 57, 58, 59, 60, 61, 163, 202, 202, 157, 218,
2258 134, 141, 30, 175, 176, 178, 179, 140, 140, 145,
2259 180, 134, 145, 179, 181, 175, 19, 20, 3, 4,
2260 7, 18, 31, 32, 69, 70, 71, 72, 73, 74,
2261 75, 76, 77, 78, 79, 80, 81, 82, 108, 109,
2262 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2263 120, 122, 123, 124, 125, 127, 128, 129, 139, 142,
2264 144, 146, 149, 150, 151, 152, 182, 210, 190, 4,
2265 8, 175, 177, 21, 144, 203, 28, 50, 51, 63,
2266 64, 65, 66, 67, 68, 81, 82, 103, 104, 105,
2267 108, 121, 122, 126, 127, 128, 129, 149, 150, 151,
2268 152, 216, 222, 223, 224, 225, 16, 165, 134, 138,
2269 175, 175, 143, 145, 175, 138, 191, 192, 83, 84,
2270 85, 86, 87, 88, 89, 90, 91, 92, 153, 19,
2271 20, 89, 90, 91, 92, 93, 94, 95, 96, 97,
2272 98, 99, 100, 101, 102, 154, 137, 137, 137, 137,
2273 137, 141, 181, 183, 144, 183, 145, 183, 16, 137,
2274 137, 137, 137, 134, 172, 198, 50, 8, 175, 212,
2275 9, 12, 9, 155, 163, 153, 154, 175, 175, 212,
2276 175, 175, 219, 212, 212, 212, 212, 212, 175, 175,
2277 212, 212, 163, 106, 107, 110, 111, 164, 30, 176,
2278 167, 141, 143, 143, 167, 172, 172, 137, 137, 181,
2279 181, 181, 181, 181, 134, 141, 145, 175, 183, 143,
2280 145, 181, 181, 181, 181, 27, 48, 170, 173, 137,
2281 3, 4, 7, 18, 19, 20, 31, 32, 52, 142,
2282 182, 209, 210, 211, 211, 211, 211, 177, 175, 175,
2283 134, 169, 134, 169, 211, 139, 134, 134, 134, 134,
2284 134, 134, 211, 211, 29, 134, 177, 175, 212, 130,
2285 164, 166, 181, 181, 221, 134, 134, 134, 134, 181,
2286 143, 145, 134, 134, 29, 134, 16, 4, 172, 30,
2287 175, 200, 201, 54, 208, 183, 134, 134, 211, 211,
2288 211, 9, 48, 9, 221, 211, 139, 212, 175, 212,
2289 212, 212, 134, 134, 175, 212, 211, 211, 134, 134,
2290 134, 134, 138, 181, 181, 181, 181, 143, 181, 181,
2291 175, 181, 165, 134, 138, 16, 143, 12, 12, 137,
2292 134, 134, 211, 4, 211, 134, 211, 134, 134, 134,
2293 211, 211, 137, 175, 181, 181, 212, 134, 138, 134,
2294 134, 138, 138, 138, 138, 198, 199, 30, 175, 167,
2295 134, 211, 211, 175, 220, 211, 211, 134, 169, 169,
2296 211, 134, 212, 212, 212, 220, 211, 138, 138, 181,
2297 181, 181, 165, 170, 171, 16, 134, 139, 211, 134,
2298 138, 141, 211, 138, 138, 138, 138, 199, 48, 168,
2299 12, 141, 155, 217, 165, 175, 167, 141, 167, 4,
2300 211, 209, 141, 155, 211, 29, 134, 209, 165, 12,
2301 12, 134, 211, 211, 12, 67, 211, 12, 211
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002302};
Reid Spencer68a24bd2005-08-27 18:50:39 +00002303
2304#define yyerrok (yyerrstatus = 0)
2305#define yyclearin (yychar = YYEMPTY)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002306#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002307#define YYEOF 0
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002308
Reid Spencer68a24bd2005-08-27 18:50:39 +00002309#define YYACCEPT goto yyacceptlab
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002310#define YYABORT goto yyabortlab
2311#define YYERROR goto yyerrorlab
2312
2313
2314/* Like YYERROR except do call yyerror. This remains here temporarily
2315 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002316 Once GCC version 2 has supplanted version 1, this can go. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002317
Reid Spencer68a24bd2005-08-27 18:50:39 +00002318#define YYFAIL goto yyerrlab
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002319
Reid Spencer68a24bd2005-08-27 18:50:39 +00002320#define YYRECOVERING() (!!yyerrstatus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002321
2322#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002323do \
2324 if (yychar == YYEMPTY && yylen == 1) \
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002325 { \
2326 yychar = (Token); \
2327 yylval = (Value); \
2328 yytoken = YYTRANSLATE (yychar); \
Reid Spencer6f407902007-01-13 05:00:46 +00002329 YYPOPSTACK; \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002330 goto yybackup; \
2331 } \
2332 else \
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002333 { \
2334 yyerror (YY_("syntax error: cannot back up")); \
2335 YYERROR; \
2336 } \
Reid Spencer6f407902007-01-13 05:00:46 +00002337while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002338
Reid Spencer3822ff52006-11-08 06:47:33 +00002339
Reid Spencer68a24bd2005-08-27 18:50:39 +00002340#define YYTERROR 1
2341#define YYERRCODE 256
2342
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002343
2344/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2345 If N is 0, then set CURRENT to the empty location which ends
2346 the previous symbol: RHS[0] (always defined). */
2347
2348#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2349#ifndef YYLLOC_DEFAULT
2350# define YYLLOC_DEFAULT(Current, Rhs, N) \
2351 do \
Reid Spencer6f407902007-01-13 05:00:46 +00002352 if (N) \
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002353 { \
2354 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2355 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2356 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2357 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2358 } \
2359 else \
2360 { \
2361 (Current).first_line = (Current).last_line = \
2362 YYRHSLOC (Rhs, 0).last_line; \
2363 (Current).first_column = (Current).last_column = \
2364 YYRHSLOC (Rhs, 0).last_column; \
2365 } \
Reid Spencer6f407902007-01-13 05:00:46 +00002366 while (0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002367#endif
2368
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002369
2370/* YY_LOCATION_PRINT -- Print the location on the stream.
2371 This macro was not mandated originally: define only if we know
2372 we won't break user code: when these are the locations we know. */
2373
2374#ifndef YY_LOCATION_PRINT
2375# if YYLTYPE_IS_TRIVIAL
2376# define YY_LOCATION_PRINT(File, Loc) \
2377 fprintf (File, "%d.%d-%d.%d", \
Reid Spencer6f407902007-01-13 05:00:46 +00002378 (Loc).first_line, (Loc).first_column, \
2379 (Loc).last_line, (Loc).last_column)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002380# else
2381# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2382# endif
2383#endif
2384
2385
2386/* YYLEX -- calling `yylex' with the right arguments. */
2387
Reid Spencer68a24bd2005-08-27 18:50:39 +00002388#ifdef YYLEX_PARAM
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002389# define YYLEX yylex (YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002390#else
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002391# define YYLEX yylex ()
Chris Lattner0fab59c2007-01-12 18:33:30 +00002392#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002393
2394/* Enable debugging if requested. */
2395#if YYDEBUG
2396
2397# ifndef YYFPRINTF
2398# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2399# define YYFPRINTF fprintf
2400# endif
2401
2402# define YYDPRINTF(Args) \
2403do { \
2404 if (yydebug) \
2405 YYFPRINTF Args; \
Reid Spencer6f407902007-01-13 05:00:46 +00002406} while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002407
Reid Spencer6f407902007-01-13 05:00:46 +00002408# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2409do { \
2410 if (yydebug) \
2411 { \
2412 YYFPRINTF (stderr, "%s ", Title); \
2413 yysymprint (stderr, \
2414 Type, Value); \
2415 YYFPRINTF (stderr, "\n"); \
2416 } \
2417} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002418
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002419/*------------------------------------------------------------------.
2420| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2421| TOP (included). |
2422`------------------------------------------------------------------*/
Reid Spencer3822ff52006-11-08 06:47:33 +00002423
Reid Spencer6f407902007-01-13 05:00:46 +00002424#if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002425static void
Reid Spencer6f407902007-01-13 05:00:46 +00002426yy_stack_print (short int *bottom, short int *top)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002427#else
2428static void
2429yy_stack_print (bottom, top)
Reid Spencer6f407902007-01-13 05:00:46 +00002430 short int *bottom;
2431 short int *top;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002432#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002433{
2434 YYFPRINTF (stderr, "Stack now");
Reid Spencer6f407902007-01-13 05:00:46 +00002435 for (/* Nothing. */; bottom <= top; ++bottom)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002436 YYFPRINTF (stderr, " %d", *bottom);
2437 YYFPRINTF (stderr, "\n");
2438}
Reid Spencer3822ff52006-11-08 06:47:33 +00002439
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002440# define YY_STACK_PRINT(Bottom, Top) \
2441do { \
2442 if (yydebug) \
2443 yy_stack_print ((Bottom), (Top)); \
Reid Spencer6f407902007-01-13 05:00:46 +00002444} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002445
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002446
2447/*------------------------------------------------.
2448| Report that the YYRULE is going to be reduced. |
2449`------------------------------------------------*/
2450
Reid Spencer6f407902007-01-13 05:00:46 +00002451#if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002452static void
Reid Spencer6f407902007-01-13 05:00:46 +00002453yy_reduce_print (int yyrule)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002454#else
2455static void
Reid Spencer6f407902007-01-13 05:00:46 +00002456yy_reduce_print (yyrule)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002457 int yyrule;
Chris Lattner1ae022f2006-10-22 06:08:13 +00002458#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002459{
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002460 int yyi;
2461 unsigned long int yylno = yyrline[yyrule];
Reid Spencer6f407902007-01-13 05:00:46 +00002462 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2463 yyrule - 1, yylno);
2464 /* Print the symbols being reduced, and their result. */
2465 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2466 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2467 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002468}
Reid Spencer21be8652006-10-22 07:03:43 +00002469
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002470# define YY_REDUCE_PRINT(Rule) \
2471do { \
2472 if (yydebug) \
Reid Spencer6f407902007-01-13 05:00:46 +00002473 yy_reduce_print (Rule); \
2474} while (0)
Reid Spencer21be8652006-10-22 07:03:43 +00002475
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002476/* Nonzero means print parse trace. It is left uninitialized so that
2477 multiple parsers can coexist. */
2478int yydebug;
2479#else /* !YYDEBUG */
2480# define YYDPRINTF(Args)
2481# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2482# define YY_STACK_PRINT(Bottom, Top)
2483# define YY_REDUCE_PRINT(Rule)
2484#endif /* !YYDEBUG */
2485
2486
2487/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002488#ifndef YYINITDEPTH
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002489# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002490#endif
2491
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002492/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2493 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002494
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002495 Do not make this value too large; the results are undefined if
2496 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2497 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002498
2499#ifndef YYMAXDEPTH
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002500# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002501#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002502
Reid Spencer68a24bd2005-08-27 18:50:39 +00002503
2504
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002505#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002506
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002507# ifndef yystrlen
Reid Spencer6f407902007-01-13 05:00:46 +00002508# if defined (__GLIBC__) && defined (_STRING_H)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002509# define yystrlen strlen
2510# else
2511/* Return the length of YYSTR. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002512static YYSIZE_T
Reid Spencer6f407902007-01-13 05:00:46 +00002513# if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002514yystrlen (const char *yystr)
Reid Spencer6f407902007-01-13 05:00:46 +00002515# else
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002516yystrlen (yystr)
Reid Spencer6f407902007-01-13 05:00:46 +00002517 const char *yystr;
2518# endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002519{
Reid Spencer6f407902007-01-13 05:00:46 +00002520 const char *yys = yystr;
2521
2522 while (*yys++ != '\0')
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002523 continue;
Reid Spencer6f407902007-01-13 05:00:46 +00002524
2525 return yys - yystr - 1;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002526}
2527# endif
2528# endif
2529
2530# ifndef yystpcpy
Reid Spencer6f407902007-01-13 05:00:46 +00002531# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002532# define yystpcpy stpcpy
2533# else
2534/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2535 YYDEST. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002536static char *
Reid Spencer6f407902007-01-13 05:00:46 +00002537# if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002538yystpcpy (char *yydest, const char *yysrc)
Reid Spencer6f407902007-01-13 05:00:46 +00002539# else
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002540yystpcpy (yydest, yysrc)
Reid Spencer6f407902007-01-13 05:00:46 +00002541 char *yydest;
2542 const char *yysrc;
2543# endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002544{
2545 char *yyd = yydest;
2546 const char *yys = yysrc;
2547
2548 while ((*yyd++ = *yys++) != '\0')
2549 continue;
2550
2551 return yyd - 1;
2552}
2553# endif
2554# endif
2555
2556# ifndef yytnamerr
2557/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2558 quotes and backslashes, so that it's suitable for yyerror. The
2559 heuristic is that double-quoting is unnecessary unless the string
2560 contains an apostrophe, a comma, or backslash (other than
2561 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2562 null, do not copy; instead, return the length of what the result
2563 would have been. */
2564static YYSIZE_T
2565yytnamerr (char *yyres, const char *yystr)
2566{
2567 if (*yystr == '"')
2568 {
Reid Spencer6f407902007-01-13 05:00:46 +00002569 size_t yyn = 0;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002570 char const *yyp = yystr;
2571
2572 for (;;)
2573 switch (*++yyp)
2574 {
2575 case '\'':
2576 case ',':
2577 goto do_not_strip_quotes;
2578
2579 case '\\':
2580 if (*++yyp != '\\')
2581 goto do_not_strip_quotes;
2582 /* Fall through. */
2583 default:
2584 if (yyres)
2585 yyres[yyn] = *yyp;
2586 yyn++;
2587 break;
2588
2589 case '"':
2590 if (yyres)
2591 yyres[yyn] = '\0';
2592 return yyn;
2593 }
2594 do_not_strip_quotes: ;
2595 }
2596
2597 if (! yyres)
2598 return yystrlen (yystr);
2599
2600 return yystpcpy (yyres, yystr) - yyres;
2601}
2602# endif
2603
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002604#endif /* YYERROR_VERBOSE */
Reid Spencer6f407902007-01-13 05:00:46 +00002605
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002606
2607
Reid Spencer6f407902007-01-13 05:00:46 +00002608#if YYDEBUG
2609/*--------------------------------.
2610| Print this symbol on YYOUTPUT. |
2611`--------------------------------*/
2612
2613#if defined (__STDC__) || defined (__cplusplus)
2614static void
2615yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2616#else
2617static void
2618yysymprint (yyoutput, yytype, yyvaluep)
2619 FILE *yyoutput;
2620 int yytype;
2621 YYSTYPE *yyvaluep;
2622#endif
2623{
2624 /* Pacify ``unused variable'' warnings. */
2625 (void) yyvaluep;
2626
2627 if (yytype < YYNTOKENS)
2628 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2629 else
2630 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2631
2632
2633# ifdef YYPRINT
2634 if (yytype < YYNTOKENS)
2635 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2636# endif
2637 switch (yytype)
2638 {
2639 default:
2640 break;
2641 }
2642 YYFPRINTF (yyoutput, ")");
2643}
2644
2645#endif /* ! YYDEBUG */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002646/*-----------------------------------------------.
2647| Release the memory associated to this symbol. |
2648`-----------------------------------------------*/
2649
Reid Spencer6f407902007-01-13 05:00:46 +00002650#if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002651static void
2652yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2653#else
2654static void
2655yydestruct (yymsg, yytype, yyvaluep)
2656 const char *yymsg;
2657 int yytype;
2658 YYSTYPE *yyvaluep;
2659#endif
2660{
Reid Spencer6f407902007-01-13 05:00:46 +00002661 /* Pacify ``unused variable'' warnings. */
2662 (void) yyvaluep;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002663
2664 if (!yymsg)
2665 yymsg = "Deleting";
2666 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2667
2668 switch (yytype)
2669 {
2670
2671 default:
Reid Spencer6f407902007-01-13 05:00:46 +00002672 break;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002673 }
2674}
2675
2676
2677/* Prevent warnings from -Wmissing-prototypes. */
2678
2679#ifdef YYPARSE_PARAM
Reid Spencer6f407902007-01-13 05:00:46 +00002680# if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002681int yyparse (void *YYPARSE_PARAM);
Reid Spencer6f407902007-01-13 05:00:46 +00002682# else
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002683int yyparse ();
Reid Spencer6f407902007-01-13 05:00:46 +00002684# endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002685#else /* ! YYPARSE_PARAM */
Reid Spencer6f407902007-01-13 05:00:46 +00002686#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere812fb22006-01-19 01:21:04 +00002687int yyparse (void);
Chris Lattner0fab59c2007-01-12 18:33:30 +00002688#else
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002689int yyparse ();
Chris Lattner0fab59c2007-01-12 18:33:30 +00002690#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002691#endif /* ! YYPARSE_PARAM */
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002692
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002693
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002694
2695/* The look-ahead symbol. */
2696int yychar;
2697
2698/* The semantic value of the look-ahead symbol. */
2699YYSTYPE yylval;
2700
2701/* Number of syntax errors so far. */
2702int yynerrs;
2703
2704
2705
2706/*----------.
2707| yyparse. |
2708`----------*/
2709
2710#ifdef YYPARSE_PARAM
Reid Spencer6f407902007-01-13 05:00:46 +00002711# if defined (__STDC__) || defined (__cplusplus)
2712int yyparse (void *YYPARSE_PARAM)
2713# else
2714int yyparse (YYPARSE_PARAM)
2715 void *YYPARSE_PARAM;
2716# endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002717#else /* ! YYPARSE_PARAM */
Reid Spencer6f407902007-01-13 05:00:46 +00002718#if defined (__STDC__) || defined (__cplusplus)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002719int
2720yyparse (void)
2721#else
2722int
2723yyparse ()
2724
Chris Lattner0fab59c2007-01-12 18:33:30 +00002725#endif
2726#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002727{
2728
2729 int yystate;
2730 int yyn;
2731 int yyresult;
2732 /* Number of tokens to shift before error messages enabled. */
2733 int yyerrstatus;
2734 /* Look-ahead token as an internal (translated) token number. */
2735 int yytoken = 0;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002736
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002737 /* Three stacks and their tools:
2738 `yyss': related to states,
2739 `yyvs': related to semantic values,
2740 `yyls': related to locations.
2741
2742 Refer to the stacks thru separate pointers, to allow yyoverflow
2743 to reallocate them elsewhere. */
2744
2745 /* The state stack. */
Reid Spencer6f407902007-01-13 05:00:46 +00002746 short int yyssa[YYINITDEPTH];
2747 short int *yyss = yyssa;
2748 short int *yyssp;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002749
2750 /* The semantic value stack. */
2751 YYSTYPE yyvsa[YYINITDEPTH];
2752 YYSTYPE *yyvs = yyvsa;
2753 YYSTYPE *yyvsp;
2754
2755
2756
Reid Spencer6f407902007-01-13 05:00:46 +00002757#define YYPOPSTACK (yyvsp--, yyssp--)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002758
2759 YYSIZE_T yystacksize = YYINITDEPTH;
2760
2761 /* The variables used to return semantic value and location from the
2762 action routines. */
2763 YYSTYPE yyval;
2764
2765
Reid Spencer6f407902007-01-13 05:00:46 +00002766 /* When reducing, the number of symbols on the RHS of the reduced
2767 rule. */
2768 int yylen;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002769
2770 YYDPRINTF ((stderr, "Starting parse\n"));
2771
Reid Spencer68a24bd2005-08-27 18:50:39 +00002772 yystate = 0;
2773 yyerrstatus = 0;
2774 yynerrs = 0;
2775 yychar = YYEMPTY; /* Cause a token to be read. */
2776
2777 /* Initialize stack pointers.
2778 Waste one element of value and location stack
2779 so that they stay on the same level as the state stack.
2780 The wasted elements are never initialized. */
2781
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002782 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002783 yyvsp = yyvs;
2784
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002785 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00002786
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002787/*------------------------------------------------------------.
2788| yynewstate -- Push a new state, which is found in yystate. |
2789`------------------------------------------------------------*/
2790 yynewstate:
2791 /* In all cases, when you get here, the value and location stacks
Reid Spencer6f407902007-01-13 05:00:46 +00002792 have just been pushed. so pushing a state here evens the stacks.
2793 */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002794 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002795
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002796 yysetstate:
2797 *yyssp = yystate;
2798
2799 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002800 {
2801 /* Get the current used size of the three stacks, in elements. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002802 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002803
2804#ifdef yyoverflow
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002805 {
Reid Spencer6f407902007-01-13 05:00:46 +00002806 /* Give user a chance to reallocate the stack. Use copies of
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002807 these so that the &'s don't force the real ones into
2808 memory. */
2809 YYSTYPE *yyvs1 = yyvs;
Reid Spencer6f407902007-01-13 05:00:46 +00002810 short int *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002811
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002812
2813 /* Each stack pointer address is followed by the size of the
2814 data in use in that stack, in bytes. This used to be a
2815 conditional around just the two extra args, but that might
2816 be undefined if yyoverflow is a macro. */
2817 yyoverflow (YY_("memory exhausted"),
2818 &yyss1, yysize * sizeof (*yyssp),
2819 &yyvs1, yysize * sizeof (*yyvsp),
2820
2821 &yystacksize);
2822
2823 yyss = yyss1;
2824 yyvs = yyvs1;
2825 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00002826#else /* no yyoverflow */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002827# ifndef YYSTACK_RELOCATE
2828 goto yyexhaustedlab;
2829# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00002830 /* Extend the stack our own way. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002831 if (YYMAXDEPTH <= yystacksize)
2832 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002833 yystacksize *= 2;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002834 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002835 yystacksize = YYMAXDEPTH;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002836
2837 {
Reid Spencer6f407902007-01-13 05:00:46 +00002838 short int *yyss1 = yyss;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002839 union yyalloc *yyptr =
2840 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2841 if (! yyptr)
2842 goto yyexhaustedlab;
2843 YYSTACK_RELOCATE (yyss);
2844 YYSTACK_RELOCATE (yyvs);
2845
2846# undef YYSTACK_RELOCATE
2847 if (yyss1 != yyssa)
2848 YYSTACK_FREE (yyss1);
2849 }
2850# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00002851#endif /* no yyoverflow */
2852
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002853 yyssp = yyss + yysize - 1;
2854 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002855
2856
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002857 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2858 (unsigned long int) yystacksize));
2859
2860 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002861 YYABORT;
2862 }
2863
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002864 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002865
2866 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002867
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002868/*-----------.
2869| yybackup. |
2870`-----------*/
2871yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002872
Reid Spencer6f407902007-01-13 05:00:46 +00002873/* Do appropriate processing given the current state. */
2874/* Read a look-ahead token if we need one and don't already have one. */
2875/* yyresume: */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002876
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002877 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer6f407902007-01-13 05:00:46 +00002878
Reid Spencer68a24bd2005-08-27 18:50:39 +00002879 yyn = yypact[yystate];
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002880 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002881 goto yydefault;
2882
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002883 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002884
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002885 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002886 if (yychar == YYEMPTY)
2887 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002888 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002889 yychar = YYLEX;
2890 }
2891
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002892 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002893 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002894 yychar = yytoken = YYEOF;
2895 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002896 }
2897 else
2898 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002899 yytoken = YYTRANSLATE (yychar);
2900 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002901 }
2902
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002903 /* If the proper action on seeing token YYTOKEN is to reduce or to
2904 detect an error, take that action. */
2905 yyn += yytoken;
2906 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002907 goto yydefault;
2908 yyn = yytable[yyn];
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002909 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002910 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002911 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002912 goto yyerrlab;
2913 yyn = -yyn;
2914 goto yyreduce;
2915 }
2916
2917 if (yyn == YYFINAL)
2918 YYACCEPT;
2919
Reid Spencer6f407902007-01-13 05:00:46 +00002920 /* Shift the look-ahead token. */
2921 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2922
2923 /* Discard the token being shifted unless it is eof. */
2924 if (yychar != YYEOF)
2925 yychar = YYEMPTY;
2926
2927 *++yyvsp = yylval;
2928
2929
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002930 /* Count tokens shifted since error; after three, turn off error
2931 status. */
2932 if (yyerrstatus)
2933 yyerrstatus--;
Chris Lattner0fab59c2007-01-12 18:33:30 +00002934
Reid Spencer68a24bd2005-08-27 18:50:39 +00002935 yystate = yyn;
2936 goto yynewstate;
2937
Chris Lattner0fab59c2007-01-12 18:33:30 +00002938
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002939/*-----------------------------------------------------------.
2940| yydefault -- do the default action for the current state. |
2941`-----------------------------------------------------------*/
2942yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002943 yyn = yydefact[yystate];
2944 if (yyn == 0)
2945 goto yyerrlab;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002946 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002947
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002948
2949/*-----------------------------.
2950| yyreduce -- Do a reduction. |
2951`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00002952yyreduce:
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002953 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002954 yylen = yyr2[yyn];
2955
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002956 /* If YYLEN is nonzero, implement the default value of the action:
2957 `$$ = $1'.
2958
2959 Otherwise, the following line sets YYVAL to garbage.
2960 This behavior is undocumented and Bison
2961 users should not rely upon it. Assigning to YYVAL
2962 unconditionally makes the parser a bit smaller, and it avoids a
2963 GCC warning that YYVAL may be used uninitialized. */
2964 yyval = yyvsp[1-yylen];
2965
2966
2967 YY_REDUCE_PRINT (yyn);
2968 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002969 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002970 case 3:
Reid Spencer6f407902007-01-13 05:00:46 +00002971#line 1032 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002972 {
Reid Spencer6f407902007-01-13 05:00:46 +00002973 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
Reid Spencer61c83e02006-08-18 08:43:06 +00002974 GEN_ERROR("Value too large for type!");
Reid Spencer6f407902007-01-13 05:00:46 +00002975 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00002976 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002977;}
2978 break;
2979
2980 case 31:
Reid Spencer6f407902007-01-13 05:00:46 +00002981#line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002982 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
2983 break;
2984
2985 case 32:
Reid Spencer6f407902007-01-13 05:00:46 +00002986#line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002987 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
2988 break;
2989
2990 case 33:
Reid Spencer6f407902007-01-13 05:00:46 +00002991#line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002992 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
2993 break;
2994
2995 case 34:
Reid Spencer6f407902007-01-13 05:00:46 +00002996#line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002997 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
2998 break;
2999
3000 case 35:
Reid Spencer6f407902007-01-13 05:00:46 +00003001#line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003002 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3003 break;
3004
3005 case 36:
Reid Spencer6f407902007-01-13 05:00:46 +00003006#line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003007 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3008 break;
3009
3010 case 37:
Reid Spencer6f407902007-01-13 05:00:46 +00003011#line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003012 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3013 break;
3014
3015 case 38:
Reid Spencer6f407902007-01-13 05:00:46 +00003016#line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003017 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3018 break;
3019
3020 case 39:
Reid Spencer6f407902007-01-13 05:00:46 +00003021#line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003022 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3023 break;
3024
3025 case 40:
Reid Spencer6f407902007-01-13 05:00:46 +00003026#line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003027 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3028 break;
3029
3030 case 41:
Reid Spencer6f407902007-01-13 05:00:46 +00003031#line 1056 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003032 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3033 break;
3034
3035 case 42:
Reid Spencer6f407902007-01-13 05:00:46 +00003036#line 1056 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003037 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3038 break;
3039
3040 case 43:
Reid Spencer6f407902007-01-13 05:00:46 +00003041#line 1057 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003042 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3043 break;
3044
3045 case 44:
Reid Spencer6f407902007-01-13 05:00:46 +00003046#line 1057 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003047 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3048 break;
3049
3050 case 45:
Reid Spencer6f407902007-01-13 05:00:46 +00003051#line 1058 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003052 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3053 break;
3054
3055 case 46:
Reid Spencer6f407902007-01-13 05:00:46 +00003056#line 1058 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003057 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3058 break;
3059
3060 case 47:
Reid Spencer6f407902007-01-13 05:00:46 +00003061#line 1059 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003062 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3063 break;
3064
3065 case 48:
Reid Spencer6f407902007-01-13 05:00:46 +00003066#line 1059 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003067 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3068 break;
3069
3070 case 49:
Reid Spencer6f407902007-01-13 05:00:46 +00003071#line 1060 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003072 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3073 break;
3074
3075 case 50:
Reid Spencer6f407902007-01-13 05:00:46 +00003076#line 1060 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003077 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3078 break;
3079
3080 case 51:
Reid Spencer6f407902007-01-13 05:00:46 +00003081#line 1061 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003082 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3083 break;
3084
3085 case 52:
Reid Spencer6f407902007-01-13 05:00:46 +00003086#line 1061 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003087 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3088 break;
3089
3090 case 53:
Reid Spencer6f407902007-01-13 05:00:46 +00003091#line 1062 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003092 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3093 break;
3094
3095 case 54:
Reid Spencer6f407902007-01-13 05:00:46 +00003096#line 1062 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003097 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3098 break;
3099
3100 case 55:
Reid Spencer6f407902007-01-13 05:00:46 +00003101#line 1063 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003102 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3103 break;
3104
3105 case 56:
Reid Spencer6f407902007-01-13 05:00:46 +00003106#line 1064 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003107 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3108 break;
3109
3110 case 60:
Reid Spencer6f407902007-01-13 05:00:46 +00003111#line 1073 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003112 {
Reid Spencer6f407902007-01-13 05:00:46 +00003113 (yyval.StrVal) = (yyvsp[-1].StrVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003114 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003115 ;}
3116 break;
3117
3118 case 61:
Reid Spencer6f407902007-01-13 05:00:46 +00003119#line 1077 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003120 {
3121 (yyval.StrVal) = 0;
Reid Spencere4d87aa2006-12-23 06:05:41 +00003122 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003123 ;}
3124 break;
3125
3126 case 62:
Reid Spencer6f407902007-01-13 05:00:46 +00003127#line 1083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003128 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3129 break;
3130
3131 case 63:
Reid Spencer6f407902007-01-13 05:00:46 +00003132#line 1084 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003133 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3134 break;
3135
3136 case 64:
Reid Spencer6f407902007-01-13 05:00:46 +00003137#line 1085 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003138 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3139 break;
3140
3141 case 65:
Reid Spencer6f407902007-01-13 05:00:46 +00003142#line 1086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003143 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3144 break;
3145
3146 case 66:
Reid Spencer6f407902007-01-13 05:00:46 +00003147#line 1087 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003148 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3149 break;
3150
3151 case 67:
Reid Spencer6f407902007-01-13 05:00:46 +00003152#line 1091 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003153 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3154 break;
3155
3156 case 68:
Reid Spencer6f407902007-01-13 05:00:46 +00003157#line 1092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003158 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3159 break;
3160
3161 case 69:
Reid Spencer6f407902007-01-13 05:00:46 +00003162#line 1093 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003163 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3164 break;
3165
3166 case 70:
Reid Spencer6f407902007-01-13 05:00:46 +00003167#line 1097 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003168 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3169 break;
3170
3171 case 71:
Reid Spencer6f407902007-01-13 05:00:46 +00003172#line 1098 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003173 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3174 break;
3175
3176 case 72:
Reid Spencer6f407902007-01-13 05:00:46 +00003177#line 1102 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003178 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3179 break;
3180
3181 case 73:
Reid Spencer6f407902007-01-13 05:00:46 +00003182#line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003183 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3184 break;
3185
3186 case 74:
Reid Spencer6f407902007-01-13 05:00:46 +00003187#line 1104 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003188 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3189 break;
3190
3191 case 75:
Reid Spencer6f407902007-01-13 05:00:46 +00003192#line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003193 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3194 break;
3195
3196 case 76:
Reid Spencer6f407902007-01-13 05:00:46 +00003197#line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003198 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3199 break;
3200
3201 case 77:
Reid Spencer6f407902007-01-13 05:00:46 +00003202#line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003203 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3204 break;
3205
3206 case 78:
Reid Spencer6f407902007-01-13 05:00:46 +00003207#line 1111 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003208 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3209 break;
3210
3211 case 79:
Reid Spencer6f407902007-01-13 05:00:46 +00003212#line 1112 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003213 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3214 break;
3215
3216 case 80:
Reid Spencer6f407902007-01-13 05:00:46 +00003217#line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003218 { (yyval.UIntVal) = CallingConv::C; ;}
3219 break;
3220
3221 case 81:
Reid Spencer6f407902007-01-13 05:00:46 +00003222#line 1116 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003223 { (yyval.UIntVal) = CallingConv::C; ;}
3224 break;
3225
3226 case 82:
Reid Spencer6f407902007-01-13 05:00:46 +00003227#line 1117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003228 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3229 break;
3230
3231 case 83:
Reid Spencer6f407902007-01-13 05:00:46 +00003232#line 1118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003233 { (yyval.UIntVal) = CallingConv::Fast; ;}
3234 break;
3235
3236 case 84:
Reid Spencer6f407902007-01-13 05:00:46 +00003237#line 1119 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003238 { (yyval.UIntVal) = CallingConv::Cold; ;}
3239 break;
3240
3241 case 85:
Reid Spencer6f407902007-01-13 05:00:46 +00003242#line 1120 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003243 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3244 break;
3245
3246 case 86:
Reid Spencer6f407902007-01-13 05:00:46 +00003247#line 1121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003248 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3249 break;
3250
3251 case 87:
Reid Spencer6f407902007-01-13 05:00:46 +00003252#line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003253 {
Reid Spencer6f407902007-01-13 05:00:46 +00003254 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
Reid Spencer61c83e02006-08-18 08:43:06 +00003255 GEN_ERROR("Calling conv too large!");
Reid Spencer6f407902007-01-13 05:00:46 +00003256 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00003257 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003258 ;}
3259 break;
3260
3261 case 88:
Reid Spencer6f407902007-01-13 05:00:46 +00003262#line 1129 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003263 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3264 break;
3265
3266 case 89:
Reid Spencer6f407902007-01-13 05:00:46 +00003267#line 1130 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003268 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3269 break;
3270
3271 case 90:
Reid Spencer6f407902007-01-13 05:00:46 +00003272#line 1133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003273 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3274 break;
3275
3276 case 91:
Reid Spencer6f407902007-01-13 05:00:46 +00003277#line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003278 {
Reid Spencer6f407902007-01-13 05:00:46 +00003279 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003280 ;}
3281 break;
3282
3283 case 92:
Reid Spencer6f407902007-01-13 05:00:46 +00003284#line 1139 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003285 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3286 break;
3287
3288 case 94:
Reid Spencer6f407902007-01-13 05:00:46 +00003289#line 1143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003290 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3291 break;
3292
3293 case 95:
Reid Spencer6f407902007-01-13 05:00:46 +00003294#line 1144 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003295 {
Reid Spencer6f407902007-01-13 05:00:46 +00003296 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003297 ;}
3298 break;
3299
3300 case 96:
Reid Spencer6f407902007-01-13 05:00:46 +00003301#line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003302 { (yyval.UIntVal) = 0; ;}
3303 break;
3304
3305 case 97:
Reid Spencer6f407902007-01-13 05:00:46 +00003306#line 1152 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003307 {
Reid Spencer6f407902007-01-13 05:00:46 +00003308 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003309 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Reid Spencera54b7cb2007-01-12 07:05:14 +00003310 GEN_ERROR("Alignment must be a power of two!");
3311 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003312;}
3313 break;
3314
3315 case 98:
Reid Spencer6f407902007-01-13 05:00:46 +00003316#line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003317 { (yyval.UIntVal) = 0; ;}
3318 break;
3319
3320 case 99:
Reid Spencer6f407902007-01-13 05:00:46 +00003321#line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003322 {
Reid Spencer6f407902007-01-13 05:00:46 +00003323 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003324 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Reid Spencera54b7cb2007-01-12 07:05:14 +00003325 GEN_ERROR("Alignment must be a power of two!");
3326 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003327;}
3328 break;
3329
3330 case 100:
Reid Spencer6f407902007-01-13 05:00:46 +00003331#line 1167 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003332 {
Reid Spencer6f407902007-01-13 05:00:46 +00003333 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3334 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
Reid Spencere4d87aa2006-12-23 06:05:41 +00003335 GEN_ERROR("Invalid character in section name!");
Reid Spencer6f407902007-01-13 05:00:46 +00003336 (yyval.StrVal) = (yyvsp[0].StrVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003337 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003338;}
3339 break;
3340
3341 case 101:
Reid Spencer6f407902007-01-13 05:00:46 +00003342#line 1175 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003343 { (yyval.StrVal) = 0; ;}
3344 break;
3345
3346 case 102:
Reid Spencer6f407902007-01-13 05:00:46 +00003347#line 1176 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3348 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003349 break;
3350
3351 case 103:
Reid Spencer6f407902007-01-13 05:00:46 +00003352#line 1181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003353 {;}
3354 break;
3355
3356 case 104:
Reid Spencer6f407902007-01-13 05:00:46 +00003357#line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003358 {;}
3359 break;
3360
3361 case 105:
Reid Spencer6f407902007-01-13 05:00:46 +00003362#line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003363 {
Reid Spencer6f407902007-01-13 05:00:46 +00003364 CurGV->setSection((yyvsp[0].StrVal));
3365 free((yyvsp[0].StrVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003366 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003367 ;}
3368 break;
3369
3370 case 106:
Reid Spencer6f407902007-01-13 05:00:46 +00003371#line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003372 {
Reid Spencer6f407902007-01-13 05:00:46 +00003373 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
Reid Spencere4d87aa2006-12-23 06:05:41 +00003374 GEN_ERROR("Alignment must be a power of two!");
Reid Spencer6f407902007-01-13 05:00:46 +00003375 CurGV->setAlignment((yyvsp[0].UInt64Val));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003376 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003377 ;}
3378 break;
3379
Reid Spencer6f407902007-01-13 05:00:46 +00003380 case 111:
3381#line 1204 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003382 {
3383 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencera132e042006-12-03 05:46:11 +00003384 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003385 ;}
3386 break;
3387
Reid Spencer6f407902007-01-13 05:00:46 +00003388 case 112:
3389#line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003390 {
Reid Spencer6f407902007-01-13 05:00:46 +00003391 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3392 CHECK_FOR_ERROR
3393 ;}
3394 break;
3395
3396 case 113:
3397#line 1212 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3398 { // Pointer type?
3399 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3400 GEN_ERROR("Cannot form a pointer to a basic block");
3401 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3402 delete (yyvsp[-1].TypeVal);
Reid Spencera132e042006-12-03 05:46:11 +00003403 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003404 ;}
3405 break;
3406
3407 case 114:
Reid Spencer6f407902007-01-13 05:00:46 +00003408#line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003409 { // Named types are also simple types...
Reid Spencer6f407902007-01-13 05:00:46 +00003410 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
Reid Spencer14310612006-12-31 05:40:51 +00003411 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003412 (yyval.TypeVal) = new PATypeHolder(tmp);
3413 ;}
3414 break;
3415
Reid Spencer6f407902007-01-13 05:00:46 +00003416 case 115:
3417#line 1224 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003418 { // Type UpReference
Reid Spencer6f407902007-01-13 05:00:46 +00003419 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
Reid Spencer3da59db2006-11-27 01:05:10 +00003420 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Reid Spencer6f407902007-01-13 05:00:46 +00003421 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003422 (yyval.TypeVal) = new PATypeHolder(OT);
Reid Spencer3da59db2006-11-27 01:05:10 +00003423 UR_OUT("New Upreference!\n");
Reid Spencer61c83e02006-08-18 08:43:06 +00003424 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003425 ;}
3426 break;
3427
Reid Spencer6f407902007-01-13 05:00:46 +00003428 case 116:
3429#line 1232 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003430 {
Reid Spencer3da59db2006-11-27 01:05:10 +00003431 std::vector<const Type*> Params;
Reid Spencer14310612006-12-31 05:40:51 +00003432 std::vector<FunctionType::ParameterAttributes> Attrs;
Reid Spencer6f407902007-01-13 05:00:46 +00003433 Attrs.push_back((yyvsp[0].ParamAttrs));
3434 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00003435 Params.push_back(I->Ty->get());
3436 if (I->Ty->get() != Type::VoidTy)
3437 Attrs.push_back(I->Attrs);
3438 }
Reid Spencer3da59db2006-11-27 01:05:10 +00003439 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3440 if (isVarArg) Params.pop_back();
3441
Reid Spencer6f407902007-01-13 05:00:46 +00003442 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3443 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3444 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3445 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3446 CHECK_FOR_ERROR
3447 ;}
3448 break;
3449
3450 case 117:
3451#line 1250 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3452 {
3453 std::vector<const Type*> Params;
3454 std::vector<FunctionType::ParameterAttributes> Attrs;
3455 Attrs.push_back((yyvsp[0].ParamAttrs));
3456 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3457 Params.push_back(I->Ty->get());
3458 if (I->Ty->get() != Type::VoidTy)
3459 Attrs.push_back(I->Attrs);
3460 }
3461 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3462 if (isVarArg) Params.pop_back();
3463
3464 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3465 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003466 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003467 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003468 ;}
3469 break;
3470
3471 case 118:
Reid Spencer6f407902007-01-13 05:00:46 +00003472#line 1268 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3473 { // Sized array type?
3474 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3475 delete (yyvsp[-1].TypeVal);
Reid Spencer14310612006-12-31 05:40:51 +00003476 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003477 ;}
3478 break;
3479
3480 case 119:
Reid Spencer6f407902007-01-13 05:00:46 +00003481#line 1273 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003482 { // Packed array type?
Reid Spencer6f407902007-01-13 05:00:46 +00003483 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3484 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
Reid Spencere4d87aa2006-12-23 06:05:41 +00003485 GEN_ERROR("Unsigned result not equal to signed result");
Reid Spencera54b7cb2007-01-12 07:05:14 +00003486 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3487 GEN_ERROR("Element type of a PackedType must be primitive");
Reid Spencer6f407902007-01-13 05:00:46 +00003488 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
Reid Spencere4d87aa2006-12-23 06:05:41 +00003489 GEN_ERROR("Vector length should be a power of 2!");
Reid Spencer6f407902007-01-13 05:00:46 +00003490 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3491 delete (yyvsp[-1].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003492 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003493 ;}
3494 break;
3495
Reid Spencer6f407902007-01-13 05:00:46 +00003496 case 120:
3497#line 1285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003498 { // Structure type?
Reid Spencere4d87aa2006-12-23 06:05:41 +00003499 std::vector<const Type*> Elements;
Reid Spencer6f407902007-01-13 05:00:46 +00003500 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3501 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
Reid Spencere4d87aa2006-12-23 06:05:41 +00003502 Elements.push_back(*I);
3503
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003504 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
Reid Spencer6f407902007-01-13 05:00:46 +00003505 delete (yyvsp[-1].TypeList);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003506 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003507 ;}
3508 break;
3509
Reid Spencer6f407902007-01-13 05:00:46 +00003510 case 121:
3511#line 1295 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003512 { // Empty structure type?
3513 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003514 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003515 ;}
3516 break;
3517
Reid Spencer6f407902007-01-13 05:00:46 +00003518 case 122:
3519#line 1299 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003520 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003521 std::vector<const Type*> Elements;
Reid Spencer6f407902007-01-13 05:00:46 +00003522 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3523 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
Reid Spencere4d87aa2006-12-23 06:05:41 +00003524 Elements.push_back(*I);
3525
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003526 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
Reid Spencer6f407902007-01-13 05:00:46 +00003527 delete (yyvsp[-2].TypeList);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003528 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003529 ;}
3530 break;
3531
Reid Spencer6f407902007-01-13 05:00:46 +00003532 case 123:
3533#line 1309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003534 { // Empty structure type?
3535 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003536 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003537 ;}
3538 break;
3539
Reid Spencer6f407902007-01-13 05:00:46 +00003540 case 124:
3541#line 1316 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003542 {
Reid Spencer6f407902007-01-13 05:00:46 +00003543 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3544 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3545 ;}
3546 break;
3547
3548 case 125:
3549#line 1323 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3550 {
3551 if (!UpRefs.empty())
3552 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3553 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3554 GEN_ERROR("LLVM functions cannot return aggregate types!");
3555 (yyval.TypeVal) = (yyvsp[0].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003556 ;}
3557 break;
3558
3559 case 126:
Reid Spencer6f407902007-01-13 05:00:46 +00003560#line 1330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003561 {
3562 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3563 ;}
3564 break;
3565
Reid Spencer6f407902007-01-13 05:00:46 +00003566 case 127:
3567#line 1335 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003568 {
3569 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer6f407902007-01-13 05:00:46 +00003570 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
Reid Spencer14310612006-12-31 05:40:51 +00003571 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003572 ;}
3573 break;
3574
Reid Spencer6f407902007-01-13 05:00:46 +00003575 case 128:
3576#line 1340 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003577 {
Reid Spencer6f407902007-01-13 05:00:46 +00003578 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
Reid Spencer14310612006-12-31 05:40:51 +00003579 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003580 ;}
3581 break;
3582
Reid Spencer6f407902007-01-13 05:00:46 +00003583 case 130:
3584#line 1348 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003585 {
Reid Spencer6f407902007-01-13 05:00:46 +00003586 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
Reid Spencer14310612006-12-31 05:40:51 +00003587 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3588 TWA.Ty = new PATypeHolder(Type::VoidTy);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003589 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003590 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003591 ;}
3592 break;
3593
Reid Spencer6f407902007-01-13 05:00:46 +00003594 case 131:
3595#line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003596 {
3597 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Reid Spencer14310612006-12-31 05:40:51 +00003598 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3599 TWA.Ty = new PATypeHolder(Type::VoidTy);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003600 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer14310612006-12-31 05:40:51 +00003601 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003602 ;}
3603 break;
3604
Reid Spencer6f407902007-01-13 05:00:46 +00003605 case 132:
3606#line 1362 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003607 {
3608 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer14310612006-12-31 05:40:51 +00003609 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003610 ;}
3611 break;
3612
Reid Spencer6f407902007-01-13 05:00:46 +00003613 case 133:
3614#line 1370 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003615 {
3616 (yyval.TypeList) = new std::list<PATypeHolder>();
Reid Spencer6f407902007-01-13 05:00:46 +00003617 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3618 CHECK_FOR_ERROR
3619 ;}
3620 break;
3621
3622 case 134:
3623#line 1375 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3624 {
3625 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00003626 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003627 ;}
3628 break;
3629
3630 case 135:
Reid Spencer6f407902007-01-13 05:00:46 +00003631#line 1386 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3632 { // Nonempty unsized arr
3633 if (!UpRefs.empty())
3634 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3635 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3636 if (ATy == 0)
3637 GEN_ERROR("Cannot make array constant with type: '" +
3638 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3639 const Type *ETy = ATy->getElementType();
3640 int NumElements = ATy->getNumElements();
3641
3642 // Verify that we have the correct size...
3643 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3644 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3645 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3646 itostr(NumElements) + "!");
3647
3648 // Verify all elements are correct type!
3649 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3650 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3651 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3652 ETy->getDescription() +"' as required!\nIt is of type '"+
3653 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3654 }
3655
3656 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3657 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer3da59db2006-11-27 01:05:10 +00003658 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003659 ;}
3660 break;
3661
3662 case 136:
Reid Spencer6f407902007-01-13 05:00:46 +00003663#line 1414 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003664 {
Reid Spencer14310612006-12-31 05:40:51 +00003665 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00003666 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3667 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003668 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003669 GEN_ERROR("Cannot make array constant with type: '" +
Reid Spencer6f407902007-01-13 05:00:46 +00003670 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003671
Andrew Lenharth6353e052006-12-08 18:07:09 +00003672 int NumElements = ATy->getNumElements();
3673 if (NumElements != -1 && NumElements != 0)
3674 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3675 " arguments, but has size of " + itostr(NumElements) +"!");
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003676 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
Reid Spencer6f407902007-01-13 05:00:46 +00003677 delete (yyvsp[-2].TypeVal);
3678 CHECK_FOR_ERROR
3679 ;}
3680 break;
3681
3682 case 137:
3683#line 1430 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3684 {
3685 if (!UpRefs.empty())
3686 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3687 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3688 if (ATy == 0)
3689 GEN_ERROR("Cannot make array constant with type: '" +
3690 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3691
3692 int NumElements = ATy->getNumElements();
3693 const Type *ETy = ATy->getElementType();
3694 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3695 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3696 GEN_ERROR("Can't build string constant of size " +
3697 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3698 " when array has size " + itostr(NumElements) + "!");
3699 std::vector<Constant*> Vals;
3700 if (ETy == Type::Int8Ty) {
3701 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3702 C != (unsigned char*)EndStr; ++C)
3703 Vals.push_back(ConstantInt::get(ETy, *C));
3704 } else {
3705 free((yyvsp[0].StrVal));
3706 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3707 }
3708 free((yyvsp[0].StrVal));
3709 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3710 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003711 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003712 ;}
3713 break;
3714
3715 case 138:
Reid Spencer6f407902007-01-13 05:00:46 +00003716#line 1459 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3717 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00003718 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00003719 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3720 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3721 if (PTy == 0)
3722 GEN_ERROR("Cannot make packed constant with type: '" +
3723 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3724 const Type *ETy = PTy->getElementType();
3725 int NumElements = PTy->getNumElements();
Reid Spencer61c83e02006-08-18 08:43:06 +00003726
Reid Spencer6f407902007-01-13 05:00:46 +00003727 // Verify that we have the correct size...
3728 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3729 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3730 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3731 itostr(NumElements) + "!");
3732
3733 // Verify all elements are correct type!
3734 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3735 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3736 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3737 ETy->getDescription() +"' as required!\nIt is of type '"+
3738 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003739 }
Reid Spencer6f407902007-01-13 05:00:46 +00003740
3741 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3742 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer61c83e02006-08-18 08:43:06 +00003743 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003744 ;}
3745 break;
3746
3747 case 139:
Reid Spencer6f407902007-01-13 05:00:46 +00003748#line 1487 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3749 {
3750 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3751 if (STy == 0)
3752 GEN_ERROR("Cannot make struct constant with type: '" +
3753 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003754
Reid Spencer6f407902007-01-13 05:00:46 +00003755 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3756 GEN_ERROR("Illegal number of initializers for structure type!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003757
Reid Spencer6f407902007-01-13 05:00:46 +00003758 // Check to ensure that constants are compatible with the type initializer!
3759 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3760 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3761 GEN_ERROR("Expected type '" +
3762 STy->getElementType(i)->getDescription() +
3763 "' for element #" + utostr(i) +
3764 " of structure initializer!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003765
Reid Spencer6f407902007-01-13 05:00:46 +00003766 // Check to ensure that Type is not packed
3767 if (STy->isPacked())
3768 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3769
3770 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3771 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer61c83e02006-08-18 08:43:06 +00003772 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003773 ;}
3774 break;
3775
3776 case 140:
Reid Spencer6f407902007-01-13 05:00:46 +00003777#line 1512 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003778 {
Reid Spencer6f407902007-01-13 05:00:46 +00003779 if (!UpRefs.empty())
3780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3781 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003782 if (STy == 0)
3783 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer6f407902007-01-13 05:00:46 +00003784 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003785
Reid Spencer6f407902007-01-13 05:00:46 +00003786 if (STy->getNumContainedTypes() != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00003787 GEN_ERROR("Illegal number of initializers for structure type!");
3788
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003789 // Check to ensure that Type is not packed
3790 if (STy->isPacked())
3791 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3792
Reid Spencer6f407902007-01-13 05:00:46 +00003793 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3794 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003795 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003796 ;}
3797 break;
3798
3799 case 141:
Reid Spencer6f407902007-01-13 05:00:46 +00003800#line 1531 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003801 {
Reid Spencer6f407902007-01-13 05:00:46 +00003802 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003803 if (STy == 0)
3804 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer6f407902007-01-13 05:00:46 +00003805 (*(yyvsp[-5].TypeVal))->getDescription() + "'!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003806
Reid Spencer6f407902007-01-13 05:00:46 +00003807 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003808 GEN_ERROR("Illegal number of initializers for structure type!");
3809
3810 // Check to ensure that constants are compatible with the type initializer!
Reid Spencer6f407902007-01-13 05:00:46 +00003811 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3812 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003813 GEN_ERROR("Expected type '" +
3814 STy->getElementType(i)->getDescription() +
3815 "' for element #" + utostr(i) +
3816 " of structure initializer!");
3817
3818 // Check to ensure that Type is packed
3819 if (!STy->isPacked())
3820 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3821
Reid Spencer6f407902007-01-13 05:00:46 +00003822 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3823 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003824 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003825 ;}
3826 break;
3827
Reid Spencer6f407902007-01-13 05:00:46 +00003828 case 142:
3829#line 1556 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003830 {
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003831 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00003832 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3833 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003834 if (STy == 0)
3835 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer6f407902007-01-13 05:00:46 +00003836 (*(yyvsp[-4].TypeVal))->getDescription() + "'!");
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003837
3838 if (STy->getNumContainedTypes() != 0)
3839 GEN_ERROR("Illegal number of initializers for structure type!");
3840
3841 // Check to ensure that Type is packed
3842 if (!STy->isPacked())
3843 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3844
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003845 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
Reid Spencer6f407902007-01-13 05:00:46 +00003846 delete (yyvsp[-4].TypeVal);
3847 CHECK_FOR_ERROR
3848 ;}
3849 break;
3850
3851 case 143:
3852#line 1575 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3853 {
3854 if (!UpRefs.empty())
3855 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3856 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3857 if (PTy == 0)
3858 GEN_ERROR("Cannot make null pointer constant with type: '" +
3859 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3860
3861 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3862 delete (yyvsp[-1].TypeVal);
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003863 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003864 ;}
3865 break;
3866
3867 case 144:
Reid Spencer6f407902007-01-13 05:00:46 +00003868#line 1587 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003869 {
Reid Spencer14310612006-12-31 05:40:51 +00003870 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00003871 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3872 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3873 delete (yyvsp[-1].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00003874 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003875 ;}
3876 break;
3877
3878 case 145:
Reid Spencer6f407902007-01-13 05:00:46 +00003879#line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003880 {
Reid Spencer14310612006-12-31 05:40:51 +00003881 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00003882 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3883 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003884 if (Ty == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003885 GEN_ERROR("Global const reference must be a pointer type!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003886
3887 // ConstExprs can exist in the body of a function, thus creating
3888 // GlobalValues whenever they refer to a variable. Because we are in
3889 // the context of a function, getValNonImprovising will search the functions
3890 // symbol table instead of the module symbol table for the global symbol,
3891 // which throws things all off. To get around this, we just tell
3892 // getValNonImprovising that we are at global scope here.
3893 //
3894 Function *SavedCurFn = CurFun.CurrentFunction;
3895 CurFun.CurrentFunction = 0;
3896
Reid Spencer6f407902007-01-13 05:00:46 +00003897 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00003898 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00003899
3900 CurFun.CurrentFunction = SavedCurFn;
3901
3902 // If this is an initializer for a constant pointer, which is referencing a
3903 // (currently) undefined variable, create a stub now that shall be replaced
3904 // in the future with the right type of variable.
3905 //
3906 if (V == 0) {
3907 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3908 const PointerType *PT = cast<PointerType>(Ty);
3909
3910 // First check to see if the forward references value is already created!
3911 PerModuleInfo::GlobalRefsType::iterator I =
Reid Spencer6f407902007-01-13 05:00:46 +00003912 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003913
3914 if (I != CurModule.GlobalRefs.end()) {
3915 V = I->second; // Placeholder already exists, use it...
Reid Spencer6f407902007-01-13 05:00:46 +00003916 (yyvsp[0].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00003917 } else {
3918 std::string Name;
Reid Spencer6f407902007-01-13 05:00:46 +00003919 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003920
3921 // Create the forward referenced global.
3922 GlobalValue *GV;
3923 if (const FunctionType *FTy =
3924 dyn_cast<FunctionType>(PT->getElementType())) {
3925 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3926 CurModule.CurrentModule);
3927 } else {
3928 GV = new GlobalVariable(PT->getElementType(), false,
3929 GlobalValue::ExternalLinkage, 0,
3930 Name, CurModule.CurrentModule);
3931 }
3932
3933 // Keep track of the fact that we have a forward ref to recycle it
Reid Spencer6f407902007-01-13 05:00:46 +00003934 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003935 V = GV;
3936 }
3937 }
3938
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003939 (yyval.ConstVal) = cast<GlobalValue>(V);
Reid Spencer6f407902007-01-13 05:00:46 +00003940 delete (yyvsp[-1].TypeVal); // Free the type handle
3941 CHECK_FOR_ERROR
3942 ;}
3943 break;
3944
3945 case 146:
3946#line 1657 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3947 {
3948 if (!UpRefs.empty())
3949 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3950 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3951 GEN_ERROR("Mismatched types for constant expression: " +
3952 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
3953 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3954 delete (yyvsp[-1].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003955 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003956 ;}
3957 break;
3958
3959 case 147:
Reid Spencer6f407902007-01-13 05:00:46 +00003960#line 1667 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003961 {
Reid Spencer14310612006-12-31 05:40:51 +00003962 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00003963 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3964 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3965 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3966 GEN_ERROR("Cannot create a null initialized value of this type!");
3967 (yyval.ConstVal) = Constant::getNullValue(Ty);
3968 delete (yyvsp[-1].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003969 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003970 ;}
3971 break;
3972
3973 case 148:
Reid Spencer6f407902007-01-13 05:00:46 +00003974#line 1677 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3975 { // integral constants
3976 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3977 GEN_ERROR("Constant value doesn't fit in type!");
3978 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003979 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003980 ;}
3981 break;
3982
3983 case 149:
Reid Spencer6f407902007-01-13 05:00:46 +00003984#line 1683 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003985 { // integral constants
Reid Spencer6f407902007-01-13 05:00:46 +00003986 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
Reid Spencer14310612006-12-31 05:40:51 +00003987 GEN_ERROR("Constant value doesn't fit in type!");
Reid Spencer6f407902007-01-13 05:00:46 +00003988 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
Reid Spencer14310612006-12-31 05:40:51 +00003989 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003990 ;}
3991 break;
3992
3993 case 150:
Reid Spencer6f407902007-01-13 05:00:46 +00003994#line 1689 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003995 { // Boolean constants
Reid Spencer6f407902007-01-13 05:00:46 +00003996 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003997 (yyval.ConstVal) = ConstantInt::getTrue();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00003998 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003999 ;}
4000 break;
4001
Reid Spencer6f407902007-01-13 05:00:46 +00004002 case 151:
4003#line 1694 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004004 { // Boolean constants
Reid Spencer6f407902007-01-13 05:00:46 +00004005 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004006 (yyval.ConstVal) = ConstantInt::getFalse();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004007 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004008 ;}
4009 break;
4010
Reid Spencer6f407902007-01-13 05:00:46 +00004011 case 152:
4012#line 1699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004013 { // Float & Double constants
Reid Spencer6f407902007-01-13 05:00:46 +00004014 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
Reid Spencere4d87aa2006-12-23 06:05:41 +00004015 GEN_ERROR("Floating point constant invalid for type!!");
Reid Spencer6f407902007-01-13 05:00:46 +00004016 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00004017 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004018 ;}
4019 break;
4020
Reid Spencer6f407902007-01-13 05:00:46 +00004021 case 153:
4022#line 1707 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004023 {
Reid Spencer14310612006-12-31 05:40:51 +00004024 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00004025 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4026 Constant *Val = (yyvsp[-3].ConstVal);
4027 const Type *Ty = (yyvsp[-1].TypeVal)->get();
Reid Spencer3da59db2006-11-27 01:05:10 +00004028 if (!Val->getType()->isFirstClassType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004029 GEN_ERROR("cast constant expression from a non-primitive type: '" +
Reid Spencer3da59db2006-11-27 01:05:10 +00004030 Val->getType()->getDescription() + "'!");
4031 if (!Ty->isFirstClassType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004032 GEN_ERROR("cast constant expression to a non-primitive type: '" +
Reid Spencer3da59db2006-11-27 01:05:10 +00004033 Ty->getDescription() + "'!");
Reid Spencer6f407902007-01-13 05:00:46 +00004034 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
4035 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004036 ;}
4037 break;
4038
Reid Spencer6f407902007-01-13 05:00:46 +00004039 case 154:
4040#line 1721 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004041 {
Reid Spencer6f407902007-01-13 05:00:46 +00004042 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
Andrew Lenharth6353e052006-12-08 18:07:09 +00004043 GEN_ERROR("GetElementPtr requires a pointer operand!");
4044
4045 const Type *IdxTy =
Reid Spencer6f407902007-01-13 05:00:46 +00004046 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004047 if (!IdxTy)
4048 GEN_ERROR("Index list invalid for constant getelementptr!");
4049
4050 std::vector<Constant*> IdxVec;
Reid Spencer6f407902007-01-13 05:00:46 +00004051 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4052 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
Andrew Lenharth6353e052006-12-08 18:07:09 +00004053 IdxVec.push_back(C);
4054 else
4055 GEN_ERROR("Indices to constant getelementptr must be constants!");
4056
Reid Spencer6f407902007-01-13 05:00:46 +00004057 delete (yyvsp[-1].ValueList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004058
Reid Spencer6f407902007-01-13 05:00:46 +00004059 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
4060 CHECK_FOR_ERROR
4061 ;}
4062 break;
4063
4064 case 155:
4065#line 1742 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4066 {
4067 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4068 GEN_ERROR("Select condition must be of boolean type!");
4069 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4070 GEN_ERROR("Select operand types must match!");
4071 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004072 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004073 ;}
4074 break;
4075
4076 case 156:
Reid Spencer6f407902007-01-13 05:00:46 +00004077#line 1750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004078 {
Reid Spencer6f407902007-01-13 05:00:46 +00004079 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4080 GEN_ERROR("Binary operator types must match!");
4081 CHECK_FOR_ERROR;
4082 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004083 ;}
4084 break;
4085
4086 case 157:
Reid Spencer6f407902007-01-13 05:00:46 +00004087#line 1756 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004088 {
Reid Spencer6f407902007-01-13 05:00:46 +00004089 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Reid Spencere4d87aa2006-12-23 06:05:41 +00004090 GEN_ERROR("Logical operator types must match!");
Reid Spencer6f407902007-01-13 05:00:46 +00004091 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4092 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4093 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
Reid Spencere4d87aa2006-12-23 06:05:41 +00004094 GEN_ERROR("Logical operator requires integral operands!");
4095 }
Reid Spencer6f407902007-01-13 05:00:46 +00004096 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004097 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004098 ;}
4099 break;
4100
Reid Spencer6f407902007-01-13 05:00:46 +00004101 case 158:
4102#line 1767 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004103 {
Reid Spencer6f407902007-01-13 05:00:46 +00004104 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Reid Spencere4d87aa2006-12-23 06:05:41 +00004105 GEN_ERROR("icmp operand types must match!");
Reid Spencer6f407902007-01-13 05:00:46 +00004106 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4107 ;}
4108 break;
4109
4110 case 159:
4111#line 1772 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4112 {
4113 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4114 GEN_ERROR("fcmp operand types must match!");
4115 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004116 ;}
4117 break;
4118
4119 case 160:
Reid Spencer6f407902007-01-13 05:00:46 +00004120#line 1777 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004121 {
Reid Spencer6f407902007-01-13 05:00:46 +00004122 if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty)
4123 GEN_ERROR("Shift count for shift constant must be i8 type!");
4124 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4125 GEN_ERROR("Shift constant expression requires integer operand!");
4126 CHECK_FOR_ERROR;
4127 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4128 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004129 ;}
4130 break;
4131
4132 case 161:
Reid Spencer6f407902007-01-13 05:00:46 +00004133#line 1786 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004134 {
Reid Spencer6f407902007-01-13 05:00:46 +00004135 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4136 GEN_ERROR("Invalid extractelement operands!");
4137 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004138 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004139 ;}
4140 break;
4141
4142 case 162:
Reid Spencer6f407902007-01-13 05:00:46 +00004143#line 1792 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004144 {
Reid Spencer6f407902007-01-13 05:00:46 +00004145 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4146 GEN_ERROR("Invalid insertelement operands!");
4147 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00004148 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004149 ;}
4150 break;
4151
4152 case 163:
Reid Spencer6f407902007-01-13 05:00:46 +00004153#line 1798 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004154 {
Reid Spencer6f407902007-01-13 05:00:46 +00004155 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4156 GEN_ERROR("Invalid shufflevector operands!");
4157 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004158 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004159 ;}
4160 break;
4161
4162 case 164:
Reid Spencer6f407902007-01-13 05:00:46 +00004163#line 1807 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004164 {
Reid Spencer6f407902007-01-13 05:00:46 +00004165 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004166 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004167 ;}
4168 break;
4169
4170 case 165:
Reid Spencer6f407902007-01-13 05:00:46 +00004171#line 1811 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004172 {
Reid Spencer6f407902007-01-13 05:00:46 +00004173 (yyval.ConstVector) = new std::vector<Constant*>();
4174 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004175 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004176 ;}
4177 break;
4178
4179 case 166:
Reid Spencer6f407902007-01-13 05:00:46 +00004180#line 1819 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004181 { (yyval.BoolVal) = false; ;}
4182 break;
4183
Reid Spencer6f407902007-01-13 05:00:46 +00004184 case 167:
4185#line 1819 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004186 { (yyval.BoolVal) = true; ;}
4187 break;
4188
Reid Spencer6f407902007-01-13 05:00:46 +00004189 case 168:
4190#line 1830 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4191 {
4192 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4193 CurModule.ModuleDone();
4194 CHECK_FOR_ERROR;
4195 ;}
4196 break;
4197
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004198 case 169:
Reid Spencer6f407902007-01-13 05:00:46 +00004199#line 1835 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004200 {
4201 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Reid Spencer14310612006-12-31 05:40:51 +00004202 CurModule.ModuleDone();
4203 CHECK_FOR_ERROR;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004204 ;}
4205 break;
4206
Reid Spencer6f407902007-01-13 05:00:46 +00004207 case 172:
4208#line 1848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004209 { CurFun.isDeclare = false ;}
4210 break;
4211
Reid Spencer6f407902007-01-13 05:00:46 +00004212 case 173:
4213#line 1848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004214 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00004215 CurFun.FunctionDone();
Reid Spencer61c83e02006-08-18 08:43:06 +00004216 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004217 ;}
4218 break;
4219
Reid Spencer6f407902007-01-13 05:00:46 +00004220 case 174:
4221#line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004222 { CurFun.isDeclare = true; ;}
4223 break;
4224
Reid Spencer6f407902007-01-13 05:00:46 +00004225 case 175:
4226#line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4227 {
4228 CHECK_FOR_ERROR
4229 ;}
4230 break;
4231
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004232 case 176:
Reid Spencer6f407902007-01-13 05:00:46 +00004233#line 1855 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004234 {
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004235 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004236 ;}
4237 break;
4238
4239 case 177:
Reid Spencer6f407902007-01-13 05:00:46 +00004240#line 1858 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004241 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00004242 // Emit an error if there are any unresolved types left.
4243 if (!CurModule.LateResolveTypes.empty()) {
4244 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
Reid Spencer61c83e02006-08-18 08:43:06 +00004245 if (DID.Type == ValID::NameVal) {
4246 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4247 } else {
4248 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4249 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004250 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004251 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004252 ;}
4253 break;
4254
Reid Spencer6f407902007-01-13 05:00:46 +00004255 case 178:
4256#line 1870 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004257 {
Reid Spencer14310612006-12-31 05:40:51 +00004258 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00004259 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004260 // Eagerly resolve types. This is not an optimization, this is a
4261 // requirement that is due to the fact that we could have this:
4262 //
4263 // %list = type { %list * }
4264 // %list = type { %list * } ; repeated type decl
4265 //
4266 // If types are not resolved eagerly, then the two types will not be
4267 // determined to be the same type!
4268 //
Reid Spencer6f407902007-01-13 05:00:46 +00004269 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004270
Reid Spencer6f407902007-01-13 05:00:46 +00004271 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00004272 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004273 // If this is a named type that is not a redefinition, add it to the slot
4274 // table.
Reid Spencer6f407902007-01-13 05:00:46 +00004275 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004276 }
Reid Spencera132e042006-12-03 05:46:11 +00004277
Reid Spencer6f407902007-01-13 05:00:46 +00004278 delete (yyvsp[0].TypeVal);
4279 CHECK_FOR_ERROR
4280 ;}
4281 break;
4282
4283 case 179:
4284#line 1894 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4285 {
4286 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4287
4288 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4289 CHECK_FOR_ERROR
4290 // If this is a named type that is not a redefinition, add it to the slot
4291 // table.
4292 CurModule.Types.push_back((yyvsp[0].PrimType));
4293 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004294 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004295 ;}
4296 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00004297
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004298 case 180:
Reid Spencer6f407902007-01-13 05:00:46 +00004299#line 1905 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4300 { /* "Externally Visible" Linkage */
4301 if ((yyvsp[0].ConstVal) == 0)
4302 GEN_ERROR("Global value initializer is not a constant!");
4303 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4304 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
Reid Spencer14310612006-12-31 05:40:51 +00004305 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004306 ;}
4307 break;
4308
4309 case 181:
Reid Spencer6f407902007-01-13 05:00:46 +00004310#line 1911 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4311 {
4312 CurGV = 0;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004313 ;}
4314 break;
4315
4316 case 182:
Reid Spencer6f407902007-01-13 05:00:46 +00004317#line 1914 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004318 {
Reid Spencer6f407902007-01-13 05:00:46 +00004319 if ((yyvsp[0].ConstVal) == 0)
4320 GEN_ERROR("Global value initializer is not a constant!");
4321 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4322 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004323 ;}
4324 break;
4325
4326 case 183:
Reid Spencer6f407902007-01-13 05:00:46 +00004327#line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004328 {
Reid Spencer6f407902007-01-13 05:00:46 +00004329 CurGV = 0;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004330 ;}
4331 break;
4332
4333 case 184:
Reid Spencer6f407902007-01-13 05:00:46 +00004334#line 1922 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004335 {
Reid Spencer6f407902007-01-13 05:00:46 +00004336 if (!UpRefs.empty())
4337 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4338 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4339 CHECK_FOR_ERROR
4340 delete (yyvsp[0].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004341 ;}
4342 break;
4343
4344 case 185:
Reid Spencer6f407902007-01-13 05:00:46 +00004345#line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004346 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004347 CurGV = 0;
4348 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004349 ;}
4350 break;
4351
Reid Spencer6f407902007-01-13 05:00:46 +00004352 case 186:
4353#line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004354 {
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004355 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004356 ;}
4357 break;
4358
Reid Spencer6f407902007-01-13 05:00:46 +00004359 case 187:
4360#line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004361 {
Reid Spencer218ded22007-01-05 17:07:23 +00004362 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004363 ;}
4364 break;
4365
Reid Spencer6f407902007-01-13 05:00:46 +00004366 case 188:
4367#line 1941 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004368 {
Chris Lattner66316012006-01-24 04:14:29 +00004369 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Reid Spencer6f407902007-01-13 05:00:46 +00004370 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4371 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4372 free((yyvsp[0].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00004373
4374 if (AsmSoFar.empty())
4375 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4376 else
4377 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
Reid Spencer61c83e02006-08-18 08:43:06 +00004378 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004379;}
4380 break;
4381
Reid Spencer6f407902007-01-13 05:00:46 +00004382 case 189:
4383#line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004384 { (yyval.Endianness) = Module::BigEndian; ;}
4385 break;
4386
Reid Spencer6f407902007-01-13 05:00:46 +00004387 case 190:
4388#line 1955 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004389 { (yyval.Endianness) = Module::LittleEndian; ;}
4390 break;
4391
Reid Spencer6f407902007-01-13 05:00:46 +00004392 case 191:
4393#line 1957 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004394 {
Reid Spencer6f407902007-01-13 05:00:46 +00004395 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4396 CHECK_FOR_ERROR
4397 ;}
4398 break;
4399
4400 case 192:
4401#line 1961 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4402 {
4403 if ((yyvsp[0].UInt64Val) == 32)
4404 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4405 else if ((yyvsp[0].UInt64Val) == 64)
4406 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4407 else
4408 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00004409 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004410 ;}
4411 break;
4412
4413 case 193:
Reid Spencer6f407902007-01-13 05:00:46 +00004414#line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004415 {
Reid Spencer6f407902007-01-13 05:00:46 +00004416 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4417 free((yyvsp[0].StrVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004418 ;}
4419 break;
4420
4421 case 194:
Reid Spencer6f407902007-01-13 05:00:46 +00004422#line 1974 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004423 {
Reid Spencer6f407902007-01-13 05:00:46 +00004424 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4425 free((yyvsp[0].StrVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004426 ;}
4427 break;
4428
Reid Spencer6f407902007-01-13 05:00:46 +00004429 case 196:
4430#line 1981 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004431 {
Reid Spencer6f407902007-01-13 05:00:46 +00004432 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4433 free((yyvsp[0].StrVal));
4434 CHECK_FOR_ERROR
4435 ;}
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004436 break;
4437
4438 case 197:
Reid Spencer6f407902007-01-13 05:00:46 +00004439#line 1986 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004440 {
Reid Spencer6f407902007-01-13 05:00:46 +00004441 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4442 free((yyvsp[0].StrVal));
Reid Spencera54b7cb2007-01-12 07:05:14 +00004443 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004444 ;}
4445 break;
4446
4447 case 198:
Reid Spencer6f407902007-01-13 05:00:46 +00004448#line 1991 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004449 {
Reid Spencera54b7cb2007-01-12 07:05:14 +00004450 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004451 ;}
4452 break;
4453
Reid Spencer6f407902007-01-13 05:00:46 +00004454 case 202:
4455#line 2001 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004456 { (yyval.StrVal) = 0; ;}
4457 break;
4458
Reid Spencer6f407902007-01-13 05:00:46 +00004459 case 203:
4460#line 2003 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004461 {
Reid Spencer14310612006-12-31 05:40:51 +00004462 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00004463 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4464 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
Reid Spencer14310612006-12-31 05:40:51 +00004465 GEN_ERROR("void typed arguments are invalid!");
Reid Spencer6f407902007-01-13 05:00:46 +00004466 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4467 (yyval.ArgList) = (yyvsp[-4].ArgList);
4468 (yyvsp[-4].ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004469 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004470 ;}
4471 break;
4472
Reid Spencer6f407902007-01-13 05:00:46 +00004473 case 204:
4474#line 2013 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004475 {
Reid Spencer14310612006-12-31 05:40:51 +00004476 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00004477 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4478 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
Reid Spencer14310612006-12-31 05:40:51 +00004479 GEN_ERROR("void typed arguments are invalid!");
Reid Spencer6f407902007-01-13 05:00:46 +00004480 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004481 (yyval.ArgList) = new ArgListType;
4482 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004483 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004484 ;}
4485 break;
4486
Reid Spencer6f407902007-01-13 05:00:46 +00004487 case 205:
4488#line 2024 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004489 {
Reid Spencer6f407902007-01-13 05:00:46 +00004490 (yyval.ArgList) = (yyvsp[0].ArgList);
4491 CHECK_FOR_ERROR
4492 ;}
4493 break;
4494
4495 case 206:
4496#line 2028 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4497 {
4498 (yyval.ArgList) = (yyvsp[-2].ArgList);
4499 struct ArgListEntry E;
4500 E.Ty = new PATypeHolder(Type::VoidTy);
4501 E.Name = 0;
4502 E.Attrs = FunctionType::NoAttributeSet;
4503 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004504 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004505 ;}
4506 break;
4507
4508 case 207:
Reid Spencer6f407902007-01-13 05:00:46 +00004509#line 2037 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004510 {
Reid Spencer6f407902007-01-13 05:00:46 +00004511 (yyval.ArgList) = new ArgListType;
Reid Spencer14310612006-12-31 05:40:51 +00004512 struct ArgListEntry E;
4513 E.Ty = new PATypeHolder(Type::VoidTy);
4514 E.Name = 0;
4515 E.Attrs = FunctionType::NoAttributeSet;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004516 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004517 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004518 ;}
4519 break;
4520
4521 case 208:
Reid Spencer6f407902007-01-13 05:00:46 +00004522#line 2046 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004523 {
4524 (yyval.ArgList) = 0;
Andrew Lenharth6353e052006-12-08 18:07:09 +00004525 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004526 ;}
4527 break;
4528
Reid Spencer6f407902007-01-13 05:00:46 +00004529 case 209:
4530#line 2052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004531 {
Reid Spencer6f407902007-01-13 05:00:46 +00004532 UnEscapeLexed((yyvsp[-6].StrVal));
4533 std::string FunctionName((yyvsp[-6].StrVal));
4534 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00004535
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004536 // Check the function result for abstractness if this is a define. We should
4537 // have no abstract types at this point
Reid Spencer6f407902007-01-13 05:00:46 +00004538 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4539 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004540
Reid Spencer68a24bd2005-08-27 18:50:39 +00004541 std::vector<const Type*> ParamTypeList;
Reid Spencer14310612006-12-31 05:40:51 +00004542 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
Reid Spencer6f407902007-01-13 05:00:46 +00004543 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4544 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4545 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00004546 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004547 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4548 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00004549 ParamTypeList.push_back(Ty);
4550 if (Ty != Type::VoidTy)
4551 ParamAttrs.push_back(I->Attrs);
4552 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004553 }
4554
4555 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4556 if (isVarArg) ParamTypeList.pop_back();
4557
Reid Spencer6f407902007-01-13 05:00:46 +00004558 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
Reid Spencer14310612006-12-31 05:40:51 +00004559 ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004560 const PointerType *PFT = PointerType::get(FT);
Reid Spencer6f407902007-01-13 05:00:46 +00004561 delete (yyvsp[-7].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004562
4563 ValID ID;
4564 if (!FunctionName.empty()) {
4565 ID = ValID::create((char*)FunctionName.c_str());
4566 } else {
4567 ID = ValID::create((int)CurModule.Values[PFT].size());
4568 }
4569
4570 Function *Fn = 0;
4571 // See if this function was forward referenced. If so, recycle the object.
4572 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4573 // Move the function to the end of the list, from whereever it was
4574 // previously inserted.
4575 Fn = cast<Function>(FWRef);
4576 CurModule.CurrentModule->getFunctionList().remove(Fn);
4577 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4578 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4579 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4580 // If this is the case, either we need to be a forward decl, or it needs
4581 // to be.
4582 if (!CurFun.isDeclare && !Fn->isExternal())
Reid Spencer61c83e02006-08-18 08:43:06 +00004583 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004584
4585 // Make sure to strip off any argument names so we can't get conflicts.
4586 if (Fn->isExternal())
4587 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4588 AI != AE; ++AI)
4589 AI->setName("");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004590 } else { // Not already defined?
4591 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4592 CurModule.CurrentModule);
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004593
Reid Spencer68a24bd2005-08-27 18:50:39 +00004594 InsertValue(Fn, CurModule.Values);
4595 }
4596
4597 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004598
4599 if (CurFun.isDeclare) {
4600 // If we have declaration, always overwrite linkage. This will allow us to
4601 // correctly handle cases, when pointer to function is passed as argument to
4602 // another function.
4603 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004604 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004605 }
Reid Spencer6f407902007-01-13 05:00:46 +00004606 Fn->setCallingConv((yyvsp[-8].UIntVal));
4607 Fn->setAlignment((yyvsp[0].UIntVal));
4608 if ((yyvsp[-1].StrVal)) {
4609 Fn->setSection((yyvsp[-1].StrVal));
4610 free((yyvsp[-1].StrVal));
Chris Lattnere869eef2005-11-12 00:11:49 +00004611 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004612
4613 // Add all of the arguments we parsed to the function...
Reid Spencer6f407902007-01-13 05:00:46 +00004614 if ((yyvsp[-4].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00004615 if (isVarArg) { // Nuke the last entry
Reid Spencer6f407902007-01-13 05:00:46 +00004616 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&&
Reid Spencera132e042006-12-03 05:46:11 +00004617 "Not a varargs marker!");
Reid Spencer6f407902007-01-13 05:00:46 +00004618 delete (yyvsp[-4].ArgList)->back().Ty;
4619 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00004620 }
4621 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spencer14310612006-12-31 05:40:51 +00004622 unsigned Idx = 1;
Reid Spencer6f407902007-01-13 05:00:46 +00004623 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00004624 delete I->Ty; // Delete the typeholder...
4625 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00004626 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004627 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00004628 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004629 }
Reid Spencera132e042006-12-03 05:46:11 +00004630
Reid Spencer6f407902007-01-13 05:00:46 +00004631 delete (yyvsp[-4].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00004632 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004633 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004634;}
4635 break;
4636
Reid Spencer6f407902007-01-13 05:00:46 +00004637 case 212:
4638#line 2159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004639 {
4640 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004641
4642 // Make sure that we keep track of the linkage type even if there was a
4643 // previous "declare".
Reid Spencer6f407902007-01-13 05:00:46 +00004644 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4645 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004646;}
4647 break;
4648
Reid Spencer6f407902007-01-13 05:00:46 +00004649 case 215:
4650#line 2170 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004651 {
Reid Spencer6f407902007-01-13 05:00:46 +00004652 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004653 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004654;}
4655 break;
4656
Reid Spencer6f407902007-01-13 05:00:46 +00004657 case 216:
4658#line 2175 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004659 {
Reid Spencer6f407902007-01-13 05:00:46 +00004660 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4661 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004662 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004663 CurFun.FunctionDone();
Reid Spencer61c83e02006-08-18 08:43:06 +00004664 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004665 ;}
4666 break;
4667
Reid Spencer6f407902007-01-13 05:00:46 +00004668 case 217:
4669#line 2187 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004670 {
4671 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00004672 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004673 ;}
4674 break;
4675
Reid Spencer6f407902007-01-13 05:00:46 +00004676 case 218:
4677#line 2191 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004678 {
4679 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00004680 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004681 ;}
4682 break;
4683
Reid Spencer6f407902007-01-13 05:00:46 +00004684 case 219:
4685#line 2196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004686 { // A reference to a direct constant
Reid Spencer6f407902007-01-13 05:00:46 +00004687 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4688 CHECK_FOR_ERROR
4689 ;}
4690 break;
4691
4692 case 220:
4693#line 2200 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4694 {
4695 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004696 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004697 ;}
4698 break;
4699
4700 case 221:
Reid Spencer6f407902007-01-13 05:00:46 +00004701#line 2204 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4702 { // Perhaps it's an FP constant?
4703 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004704 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004705 ;}
4706 break;
4707
4708 case 222:
Reid Spencer6f407902007-01-13 05:00:46 +00004709#line 2208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004710 {
4711 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004712 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004713 ;}
4714 break;
4715
Reid Spencer6f407902007-01-13 05:00:46 +00004716 case 223:
4717#line 2212 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004718 {
4719 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004720 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004721 ;}
4722 break;
4723
Reid Spencer6f407902007-01-13 05:00:46 +00004724 case 224:
4725#line 2216 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004726 {
4727 (yyval.ValIDVal) = ValID::createNull();
Reid Spencer61c83e02006-08-18 08:43:06 +00004728 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004729 ;}
4730 break;
4731
Reid Spencer6f407902007-01-13 05:00:46 +00004732 case 225:
4733#line 2220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004734 {
4735 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00004736 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004737 ;}
4738 break;
4739
Reid Spencer6f407902007-01-13 05:00:46 +00004740 case 226:
4741#line 2224 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004742 { // A vector zero constant.
4743 (yyval.ValIDVal) = ValID::createZeroInit();
Reid Spencer61c83e02006-08-18 08:43:06 +00004744 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004745 ;}
4746 break;
4747
Reid Spencer6f407902007-01-13 05:00:46 +00004748 case 227:
4749#line 2228 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004750 { // Nonempty unsized packed vector
Reid Spencer6f407902007-01-13 05:00:46 +00004751 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4752 int NumElements = (yyvsp[-1].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004753
4754 PackedType* pt = PackedType::get(ETy, NumElements);
4755 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00004756 HandleUpRefs(
4757 PackedType::get(
4758 ETy,
4759 NumElements)
4760 )
4761 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00004762
4763 // Verify all elements are correct type!
Reid Spencer6f407902007-01-13 05:00:46 +00004764 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4765 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004766 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00004767 ETy->getDescription() +"' as required!\nIt is of type '" +
Reid Spencer6f407902007-01-13 05:00:46 +00004768 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004769 }
4770
Reid Spencer6f407902007-01-13 05:00:46 +00004771 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4772 delete PTy; delete (yyvsp[-1].ConstVector);
4773 CHECK_FOR_ERROR
4774 ;}
4775 break;
4776
4777 case 228:
4778#line 2253 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4779 {
4780 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004781 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004782 ;}
4783 break;
Reid Spencere4d87aa2006-12-23 06:05:41 +00004784
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004785 case 229:
Reid Spencer6f407902007-01-13 05:00:46 +00004786#line 2257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004787 {
Reid Spencer6f407902007-01-13 05:00:46 +00004788 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4789 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4790 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4791 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4792 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4793 free((yyvsp[-2].StrVal));
4794 free((yyvsp[0].StrVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004795 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004796 ;}
4797 break;
4798
4799 case 230:
Reid Spencer6f407902007-01-13 05:00:46 +00004800#line 2271 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4801 { // Is it an integer reference...?
4802 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004803 CHECK_FOR_ERROR
4804 ;}
4805 break;
4806
4807 case 231:
Reid Spencer6f407902007-01-13 05:00:46 +00004808#line 2275 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4809 { // Is it a named reference...?
4810 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004811 CHECK_FOR_ERROR
4812 ;}
4813 break;
4814
Reid Spencer6f407902007-01-13 05:00:46 +00004815 case 234:
4816#line 2287 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4817 {
4818 if (!UpRefs.empty())
4819 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4820 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4821 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004822 CHECK_FOR_ERROR
4823 ;}
4824 break;
4825
4826 case 235:
Reid Spencer6f407902007-01-13 05:00:46 +00004827#line 2296 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004828 {
Reid Spencer6f407902007-01-13 05:00:46 +00004829 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004830 CHECK_FOR_ERROR
4831 ;}
4832 break;
4833
4834 case 236:
Reid Spencer6f407902007-01-13 05:00:46 +00004835#line 2300 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4836 { // Do not allow functions with 0 basic blocks
4837 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004838 CHECK_FOR_ERROR
4839 ;}
4840 break;
4841
4842 case 237:
Reid Spencer6f407902007-01-13 05:00:46 +00004843#line 2309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4844 {
4845 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4846 CHECK_FOR_ERROR
4847 InsertValue((yyvsp[0].TermInstVal));
4848
4849 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4850 InsertValue((yyvsp[-2].BasicBlockVal));
4851 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004852 CHECK_FOR_ERROR
4853 ;}
4854 break;
4855
4856 case 238:
Reid Spencer6f407902007-01-13 05:00:46 +00004857#line 2320 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004858 {
Reid Spencer6f407902007-01-13 05:00:46 +00004859 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4860 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4861 if (CI2->getParent() == 0)
4862 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4863 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4864 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004865 CHECK_FOR_ERROR
4866 ;}
4867 break;
4868
4869 case 239:
Reid Spencer6f407902007-01-13 05:00:46 +00004870#line 2329 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004871 {
4872 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004873 CHECK_FOR_ERROR
4874
4875 // Make sure to move the basic block to the correct location in the
4876 // function, instead of leaving it inserted wherever it was first
4877 // referenced.
4878 Function::BasicBlockListType &BBL =
4879 CurFun.CurrentFunction->getBasicBlockList();
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004880 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004881 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004882 ;}
4883 break;
4884
Reid Spencer6f407902007-01-13 05:00:46 +00004885 case 240:
4886#line 2341 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004887 {
Reid Spencer6f407902007-01-13 05:00:46 +00004888 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004889 CHECK_FOR_ERROR
4890
4891 // Make sure to move the basic block to the correct location in the
4892 // function, instead of leaving it inserted wherever it was first
4893 // referenced.
4894 Function::BasicBlockListType &BBL =
4895 CurFun.CurrentFunction->getBasicBlockList();
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004896 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencer3822ff52006-11-08 06:47:33 +00004897 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004898 ;}
4899 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00004900
Reid Spencer6f407902007-01-13 05:00:46 +00004901 case 241:
4902#line 2354 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004903 { // Return with a result...
Reid Spencer6f407902007-01-13 05:00:46 +00004904 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004905 CHECK_FOR_ERROR
4906 ;}
4907 break;
4908
Reid Spencer6f407902007-01-13 05:00:46 +00004909 case 242:
4910#line 2358 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004911 { // Return with no result...
4912 (yyval.TermInstVal) = new ReturnInst();
4913 CHECK_FOR_ERROR
4914 ;}
4915 break;
4916
Reid Spencer6f407902007-01-13 05:00:46 +00004917 case 243:
4918#line 2362 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004919 { // Unconditional Branch...
Reid Spencer6f407902007-01-13 05:00:46 +00004920 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004921 CHECK_FOR_ERROR
4922 (yyval.TermInstVal) = new BranchInst(tmpBB);
4923 ;}
4924 break;
4925
Reid Spencer6f407902007-01-13 05:00:46 +00004926 case 244:
4927#line 2367 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004928 {
Reid Spencer6f407902007-01-13 05:00:46 +00004929 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
4930 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004931 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00004932 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004933 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00004934 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004935 CHECK_FOR_ERROR
4936 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4937 ;}
4938 break;
4939
Reid Spencer6f407902007-01-13 05:00:46 +00004940 case 245:
4941#line 2377 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004942 {
Reid Spencer6f407902007-01-13 05:00:46 +00004943 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004944 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00004945 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004946 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00004947 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004948 (yyval.TermInstVal) = S;
4949
Reid Spencer6f407902007-01-13 05:00:46 +00004950 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4951 E = (yyvsp[-1].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004952 for (; I != E; ++I) {
4953 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4954 S->addCase(CI, I->second);
4955 else
Reid Spencer61c83e02006-08-18 08:43:06 +00004956 GEN_ERROR("Switch case is constant, but not a simple integer!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004957 }
Reid Spencer6f407902007-01-13 05:00:46 +00004958 delete (yyvsp[-1].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00004959 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004960 ;}
4961 break;
4962
Reid Spencer6f407902007-01-13 05:00:46 +00004963 case 246:
4964#line 2396 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004965 {
Reid Spencer6f407902007-01-13 05:00:46 +00004966 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004967 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00004968 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004969 CHECK_FOR_ERROR
4970 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004971 (yyval.TermInstVal) = S;
Reid Spencer61c83e02006-08-18 08:43:06 +00004972 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004973 ;}
4974 break;
4975
Reid Spencer6f407902007-01-13 05:00:46 +00004976 case 247:
4977#line 2406 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004978 {
Reid Spencer3822ff52006-11-08 06:47:33 +00004979
Reid Spencer14310612006-12-31 05:40:51 +00004980 // Handle the short syntax
4981 const PointerType *PFTy = 0;
4982 const FunctionType *Ty = 0;
Reid Spencer6f407902007-01-13 05:00:46 +00004983 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00004984 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4985 // Pull out the types of all of the arguments...
4986 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00004987 FunctionType::ParamAttrsList ParamAttrs;
Reid Spencer6f407902007-01-13 05:00:46 +00004988 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
4989 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00004990 const Type *Ty = I->Val->getType();
4991 if (Ty == Type::VoidTy)
4992 GEN_ERROR("Short call syntax cannot be used with varargs");
4993 ParamTypes.push_back(Ty);
4994 ParamAttrs.push_back(I->Attrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004995 }
4996
Reid Spencer6f407902007-01-13 05:00:46 +00004997 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004998 PFTy = PointerType::get(Ty);
4999 }
5000
Reid Spencer6f407902007-01-13 05:00:46 +00005001 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005002 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005003 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005004 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005005 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00005006 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005007
Reid Spencer14310612006-12-31 05:40:51 +00005008 // Check the arguments
5009 ValueList Args;
Reid Spencer6f407902007-01-13 05:00:46 +00005010 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00005011 // Make sure no arguments is a good thing!
5012 if (Ty->getNumParams() != 0)
5013 GEN_ERROR("No arguments passed to a function that "
5014 "expects arguments!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005015 } else { // Has arguments?
5016 // Loop through FunctionType's arguments and ensure they are specified
5017 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005018 FunctionType::param_iterator I = Ty->param_begin();
5019 FunctionType::param_iterator E = Ty->param_end();
Reid Spencer6f407902007-01-13 05:00:46 +00005020 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005021
Reid Spencer14310612006-12-31 05:40:51 +00005022 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5023 if (ArgI->Val->getType() != *I)
5024 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencera132e042006-12-03 05:46:11 +00005025 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005026 Args.push_back(ArgI->Val);
5027 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005028
Reid Spencer14310612006-12-31 05:40:51 +00005029 if (Ty->isVarArg()) {
5030 if (I == E)
5031 for (; ArgI != ArgE; ++ArgI)
5032 Args.push_back(ArgI->Val); // push the remaining varargs
5033 } else if (I != E || ArgI != ArgE)
Reid Spencer61c83e02006-08-18 08:43:06 +00005034 GEN_ERROR("Invalid number of parameters detected!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005035 }
Reid Spencer14310612006-12-31 05:40:51 +00005036
5037 // Create the InvokeInst
5038 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
Reid Spencer6f407902007-01-13 05:00:46 +00005039 II->setCallingConv((yyvsp[-12].UIntVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005040 (yyval.TermInstVal) = II;
Reid Spencer6f407902007-01-13 05:00:46 +00005041 delete (yyvsp[-8].ValueRefList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005042 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005043 ;}
5044 break;
5045
Reid Spencer6f407902007-01-13 05:00:46 +00005046 case 248:
5047#line 2472 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005048 {
5049 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005050 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005051 ;}
5052 break;
5053
Reid Spencer6f407902007-01-13 05:00:46 +00005054 case 249:
5055#line 2476 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005056 {
5057 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005058 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005059 ;}
5060 break;
5061
Reid Spencer6f407902007-01-13 05:00:46 +00005062 case 250:
5063#line 2483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005064 {
Reid Spencer6f407902007-01-13 05:00:46 +00005065 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5066 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005067 CHECK_FOR_ERROR
5068 if (V == 0)
5069 GEN_ERROR("May only switch on a constant pool value!");
5070
Reid Spencer6f407902007-01-13 05:00:46 +00005071 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005072 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005073 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5074 ;}
5075 break;
5076
Reid Spencer6f407902007-01-13 05:00:46 +00005077 case 251:
5078#line 2494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005079 {
5080 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
Reid Spencer6f407902007-01-13 05:00:46 +00005081 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005082 CHECK_FOR_ERROR
5083
5084 if (V == 0)
5085 GEN_ERROR("May only switch on a constant pool value!");
5086
Reid Spencer6f407902007-01-13 05:00:46 +00005087 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005088 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005089 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5090 ;}
5091 break;
5092
Reid Spencer6f407902007-01-13 05:00:46 +00005093 case 252:
5094#line 2507 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005095 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005096 // Is this definition named?? if so, assign the name...
Reid Spencer6f407902007-01-13 05:00:46 +00005097 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005098 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005099 InsertValue((yyvsp[0].InstVal));
5100 (yyval.InstVal) = (yyvsp[0].InstVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005101 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005102;}
5103 break;
5104
Reid Spencer6f407902007-01-13 05:00:46 +00005105 case 253:
5106#line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005107 { // Used for PHI nodes
Reid Spencer14310612006-12-31 05:40:51 +00005108 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005109 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005110 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
Reid Spencer6f407902007-01-13 05:00:46 +00005111 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005112 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005113 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005114 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005115 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
Reid Spencer6f407902007-01-13 05:00:46 +00005116 delete (yyvsp[-5].TypeVal);
5117 ;}
5118 break;
5119
5120 case 254:
5121#line 2527 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5122 {
5123 (yyval.PHIList) = (yyvsp[-6].PHIList);
5124 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5125 CHECK_FOR_ERROR
5126 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5127 CHECK_FOR_ERROR
5128 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005129 ;}
5130 break;
5131
5132 case 255:
Reid Spencer6f407902007-01-13 05:00:46 +00005133#line 2537 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5134 {
5135 if (!UpRefs.empty())
5136 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5137 // Used for call and invoke instructions
5138 (yyval.ValueRefList) = new ValueRefList();
5139 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5140 (yyval.ValueRefList)->push_back(E);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005141 ;}
5142 break;
5143
5144 case 256:
Reid Spencer6f407902007-01-13 05:00:46 +00005145#line 2545 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5146 {
Reid Spencer14310612006-12-31 05:40:51 +00005147 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005148 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5149 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5150 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005151 (yyval.ValueRefList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005152 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005153 ;}
5154 break;
5155
5156 case 257:
Reid Spencer6f407902007-01-13 05:00:46 +00005157#line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005158 { (yyval.ValueRefList) = new ValueRefList(); ;}
5159 break;
5160
Reid Spencer6f407902007-01-13 05:00:46 +00005161 case 258:
5162#line 2556 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005163 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5164 break;
5165
Reid Spencer6f407902007-01-13 05:00:46 +00005166 case 259:
5167#line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005168 {
Reid Spencer6f407902007-01-13 05:00:46 +00005169 (yyval.ValueList) = (yyvsp[-2].ValueList);
5170 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
Reid Spencer14310612006-12-31 05:40:51 +00005171 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005172 ;}
5173 break;
5174
Reid Spencer6f407902007-01-13 05:00:46 +00005175 case 260:
5176#line 2564 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005177 {
5178 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005179 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005180 ;}
5181 break;
5182
Reid Spencer6f407902007-01-13 05:00:46 +00005183 case 261:
5184#line 2568 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005185 {
5186 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005187 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005188 ;}
5189 break;
5190
Reid Spencer6f407902007-01-13 05:00:46 +00005191 case 262:
5192#line 2573 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005193 {
Reid Spencer14310612006-12-31 05:40:51 +00005194 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005195 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5196 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5197 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
Reid Spencere4d87aa2006-12-23 06:05:41 +00005198 GEN_ERROR(
5199 "Arithmetic operator requires integer, FP, or packed operands!");
Reid Spencer6f407902007-01-13 05:00:46 +00005200 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5201 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5202 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5203 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
Reid Spencere4d87aa2006-12-23 06:05:41 +00005204 GEN_ERROR("U/S/FRem not supported on packed types!");
Reid Spencer6f407902007-01-13 05:00:46 +00005205 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005206 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005207 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005208 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005209 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005210 if ((yyval.InstVal) == 0)
Reid Spencere4d87aa2006-12-23 06:05:41 +00005211 GEN_ERROR("binary operator returned null!");
Reid Spencer6f407902007-01-13 05:00:46 +00005212 delete (yyvsp[-3].TypeVal);
5213 ;}
5214 break;
5215
5216 case 263:
5217#line 2594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5218 {
5219 if (!UpRefs.empty())
5220 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5221 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5222 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5223 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5224 GEN_ERROR("Logical operator requires integral operands!");
5225 }
5226 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5227 CHECK_FOR_ERROR
5228 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5229 CHECK_FOR_ERROR
5230 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5231 if ((yyval.InstVal) == 0)
5232 GEN_ERROR("binary operator returned null!");
5233 delete (yyvsp[-3].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005234 ;}
5235 break;
5236
5237 case 264:
Reid Spencer6f407902007-01-13 05:00:46 +00005238#line 2611 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005239 {
Reid Spencer14310612006-12-31 05:40:51 +00005240 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005241 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5242 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005243 GEN_ERROR("Packed types not supported by icmp instruction");
Reid Spencer6f407902007-01-13 05:00:46 +00005244 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005245 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005246 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005247 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005248 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005249 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005250 GEN_ERROR("icmp operator returned null!");
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005251 ;}
5252 break;
5253
Reid Spencer6f407902007-01-13 05:00:46 +00005254 case 265:
5255#line 2624 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005256 {
Reid Spencer14310612006-12-31 05:40:51 +00005257 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005258 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5259 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005260 GEN_ERROR("Packed types not supported by fcmp instruction");
Reid Spencer6f407902007-01-13 05:00:46 +00005261 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005262 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005263 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005264 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005265 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005266 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005267 GEN_ERROR("fcmp operator returned null!");
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005268 ;}
5269 break;
5270
Reid Spencer6f407902007-01-13 05:00:46 +00005271 case 266:
5272#line 2637 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005273 {
Reid Spencer6f407902007-01-13 05:00:46 +00005274 if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty)
Reid Spencer14310612006-12-31 05:40:51 +00005275 GEN_ERROR("Shift amount must be i8 type!");
Reid Spencer6f407902007-01-13 05:00:46 +00005276 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
Andrew Lenharth6353e052006-12-08 18:07:09 +00005277 GEN_ERROR("Shift constant expression requires integer operand!");
5278 CHECK_FOR_ERROR;
Reid Spencer6f407902007-01-13 05:00:46 +00005279 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005280 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005281 ;}
5282 break;
5283
Reid Spencer6f407902007-01-13 05:00:46 +00005284 case 267:
5285#line 2646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005286 {
Reid Spencer14310612006-12-31 05:40:51 +00005287 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005288 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5289 Value* Val = (yyvsp[-2].ValueVal);
5290 const Type* Ty = (yyvsp[0].TypeVal)->get();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005291 if (!Val->getType()->isFirstClassType())
5292 GEN_ERROR("cast from a non-primitive type: '" +
5293 Val->getType()->getDescription() + "'!");
5294 if (!Ty->isFirstClassType())
5295 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
Reid Spencer6f407902007-01-13 05:00:46 +00005296 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, (yyvsp[0].TypeVal)->get());
5297 delete (yyvsp[0].TypeVal);
5298 ;}
5299 break;
5300
5301 case 268:
5302#line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5303 {
5304 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5305 GEN_ERROR("select condition must be boolean!");
5306 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5307 GEN_ERROR("select value types should match!");
5308 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5309 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005310 ;}
5311 break;
5312
5313 case 269:
Reid Spencer6f407902007-01-13 05:00:46 +00005314#line 2667 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005315 {
Reid Spencer6f407902007-01-13 05:00:46 +00005316 if (!UpRefs.empty())
5317 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5318 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5319 delete (yyvsp[0].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005320 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005321 ;}
5322 break;
5323
5324 case 270:
Reid Spencer6f407902007-01-13 05:00:46 +00005325#line 2674 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005326 {
Reid Spencer6f407902007-01-13 05:00:46 +00005327 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5328 GEN_ERROR("Invalid extractelement operands!");
5329 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005330 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005331 ;}
5332 break;
5333
5334 case 271:
Reid Spencer6f407902007-01-13 05:00:46 +00005335#line 2680 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005336 {
Reid Spencer6f407902007-01-13 05:00:46 +00005337 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5338 GEN_ERROR("Invalid insertelement operands!");
5339 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005340 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005341 ;}
5342 break;
5343
5344 case 272:
Reid Spencer6f407902007-01-13 05:00:46 +00005345#line 2686 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005346 {
Reid Spencer6f407902007-01-13 05:00:46 +00005347 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5348 GEN_ERROR("Invalid shufflevector operands!");
5349 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005350 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005351 ;}
5352 break;
5353
5354 case 273:
Reid Spencer6f407902007-01-13 05:00:46 +00005355#line 2692 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005356 {
Reid Spencer6f407902007-01-13 05:00:46 +00005357 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5358 if (!Ty->isFirstClassType())
5359 GEN_ERROR("PHI node operands must be of first class type!");
5360 (yyval.InstVal) = new PHINode(Ty);
5361 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5362 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5363 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5364 GEN_ERROR("All elements of a PHI node must be of the same type!");
5365 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5366 (yyvsp[0].PHIList)->pop_front();
5367 }
5368 delete (yyvsp[0].PHIList); // Free the list...
Reid Spencer61c83e02006-08-18 08:43:06 +00005369 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005370 ;}
5371 break;
5372
5373 case 274:
Reid Spencer6f407902007-01-13 05:00:46 +00005374#line 2708 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005375 {
Reid Spencer14310612006-12-31 05:40:51 +00005376
5377 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00005378 const PointerType *PFTy = 0;
5379 const FunctionType *Ty = 0;
Reid Spencer6f407902007-01-13 05:00:46 +00005380 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00005381 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5382 // Pull out the types of all of the arguments...
5383 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00005384 FunctionType::ParamAttrsList ParamAttrs;
Reid Spencer6f407902007-01-13 05:00:46 +00005385 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5386 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005387 const Type *Ty = I->Val->getType();
5388 if (Ty == Type::VoidTy)
5389 GEN_ERROR("Short call syntax cannot be used with varargs");
5390 ParamTypes.push_back(Ty);
5391 ParamAttrs.push_back(I->Attrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005392 }
5393
Reid Spencer6f407902007-01-13 05:00:46 +00005394 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005395 PFTy = PointerType::get(Ty);
5396 }
5397
Reid Spencer6f407902007-01-13 05:00:46 +00005398 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005399 CHECK_FOR_ERROR
5400
Reid Spencer14310612006-12-31 05:40:51 +00005401 // Check the arguments
5402 ValueList Args;
Reid Spencer6f407902007-01-13 05:00:46 +00005403 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00005404 // Make sure no arguments is a good thing!
5405 if (Ty->getNumParams() != 0)
5406 GEN_ERROR("No arguments passed to a function that "
5407 "expects arguments!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005408 } else { // Has arguments?
5409 // Loop through FunctionType's arguments and ensure they are specified
5410 // correctly!
5411 //
5412 FunctionType::param_iterator I = Ty->param_begin();
5413 FunctionType::param_iterator E = Ty->param_end();
Reid Spencer6f407902007-01-13 05:00:46 +00005414 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005415
Reid Spencer14310612006-12-31 05:40:51 +00005416 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5417 if (ArgI->Val->getType() != *I)
5418 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00005419 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005420 Args.push_back(ArgI->Val);
5421 }
5422 if (Ty->isVarArg()) {
5423 if (I == E)
5424 for (; ArgI != ArgE; ++ArgI)
5425 Args.push_back(ArgI->Val); // push the remaining varargs
5426 } else if (I != E || ArgI != ArgE)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005427 GEN_ERROR("Invalid number of parameters detected!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005428 }
Reid Spencer14310612006-12-31 05:40:51 +00005429 // Create the call node
5430 CallInst *CI = new CallInst(V, Args);
Reid Spencer6f407902007-01-13 05:00:46 +00005431 CI->setTailCall((yyvsp[-7].BoolVal));
5432 CI->setCallingConv((yyvsp[-6].UIntVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005433 (yyval.InstVal) = CI;
Reid Spencer6f407902007-01-13 05:00:46 +00005434 delete (yyvsp[-2].ValueRefList);
5435 CHECK_FOR_ERROR
5436 ;}
5437 break;
5438
5439 case 275:
5440#line 2770 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5441 {
5442 (yyval.InstVal) = (yyvsp[0].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005443 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005444 ;}
5445 break;
5446
5447 case 276:
Reid Spencer6f407902007-01-13 05:00:46 +00005448#line 2775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005449 {
5450 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005451 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005452 ;}
5453 break;
5454
Reid Spencer6f407902007-01-13 05:00:46 +00005455 case 277:
5456#line 2779 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005457 {
5458 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005459 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005460 ;}
5461 break;
5462
Reid Spencer6f407902007-01-13 05:00:46 +00005463 case 278:
5464#line 2786 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005465 {
Reid Spencer14310612006-12-31 05:40:51 +00005466 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005467 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5468 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5469 delete (yyvsp[-1].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005470 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005471 ;}
5472 break;
5473
Reid Spencer6f407902007-01-13 05:00:46 +00005474 case 279:
5475#line 2793 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5476 {
5477 if (!UpRefs.empty())
5478 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5479 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5480 CHECK_FOR_ERROR
5481 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5482 delete (yyvsp[-4].TypeVal);
5483 ;}
5484 break;
5485
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005486 case 280:
Reid Spencer6f407902007-01-13 05:00:46 +00005487#line 2801 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005488 {
Reid Spencer14310612006-12-31 05:40:51 +00005489 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005490 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5491 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5492 delete (yyvsp[-1].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005493 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005494 ;}
5495 break;
5496
5497 case 281:
Reid Spencer6f407902007-01-13 05:00:46 +00005498#line 2808 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005499 {
Reid Spencer14310612006-12-31 05:40:51 +00005500 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005501 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5502 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005503 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005504 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5505 delete (yyvsp[-4].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005506 ;}
5507 break;
5508
5509 case 282:
Reid Spencer6f407902007-01-13 05:00:46 +00005510#line 2816 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005511 {
Reid Spencer6f407902007-01-13 05:00:46 +00005512 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5513 GEN_ERROR("Trying to free nonpointer type " +
5514 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5515 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005516 CHECK_FOR_ERROR
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005517 ;}
5518 break;
5519
5520 case 283:
Reid Spencer6f407902007-01-13 05:00:46 +00005521#line 2824 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005522 {
Reid Spencer6f407902007-01-13 05:00:46 +00005523 if (!UpRefs.empty())
5524 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5525 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5526 GEN_ERROR("Can't load from nonpointer type: " +
5527 (*(yyvsp[-1].TypeVal))->getDescription());
5528 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5529 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5530 (*(yyvsp[-1].TypeVal))->getDescription());
5531 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005532 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005533 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5534 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005535 ;}
5536 break;
5537
5538 case 284:
Reid Spencer6f407902007-01-13 05:00:46 +00005539#line 2838 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005540 {
Reid Spencer14310612006-12-31 05:40:51 +00005541 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005542 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5543 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5544 if (!PT)
5545 GEN_ERROR("Can't store to a nonpointer type: " +
5546 (*(yyvsp[-1].TypeVal))->getDescription());
5547 const Type *ElTy = PT->getElementType();
5548 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5549 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5550 "' into space of type '" + ElTy->getDescription() + "'!");
5551
5552 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005553 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005554 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5555 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005556 ;}
5557 break;
5558
5559 case 285:
Reid Spencer6f407902007-01-13 05:00:46 +00005560#line 2855 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005561 {
Reid Spencer14310612006-12-31 05:40:51 +00005562 if (!UpRefs.empty())
Reid Spencer6f407902007-01-13 05:00:46 +00005563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5564 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
Reid Spencer61c83e02006-08-18 08:43:06 +00005565 GEN_ERROR("getelementptr insn requires pointer operand!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005566
Reid Spencer6f407902007-01-13 05:00:46 +00005567 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
Reid Spencer61c83e02006-08-18 08:43:06 +00005568 GEN_ERROR("Invalid getelementptr indices for type '" +
Reid Spencer6f407902007-01-13 05:00:46 +00005569 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5570 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005571 CHECK_FOR_ERROR
Reid Spencer6f407902007-01-13 05:00:46 +00005572 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5573 delete (yyvsp[-2].TypeVal);
5574 delete (yyvsp[0].ValueList);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005575 ;}
5576 break;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005577
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005578
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005579 default: break;
Chris Lattner0fab59c2007-01-12 18:33:30 +00005580 }
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005581
Reid Spencer6f407902007-01-13 05:00:46 +00005582/* Line 1126 of yacc.c. */
5583#line 5584 "llvmAsmParser.tab.c"
5584
5585 yyvsp -= yylen;
5586 yyssp -= yylen;
5587
5588
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005589 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005590
5591 *++yyvsp = yyval;
5592
5593
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005594 /* Now `shift' the result of the reduction. Determine what state
5595 that goes to, based on the state we popped back to and the rule
5596 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005597
5598 yyn = yyr1[yyn];
5599
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005600 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5601 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005602 yystate = yytable[yystate];
5603 else
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005604 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00005605
5606 goto yynewstate;
5607
5608
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005609/*------------------------------------.
5610| yyerrlab -- here on detecting error |
5611`------------------------------------*/
5612yyerrlab:
5613 /* If not already recovering from an error, report this error. */
5614 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005615 {
5616 ++yynerrs;
Reid Spencer6f407902007-01-13 05:00:46 +00005617#if YYERROR_VERBOSE
5618 yyn = yypact[yystate];
Chris Lattner0fab59c2007-01-12 18:33:30 +00005619
Reid Spencer6f407902007-01-13 05:00:46 +00005620 if (YYPACT_NINF < yyn && yyn < YYLAST)
5621 {
5622 int yytype = YYTRANSLATE (yychar);
5623 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5624 YYSIZE_T yysize = yysize0;
5625 YYSIZE_T yysize1;
5626 int yysize_overflow = 0;
5627 char *yymsg = 0;
5628# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5629 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5630 int yyx;
5631
5632#if 0
5633 /* This is so xgettext sees the translatable formats that are
5634 constructed on the fly. */
5635 YY_("syntax error, unexpected %s");
5636 YY_("syntax error, unexpected %s, expecting %s");
5637 YY_("syntax error, unexpected %s, expecting %s or %s");
5638 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5639 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005640#endif
Reid Spencer6f407902007-01-13 05:00:46 +00005641 char *yyfmt;
5642 char const *yyf;
5643 static char const yyunexpected[] = "syntax error, unexpected %s";
5644 static char const yyexpecting[] = ", expecting %s";
5645 static char const yyor[] = " or %s";
5646 char yyformat[sizeof yyunexpected
5647 + sizeof yyexpecting - 1
5648 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5649 * (sizeof yyor - 1))];
5650 char const *yyprefix = yyexpecting;
5651
5652 /* Start YYX at -YYN if negative to avoid negative indexes in
5653 YYCHECK. */
5654 int yyxbegin = yyn < 0 ? -yyn : 0;
5655
5656 /* Stay within bounds of both yycheck and yytname. */
5657 int yychecklim = YYLAST - yyn;
5658 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5659 int yycount = 1;
5660
5661 yyarg[0] = yytname[yytype];
5662 yyfmt = yystpcpy (yyformat, yyunexpected);
5663
5664 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5665 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5666 {
5667 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5668 {
5669 yycount = 1;
5670 yysize = yysize0;
5671 yyformat[sizeof yyunexpected - 1] = '\0';
5672 break;
5673 }
5674 yyarg[yycount++] = yytname[yyx];
5675 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5676 yysize_overflow |= yysize1 < yysize;
5677 yysize = yysize1;
5678 yyfmt = yystpcpy (yyfmt, yyprefix);
5679 yyprefix = yyor;
5680 }
5681
5682 yyf = YY_(yyformat);
5683 yysize1 = yysize + yystrlen (yyf);
5684 yysize_overflow |= yysize1 < yysize;
5685 yysize = yysize1;
5686
5687 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5688 yymsg = (char *) YYSTACK_ALLOC (yysize);
5689 if (yymsg)
5690 {
5691 /* Avoid sprintf, as that infringes on the user's name space.
5692 Don't have undefined behavior even if the translation
5693 produced a string with the wrong number of "%s"s. */
5694 char *yyp = yymsg;
5695 int yyi = 0;
5696 while ((*yyp = *yyf))
5697 {
5698 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5699 {
5700 yyp += yytnamerr (yyp, yyarg[yyi++]);
5701 yyf += 2;
5702 }
5703 else
5704 {
5705 yyp++;
5706 yyf++;
5707 }
5708 }
5709 yyerror (yymsg);
5710 YYSTACK_FREE (yymsg);
5711 }
5712 else
5713 {
5714 yyerror (YY_("syntax error"));
5715 goto yyexhaustedlab;
5716 }
5717 }
5718 else
5719#endif /* YYERROR_VERBOSE */
5720 yyerror (YY_("syntax error"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005721 }
5722
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005723
Reid Spencer68a24bd2005-08-27 18:50:39 +00005724
5725 if (yyerrstatus == 3)
5726 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005727 /* If just tried and failed to reuse look-ahead token after an
5728 error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005729
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005730 if (yychar <= YYEOF)
Reid Spencer6f407902007-01-13 05:00:46 +00005731 {
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005732 /* Return failure if at end of input. */
5733 if (yychar == YYEOF)
5734 YYABORT;
Reid Spencer6f407902007-01-13 05:00:46 +00005735 }
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005736 else
5737 {
Reid Spencer6f407902007-01-13 05:00:46 +00005738 yydestruct ("Error: discarding", yytoken, &yylval);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005739 yychar = YYEMPTY;
5740 }
5741 }
5742
5743 /* Else will try to reuse look-ahead token after shifting the error
5744 token. */
5745 goto yyerrlab1;
5746
5747
5748/*---------------------------------------------------.
5749| yyerrorlab -- error raised explicitly by YYERROR. |
5750`---------------------------------------------------*/
5751yyerrorlab:
5752
5753 /* Pacify compilers like GCC when the user code never invokes
5754 YYERROR and the label yyerrorlab therefore never appears in user
5755 code. */
Reid Spencer6f407902007-01-13 05:00:46 +00005756 if (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005757 goto yyerrorlab;
5758
Reid Spencer6f407902007-01-13 05:00:46 +00005759yyvsp -= yylen;
5760 yyssp -= yylen;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005761 yystate = *yyssp;
5762 goto yyerrlab1;
5763
5764
5765/*-------------------------------------------------------------.
5766| yyerrlab1 -- common code for both syntax error and YYERROR. |
5767`-------------------------------------------------------------*/
5768yyerrlab1:
5769 yyerrstatus = 3; /* Each real token shifted decrements this. */
5770
5771 for (;;)
5772 {
5773 yyn = yypact[yystate];
5774 if (yyn != YYPACT_NINF)
5775 {
5776 yyn += YYTERROR;
5777 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5778 {
5779 yyn = yytable[yyn];
5780 if (0 < yyn)
5781 break;
5782 }
5783 }
5784
5785 /* Pop the current state because it cannot handle the error token. */
5786 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005787 YYABORT;
5788
Reid Spencere4d87aa2006-12-23 06:05:41 +00005789
Reid Spencer6f407902007-01-13 05:00:46 +00005790 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5791 YYPOPSTACK;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005792 yystate = *yyssp;
5793 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005794 }
5795
5796 if (yyn == YYFINAL)
5797 YYACCEPT;
5798
Reid Spencer68a24bd2005-08-27 18:50:39 +00005799 *++yyvsp = yylval;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005800
5801
Reid Spencer6f407902007-01-13 05:00:46 +00005802 /* Shift the error token. */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005803 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005804
Reid Spencer68a24bd2005-08-27 18:50:39 +00005805 yystate = yyn;
5806 goto yynewstate;
5807
Chris Lattner0fab59c2007-01-12 18:33:30 +00005808
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005809/*-------------------------------------.
5810| yyacceptlab -- YYACCEPT comes here. |
5811`-------------------------------------*/
5812yyacceptlab:
5813 yyresult = 0;
5814 goto yyreturn;
5815
5816/*-----------------------------------.
5817| yyabortlab -- YYABORT comes here. |
5818`-----------------------------------*/
5819yyabortlab:
5820 yyresult = 1;
5821 goto yyreturn;
5822
5823#ifndef yyoverflow
5824/*-------------------------------------------------.
5825| yyexhaustedlab -- memory exhaustion comes here. |
5826`-------------------------------------------------*/
5827yyexhaustedlab:
5828 yyerror (YY_("memory exhausted"));
5829 yyresult = 2;
5830 /* Fall through. */
Chris Lattner0fab59c2007-01-12 18:33:30 +00005831#endif
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005832
5833yyreturn:
5834 if (yychar != YYEOF && yychar != YYEMPTY)
5835 yydestruct ("Cleanup: discarding lookahead",
5836 yytoken, &yylval);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005837 while (yyssp != yyss)
5838 {
5839 yydestruct ("Cleanup: popping",
5840 yystos[*yyssp], yyvsp);
Reid Spencer6f407902007-01-13 05:00:46 +00005841 YYPOPSTACK;
Chris Lattner0fab59c2007-01-12 18:33:30 +00005842 }
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005843#ifndef yyoverflow
5844 if (yyss != yyssa)
5845 YYSTACK_FREE (yyss);
5846#endif
Reid Spencer6f407902007-01-13 05:00:46 +00005847 return yyresult;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005848}
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005849
5850
Reid Spencer6f407902007-01-13 05:00:46 +00005851#line 2872 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00005852
5853
Reid Spencer14310612006-12-31 05:40:51 +00005854// common code from the two 'RunVMAsmParser' functions
5855static Module* RunParser(Module * M) {
5856
5857 llvmAsmlineno = 1; // Reset the current line number...
5858 CurModule.CurrentModule = M;
5859#if YYDEBUG
5860 yydebug = Debug;
5861#endif
5862
5863 // Check to make sure the parser succeeded
5864 if (yyparse()) {
5865 if (ParserResult)
5866 delete ParserResult;
5867 return 0;
5868 }
5869
5870 // Check to make sure that parsing produced a result
5871 if (!ParserResult)
5872 return 0;
5873
5874 // Reset ParserResult variable while saving its value for the result.
5875 Module *Result = ParserResult;
5876 ParserResult = 0;
5877
5878 return Result;
5879}
5880
Reid Spencer61c83e02006-08-18 08:43:06 +00005881void llvm::GenerateError(const std::string &message, int LineNo) {
5882 if (LineNo == -1) LineNo = llvmAsmlineno;
5883 // TODO: column number in exception
5884 if (TheParseError)
5885 TheParseError->setError(CurFilename, message, LineNo);
5886 TriggerError = 1;
5887}
Reid Spencer68a24bd2005-08-27 18:50:39 +00005888
5889int yyerror(const char *ErrorMsg) {
5890 std::string where
5891 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5892 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5893 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5894 if (yychar == YYEMPTY || yychar == 0)
5895 errMsg += "end-of-file.";
5896 else
5897 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
Reid Spencer61c83e02006-08-18 08:43:06 +00005898 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005899 return 0;
5900}
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005901