blob: a682d1e06e86b21d34c1f6017e72696d48e8e8da [file] [log] [blame]
Chris Lattner59363a32008-02-19 04:36:25 +00001/* A Bison parser, made by GNU Bison 2.3. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Chris Lattner59363a32008-02-19 04:36:25 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Chris Lattner59363a32008-02-19 04:36:25 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007
Chris Lattner59363a32008-02-19 04:36:25 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062#define yyparse llvmAsmparse
Chris Lattner59363a32008-02-19 04:36:25 +000063#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +000064#define yyerror llvmAsmerror
Chris Lattner59363a32008-02-19 04:36:25 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Dan Gohmanf17a25c2007-07-18 16:29:46 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069
Chris Lattner59363a32008-02-19 04:36:25 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
123 OPAQUE = 304,
124 EXTERNAL = 305,
125 TARGET = 306,
126 TRIPLE = 307,
127 ALIGN = 308,
128 ADDRSPACE = 309,
129 DEPLIBS = 310,
130 CALL = 311,
131 TAIL = 312,
132 ASM_TOK = 313,
133 MODULE = 314,
134 SIDEEFFECT = 315,
135 CC_TOK = 316,
136 CCC_TOK = 317,
137 FASTCC_TOK = 318,
138 COLDCC_TOK = 319,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
141 DATALAYOUT = 322,
142 RET = 323,
143 BR = 324,
144 SWITCH = 325,
145 INVOKE = 326,
146 UNWIND = 327,
147 UNREACHABLE = 328,
148 ADD = 329,
149 SUB = 330,
150 MUL = 331,
151 UDIV = 332,
152 SDIV = 333,
153 FDIV = 334,
154 UREM = 335,
155 SREM = 336,
156 FREM = 337,
157 AND = 338,
158 OR = 339,
159 XOR = 340,
160 SHL = 341,
161 LSHR = 342,
162 ASHR = 343,
163 ICMP = 344,
164 FCMP = 345,
165 EQ = 346,
166 NE = 347,
167 SLT = 348,
168 SGT = 349,
169 SLE = 350,
170 SGE = 351,
171 ULT = 352,
172 UGT = 353,
173 ULE = 354,
174 UGE = 355,
175 OEQ = 356,
176 ONE = 357,
177 OLT = 358,
178 OGT = 359,
179 OLE = 360,
180 OGE = 361,
181 ORD = 362,
182 UNO = 363,
183 UEQ = 364,
184 UNE = 365,
185 MALLOC = 366,
186 ALLOCA = 367,
187 FREE = 368,
188 LOAD = 369,
189 STORE = 370,
190 GETELEMENTPTR = 371,
191 TRUNC = 372,
192 ZEXT = 373,
193 SEXT = 374,
194 FPTRUNC = 375,
195 FPEXT = 376,
196 BITCAST = 377,
197 UITOFP = 378,
198 SITOFP = 379,
199 FPTOUI = 380,
200 FPTOSI = 381,
201 INTTOPTR = 382,
202 PTRTOINT = 383,
203 PHI_TOK = 384,
204 SELECT = 385,
205 VAARG = 386,
206 EXTRACTELEMENT = 387,
207 INSERTELEMENT = 388,
208 SHUFFLEVECTOR = 389,
Devang Patel3b8849c2008-02-19 22:27:01 +0000209 GETRESULT = 390,
210 SIGNEXT = 391,
211 ZEROEXT = 392,
212 NORETURN = 393,
213 INREG = 394,
214 SRET = 395,
215 NOUNWIND = 396,
216 NOALIAS = 397,
217 BYVAL = 398,
218 NEST = 399,
219 READNONE = 400,
220 READONLY = 401,
221 GC = 402,
222 DEFAULT = 403,
223 HIDDEN = 404,
224 PROTECTED = 405
Chris Lattner59363a32008-02-19 04:36:25 +0000225 };
226#endif
227/* Tokens. */
228#define ESINT64VAL 258
229#define EUINT64VAL 259
230#define ESAPINTVAL 260
231#define EUAPINTVAL 261
232#define LOCALVAL_ID 262
233#define GLOBALVAL_ID 263
234#define FPVAL 264
235#define VOID 265
236#define INTTYPE 266
237#define FLOAT 267
238#define DOUBLE 268
239#define X86_FP80 269
240#define FP128 270
241#define PPC_FP128 271
242#define LABEL 272
243#define TYPE 273
244#define LOCALVAR 274
245#define GLOBALVAR 275
246#define LABELSTR 276
247#define STRINGCONSTANT 277
248#define ATSTRINGCONSTANT 278
249#define PCTSTRINGCONSTANT 279
250#define ZEROINITIALIZER 280
251#define TRUETOK 281
252#define FALSETOK 282
253#define BEGINTOK 283
254#define ENDTOK 284
255#define DECLARE 285
256#define DEFINE 286
257#define GLOBAL 287
258#define CONSTANT 288
259#define SECTION 289
260#define ALIAS 290
261#define VOLATILE 291
262#define THREAD_LOCAL 292
263#define TO 293
264#define DOTDOTDOT 294
265#define NULL_TOK 295
266#define UNDEF 296
267#define INTERNAL 297
268#define LINKONCE 298
269#define WEAK 299
270#define APPENDING 300
271#define DLLIMPORT 301
272#define DLLEXPORT 302
273#define EXTERN_WEAK 303
274#define OPAQUE 304
275#define EXTERNAL 305
276#define TARGET 306
277#define TRIPLE 307
278#define ALIGN 308
279#define ADDRSPACE 309
280#define DEPLIBS 310
281#define CALL 311
282#define TAIL 312
283#define ASM_TOK 313
284#define MODULE 314
285#define SIDEEFFECT 315
286#define CC_TOK 316
287#define CCC_TOK 317
288#define FASTCC_TOK 318
289#define COLDCC_TOK 319
290#define X86_STDCALLCC_TOK 320
291#define X86_FASTCALLCC_TOK 321
292#define DATALAYOUT 322
293#define RET 323
294#define BR 324
295#define SWITCH 325
296#define INVOKE 326
297#define UNWIND 327
298#define UNREACHABLE 328
299#define ADD 329
300#define SUB 330
301#define MUL 331
302#define UDIV 332
303#define SDIV 333
304#define FDIV 334
305#define UREM 335
306#define SREM 336
307#define FREM 337
308#define AND 338
309#define OR 339
310#define XOR 340
311#define SHL 341
312#define LSHR 342
313#define ASHR 343
314#define ICMP 344
315#define FCMP 345
316#define EQ 346
317#define NE 347
318#define SLT 348
319#define SGT 349
320#define SLE 350
321#define SGE 351
322#define ULT 352
323#define UGT 353
324#define ULE 354
325#define UGE 355
326#define OEQ 356
327#define ONE 357
328#define OLT 358
329#define OGT 359
330#define OLE 360
331#define OGE 361
332#define ORD 362
333#define UNO 363
334#define UEQ 364
335#define UNE 365
336#define MALLOC 366
337#define ALLOCA 367
338#define FREE 368
339#define LOAD 369
340#define STORE 370
341#define GETELEMENTPTR 371
342#define TRUNC 372
343#define ZEXT 373
344#define SEXT 374
345#define FPTRUNC 375
346#define FPEXT 376
347#define BITCAST 377
348#define UITOFP 378
349#define SITOFP 379
350#define FPTOUI 380
351#define FPTOSI 381
352#define INTTOPTR 382
353#define PTRTOINT 383
354#define PHI_TOK 384
355#define SELECT 385
356#define VAARG 386
357#define EXTRACTELEMENT 387
358#define INSERTELEMENT 388
359#define SHUFFLEVECTOR 389
Devang Patel3b8849c2008-02-19 22:27:01 +0000360#define GETRESULT 390
361#define SIGNEXT 391
362#define ZEROEXT 392
363#define NORETURN 393
364#define INREG 394
365#define SRET 395
366#define NOUNWIND 396
367#define NOALIAS 397
368#define BYVAL 398
369#define NEST 399
370#define READNONE 400
371#define READONLY 401
372#define GC 402
373#define DEFAULT 403
374#define HIDDEN 404
375#define PROTECTED 405
Chris Lattner59363a32008-02-19 04:36:25 +0000376
377
378
379
380/* Copy the first part of user declarations. */
Dale Johannesena79ecf32008-02-20 21:15:43 +0000381#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000382
383#include "ParserInternals.h"
384#include "llvm/CallingConv.h"
385#include "llvm/InlineAsm.h"
386#include "llvm/Instructions.h"
387#include "llvm/Module.h"
388#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000389#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000390#include "llvm/Support/GetElementPtrTypeIterator.h"
391#include "llvm/Support/CommandLine.h"
392#include "llvm/ADT/SmallVector.h"
393#include "llvm/ADT/STLExtras.h"
394#include "llvm/Support/MathExtras.h"
395#include "llvm/Support/Streams.h"
396#include <algorithm>
397#include <list>
398#include <map>
399#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000400
401// The following is a gross hack. In order to rid the libAsmParser library of
402// exceptions, we have to have a way of getting the yyparse function to go into
403// an error situation. So, whenever we want an error to occur, the GenerateError
404// function (see bottom of file) sets TriggerError. Then, at the end of each
405// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
406// (a goto) to put YACC in error state. Furthermore, several calls to
407// GenerateError are made from inside productions and they must simulate the
408// previous exception behavior by exiting the production immediately. We have
409// replaced these with the GEN_ERROR macro which calls GeneratError and then
410// immediately invokes YYERROR. This would be so much cleaner if it was a
411// recursive descent parser.
412static bool TriggerError = false;
413#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
414#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
415
416int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
417int yylex(); // declaration" of xxx warnings.
418int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000419using namespace llvm;
420
421static Module *ParserResult;
422
423// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
424// relating to upreferences in the input stream.
425//
426//#define DEBUG_UPREFS 1
427#ifdef DEBUG_UPREFS
428#define UR_OUT(X) cerr << X
429#else
430#define UR_OUT(X)
431#endif
432
433#define YYERROR_VERBOSE 1
434
435static GlobalVariable *CurGV;
436
437
438// This contains info used when building the body of a function. It is
439// destroyed when the function is completed.
440//
441typedef std::vector<Value *> ValueList; // Numbered defs
442
443static void
444ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
445
446static struct PerModuleInfo {
447 Module *CurrentModule;
448 ValueList Values; // Module level numbered definitions
449 ValueList LateResolveValues;
450 std::vector<PATypeHolder> Types;
451 std::map<ValID, PATypeHolder> LateResolveTypes;
452
453 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
454 /// how they were referenced and on which line of the input they came from so
455 /// that we can resolve them later and print error messages as appropriate.
456 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
457
458 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
459 // references to global values. Global values may be referenced before they
460 // are defined, and if so, the temporary object that they represent is held
461 // here. This is used for forward references of GlobalValues.
462 //
463 typedef std::map<std::pair<const PointerType *,
464 ValID>, GlobalValue*> GlobalRefsType;
465 GlobalRefsType GlobalRefs;
466
467 void ModuleDone() {
468 // If we could not resolve some functions at function compilation time
469 // (calls to functions before they are defined), resolve them now... Types
470 // are resolved when the constant pool has been completely parsed.
471 //
472 ResolveDefinitions(LateResolveValues);
473 if (TriggerError)
474 return;
475
476 // Check to make sure that all global value forward references have been
477 // resolved!
478 //
479 if (!GlobalRefs.empty()) {
480 std::string UndefinedReferences = "Unresolved global references exist:\n";
481
482 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
483 I != E; ++I) {
484 UndefinedReferences += " " + I->first.first->getDescription() + " " +
485 I->first.second.getName() + "\n";
486 }
487 GenerateError(UndefinedReferences);
488 return;
489 }
490
Chandler Carruth563d4a42007-08-04 01:56:21 +0000491 // Look for intrinsic functions and CallInst that need to be upgraded
492 for (Module::iterator FI = CurrentModule->begin(),
493 FE = CurrentModule->end(); FI != FE; )
494 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
495
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000496 Values.clear(); // Clear out function local definitions
497 Types.clear();
498 CurrentModule = 0;
499 }
500
501 // GetForwardRefForGlobal - Check to see if there is a forward reference
502 // for this global. If so, remove it from the GlobalRefs map and return it.
503 // If not, just return null.
504 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
505 // Check to see if there is a forward reference to this global variable...
506 // if there is, eliminate it and patch the reference to use the new def'n.
507 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
508 GlobalValue *Ret = 0;
509 if (I != GlobalRefs.end()) {
510 Ret = I->second;
511 GlobalRefs.erase(I);
512 }
513 return Ret;
514 }
515
516 bool TypeIsUnresolved(PATypeHolder* PATy) {
517 // If it isn't abstract, its resolved
518 const Type* Ty = PATy->get();
519 if (!Ty->isAbstract())
520 return false;
521 // Traverse the type looking for abstract types. If it isn't abstract then
522 // we don't need to traverse that leg of the type.
523 std::vector<const Type*> WorkList, SeenList;
524 WorkList.push_back(Ty);
525 while (!WorkList.empty()) {
526 const Type* Ty = WorkList.back();
527 SeenList.push_back(Ty);
528 WorkList.pop_back();
529 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
530 // Check to see if this is an unresolved type
531 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
532 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
533 for ( ; I != E; ++I) {
534 if (I->second.get() == OpTy)
535 return true;
536 }
537 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
538 const Type* TheTy = SeqTy->getElementType();
539 if (TheTy->isAbstract() && TheTy != Ty) {
540 std::vector<const Type*>::iterator I = SeenList.begin(),
541 E = SeenList.end();
542 for ( ; I != E; ++I)
543 if (*I == TheTy)
544 break;
545 if (I == E)
546 WorkList.push_back(TheTy);
547 }
548 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
549 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
550 const Type* TheTy = StrTy->getElementType(i);
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
553 E = SeenList.end();
554 for ( ; I != E; ++I)
555 if (*I == TheTy)
556 break;
557 if (I == E)
558 WorkList.push_back(TheTy);
559 }
560 }
561 }
562 }
563 return false;
564 }
565} CurModule;
566
567static struct PerFunctionInfo {
568 Function *CurrentFunction; // Pointer to current function being created
569
570 ValueList Values; // Keep track of #'d definitions
571 unsigned NextValNum;
572 ValueList LateResolveValues;
573 bool isDeclare; // Is this function a forward declararation?
574 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
575 GlobalValue::VisibilityTypes Visibility;
576
577 /// BBForwardRefs - When we see forward references to basic blocks, keep
578 /// track of them here.
579 std::map<ValID, BasicBlock*> BBForwardRefs;
580
581 inline PerFunctionInfo() {
582 CurrentFunction = 0;
583 isDeclare = false;
584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
586 }
587
588 inline void FunctionStart(Function *M) {
589 CurrentFunction = M;
590 NextValNum = 0;
591 }
592
593 void FunctionDone() {
594 // Any forward referenced blocks left?
595 if (!BBForwardRefs.empty()) {
596 GenerateError("Undefined reference to label " +
597 BBForwardRefs.begin()->second->getName());
598 return;
599 }
600
601 // Resolve all forward references now.
602 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
603
604 Values.clear(); // Clear out function local definitions
605 BBForwardRefs.clear();
606 CurrentFunction = 0;
607 isDeclare = false;
608 Linkage = GlobalValue::ExternalLinkage;
609 Visibility = GlobalValue::DefaultVisibility;
610 }
611} CurFun; // Info for the current function...
612
613static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
614
615
616//===----------------------------------------------------------------------===//
617// Code to handle definitions of all the types
618//===----------------------------------------------------------------------===//
619
620static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
621 // Things that have names or are void typed don't get slot numbers
622 if (V->hasName() || (V->getType() == Type::VoidTy))
623 return;
624
625 // In the case of function values, we have to allow for the forward reference
626 // of basic blocks, which are included in the numbering. Consequently, we keep
627 // track of the next insertion location with NextValNum. When a BB gets
628 // inserted, it could change the size of the CurFun.Values vector.
629 if (&ValueTab == &CurFun.Values) {
630 if (ValueTab.size() <= CurFun.NextValNum)
631 ValueTab.resize(CurFun.NextValNum+1);
632 ValueTab[CurFun.NextValNum++] = V;
633 return;
634 }
635 // For all other lists, its okay to just tack it on the back of the vector.
636 ValueTab.push_back(V);
637}
638
639static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
640 switch (D.Type) {
641 case ValID::LocalID: // Is it a numbered definition?
642 // Module constants occupy the lowest numbered slots...
643 if (D.Num < CurModule.Types.size())
644 return CurModule.Types[D.Num];
645 break;
646 case ValID::LocalName: // Is it a named definition?
647 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
648 D.destroy(); // Free old strdup'd memory...
649 return N;
650 }
651 break;
652 default:
653 GenerateError("Internal parser error: Invalid symbol type reference");
654 return 0;
655 }
656
657 // If we reached here, we referenced either a symbol that we don't know about
658 // or an id number that hasn't been read yet. We may be referencing something
659 // forward, so just create an entry to be resolved later and get to it...
660 //
661 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
662
663
664 if (inFunctionScope()) {
665 if (D.Type == ValID::LocalName) {
666 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
667 return 0;
668 } else {
669 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
670 return 0;
671 }
672 }
673
674 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
675 if (I != CurModule.LateResolveTypes.end())
676 return I->second;
677
678 Type *Typ = OpaqueType::get();
679 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
680 return Typ;
681 }
682
683// getExistingVal - Look up the value specified by the provided type and
684// the provided ValID. If the value exists and has already been defined, return
685// it. Otherwise return null.
686//
687static Value *getExistingVal(const Type *Ty, const ValID &D) {
688 if (isa<FunctionType>(Ty)) {
689 GenerateError("Functions are not values and "
690 "must be referenced as pointers");
691 return 0;
692 }
693
694 switch (D.Type) {
695 case ValID::LocalID: { // Is it a numbered definition?
696 // Check that the number is within bounds.
697 if (D.Num >= CurFun.Values.size())
698 return 0;
699 Value *Result = CurFun.Values[D.Num];
700 if (Ty != Result->getType()) {
701 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
702 Result->getType()->getDescription() + "' does not match "
703 "expected type, '" + Ty->getDescription() + "'");
704 return 0;
705 }
706 return Result;
707 }
708 case ValID::GlobalID: { // Is it a numbered definition?
709 if (D.Num >= CurModule.Values.size())
710 return 0;
711 Value *Result = CurModule.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
716 return 0;
717 }
718 return Result;
719 }
720
721 case ValID::LocalName: { // Is it a named definition?
722 if (!inFunctionScope())
723 return 0;
724 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
725 Value *N = SymTab.lookup(D.getName());
726 if (N == 0)
727 return 0;
728 if (N->getType() != Ty)
729 return 0;
730
731 D.destroy(); // Free old strdup'd memory...
732 return N;
733 }
734 case ValID::GlobalName: { // Is it a named definition?
735 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
736 Value *N = SymTab.lookup(D.getName());
737 if (N == 0)
738 return 0;
739 if (N->getType() != Ty)
740 return 0;
741
742 D.destroy(); // Free old strdup'd memory...
743 return N;
744 }
745
746 // Check to make sure that "Ty" is an integral type, and that our
747 // value will fit into the specified type...
748 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000749 if (!isa<IntegerType>(Ty) ||
750 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000751 GenerateError("Signed integral constant '" +
752 itostr(D.ConstPool64) + "' is invalid for type '" +
753 Ty->getDescription() + "'");
754 return 0;
755 }
756 return ConstantInt::get(Ty, D.ConstPool64, true);
757
758 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000759 if (isa<IntegerType>(Ty) &&
760 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000761 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000762
763 if (!isa<IntegerType>(Ty) ||
764 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
765 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
766 "' is invalid or out of range for type '" +
767 Ty->getDescription() + "'");
768 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000769 }
Chris Lattner59363a32008-02-19 04:36:25 +0000770 // This is really a signed reference. Transmogrify.
771 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000772
773 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000774 if (!Ty->isFloatingPoint() ||
775 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000776 GenerateError("FP constant invalid for type");
777 return 0;
778 }
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000779 // Lexer has no type info, so builds all float and double FP constants
780 // as double. Fix this here. Long double does not need this.
781 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
782 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000783 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
784 return ConstantFP::get(Ty, *D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000785
786 case ValID::ConstNullVal: // Is it a null value?
787 if (!isa<PointerType>(Ty)) {
788 GenerateError("Cannot create a a non pointer null");
789 return 0;
790 }
791 return ConstantPointerNull::get(cast<PointerType>(Ty));
792
793 case ValID::ConstUndefVal: // Is it an undef value?
794 return UndefValue::get(Ty);
795
796 case ValID::ConstZeroVal: // Is it a zero value?
797 return Constant::getNullValue(Ty);
798
799 case ValID::ConstantVal: // Fully resolved constant?
800 if (D.ConstantValue->getType() != Ty) {
801 GenerateError("Constant expression type different from required type");
802 return 0;
803 }
804 return D.ConstantValue;
805
806 case ValID::InlineAsmVal: { // Inline asm expression
807 const PointerType *PTy = dyn_cast<PointerType>(Ty);
808 const FunctionType *FTy =
809 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
810 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
811 GenerateError("Invalid type for asm constraint string");
812 return 0;
813 }
814 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
815 D.IAD->HasSideEffects);
816 D.destroy(); // Free InlineAsmDescriptor.
817 return IA;
818 }
819 default:
820 assert(0 && "Unhandled case!");
821 return 0;
822 } // End of switch
823
824 assert(0 && "Unhandled case!");
825 return 0;
826}
827
828// getVal - This function is identical to getExistingVal, except that if a
829// value is not already defined, it "improvises" by creating a placeholder var
830// that looks and acts just like the requested variable. When the value is
831// defined later, all uses of the placeholder variable are replaced with the
832// real thing.
833//
834static Value *getVal(const Type *Ty, const ValID &ID) {
835 if (Ty == Type::LabelTy) {
836 GenerateError("Cannot use a basic block here");
837 return 0;
838 }
839
840 // See if the value has already been defined.
841 Value *V = getExistingVal(Ty, ID);
842 if (V) return V;
843 if (TriggerError) return 0;
844
845 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
846 GenerateError("Invalid use of a composite type");
847 return 0;
848 }
849
850 // If we reached here, we referenced either a symbol that we don't know about
851 // or an id number that hasn't been read yet. We may be referencing something
852 // forward, so just create an entry to be resolved later and get to it...
853 //
854 switch (ID.Type) {
855 case ValID::GlobalName:
856 case ValID::GlobalID: {
857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
858 if (!PTy) {
859 GenerateError("Invalid type for reference to global" );
860 return 0;
861 }
862 const Type* ElTy = PTy->getElementType();
863 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
864 V = new Function(FTy, GlobalValue::ExternalLinkage);
865 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000866 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
867 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000868 break;
869 }
870 default:
871 V = new Argument(Ty);
872 }
873
874 // Remember where this forward reference came from. FIXME, shouldn't we try
875 // to recycle these things??
876 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000877 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000878
879 if (inFunctionScope())
880 InsertValue(V, CurFun.LateResolveValues);
881 else
882 InsertValue(V, CurModule.LateResolveValues);
883 return V;
884}
885
886/// defineBBVal - This is a definition of a new basic block with the specified
887/// identifier which must be the same as CurFun.NextValNum, if its numeric.
888static BasicBlock *defineBBVal(const ValID &ID) {
889 assert(inFunctionScope() && "Can't get basic block at global scope!");
890
891 BasicBlock *BB = 0;
892
893 // First, see if this was forward referenced
894
895 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
896 if (BBI != CurFun.BBForwardRefs.end()) {
897 BB = BBI->second;
898 // The forward declaration could have been inserted anywhere in the
899 // function: insert it into the correct place now.
900 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
901 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
902
903 // We're about to erase the entry, save the key so we can clean it up.
904 ValID Tmp = BBI->first;
905
906 // Erase the forward ref from the map as its no longer "forward"
907 CurFun.BBForwardRefs.erase(ID);
908
909 // The key has been removed from the map but so we don't want to leave
910 // strdup'd memory around so destroy it too.
911 Tmp.destroy();
912
913 // If its a numbered definition, bump the number and set the BB value.
914 if (ID.Type == ValID::LocalID) {
915 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
916 InsertValue(BB);
917 }
918
919 ID.destroy();
920 return BB;
921 }
922
923 // We haven't seen this BB before and its first mention is a definition.
924 // Just create it and return it.
925 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
926 BB = new BasicBlock(Name, CurFun.CurrentFunction);
927 if (ID.Type == ValID::LocalID) {
928 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
929 InsertValue(BB);
930 }
931
932 ID.destroy(); // Free strdup'd memory
933 return BB;
934}
935
936/// getBBVal - get an existing BB value or create a forward reference for it.
937///
938static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
940
941 BasicBlock *BB = 0;
942
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
945 BB = BBI->second;
946 } if (ID.Type == ValID::LocalName) {
947 std::string Name = ID.getName();
948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000949 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
952 else
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000955 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
960 else
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
964 }
965 } else {
966 GenerateError("Illegal label reference " + ID.getName());
967 return 0;
968 }
969
970 // If its already been defined, return it now.
971 if (BB) {
972 ID.destroy(); // Free strdup'd memory.
973 return BB;
974 }
975
976 // Otherwise, this block has not been seen before, create it.
977 std::string Name;
978 if (ID.Type == ValID::LocalName)
979 Name = ID.getName();
980 BB = new BasicBlock(Name, CurFun.CurrentFunction);
981
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
984
985 return BB;
986}
987
988
989//===----------------------------------------------------------------------===//
990// Code to handle forward references in instructions
991//===----------------------------------------------------------------------===//
992//
993// This code handles the late binding needed with statements that reference
994// values not defined yet... for example, a forward branch, or the PHI node for
995// a loop body.
996//
997// This keeps a table (CurFun.LateResolveValues) of all such forward references
998// and back patchs after we are done.
999//
1000
1001// ResolveDefinitions - If we could not resolve some defs at parsing
1002// time (forward branches, phi functions for loops, etc...) resolve the
1003// defs now...
1004//
1005static void
1006ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
1011
1012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1015
1016 ValID &DID = PHI->second.first;
1017
1018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1019 if (TriggerError)
1020 return;
1021 if (TheRealValue) {
1022 V->replaceAllUsesWith(TheRealValue);
1023 delete V;
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1027 // resolver table
1028 InsertValue(V, *FutureLateResolvers);
1029 } else {
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
1034 return;
1035 } else {
1036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1040 return;
1041 }
1042 }
1043 }
1044 LateResolvers.clear();
1045}
1046
1047// ResolveTypeTo - A brand new type was just declared. This means that (if
1048// name is not null) things referencing Name can be resolved. Otherwise, things
1049// refering to the number can be resolved. Do this now.
1050//
1051static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1052 ValID D;
1053 if (Name)
1054 D = ValID::createLocalName(*Name);
1055 else
1056 D = ValID::createLocalID(CurModule.Types.size());
1057
1058 std::map<ValID, PATypeHolder>::iterator I =
1059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
1061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1062 CurModule.LateResolveTypes.erase(I);
1063 }
1064}
1065
1066// setValueName - Set the specified value to the name given. The name may be
1067// null potentially, in which case this is a noop. The string passed in is
1068// assumed to be a malloc'd string buffer, and is free'd by this function.
1069//
1070static void setValueName(Value *V, std::string *NameStr) {
1071 if (!NameStr) return;
1072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
1074
1075 if (V->getType() == Type::VoidTy) {
1076 GenerateError("Can't assign name '" + Name+"' to value with void type");
1077 return;
1078 }
1079
1080 assert(inFunctionScope() && "Must be in function scope!");
1081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
1083 GenerateError("Redefinition of value '" + Name + "' of type '" +
1084 V->getType()->getDescription() + "'");
1085 return;
1086 }
1087
1088 // Set the name.
1089 V->setName(Name);
1090}
1091
1092/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093/// this is a declaration, otherwise it is a definition.
1094static GlobalVariable *
1095ParseGlobalVariable(std::string *NameStr,
1096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
1098 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001101 if (isa<FunctionType>(Ty)) {
1102 GenerateError("Cannot declare global vars of function type");
1103 return 0;
1104 }
1105
Christopher Lamb0a243582007-12-11 09:02:08 +00001106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001107
1108 std::string Name;
1109 if (NameStr) {
1110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
1112 }
1113
1114 // See if this global value was forward referenced. If so, recycle the
1115 // object.
1116 ValID ID;
1117 if (!Name.empty()) {
1118 ID = ValID::createGlobalName(Name);
1119 } else {
1120 ID = ValID::createGlobalID(CurModule.Values.size());
1121 }
1122
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
1131 GV->setVisibility(Visibility);
1132 GV->setConstant(isConstantGlobal);
1133 GV->setThreadLocal(IsThreadLocal);
1134 InsertValue(GV, CurModule.Values);
1135 return GV;
1136 }
1137
1138 // If this global has a name
1139 if (!Name.empty()) {
1140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1151 return 0;
1152 }
1153 }
1154
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001159 GV->setVisibility(Visibility);
1160 InsertValue(GV, CurModule.Values);
1161 return GV;
1162}
1163
1164// setTypeName - Set the specified type to the name given. The name may be
1165// null potentially, in which case this is a noop. The string passed in is
1166// assumed to be a malloc'd string buffer, and is freed by this function.
1167//
1168// This function returns true if the type has already been defined, but is
1169// allowed to be redefined in the specified context. If the name is a new name
1170// for the type plane, it is inserted and false is returned.
1171static bool setTypeName(const Type *T, std::string *NameStr) {
1172 assert(!inFunctionScope() && "Can't give types function-local names!");
1173 if (NameStr == 0) return false;
1174
1175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
1177
1178 // We don't allow assigning names to void type
1179 if (T == Type::VoidTy) {
1180 GenerateError("Can't assign name '" + Name + "' to the void type");
1181 return false;
1182 }
1183
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1186
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1189 assert(Existing && "Conflict but no matching type?!");
1190
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1196 return true;
1197 }
1198
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1204
1205 // Any other kind of (non-equivalent) redefinition is an error.
1206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1207 T->getDescription() + "'");
1208 }
1209
1210 return false;
1211}
1212
1213//===----------------------------------------------------------------------===//
1214// Code for handling upreferences in type names...
1215//
1216
1217// TypeContains - Returns true if Ty directly contains E in it.
1218//
1219static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1222}
1223
1224namespace {
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1229
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1233
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1237
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1240 };
1241}
1242
1243// UpRefs - A list of the outstanding upreferences that need to be resolved.
1244static std::vector<UpRefRecord> UpRefs;
1245
1246/// HandleUpRefs - Every time we finish a new layer of types, this function is
1247/// called. It loops through the UpRefs vector, which is a list of the
1248/// currently active types. For each type, if the up reference is contained in
1249/// the newly completed type, we decrement the level count. When the level
1250/// count reaches zero, the upreferenced type is the type that is passed in:
1251/// thus we can complete the cycle.
1252///
1253static PATypeHolder HandleUpRefs(const Type *ty) {
1254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1257
1258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1262
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1266 // this variable.
1267 OpaqueType *TypeToResolve = 0;
1268
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1281 } else {
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1288 }
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1291 }
1292 }
1293 }
1294
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1300 }
1301
1302 return Ty;
1303}
1304
1305//===----------------------------------------------------------------------===//
1306// RunVMAsmParser - Define an interface to this parser
1307//===----------------------------------------------------------------------===//
1308//
1309static Module* RunParser(Module * M);
1310
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001311Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1312 InitLLLexer(MB);
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1314 FreeLexer();
1315 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001316}
1317
1318
Chris Lattner59363a32008-02-19 04:36:25 +00001319
1320/* Enabling traces. */
1321#ifndef YYDEBUG
1322# define YYDEBUG 0
1323#endif
1324
1325/* Enabling verbose error messages. */
1326#ifdef YYERROR_VERBOSE
1327# undef YYERROR_VERBOSE
1328# define YYERROR_VERBOSE 1
1329#else
1330# define YYERROR_VERBOSE 0
1331#endif
1332
1333/* Enabling the token table. */
1334#ifndef YYTOKEN_TABLE
1335# define YYTOKEN_TABLE 0
1336#endif
1337
1338#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339typedef union YYSTYPE
Dale Johannesena79ecf32008-02-20 21:15:43 +00001340#line 952 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00001341{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
1344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
1347 llvm::Constant *ConstVal;
1348
1349 const llvm::Type *PrimType;
1350 std::list<llvm::PATypeHolder> *TypeList;
1351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
1353 std::vector<llvm::Value*> *ValueList;
1354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001357 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001358
1359 // Represent the RHS of PHI node
1360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
1362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1363 std::vector<llvm::Constant*> *ConstVector;
1364
1365 llvm::GlobalValue::LinkageTypes Linkage;
1366 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesend915ee52008-02-19 21:40:51 +00001367 llvm::ParameterAttributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001368 llvm::APInt *APIntVal;
1369 int64_t SInt64Val;
1370 uint64_t UInt64Val;
1371 int SIntVal;
1372 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001373 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001374 bool BoolVal;
1375
1376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
1378
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
Chris Lattner59363a32008-02-19 04:36:25 +00001386}
Devang Pateleb293342008-02-20 19:13:10 +00001387/* Line 193 of yacc.c. */
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +00001388#line 1389 "llvmAsmParser.tab.c"
Chris Lattner59363a32008-02-19 04:36:25 +00001389 YYSTYPE;
1390# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391# define YYSTYPE_IS_DECLARED 1
1392# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001393#endif
1394
1395
1396
Chris Lattner59363a32008-02-19 04:36:25 +00001397/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001398
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001399
Chris Lattner59363a32008-02-19 04:36:25 +00001400/* Line 216 of yacc.c. */
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +00001401#line 1402 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001402
Chris Lattner59363a32008-02-19 04:36:25 +00001403#ifdef short
1404# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405#endif
1406
Chris Lattner59363a32008-02-19 04:36:25 +00001407#ifdef YYTYPE_UINT8
1408typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409#else
Chris Lattner59363a32008-02-19 04:36:25 +00001410typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411#endif
1412
Chris Lattner59363a32008-02-19 04:36:25 +00001413#ifdef YYTYPE_INT8
1414typedef YYTYPE_INT8 yytype_int8;
1415#elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417typedef signed char yytype_int8;
1418#else
1419typedef short int yytype_int8;
1420#endif
1421
1422#ifdef YYTYPE_UINT16
1423typedef YYTYPE_UINT16 yytype_uint16;
1424#else
1425typedef unsigned short int yytype_uint16;
1426#endif
1427
1428#ifdef YYTYPE_INT16
1429typedef YYTYPE_INT16 yytype_int16;
1430#else
1431typedef short int yytype_int16;
1432#endif
1433
1434#ifndef YYSIZE_T
1435# ifdef __SIZE_TYPE__
1436# define YYSIZE_T __SIZE_TYPE__
1437# elif defined size_t
1438# define YYSIZE_T size_t
1439# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442# define YYSIZE_T size_t
1443# else
1444# define YYSIZE_T unsigned int
1445# endif
1446#endif
1447
1448#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1449
1450#ifndef YY_
Devang Pateleb293342008-02-20 19:13:10 +00001451# if defined YYENABLE_NLS && YYENABLE_NLS
Chris Lattner59363a32008-02-19 04:36:25 +00001452# if ENABLE_NLS
1453# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454# define YY_(msgid) dgettext ("bison-runtime", msgid)
1455# endif
1456# endif
1457# ifndef YY_
1458# define YY_(msgid) msgid
1459# endif
1460#endif
1461
1462/* Suppress unused-variable warnings by "using" E. */
1463#if ! defined lint || defined __GNUC__
1464# define YYUSE(e) ((void) (e))
1465#else
1466# define YYUSE(e) /* empty */
1467#endif
1468
1469/* Identity function, used to suppress warnings about constant conditions. */
1470#ifndef lint
1471# define YYID(n) (n)
1472#else
1473#if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1475static int
1476YYID (int i)
1477#else
1478static int
1479YYID (i)
1480 int i;
1481#endif
1482{
1483 return i;
1484}
1485#endif
1486
1487#if ! defined yyoverflow || YYERROR_VERBOSE
1488
1489/* The parser invokes alloca or malloc; define the necessary symbols. */
1490
1491# ifdef YYSTACK_USE_ALLOCA
1492# if YYSTACK_USE_ALLOCA
1493# ifdef __GNUC__
1494# define YYSTACK_ALLOC __builtin_alloca
1495# elif defined __BUILTIN_VA_ARG_INCR
1496# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1497# elif defined _AIX
1498# define YYSTACK_ALLOC __alloca
1499# elif defined _MSC_VER
1500# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501# define alloca _alloca
1502# else
1503# define YYSTACK_ALLOC alloca
1504# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1507# ifndef _STDLIB_H
1508# define _STDLIB_H 1
1509# endif
1510# endif
1511# endif
1512# endif
1513# endif
1514
1515# ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518# ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1524# endif
1525# else
1526# define YYSTACK_ALLOC YYMALLOC
1527# define YYSTACK_FREE YYFREE
1528# ifndef YYSTACK_ALLOC_MAXIMUM
1529# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1530# endif
1531# if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1535# ifndef _STDLIB_H
1536# define _STDLIB_H 1
1537# endif
1538# endif
1539# ifndef YYMALLOC
1540# define YYMALLOC malloc
1541# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1544# endif
1545# endif
1546# ifndef YYFREE
1547# define YYFREE free
1548# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550void free (void *); /* INFRINGES ON USER NAME SPACE */
1551# endif
1552# endif
1553# endif
1554#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1555
1556
1557#if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1560
1561/* A type that is properly aligned for any stack member. */
1562union yyalloc
1563{
1564 yytype_int16 yyss;
1565 YYSTYPE yyvs;
1566 };
1567
1568/* The size of the maximum gap between one aligned stack and the next. */
1569# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1570
1571/* The size of an array large to enough to hold all stacks, each with
1572 N elements. */
1573# define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1576
1577/* Copy COUNT objects from FROM to TO. The source and destination do
1578 not overlap. */
1579# ifndef YYCOPY
1580# if defined __GNUC__ && 1 < __GNUC__
1581# define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1583# else
1584# define YYCOPY(To, From, Count) \
1585 do \
1586 { \
1587 YYSIZE_T yyi; \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1590 } \
1591 while (YYID (0))
1592# endif
1593# endif
1594
1595/* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1599 stack. */
1600# define YYSTACK_RELOCATE(Stack) \
1601 do \
1602 { \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1608 } \
1609 while (YYID (0))
1610
1611#endif
1612
1613/* YYFINAL -- State number of the termination state. */
1614#define YYFINAL 43
1615/* YYLAST -- Last index in YYTABLE. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00001616#define YYLAST 2018
Chris Lattner59363a32008-02-19 04:36:25 +00001617
1618/* YYNTOKENS -- Number of terminals. */
Devang Patel3b8849c2008-02-19 22:27:01 +00001619#define YYNTOKENS 165
Chris Lattner59363a32008-02-19 04:36:25 +00001620/* YYNNTS -- Number of nonterminals. */
1621#define YYNNTS 84
1622/* YYNRULES -- Number of rules. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00001623#define YYNRULES 320
Chris Lattner59363a32008-02-19 04:36:25 +00001624/* YYNRULES -- Number of states. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00001625#define YYNSTATES 626
Chris Lattner59363a32008-02-19 04:36:25 +00001626
1627/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628#define YYUNDEFTOK 2
Devang Patel3b8849c2008-02-19 22:27:01 +00001629#define YYMAXUTOK 405
Chris Lattner59363a32008-02-19 04:36:25 +00001630
1631#define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1633
1634/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635static const yytype_uint8 yytranslate[] =
1636{
1637 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001641 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001643 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001646 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
Chris Lattner59363a32008-02-19 04:36:25 +00001647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001649 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Devang Patel3b8849c2008-02-19 22:27:01 +00001677 145, 146, 147, 148, 149, 150
Chris Lattner59363a32008-02-19 04:36:25 +00001678};
1679
1680#if YYDEBUG
1681/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1682 YYRHS. */
1683static const yytype_uint16 yyprhs[] =
1684{
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001696 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1697 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1698 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1699 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1700 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1701 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1702 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1704 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1705 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1706 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1707 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1708 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1709 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1710 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
1711 720, 726, 728, 730, 732, 734, 736, 738, 741, 744,
1712 747, 751, 754, 755, 757, 760, 763, 767, 777, 787,
1713 796, 811, 813, 815, 822, 828, 831, 838, 846, 851,
1714 856, 863, 870, 871, 872, 876, 879, 881, 887, 893,
1715 900, 907, 912, 919, 924, 929, 936, 943, 946, 955,
1716 957, 959, 960, 964, 971, 975, 982, 985, 991, 999,
1717 1005
Chris Lattner59363a32008-02-19 04:36:25 +00001718};
1719
1720/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1721static const yytype_int16 yyrhs[] =
1722{
Devang Patel3b8849c2008-02-19 22:27:01 +00001723 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
Chris Lattner59363a32008-02-19 04:36:25 +00001724 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1725 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1726 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1727 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1728 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1729 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1730 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1731 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1732 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1733 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1734 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patel3b8849c2008-02-19 22:27:01 +00001735 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1736 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1737 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
Chris Lattner59363a32008-02-19 04:36:25 +00001738 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00001739 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1740 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
Chris Lattner59363a32008-02-19 04:36:25 +00001741 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1742 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
Devang Patel3b8849c2008-02-19 22:27:01 +00001743 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1744 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001745 143, -1, 144, -1, 53, 4, -1, -1, 188, 187,
1746 -1, 138, -1, 141, -1, 137, -1, 136, -1, 145,
1747 -1, 146, -1, -1, 190, 189, -1, -1, 147, 22,
1748 -1, -1, 53, 4, -1, -1, 154, 53, 4, -1,
1749 34, 22, -1, -1, 194, -1, -1, 154, 197, 196,
1750 -1, 194, -1, 53, 4, -1, 11, -1, 12, -1,
1751 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1752 49, -1, 198, -1, 199, 175, 155, -1, 233, -1,
1753 156, 4, -1, 199, 151, 203, 152, 190, -1, 10,
1754 151, 203, 152, 190, -1, 157, 4, 158, 199, 159,
1755 -1, 160, 4, 158, 199, 161, -1, 162, 204, 163,
1756 -1, 162, 163, -1, 160, 162, 204, 163, 161, -1,
1757 160, 162, 163, 161, -1, 199, 188, -1, 199, -1,
1758 10, -1, 200, -1, 202, 154, 200, -1, 202, -1,
1759 202, 154, 39, -1, 39, -1, -1, 199, -1, 204,
1760 154, 199, -1, 199, 157, 207, 159, -1, 199, 157,
1761 159, -1, 199, 164, 22, -1, 199, 160, 207, 161,
1762 -1, 199, 162, 207, 163, -1, 199, 162, 163, -1,
1763 199, 160, 162, 207, 163, 161, -1, 199, 160, 162,
1764 163, 161, -1, 199, 40, -1, 199, 41, -1, 199,
1765 233, -1, 199, 206, -1, 199, 25, -1, 171, 3,
1766 -1, 171, 5, -1, 171, 4, -1, 171, 6, -1,
1767 11, 26, -1, 11, 27, -1, 172, 9, -1, 168,
1768 151, 205, 38, 199, 152, -1, 116, 151, 205, 244,
1769 152, -1, 130, 151, 205, 154, 205, 154, 205, 152,
1770 -1, 166, 151, 205, 154, 205, 152, -1, 167, 151,
1771 205, 154, 205, 152, -1, 89, 169, 151, 205, 154,
1772 205, 152, -1, 90, 170, 151, 205, 154, 205, 152,
1773 -1, 132, 151, 205, 154, 205, 152, -1, 133, 151,
1774 205, 154, 205, 154, 205, 152, -1, 134, 151, 205,
1775 154, 205, 154, 205, 152, -1, 207, 154, 205, -1,
1776 205, -1, 32, -1, 33, -1, 37, -1, -1, 201,
1777 233, -1, 122, 151, 210, 38, 199, 152, -1, 212,
1778 -1, -1, 213, -1, 212, 213, -1, -1, 31, 214,
1779 229, -1, -1, 30, 215, 230, -1, 59, 58, 219,
1780 -1, 176, 18, 199, -1, 176, 18, 10, -1, -1,
1781 178, 182, 209, 208, 205, 175, 216, 196, -1, -1,
1782 178, 180, 182, 209, 208, 205, 175, 217, 196, -1,
1783 -1, 178, 181, 182, 209, 208, 199, 175, 218, 196,
1784 -1, 178, 182, 35, 185, 210, -1, 51, 220, -1,
1785 55, 153, 221, -1, 22, -1, 52, 153, 22, -1,
1786 67, 153, 22, -1, 157, 222, 159, -1, 222, 154,
1787 22, -1, 22, -1, -1, 223, 154, 199, 188, 174,
1788 -1, 199, 188, 174, -1, 223, -1, 223, 154, 39,
1789 -1, 39, -1, -1, 186, 201, 177, 151, 224, 152,
1790 190, 195, 192, 191, -1, 28, -1, 162, -1, 184,
1791 182, 225, 226, -1, 29, -1, 163, -1, 236, 228,
1792 -1, 183, 182, 225, -1, -1, 60, -1, 3, -1,
1793 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1794 41, -1, 25, -1, 160, 207, 161, -1, 206, -1,
1795 58, 231, 22, 154, 22, -1, 7, -1, 8, -1,
1796 173, -1, 177, -1, 233, -1, 232, -1, 199, 234,
1797 -1, 236, 237, -1, 227, 237, -1, 238, 176, 239,
1798 -1, 238, 241, -1, -1, 21, -1, 68, 235, -1,
1799 68, 10, -1, 69, 17, 234, -1, 69, 11, 234,
1800 154, 17, 234, 154, 17, 234, -1, 70, 171, 234,
1801 154, 17, 234, 157, 240, 159, -1, 70, 171, 234,
1802 154, 17, 234, 157, 159, -1, 71, 186, 201, 234,
1803 151, 243, 152, 190, 38, 17, 234, 72, 17, 234,
1804 -1, 72, -1, 73, -1, 240, 171, 232, 154, 17,
1805 234, -1, 171, 232, 154, 17, 234, -1, 176, 246,
1806 -1, 199, 157, 234, 154, 234, 159, -1, 242, 154,
1807 157, 234, 154, 234, 159, -1, 199, 188, 234, 188,
1808 -1, 17, 188, 234, 188, -1, 243, 154, 199, 188,
1809 234, 188, -1, 243, 154, 17, 188, 234, 188, -1,
1810 -1, -1, 244, 154, 235, -1, 57, 56, -1, 56,
1811 -1, 166, 199, 234, 154, 234, -1, 167, 199, 234,
1812 154, 234, -1, 89, 169, 199, 234, 154, 234, -1,
1813 90, 170, 199, 234, 154, 234, -1, 168, 235, 38,
1814 199, -1, 130, 235, 154, 235, 154, 235, -1, 131,
1815 235, 154, 199, -1, 132, 235, 154, 235, -1, 133,
1816 235, 154, 235, 154, 235, -1, 134, 235, 154, 235,
1817 154, 235, -1, 129, 242, -1, 245, 186, 201, 234,
1818 151, 243, 152, 190, -1, 248, -1, 36, -1, -1,
1819 111, 199, 193, -1, 111, 199, 154, 11, 234, 193,
1820 -1, 112, 199, 193, -1, 112, 199, 154, 11, 234,
1821 193, -1, 113, 235, -1, 247, 114, 199, 234, 193,
1822 -1, 247, 115, 235, 154, 199, 234, 193, -1, 135,
1823 199, 173, 154, 4, -1, 116, 199, 234, 244, -1
Chris Lattner59363a32008-02-19 04:36:25 +00001824};
1825
1826/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1827static const yytype_uint16 yyrline[] =
1828{
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +00001829 0, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
1830 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115,
1831 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1116, 1116, 1119,
1832 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1127,
1833 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132,
1834 1132, 1133, 1133, 1134, 1135, 1140, 1141, 1141, 1141, 1141,
1835 1141, 1143, 1143, 1143, 1144, 1144, 1146, 1147, 1151, 1155,
1836 1160, 1160, 1162, 1163, 1168, 1174, 1175, 1176, 1177, 1178,
1837 1182, 1183, 1184, 1188, 1189, 1190, 1191, 1195, 1196, 1197,
1838 1201, 1202, 1203, 1204, 1205, 1209, 1210, 1211, 1214, 1215,
1839 1216, 1217, 1218, 1219, 1220, 1227, 1228, 1229, 1230, 1231,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001840 1232, 1233, 1234, 1235, 1236, 1239, 1240, 1245, 1246, 1247,
1841 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268, 1274,
1842 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318, 1318,
1843 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336, 1341,
1844 1349, 1379, 1404, 1409, 1419, 1429, 1433, 1443, 1450, 1459,
1845 1466, 1471, 1476, 1483, 1484, 1491, 1498, 1506, 1512, 1524,
1846 1552, 1568, 1595, 1623, 1649, 1669, 1695, 1715, 1727, 1734,
1847 1800, 1810, 1820, 1826, 1836, 1842, 1852, 1857, 1862, 1875,
1848 1887, 1909, 1917, 1923, 1934, 1939, 1944, 1950, 1956, 1965,
1849 1969, 1977, 1977, 1980, 1980, 1983, 1995, 2016, 2021, 2029,
1850 2030, 2034, 2034, 2038, 2038, 2041, 2044, 2068, 2080, 2079,
1851 2091, 2090, 2100, 2099, 2110, 2150, 2153, 2159, 2169, 2173,
1852 2178, 2180, 2185, 2190, 2199, 2209, 2220, 2224, 2233, 2242,
1853 2247, 2381, 2381, 2383, 2392, 2392, 2394, 2399, 2411, 2415,
1854 2420, 2424, 2428, 2432, 2436, 2440, 2444, 2448, 2452, 2477,
1855 2481, 2491, 2495, 2499, 2504, 2511, 2511, 2517, 2526, 2530,
1856 2539, 2548, 2557, 2561, 2568, 2572, 2576, 2581, 2591, 2610,
1857 2619, 2710, 2714, 2721, 2732, 2745, 2755, 2766, 2776, 2787,
1858 2795, 2805, 2812, 2815, 2816, 2823, 2827, 2832, 2848, 2865,
1859 2879, 2893, 2905, 2913, 2920, 2926, 2932, 2938, 2953, 3051,
1860 3056, 3060, 3067, 3074, 3082, 3089, 3097, 3105, 3119, 3136,
1861 3144
Chris Lattner59363a32008-02-19 04:36:25 +00001862};
1863#endif
1864
1865#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1866/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1867 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1868static const char *const yytname[] =
1869{
1870 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1871 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1872 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1873 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1874 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1875 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1876 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1877 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1878 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1879 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1880 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1881 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1882 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1883 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1884 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1885 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1886 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1887 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1888 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1889 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
Devang Patel3b8849c2008-02-19 22:27:01 +00001890 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1891 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1892 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1893 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1894 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1895 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1896 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1897 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Chris Lattner59363a32008-02-19 04:36:25 +00001898 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1899 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1900 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1901 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1902 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1903 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1904 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1905 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1906 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1907 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1908 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1909 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1910 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1911 "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
1912 "OptVolatile", "MemoryInst", 0
1913};
1914#endif
1915
1916# ifdef YYPRINT
1917/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1918 token YYLEX-NUM. */
1919static const yytype_uint16 yytoknum[] =
1920{
1921 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1922 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1923 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1924 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1925 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1926 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1927 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1928 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1929 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1930 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1931 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1932 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1933 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1934 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1935 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel3b8849c2008-02-19 22:27:01 +00001936 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1937 60, 62, 123, 125, 99
Chris Lattner59363a32008-02-19 04:36:25 +00001938};
1939# endif
1940
1941/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1942static const yytype_uint8 yyr1[] =
1943{
Devang Patel3b8849c2008-02-19 22:27:01 +00001944 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1945 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
Chris Lattner59363a32008-02-19 04:36:25 +00001946 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
Devang Patel3b8849c2008-02-19 22:27:01 +00001947 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1948 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1949 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1950 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1951 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1952 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1953 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1954 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001955 187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
1956 189, 189, 189, 190, 190, 191, 191, 192, 192, 193,
1957 193, 194, 195, 195, 196, 196, 197, 197, 198, 198,
1958 198, 198, 198, 198, 198, 199, 199, 199, 199, 199,
1959 199, 199, 199, 199, 199, 199, 199, 199, 200, 201,
1960 201, 202, 202, 203, 203, 203, 203, 204, 204, 205,
Devang Patel3b8849c2008-02-19 22:27:01 +00001961 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001962 205, 205, 205, 205, 205, 205, 205, 205, 205, 206,
1963 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1964 207, 208, 208, 209, 209, 210, 210, 211, 211, 212,
1965 212, 214, 213, 215, 213, 213, 213, 213, 216, 213,
1966 217, 213, 218, 213, 213, 213, 213, 219, 220, 220,
1967 221, 222, 222, 222, 223, 223, 224, 224, 224, 224,
1968 225, 226, 226, 227, 228, 228, 229, 230, 231, 231,
Devang Patel3b8849c2008-02-19 22:27:01 +00001969 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001970 232, 233, 233, 233, 233, 234, 234, 235, 236, 236,
1971 237, 238, 238, 238, 239, 239, 239, 239, 239, 239,
1972 239, 239, 239, 240, 240, 241, 242, 242, 243, 243,
1973 243, 243, 243, 244, 244, 245, 245, 246, 246, 246,
1974 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
1975 247, 247, 248, 248, 248, 248, 248, 248, 248, 248,
1976 248
Chris Lattner59363a32008-02-19 04:36:25 +00001977};
1978
1979/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1980static const yytype_uint8 yyr2[] =
1981{
1982 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1983 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1986 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1987 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1988 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1989 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1990 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1991 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1992 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001993 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1994 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1995 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1996 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
1997 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
1998 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
1999 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2000 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2001 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2002 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2003 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2004 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2005 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2006 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2007 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2008 5, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2009 3, 2, 0, 1, 2, 2, 3, 9, 9, 8,
2010 14, 1, 1, 6, 5, 2, 6, 7, 4, 4,
2011 6, 6, 0, 0, 3, 2, 1, 5, 5, 6,
2012 6, 4, 6, 4, 4, 6, 6, 2, 8, 1,
2013 1, 0, 3, 6, 3, 6, 2, 5, 7, 5,
2014 4
Chris Lattner59363a32008-02-19 04:36:25 +00002015};
2016
2017/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2018 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2019 means the default is an error. */
2020static const yytype_uint16 yydefact[] =
2021{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002022 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2023 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2024 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
Chris Lattner59363a32008-02-19 04:36:25 +00002025 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002026 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
2027 92, 93, 94, 83, 272, 212, 272, 0, 0, 233,
2028 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2029 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2030 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
2031 273, 269, 69, 244, 245, 246, 268, 228, 229, 232,
2032 0, 166, 149, 0, 0, 0, 0, 155, 167, 0,
2033 0, 166, 0, 0, 0, 97, 96, 0, 201, 202,
2034 0, 0, 99, 100, 101, 102, 103, 0, 247, 0,
2035 311, 271, 0, 230, 165, 115, 161, 163, 0, 0,
2036 0, 0, 0, 0, 154, 0, 0, 147, 0, 0,
2037 160, 0, 159, 0, 224, 138, 139, 140, 143, 142,
2038 141, 0, 0, 67, 67, 104, 0, 241, 242, 243,
2039 310, 296, 0, 0, 0, 0, 98, 281, 282, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00002040 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2041 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2042 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2043 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002044 0, 0, 270, 98, 285, 0, 309, 231, 158, 0,
2045 123, 67, 67, 157, 0, 168, 0, 123, 67, 67,
2046 0, 205, 186, 187, 182, 184, 183, 185, 188, 181,
2047 177, 178, 0, 0, 0, 0, 0, 0, 0, 0,
2048 0, 0, 0, 0, 0, 0, 180, 179, 218, 0,
2049 295, 275, 67, 274, 0, 0, 55, 0, 0, 29,
Devang Patel3b8849c2008-02-19 22:27:01 +00002050 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2051 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002052 43, 44, 45, 46, 47, 48, 0, 129, 129, 316,
2053 67, 67, 307, 0, 0, 0, 0, 0, 67, 67,
2054 67, 0, 0, 0, 0, 0, 106, 108, 107, 105,
2055 109, 110, 111, 112, 113, 116, 164, 162, 151, 152,
2056 153, 156, 66, 150, 220, 222, 0, 0, 0, 0,
2057 0, 0, 0, 0, 170, 200, 0, 0, 0, 174,
2058 0, 171, 0, 0, 0, 134, 239, 250, 251, 252,
2059 257, 253, 254, 255, 256, 248, 0, 259, 266, 265,
2060 267, 0, 276, 0, 0, 67, 67, 0, 312, 0,
2061 314, 293, 0, 0, 0, 0, 0, 0, 0, 0,
2062 0, 0, 0, 0, 67, 0, 114, 120, 119, 117,
2063 118, 121, 122, 124, 134, 134, 0, 0, 0, 293,
2064 0, 0, 0, 0, 0, 169, 155, 167, 0, 172,
2065 173, 0, 0, 0, 0, 219, 238, 115, 236, 0,
2066 249, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2067 0, 320, 0, 0, 0, 303, 304, 0, 0, 0,
2068 0, 0, 301, 0, 129, 0, 221, 223, 67, 0,
2069 0, 0, 0, 0, 0, 0, 199, 176, 0, 0,
2070 0, 0, 0, 0, 136, 134, 65, 0, 123, 0,
2071 258, 0, 0, 292, 0, 0, 129, 130, 129, 0,
2072 0, 0, 0, 0, 0, 319, 297, 298, 292, 0,
2073 317, 67, 206, 0, 0, 190, 0, 0, 0, 0,
2074 175, 0, 0, 67, 131, 137, 135, 64, 235, 237,
2075 115, 132, 0, 0, 0, 115, 115, 0, 299, 300,
2076 313, 315, 294, 0, 0, 302, 305, 306, 0, 129,
2077 0, 0, 0, 196, 0, 0, 192, 193, 189, 65,
2078 133, 127, 260, 0, 0, 0, 0, 123, 0, 286,
2079 0, 123, 318, 194, 195, 0, 0, 0, 234, 0,
2080 125, 0, 279, 0, 0, 106, 108, 115, 115, 0,
2081 115, 115, 287, 308, 191, 197, 198, 128, 0, 240,
2082 277, 0, 278, 0, 289, 288, 0, 0, 0, 126,
2083 0, 0, 0, 115, 115, 0, 0, 0, 291, 290,
2084 284, 0, 0, 283, 0, 280
Chris Lattner59363a32008-02-19 04:36:25 +00002085};
2086
2087/* YYDEFGOTO[NTERM-NUM]. */
2088static const yytype_int16 yydefgoto[] =
2089{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002090 -1, 263, 264, 265, 289, 306, 161, 162, 78, 528,
Chris Lattner59363a32008-02-19 04:36:25 +00002091 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002092 117, 127, 335, 228, 413, 338, 599, 580, 388, 484,
2093 561, 435, 485, 80, 163, 136, 153, 137, 138, 109,
2094 355, 377, 356, 120, 87, 154, 16, 17, 18, 20,
2095 19, 365, 414, 415, 62, 23, 60, 100, 438, 439,
2096 128, 169, 54, 95, 55, 48, 441, 378, 82, 380,
2097 273, 56, 91, 92, 222, 584, 131, 312, 537, 451,
Devang Patel3b8849c2008-02-19 22:27:01 +00002098 223, 224, 225, 226
Chris Lattner59363a32008-02-19 04:36:25 +00002099};
2100
2101/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2102 STATE-NUM. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00002103#define YYPACT_NINF -531
Chris Lattner59363a32008-02-19 04:36:25 +00002104static const yytype_int16 yypact[] =
2105{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002106 626, -531, -531, -531, -531, -531, -531, -531, -24, -116,
2107 28, -94, 54, -47, 2, -531, 110, 1179, -531, 216,
2108 101, -37, -31, -531, -30, 113, -531, 1516, -531, -531,
2109 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2110 61, 61, 249, -531, -531, -531, -531, 61, -531, -531,
2111 -531, -531, -531, 61, 128, -531, -10, 132, 152, 160,
2112 -531, -531, -531, -531, -531, 46, -531, -531, -531, -531,
2113 -531, -531, -531, -531, 221, 230, 1, 560, -531, -531,
2114 -531, -25, -531, 183, 183, 248, -531, 214, 179, 179,
2115 -531, -531, 177, -531, -531, -531, -531, -531, -531, -531,
2116 -99, 1111, -531, 95, 107, 803, 46, -531, -25, -87,
2117 126, 1111, 106, 214, 214, -531, -531, 259, -531, -531,
2118 1556, 281, -531, -531, -531, -531, -531, 1614, -531, -16,
2119 1883, -531, 272, -531, -531, -25, -531, 151, 159, 1672,
2120 1672, 156, -76, 1672, -531, 315, 170, -531, 1556, 1672,
2121 46, 176, -25, 209, -531, 77, 319, 320, 323, 325,
2122 326, 254, 327, 1167, 289, -531, 207, -531, -531, -531,
2123 -531, -531, 291, 1712, 94, 337, 179, -531, -531, -531,
2124 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2125 -531, -531, -531, -531, 405, 431, 1672, 1672, 1672, 1672,
2126 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2127 -531, -531, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
2128 1672, 1672, -531, 179, -531, 201, -531, -531, 309, 1397,
2129 -531, -19, -36, -531, 189, -25, 200, -531, 289, 16,
2130 259, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2131 -531, -531, 405, 431, 206, 222, 223, 224, 228, 1437,
2132 1730, 843, 345, 231, 232, 233, -531, -531, -531, 234,
2133 -531, 46, 754, -531, 893, 893, -531, 893, 1614, -531,
2134 -531, -531, -531, -531, -531, -531, -531, -531, -531, 1672,
2135 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2136 -531, -531, -531, -531, -531, -531, 1672, 30, 64, -531,
2137 754, -15, 235, 238, 239, 247, 250, 251, 14, 754,
2138 754, 348, 1614, 1672, 1672, 383, -531, -531, -531, -531,
2139 -531, -531, -531, -531, -531, -531, -531, -531, -48, -531,
2140 -531, -531, -531, -48, -531, 106, 350, 245, 257, 1556,
2141 1556, 1556, 1556, 1556, -531, -531, -52, 1066, 22, -531,
2142 -55, -531, 1556, 1556, 1556, 258, 1458, -531, -531, -531,
2143 -531, -531, -531, -531, -531, 342, 1556, -531, -531, -531,
2144 -531, 263, -531, 264, 893, 754, 754, 21, -531, 43,
2145 -531, -531, 893, 267, 1672, 1672, 1672, 1672, 1672, 266,
2146 271, 275, 1672, 893, 754, 276, -531, -531, -531, -531,
2147 -531, -531, -531, -531, 258, 258, 1672, 1556, 1556, -531,
2148 277, 280, 282, 283, 1556, -531, 265, 1021, -54, -531,
2149 -531, 288, 290, 397, 8, -531, -531, -25, 296, 302,
2150 -531, 421, 51, 439, 442, 311, 306, 310, 893, 459,
2151 893, 312, 316, 893, 317, -25, -531, 318, 321, 461,
2152 893, 893, -25, 328, 329, 1672, -531, -531, -13, 331,
2153 336, 139, 1556, 1556, 1556, 1556, -531, -531, 313, 1556,
2154 1556, 1672, 458, 477, -531, 258, 202, 1498, -531, 338,
2155 -531, 893, 893, 1770, 893, 893, 329, -531, 329, 1672,
2156 893, 339, 1672, 1672, 1672, -531, -531, -531, 1770, 438,
2157 -531, 754, -531, 1556, 1556, -531, 340, 356, 355, 358,
2158 -531, 361, 362, 4, -531, -531, -531, -531, -531, -531,
2159 -25, 23, 494, 363, 364, -14, -25, 147, -531, -531,
2160 -531, -531, -531, 360, 893, -531, -531, -531, 148, 329,
2161 368, 370, 1556, -531, 1556, 1556, -531, -531, -531, 202,
2162 -531, 470, -531, 508, -2, 612, 612, -531, 1788, -531,
2163 367, -531, -531, -531, -531, 391, 392, 393, -531, 542,
2164 400, 893, -531, 1307, 3, 398, 399, -531, -531, -17,
2165 -14, -25, -531, -48, -531, -531, -531, -531, 526, -531,
2166 -531, 401, -531, 1307, 309, 309, 535, 612, 612, -531,
2167 537, 403, 893, -531, -531, 893, 541, 488, 309, 309,
2168 -531, 893, 544, -531, 893, -531
Chris Lattner59363a32008-02-19 04:36:25 +00002169};
2170
2171/* YYPGOTO[NTERM-NUM]. */
2172static const yytype_int16 yypgoto[] =
2173{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002174 -531, 432, 435, 436, 333, 334, -173, -531, 0, 10,
2175 -144, 486, 13, -531, -531, -531, -531, 24, -531, -531,
2176 -531, -154, -531, -181, -531, -234, -531, -531, -298, 50,
2177 -531, -352, -531, -531, -26, 357, -120, -531, 478, 483,
2178 -114, -159, -245, 210, 242, 351, -531, -531, 573, -531,
2179 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2180 503, -531, -531, -531, -531, -531, -531, -530, -97, 103,
2181 -190, -531, 540, -531, -531, -531, -531, -531, 85, 180,
2182 -531, -531, -531, -531
Chris Lattner59363a32008-02-19 04:36:25 +00002183};
2184
2185/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2186 positive, shift that token. If negative, reduce the rule which
2187 number is the opposite. If zero, do what YYDEFACT says.
2188 If YYTABLE_NINF, syntax error. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00002189#define YYTABLE_NINF -209
Chris Lattner59363a32008-02-19 04:36:25 +00002190static const yytype_int16 yytable[] =
2191{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002192 11, 81, 277, 343, 266, 104, 164, 166, 309, 276,
2193 390, 90, 167, 13, 276, 358, 360, 11, 110, 93,
2194 268, 606, 278, 313, 314, 315, 316, 317, 21, 110,
2195 13, 321, 448, 1, 238, 110, 3, 24, 5, 110,
2196 -144, 110, 482, 22, 29, 30, 31, 32, 33, 34,
2197 35, 108, 36, 601, 450, 132, 241, 482, 110, 26,
2198 133, 483, 466, 467, 83, 84, 267, 143, 110, 322,
2199 110, 88, 27, 611, 449, 135, 144, 89, 143, 108,
2200 -55, -55, -55, -55, 110, 135, 25, 234, 407, 408,
2201 409, 152, 11, 410, 344, 345, 449, 411, 412, 424,
2202 424, 152, 424, 242, 243, 274, 28, 425, 430, 478,
2203 43, 275, 428, 231, 232, 111, 57, 235, 110, 407,
2204 408, 409, 58, 239, 410, 340, 111, 59, 411, 412,
2205 -67, 442, 111, 526, 405, 61, 111, -144, 111, 512,
2206 339, -144, 392, 49, 50, 51, 168, 272, 52, 90,
2207 37, 38, 39, 94, 97, 111, 558, 582, 384, 407,
2208 408, 409, 602, 105, 410, 111, 510, 111, 411, 412,
2209 307, 308, 272, 310, 98, 379, 424, 379, 379, 269,
2210 379, 111, 99, 429, 387, -67, 311, 272, 272, 272,
2211 272, 272, 318, 319, 320, 272, 1, 101, 540, 3,
2212 541, 5, 403, 135, 454, 424, 456, 457, 458, 37,
2213 38, 39, 490, 379, 152, 111, 63, 64, 389, -67,
2214 86, 1, 379, 379, 3, 102, 5, 2, 1, 2,
2215 4, 3, 4, 5, 103, 419, 420, 421, 422, 423,
2216 121, 122, 123, 124, 125, 126, 118, 119, 431, 432,
2217 433, 572, 152, 139, 531, 325, 486, 244, 245, 246,
2218 247, 147, 45, 385, 46, 140, 63, 64, 266, 150,
2219 66, 67, 68, 69, 70, 71, 72, 145, 1, 2,
2220 386, 3, 4, 5, 85, 165, 86, 379, 379, 379,
2221 115, 515, 116, 499, 227, 379, 152, 404, 272, 567,
2222 571, 568, 568, 469, 470, 229, 379, 379, 73, 542,
2223 476, 230, 545, 546, 547, 323, 324, 233, 399, 236,
2224 326, 327, 237, 148, 149, 113, 114, 240, -56, -57,
2225 267, 427, -60, 589, -59, -58, 248, 593, 328, 329,
2226 437, 330, 331, 110, 332, 333, 334, 270, 276, 559,
2227 341, 379, 342, 379, 565, 566, 379, 349, 516, 517,
2228 518, 519, 325, 379, 379, 521, 522, 361, 272, 455,
2229 272, 272, 272, 350, 351, 352, 462, 381, 382, 353,
2230 383, 151, 362, 363, 364, 366, 402, 406, 416, 393,
2231 468, 583, 394, 395, 379, 379, 417, 379, 379, 550,
2232 551, 396, 440, 379, 397, 398, 604, 605, 418, 607,
2233 608, 603, 434, 391, 379, 74, 75, 443, 444, 76,
2234 459, 77, 400, 401, 453, 460, 477, 326, 327, 461,
2235 465, 472, 618, 619, 473, 481, 474, 475, 575, 511,
2236 576, 577, 479, 489, 480, 328, 329, 379, 330, 331,
2237 487, 332, 333, 334, 488, 523, 491, 290, 291, 492,
2238 494, 530, 493, 497, 495, 505, 499, 536, 379, 379,
2239 500, 502, 503, 272, 520, 504, 272, 272, 272, 508,
2240 524, 525, 536, 509, 379, 513, 527, 445, 446, 447,
2241 514, 449, 532, 544, 552, 452, 279, 280, 281, 282,
2242 283, 284, 285, 286, 287, 288, 463, 464, 553, 554,
2243 379, 379, 555, 556, 557, 379, 562, 563, 379, 569,
2244 573, 564, 574, 579, 379, 581, 592, 379, 292, 293,
2245 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
2246 304, 305, 591, 594, 595, 596, 597, 598, 609, -18,
2247 -19, 496, 612, 498, 615, 610, 501, 616, 621, 527,
2248 622, 624, 219, 506, 507, 220, 221, 63, 64, 578,
2249 106, 66, 67, 68, 69, 70, 71, 72, 130, 1,
2250 2, 560, 3, 4, 5, 347, 337, 348, 142, 146,
2251 44, 346, 129, 548, 533, 534, 96, 538, 539, 471,
2252 0, 0, 0, 543, 0, 0, 0, 0, 0, 73,
2253 0, 0, 0, 0, 549, 367, 368, 0, 0, 63,
2254 64, 369, 0, 0, 0, 0, -208, 0, 0, 0,
2255 0, 1, 2, 0, 3, 4, 5, 370, 371, 372,
2256 0, 0, 0, 0, -69, 1, 2, 570, 3, 4,
2257 5, 0, 373, 374, 0, 0, 6, 7, 0, 0,
2258 0, 0, 0, 0, 0, 325, 0, 0, 587, 588,
2259 375, 0, 0, 0, 0, 0, 0, 8, 0, 0,
2260 0, 9, 0, 0, 600, 10, 179, 180, 181, 182,
2261 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2262 193, 252, 253, 0, 0, 0, 0, 0, 0, 0,
2263 613, 614, 0, 0, 0, 617, 74, 75, 620, 0,
2264 76, 0, 77, 107, 623, 0, 0, 625, 254, 200,
2265 585, 586, 203, 204, 205, 206, 207, 208, 209, 210,
2266 211, 0, 255, 0, 256, 257, 258, 0, 328, 329,
2267 0, 330, 331, 0, 332, 333, 334, 367, 368, 0,
2268 0, 63, 64, 369, 0, 0, 0, 0, 0, 0,
2269 0, 0, 376, 1, 2, 0, 3, 4, 5, 370,
2270 371, 372, 0, 0, 0, 0, 0, 0, 0, 0,
2271 0, 0, 0, 0, 373, 374, 0, 0, 0, 0,
2272 0, 0, 0, 0, 0, 0, 0, 0, 110, 0,
2273 63, 64, 375, 106, 66, 67, 68, 69, 70, 71,
2274 72, 0, 1, 2, 0, 3, 4, 5, 179, 180,
Devang Patel3b8849c2008-02-19 22:27:01 +00002275 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2276 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002277 63, 64, 73, 106, 155, 156, 157, 158, 159, 160,
2278 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Devang Patel3b8849c2008-02-19 22:27:01 +00002279 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2280 209, 210, 211, 0, 255, 0, 256, 257, 258, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002281 0, 0, 73, 0, 0, 0, 367, 368, 0, 0,
2282 63, 64, 369, 0, 0, 111, 0, 0, 0, 0,
2283 0, 0, 1, 2, 376, 3, 4, 5, 370, 371,
2284 372, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2285 0, 0, 0, 373, 374, 0, 0, 0, 0, 0,
Chris Lattner59363a32008-02-19 04:36:25 +00002286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002287 0, 375, 0, 0, 0, 0, 0, 0, 0, 74,
2288 75, 0, 0, 76, 0, 77, 141, 179, 180, 181,
2289 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2290 192, 193, 252, 253, 0, 0, 0, 0, 0, 0,
Devang Patel3b8849c2008-02-19 22:27:01 +00002291 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002292 75, 0, 0, 76, 0, 77, 359, 0, 0, 254,
2293 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2294 210, 211, 0, 255, 0, 256, 257, 258, 63, 64,
2295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2296 1, 2, 0, 3, 4, 5, 249, 0, 0, 0,
2297 0, 0, 0, 376, 0, 0, 0, 0, 0, 0,
2298 0, 250, 251, 0, 0, 0, 0, 0, 0, 0,
2299 0, 0, 0, 63, 64, 110, 106, 155, 156, 157,
2300 158, 159, 160, 72, 0, 1, 2, 0, 3, 4,
2301 5, 0, 0, 0, 0, 179, 180, 181, 182, 183,
2302 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2303 252, 253, 0, 0, 0, 73, 0, 0, 63, 64,
2304 0, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2305 1, 2, 0, 3, 4, 5, 0, 254, 200, 201,
2306 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2307 134, 255, 0, 256, 257, 258, 0, 0, 0, 0,
2308 73, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2309 0, 0, 111, 0, 63, 64, -67, 0, 259, -207,
2310 0, 260, 0, 261, 0, 262, 1, 2, 0, 3,
2311 4, 5, 249, 0, 0, 0, 0, -69, 1, 2,
2312 0, 3, 4, 5, 0, 0, 0, 250, 251, 6,
2313 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2314 0, 110, 74, 75, 0, 0, 76, 0, 77, 426,
2315 8, 0, 0, 0, 9, 0, 0, 0, 10, 0,
2316 0, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2317 188, 189, 190, 191, 192, 193, 252, 253, 0, 0,
Chris Lattner59363a32008-02-19 04:36:25 +00002318 0, 0, 0, 0, 0, 0, 0, 74, 75, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002319 0, 76, 0, 77, 0, 0, 0, 0, 0, 0,
2320 0, 0, 0, 254, 200, 201, 202, 203, 204, 205,
2321 206, 207, 208, 209, 210, 211, 0, 255, 0, 256,
2322 257, 258, 0, 0, 0, 0, 0, 0, 0, 0,
2323 367, 368, 0, 0, 0, 0, 369, 0, 111, 0,
2324 0, 0, 0, 0, 259, 0, 0, 260, 0, 261,
2325 0, 262, 370, 371, 372, 0, 0, 0, 0, 0,
2326 0, 0, 0, 0, 0, 0, 0, 373, 374, 0,
2327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2328 0, 0, 0, 0, 0, 375, 0, 0, 0, 0,
2329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2330 0, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2331 188, 189, 190, 191, 192, 193, 252, 253, 0, 0,
2332 0, 0, 0, 0, 63, 64, 0, 106, 66, 67,
Devang Patel3b8849c2008-02-19 22:27:01 +00002333 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002334 4, 5, 0, 254, 200, 201, 202, 203, 204, 205,
2335 206, 207, 208, 209, 210, 211, 336, 255, 0, 256,
2336 257, 258, 0, 0, 63, 64, 73, 106, 155, 156,
2337 157, 158, 159, 160, 72, 0, 1, 2, 0, 3,
2338 4, 5, 0, 0, 0, 63, 64, 376, 106, 66,
2339 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2340 3, 4, 5, 0, 0, 0, 73, 0, 0, 0,
2341 0, 0, 0, 0, 0, 0, 0, 436, 0, 0,
2342 0, 0, 0, 0, 0, 63, 64, 73, 106, 66,
2343 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2344 3, 4, 5, 63, 64, 0, 65, 66, 67, 68,
2345 69, 70, 71, 72, 0, 1, 2, 529, 3, 4,
2346 5, 0, 0, 0, 0, 0, 0, 73, 0, 0,
Chris Lattner59363a32008-02-19 04:36:25 +00002347 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002348 0, 0, 0, 63, 64, 73, 106, 155, 156, 157,
2349 158, 159, 160, 72, 0, 1, 2, 0, 3, 4,
2350 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2351 0, 0, 0, 74, 75, 0, 354, 76, 0, 77,
2352 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2353 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2354 77, 63, 64, 0, 150, 66, 67, 68, 69, 70,
2355 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
Devang Patel3b8849c2008-02-19 22:27:01 +00002356 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002357 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2358 77, 0, 0, 73, 0, 0, 0, 0, 0, 0,
2359 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
2360 64, 0, 106, 66, 67, 68, 69, 70, 71, 72,
2361 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2362 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2363 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
2364 64, 73, 271, 66, 67, 68, 69, 70, 71, 72,
2365 0, 1, 2, 0, 3, 4, 5, 63, 64, 0,
2366 106, 155, 156, 157, 158, 159, 160, 72, 0, 1,
2367 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2368 0, 73, 0, 0, 0, 0, 0, 0, 0, 0,
2369 74, 75, 0, 0, 76, 0, 77, 63, 64, 73,
2370 106, 66, 67, 68, 69, 70, 71, 535, 0, 1,
2371 2, 0, 3, 4, 5, 63, 64, 0, 106, 66,
2372 67, 68, 69, 70, 71, 590, 0, 1, 2, 0,
2373 3, 4, 5, 0, 0, 0, 0, 0, 0, 73,
2374 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
2375 0, 0, 76, 0, 77, 0, 0, 73, 0, 0,
2376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2378 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
2379 0, 0, 76, 0, 77, 0, 0, 0, 0, 0,
2380 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2381 76, 0, 357, 0, 0, 0, 0, 0, 0, 0,
2382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2383 0, 0, 0, 0, 0, 0, 0, 0, 0, 170,
2384 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2385 76, 0, 77, 0, 0, 0, 0, 0, 0, 171,
2386 172, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2387 77, 173, 174, 175, 176, 177, 178, 179, 180, 181,
2388 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2389 192, 193, 194, 195, 0, 0, 0, 0, 0, 0,
2390 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2391 0, 0, 0, 0, 196, 197, 198, 0, 0, 199,
2392 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2393 210, 211, 212, 213, 214, 215, 216, 217, 218
Chris Lattner59363a32008-02-19 04:36:25 +00002394};
2395
2396static const yytype_int16 yycheck[] =
2397{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002398 0, 27, 175, 237, 163, 4, 120, 127, 198, 11,
2399 308, 21, 28, 0, 11, 260, 261, 17, 54, 29,
2400 164, 38, 176, 213, 214, 215, 216, 217, 52, 54,
2401 17, 221, 11, 19, 148, 54, 22, 153, 24, 54,
2402 54, 54, 34, 67, 42, 43, 44, 45, 46, 47,
2403 48, 77, 50, 583, 11, 154, 153, 34, 54, 153,
2404 159, 53, 414, 415, 40, 41, 163, 154, 54, 223,
2405 54, 47, 18, 603, 53, 101, 163, 53, 154, 105,
2406 3, 4, 5, 6, 54, 111, 58, 163, 136, 137,
2407 138, 117, 92, 141, 238, 239, 53, 145, 146, 154,
2408 154, 127, 154, 26, 27, 11, 153, 159, 163, 163,
2409 0, 17, 357, 139, 140, 151, 153, 143, 54, 136,
2410 137, 138, 153, 149, 141, 161, 151, 157, 145, 146,
2411 155, 376, 151, 485, 324, 22, 151, 151, 151, 152,
2412 159, 155, 157, 42, 43, 44, 162, 173, 47, 21,
2413 148, 149, 150, 163, 22, 151, 152, 159, 278, 136,
2414 137, 138, 159, 162, 141, 151, 464, 151, 145, 146,
2415 196, 197, 198, 199, 22, 272, 154, 274, 275, 166,
2416 277, 151, 22, 161, 154, 155, 212, 213, 214, 215,
2417 216, 217, 218, 219, 220, 221, 19, 151, 496, 22,
2418 498, 24, 322, 229, 394, 154, 396, 397, 398, 148,
2419 149, 150, 161, 310, 240, 151, 7, 8, 154, 155,
2420 37, 19, 319, 320, 22, 4, 24, 20, 19, 20,
2421 23, 22, 23, 24, 4, 349, 350, 351, 352, 353,
2422 61, 62, 63, 64, 65, 66, 32, 33, 362, 363,
2423 364, 549, 278, 158, 488, 53, 437, 3, 4, 5,
2424 6, 155, 46, 289, 48, 158, 7, 8, 427, 10,
2425 11, 12, 13, 14, 15, 16, 17, 151, 19, 20,
2426 306, 22, 23, 24, 35, 4, 37, 384, 385, 386,
2427 42, 152, 44, 154, 22, 392, 322, 323, 324, 152,
2428 152, 154, 154, 417, 418, 154, 403, 404, 49, 499,
2429 424, 152, 502, 503, 504, 114, 115, 161, 318, 4,
2430 118, 119, 152, 113, 114, 83, 84, 151, 9, 9,
2431 427, 357, 9, 567, 9, 9, 9, 571, 136, 137,
2432 366, 139, 140, 54, 142, 143, 144, 56, 11, 530,
2433 161, 448, 152, 450, 535, 536, 453, 151, 472, 473,
2434 474, 475, 53, 460, 461, 479, 480, 22, 394, 395,
2435 396, 397, 398, 151, 151, 151, 402, 274, 275, 151,
2436 277, 122, 151, 151, 151, 151, 38, 4, 38, 154,
2437 416, 564, 154, 154, 491, 492, 151, 494, 495, 513,
2438 514, 154, 60, 500, 154, 154, 587, 588, 151, 590,
2439 591, 584, 154, 310, 511, 156, 157, 154, 154, 160,
2440 154, 162, 319, 320, 157, 154, 161, 118, 119, 154,
2441 154, 154, 613, 614, 154, 38, 154, 154, 552, 465,
2442 554, 555, 154, 22, 154, 136, 137, 544, 139, 140,
2443 154, 142, 143, 144, 152, 481, 17, 26, 27, 17,
2444 154, 487, 151, 4, 154, 4, 154, 493, 565, 566,
2445 154, 154, 154, 499, 161, 154, 502, 503, 504, 151,
2446 22, 4, 508, 154, 581, 154, 486, 384, 385, 386,
2447 154, 53, 154, 154, 154, 392, 91, 92, 93, 94,
2448 95, 96, 97, 98, 99, 100, 403, 404, 152, 154,
2449 607, 608, 154, 152, 152, 612, 22, 154, 615, 159,
2450 152, 157, 152, 53, 621, 17, 159, 624, 97, 98,
2451 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2452 109, 110, 568, 152, 152, 152, 4, 147, 22, 151,
2453 151, 448, 17, 450, 17, 154, 453, 154, 17, 559,
2454 72, 17, 130, 460, 461, 130, 130, 7, 8, 559,
2455 10, 11, 12, 13, 14, 15, 16, 17, 92, 19,
2456 20, 531, 22, 23, 24, 252, 229, 253, 105, 111,
2457 17, 240, 89, 508, 491, 492, 56, 494, 495, 419,
2458 -1, -1, -1, 500, -1, -1, -1, -1, -1, 49,
2459 -1, -1, -1, -1, 511, 3, 4, -1, -1, 7,
2460 8, 9, -1, -1, -1, -1, 0, -1, -1, -1,
2461 -1, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2462 -1, -1, -1, -1, 18, 19, 20, 544, 22, 23,
2463 24, -1, 40, 41, -1, -1, 30, 31, -1, -1,
2464 -1, -1, -1, -1, -1, 53, -1, -1, 565, 566,
2465 58, -1, -1, -1, -1, -1, -1, 51, -1, -1,
2466 -1, 55, -1, -1, 581, 59, 74, 75, 76, 77,
2467 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2468 88, 89, 90, -1, -1, -1, -1, -1, -1, -1,
2469 607, 608, -1, -1, -1, 612, 156, 157, 615, -1,
2470 160, -1, 162, 163, 621, -1, -1, 624, 116, 117,
2471 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2472 128, -1, 130, -1, 132, 133, 134, -1, 136, 137,
2473 -1, 139, 140, -1, 142, 143, 144, 3, 4, -1,
2474 -1, 7, 8, 9, -1, -1, -1, -1, -1, -1,
2475 -1, -1, 160, 19, 20, -1, 22, 23, 24, 25,
Devang Patel3b8849c2008-02-19 22:27:01 +00002476 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002477 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2478 -1, -1, -1, -1, -1, -1, -1, -1, 54, -1,
2479 7, 8, 58, 10, 11, 12, 13, 14, 15, 16,
2480 17, -1, 19, 20, -1, 22, 23, 24, 74, 75,
Devang Patel3b8849c2008-02-19 22:27:01 +00002481 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2482 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002483 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
2484 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002485 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2486 126, 127, 128, -1, 130, -1, 132, 133, 134, -1,
2487 -1, -1, 49, -1, -1, -1, 3, 4, -1, -1,
2488 7, 8, 9, -1, -1, 151, -1, -1, -1, -1,
2489 -1, -1, 19, 20, 160, 22, 23, 24, 25, 26,
2490 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2491 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002492 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002493 -1, 58, -1, -1, -1, -1, -1, -1, -1, 156,
2494 157, -1, -1, 160, -1, 162, 163, 74, 75, 76,
2495 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2496 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
2497 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2498 157, -1, -1, 160, -1, 162, 163, -1, -1, 116,
2499 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2500 127, 128, -1, 130, -1, 132, 133, 134, 7, 8,
2501 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2502 19, 20, -1, 22, 23, 24, 25, -1, -1, -1,
2503 -1, -1, -1, 160, -1, -1, -1, -1, -1, -1,
2504 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2505 -1, -1, -1, 7, 8, 54, 10, 11, 12, 13,
2506 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2507 24, -1, -1, -1, -1, 74, 75, 76, 77, 78,
2508 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2509 89, 90, -1, -1, -1, 49, -1, -1, 7, 8,
Devang Patel3b8849c2008-02-19 22:27:01 +00002510 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002511 19, 20, -1, 22, 23, 24, -1, 116, 117, 118,
2512 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2513 39, 130, -1, 132, 133, 134, -1, -1, -1, -1,
2514 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2515 -1, -1, 151, -1, 7, 8, 155, -1, 157, 0,
2516 -1, 160, -1, 162, -1, 164, 19, 20, -1, 22,
2517 23, 24, 25, -1, -1, -1, -1, 18, 19, 20,
2518 -1, 22, 23, 24, -1, -1, -1, 40, 41, 30,
2519 31, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2520 -1, 54, 156, 157, -1, -1, 160, -1, 162, 163,
2521 51, -1, -1, -1, 55, -1, -1, -1, 59, -1,
2522 -1, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2523 83, 84, 85, 86, 87, 88, 89, 90, -1, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002524 -1, -1, -1, -1, -1, -1, -1, 156, 157, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002525 -1, 160, -1, 162, -1, -1, -1, -1, -1, -1,
2526 -1, -1, -1, 116, 117, 118, 119, 120, 121, 122,
2527 123, 124, 125, 126, 127, 128, -1, 130, -1, 132,
2528 133, 134, -1, -1, -1, -1, -1, -1, -1, -1,
2529 3, 4, -1, -1, -1, -1, 9, -1, 151, -1,
2530 -1, -1, -1, -1, 157, -1, -1, 160, -1, 162,
2531 -1, 164, 25, 26, 27, -1, -1, -1, -1, -1,
2532 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2533 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2534 -1, -1, -1, -1, -1, 58, -1, -1, -1, -1,
2535 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2536 -1, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2537 83, 84, 85, 86, 87, 88, 89, 90, -1, -1,
2538 -1, -1, -1, -1, 7, 8, -1, 10, 11, 12,
Devang Patel3b8849c2008-02-19 22:27:01 +00002539 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002540 23, 24, -1, 116, 117, 118, 119, 120, 121, 122,
2541 123, 124, 125, 126, 127, 128, 39, 130, -1, 132,
2542 133, 134, -1, -1, 7, 8, 49, 10, 11, 12,
2543 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2544 23, 24, -1, -1, -1, 7, 8, 160, 10, 11,
2545 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2546 22, 23, 24, -1, -1, -1, 49, -1, -1, -1,
2547 -1, -1, -1, -1, -1, -1, -1, 39, -1, -1,
2548 -1, -1, -1, -1, -1, 7, 8, 49, 10, 11,
2549 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2550 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
2551 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
2552 24, -1, -1, -1, -1, -1, -1, 49, -1, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002553 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002554 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
2555 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2556 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2557 -1, -1, -1, 156, 157, -1, 159, 160, -1, 162,
2558 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2559 -1, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2560 162, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2561 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002562 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002563 -1, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2564 162, -1, -1, 49, -1, -1, -1, -1, -1, -1,
2565 -1, -1, 156, 157, -1, -1, 160, -1, 162, 7,
2566 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2567 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2568 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2569 -1, -1, 156, 157, -1, -1, 160, -1, 162, 7,
2570 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2571 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2572 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2573 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2574 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
2575 156, 157, -1, -1, 160, -1, 162, 7, 8, 49,
2576 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2577 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2578 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2579 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2580 -1, -1, -1, -1, -1, -1, -1, -1, 156, 157,
2581 -1, -1, 160, -1, 162, -1, -1, 49, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2583 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2584 -1, -1, -1, -1, -1, -1, -1, -1, 156, 157,
2585 -1, -1, 160, -1, 162, -1, -1, -1, -1, -1,
2586 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2587 160, -1, 162, -1, -1, -1, -1, -1, -1, -1,
2588 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2589 -1, -1, -1, -1, -1, -1, -1, -1, -1, 36,
2590 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2591 160, -1, 162, -1, -1, -1, -1, -1, -1, 56,
2592 57, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2593 162, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2594 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2595 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
2596 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2597 -1, -1, -1, -1, 111, 112, 113, -1, -1, 116,
2598 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2599 127, 128, 129, 130, 131, 132, 133, 134, 135
Chris Lattner59363a32008-02-19 04:36:25 +00002600};
2601
2602/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2603 symbol of state STATE-NUM. */
2604static const yytype_uint8 yystos[] =
2605{
2606 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
Devang Patel3b8849c2008-02-19 22:27:01 +00002607 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2608 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2609 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2610 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
2611 43, 44, 47, 184, 227, 229, 236, 153, 153, 157,
2612 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2613 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2614 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
2615 21, 237, 238, 29, 163, 228, 237, 22, 22, 22,
2616 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2617 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2618 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
2619 176, 241, 154, 159, 39, 199, 200, 202, 203, 158,
2620 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2621 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2622 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
Chris Lattner59363a32008-02-19 04:36:25 +00002623 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2624 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2625 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2626 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
Devang Patel3b8849c2008-02-19 22:27:01 +00002627 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
2628 167, 168, 239, 245, 246, 247, 248, 22, 188, 154,
2629 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2630 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2631 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2632 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
2633 56, 10, 199, 235, 11, 17, 11, 171, 186, 91,
2634 92, 93, 94, 95, 96, 97, 98, 99, 100, 169,
2635 26, 27, 97, 98, 99, 100, 101, 102, 103, 104,
2636 105, 106, 107, 108, 109, 110, 170, 199, 199, 235,
2637 199, 199, 242, 235, 235, 235, 235, 235, 199, 199,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002638 199, 235, 186, 114, 115, 53, 118, 119, 136, 137,
2639 139, 140, 142, 143, 144, 187, 39, 200, 190, 159,
2640 161, 161, 152, 190, 175, 175, 210, 169, 170, 151,
2641 151, 151, 151, 151, 159, 205, 207, 162, 207, 163,
2642 207, 22, 151, 151, 151, 216, 151, 3, 4, 9,
2643 25, 26, 27, 40, 41, 58, 160, 206, 232, 233,
2644 234, 234, 234, 234, 201, 199, 199, 154, 193, 154,
2645 193, 234, 157, 154, 154, 154, 154, 154, 154, 173,
2646 234, 234, 38, 201, 199, 235, 4, 136, 137, 138,
2647 141, 145, 146, 189, 217, 218, 38, 151, 151, 205,
2648 205, 205, 205, 205, 154, 159, 163, 199, 207, 161,
2649 163, 205, 205, 205, 154, 196, 39, 199, 223, 224,
2650 60, 231, 207, 154, 154, 234, 234, 234, 11, 53,
2651 11, 244, 234, 157, 235, 199, 235, 235, 235, 154,
2652 154, 154, 199, 234, 234, 154, 196, 196, 199, 205,
2653 205, 244, 154, 154, 154, 154, 205, 161, 163, 154,
2654 154, 38, 34, 53, 194, 197, 188, 154, 152, 22,
2655 161, 17, 17, 151, 154, 154, 234, 4, 234, 154,
2656 154, 234, 154, 154, 154, 4, 234, 234, 151, 154,
2657 193, 199, 152, 154, 154, 152, 205, 205, 205, 205,
2658 161, 205, 205, 199, 22, 4, 196, 173, 174, 39,
2659 199, 190, 154, 234, 234, 17, 199, 243, 234, 234,
2660 193, 193, 235, 234, 154, 235, 235, 235, 243, 234,
2661 205, 205, 154, 152, 154, 154, 152, 152, 152, 188,
2662 194, 195, 22, 154, 157, 188, 188, 152, 154, 159,
2663 234, 152, 193, 152, 152, 205, 205, 205, 174, 53,
2664 192, 17, 159, 171, 240, 118, 119, 234, 234, 190,
2665 17, 199, 159, 190, 152, 152, 152, 4, 147, 191,
2666 234, 232, 159, 171, 188, 188, 38, 188, 188, 22,
2667 154, 232, 17, 234, 234, 17, 154, 234, 188, 188,
2668 234, 17, 72, 234, 17, 234
Chris Lattner59363a32008-02-19 04:36:25 +00002669};
David Greene9145dd22007-08-01 03:59:32 +00002670
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002671#define yyerrok (yyerrstatus = 0)
2672#define yyclearin (yychar = YYEMPTY)
Chris Lattner59363a32008-02-19 04:36:25 +00002673#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002674#define YYEOF 0
Chris Lattner59363a32008-02-19 04:36:25 +00002675
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002676#define YYACCEPT goto yyacceptlab
Chris Lattner59363a32008-02-19 04:36:25 +00002677#define YYABORT goto yyabortlab
2678#define YYERROR goto yyerrorlab
2679
2680
2681/* Like YYERROR except do call yyerror. This remains here temporarily
2682 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002683 Once GCC version 2 has supplanted version 1, this can go. */
Chris Lattner59363a32008-02-19 04:36:25 +00002684
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002685#define YYFAIL goto yyerrlab
Chris Lattner59363a32008-02-19 04:36:25 +00002686
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002687#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner59363a32008-02-19 04:36:25 +00002688
2689#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002690do \
2691 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner59363a32008-02-19 04:36:25 +00002692 { \
2693 yychar = (Token); \
2694 yylval = (Value); \
2695 yytoken = YYTRANSLATE (yychar); \
2696 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002697 goto yybackup; \
2698 } \
2699 else \
Chris Lattner59363a32008-02-19 04:36:25 +00002700 { \
2701 yyerror (YY_("syntax error: cannot back up")); \
2702 YYERROR; \
2703 } \
2704while (YYID (0))
2705
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002706
2707#define YYTERROR 1
2708#define YYERRCODE 256
2709
Chris Lattner59363a32008-02-19 04:36:25 +00002710
2711/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2712 If N is 0, then set CURRENT to the empty location which ends
2713 the previous symbol: RHS[0] (always defined). */
2714
2715#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2716#ifndef YYLLOC_DEFAULT
2717# define YYLLOC_DEFAULT(Current, Rhs, N) \
2718 do \
2719 if (YYID (N)) \
2720 { \
2721 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2722 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2723 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2724 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2725 } \
2726 else \
2727 { \
2728 (Current).first_line = (Current).last_line = \
2729 YYRHSLOC (Rhs, 0).last_line; \
2730 (Current).first_column = (Current).last_column = \
2731 YYRHSLOC (Rhs, 0).last_column; \
2732 } \
2733 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002734#endif
2735
Chris Lattner59363a32008-02-19 04:36:25 +00002736
2737/* YY_LOCATION_PRINT -- Print the location on the stream.
2738 This macro was not mandated originally: define only if we know
2739 we won't break user code: when these are the locations we know. */
2740
2741#ifndef YY_LOCATION_PRINT
Devang Pateleb293342008-02-20 19:13:10 +00002742# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Chris Lattner59363a32008-02-19 04:36:25 +00002743# define YY_LOCATION_PRINT(File, Loc) \
2744 fprintf (File, "%d.%d-%d.%d", \
2745 (Loc).first_line, (Loc).first_column, \
2746 (Loc).last_line, (Loc).last_column)
2747# else
2748# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2749# endif
2750#endif
2751
2752
2753/* YYLEX -- calling `yylex' with the right arguments. */
2754
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002755#ifdef YYLEX_PARAM
Chris Lattner59363a32008-02-19 04:36:25 +00002756# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002757#else
Chris Lattner59363a32008-02-19 04:36:25 +00002758# define YYLEX yylex ()
Scott Michel6d1aba82008-01-30 03:10:00 +00002759#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002760
2761/* Enable debugging if requested. */
2762#if YYDEBUG
2763
2764# ifndef YYFPRINTF
2765# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2766# define YYFPRINTF fprintf
2767# endif
2768
2769# define YYDPRINTF(Args) \
2770do { \
2771 if (yydebug) \
2772 YYFPRINTF Args; \
2773} while (YYID (0))
2774
2775# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2776do { \
2777 if (yydebug) \
2778 { \
2779 YYFPRINTF (stderr, "%s ", Title); \
2780 yy_symbol_print (stderr, \
2781 Type, Value); \
2782 YYFPRINTF (stderr, "\n"); \
2783 } \
2784} while (YYID (0))
2785
2786
2787/*--------------------------------.
2788| Print this symbol on YYOUTPUT. |
2789`--------------------------------*/
2790
2791/*ARGSUSED*/
2792#if (defined __STDC__ || defined __C99__FUNC__ \
2793 || defined __cplusplus || defined _MSC_VER)
2794static void
2795yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Scott Michel6d1aba82008-01-30 03:10:00 +00002796#else
Chris Lattner59363a32008-02-19 04:36:25 +00002797static void
2798yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2799 FILE *yyoutput;
2800 int yytype;
2801 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002802#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002803{
2804 if (!yyvaluep)
2805 return;
2806# ifdef YYPRINT
2807 if (yytype < YYNTOKENS)
2808 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2809# else
2810 YYUSE (yyoutput);
2811# endif
2812 switch (yytype)
2813 {
2814 default:
2815 break;
2816 }
2817}
2818
2819
2820/*--------------------------------.
2821| Print this symbol on YYOUTPUT. |
2822`--------------------------------*/
2823
2824#if (defined __STDC__ || defined __C99__FUNC__ \
2825 || defined __cplusplus || defined _MSC_VER)
2826static void
2827yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2828#else
2829static void
2830yy_symbol_print (yyoutput, yytype, yyvaluep)
2831 FILE *yyoutput;
2832 int yytype;
2833 YYSTYPE const * const yyvaluep;
Christopher Lamb0a243582007-12-11 09:02:08 +00002834#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002835{
2836 if (yytype < YYNTOKENS)
2837 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2838 else
2839 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Scott Michel5a6f17b2008-01-30 02:55:46 +00002840
Chris Lattner59363a32008-02-19 04:36:25 +00002841 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2842 YYFPRINTF (yyoutput, ")");
2843}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002844
Chris Lattner59363a32008-02-19 04:36:25 +00002845/*------------------------------------------------------------------.
2846| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2847| TOP (included). |
2848`------------------------------------------------------------------*/
Scott Michel5a6f17b2008-01-30 02:55:46 +00002849
Chris Lattner59363a32008-02-19 04:36:25 +00002850#if (defined __STDC__ || defined __C99__FUNC__ \
2851 || defined __cplusplus || defined _MSC_VER)
2852static void
2853yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2854#else
2855static void
2856yy_stack_print (bottom, top)
2857 yytype_int16 *bottom;
2858 yytype_int16 *top;
Christopher Lamb0a243582007-12-11 09:02:08 +00002859#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002860{
2861 YYFPRINTF (stderr, "Stack now");
2862 for (; bottom <= top; ++bottom)
2863 YYFPRINTF (stderr, " %d", *bottom);
2864 YYFPRINTF (stderr, "\n");
2865}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002866
Chris Lattner59363a32008-02-19 04:36:25 +00002867# define YY_STACK_PRINT(Bottom, Top) \
2868do { \
2869 if (yydebug) \
2870 yy_stack_print ((Bottom), (Top)); \
2871} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00002872
Chris Lattner59363a32008-02-19 04:36:25 +00002873
2874/*------------------------------------------------.
2875| Report that the YYRULE is going to be reduced. |
2876`------------------------------------------------*/
2877
2878#if (defined __STDC__ || defined __C99__FUNC__ \
2879 || defined __cplusplus || defined _MSC_VER)
2880static void
2881yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2882#else
2883static void
2884yy_reduce_print (yyvsp, yyrule)
2885 YYSTYPE *yyvsp;
2886 int yyrule;
Dale Johannesen3afee192007-09-07 21:07:57 +00002887#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002888{
2889 int yynrhs = yyr2[yyrule];
2890 int yyi;
2891 unsigned long int yylno = yyrline[yyrule];
2892 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2893 yyrule - 1, yylno);
2894 /* The symbols being reduced. */
2895 for (yyi = 0; yyi < yynrhs; yyi++)
2896 {
2897 fprintf (stderr, " $%d = ", yyi + 1);
2898 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2899 &(yyvsp[(yyi + 1) - (yynrhs)])
2900 );
2901 fprintf (stderr, "\n");
2902 }
2903}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002904
Chris Lattner59363a32008-02-19 04:36:25 +00002905# define YY_REDUCE_PRINT(Rule) \
2906do { \
2907 if (yydebug) \
2908 yy_reduce_print (yyvsp, Rule); \
2909} while (YYID (0))
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002910
Chris Lattner59363a32008-02-19 04:36:25 +00002911/* Nonzero means print parse trace. It is left uninitialized so that
2912 multiple parsers can coexist. */
2913int yydebug;
2914#else /* !YYDEBUG */
2915# define YYDPRINTF(Args)
2916# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2917# define YY_STACK_PRINT(Bottom, Top)
2918# define YY_REDUCE_PRINT(Rule)
2919#endif /* !YYDEBUG */
2920
2921
2922/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002923#ifndef YYINITDEPTH
Chris Lattner59363a32008-02-19 04:36:25 +00002924# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002925#endif
2926
Chris Lattner59363a32008-02-19 04:36:25 +00002927/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2928 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002929
Chris Lattner59363a32008-02-19 04:36:25 +00002930 Do not make this value too large; the results are undefined if
2931 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2932 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00002933
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002934#ifndef YYMAXDEPTH
Chris Lattner59363a32008-02-19 04:36:25 +00002935# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002936#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002937
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002938
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002939
Chris Lattner59363a32008-02-19 04:36:25 +00002940#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002941
Chris Lattner59363a32008-02-19 04:36:25 +00002942# ifndef yystrlen
2943# if defined __GLIBC__ && defined _STRING_H
2944# define yystrlen strlen
2945# else
2946/* Return the length of YYSTR. */
2947#if (defined __STDC__ || defined __C99__FUNC__ \
2948 || defined __cplusplus || defined _MSC_VER)
2949static YYSIZE_T
2950yystrlen (const char *yystr)
Scott Michel5a6f17b2008-01-30 02:55:46 +00002951#else
Chris Lattner59363a32008-02-19 04:36:25 +00002952static YYSIZE_T
2953yystrlen (yystr)
2954 const char *yystr;
2955#endif
2956{
2957 YYSIZE_T yylen;
2958 for (yylen = 0; yystr[yylen]; yylen++)
2959 continue;
2960 return yylen;
2961}
2962# endif
2963# endif
2964
2965# ifndef yystpcpy
2966# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2967# define yystpcpy stpcpy
2968# else
2969/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2970 YYDEST. */
2971#if (defined __STDC__ || defined __C99__FUNC__ \
2972 || defined __cplusplus || defined _MSC_VER)
2973static char *
2974yystpcpy (char *yydest, const char *yysrc)
2975#else
2976static char *
2977yystpcpy (yydest, yysrc)
2978 char *yydest;
2979 const char *yysrc;
2980#endif
2981{
2982 char *yyd = yydest;
2983 const char *yys = yysrc;
2984
2985 while ((*yyd++ = *yys++) != '\0')
2986 continue;
2987
2988 return yyd - 1;
2989}
2990# endif
2991# endif
2992
2993# ifndef yytnamerr
2994/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2995 quotes and backslashes, so that it's suitable for yyerror. The
2996 heuristic is that double-quoting is unnecessary unless the string
2997 contains an apostrophe, a comma, or backslash (other than
2998 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2999 null, do not copy; instead, return the length of what the result
3000 would have been. */
3001static YYSIZE_T
3002yytnamerr (char *yyres, const char *yystr)
3003{
3004 if (*yystr == '"')
3005 {
3006 YYSIZE_T yyn = 0;
3007 char const *yyp = yystr;
3008
3009 for (;;)
3010 switch (*++yyp)
3011 {
3012 case '\'':
3013 case ',':
3014 goto do_not_strip_quotes;
3015
3016 case '\\':
3017 if (*++yyp != '\\')
3018 goto do_not_strip_quotes;
3019 /* Fall through. */
3020 default:
3021 if (yyres)
3022 yyres[yyn] = *yyp;
3023 yyn++;
3024 break;
3025
3026 case '"':
3027 if (yyres)
3028 yyres[yyn] = '\0';
3029 return yyn;
3030 }
3031 do_not_strip_quotes: ;
3032 }
3033
3034 if (! yyres)
3035 return yystrlen (yystr);
3036
3037 return yystpcpy (yyres, yystr) - yyres;
3038}
3039# endif
3040
3041/* Copy into YYRESULT an error message about the unexpected token
3042 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3043 including the terminating null byte. If YYRESULT is null, do not
3044 copy anything; just return the number of bytes that would be
3045 copied. As a special case, return 0 if an ordinary "syntax error"
3046 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3047 size calculation. */
3048static YYSIZE_T
3049yysyntax_error (char *yyresult, int yystate, int yychar)
3050{
3051 int yyn = yypact[yystate];
3052
3053 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3054 return 0;
3055 else
3056 {
3057 int yytype = YYTRANSLATE (yychar);
3058 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3059 YYSIZE_T yysize = yysize0;
3060 YYSIZE_T yysize1;
3061 int yysize_overflow = 0;
3062 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3063 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3064 int yyx;
3065
3066# if 0
3067 /* This is so xgettext sees the translatable formats that are
3068 constructed on the fly. */
3069 YY_("syntax error, unexpected %s");
3070 YY_("syntax error, unexpected %s, expecting %s");
3071 YY_("syntax error, unexpected %s, expecting %s or %s");
3072 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3073 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3074# endif
3075 char *yyfmt;
3076 char const *yyf;
3077 static char const yyunexpected[] = "syntax error, unexpected %s";
3078 static char const yyexpecting[] = ", expecting %s";
3079 static char const yyor[] = " or %s";
3080 char yyformat[sizeof yyunexpected
3081 + sizeof yyexpecting - 1
3082 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3083 * (sizeof yyor - 1))];
3084 char const *yyprefix = yyexpecting;
3085
3086 /* Start YYX at -YYN if negative to avoid negative indexes in
3087 YYCHECK. */
3088 int yyxbegin = yyn < 0 ? -yyn : 0;
3089
3090 /* Stay within bounds of both yycheck and yytname. */
3091 int yychecklim = YYLAST - yyn + 1;
3092 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3093 int yycount = 1;
3094
3095 yyarg[0] = yytname[yytype];
3096 yyfmt = yystpcpy (yyformat, yyunexpected);
3097
3098 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3099 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3100 {
3101 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3102 {
3103 yycount = 1;
3104 yysize = yysize0;
3105 yyformat[sizeof yyunexpected - 1] = '\0';
3106 break;
3107 }
3108 yyarg[yycount++] = yytname[yyx];
3109 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3110 yysize_overflow |= (yysize1 < yysize);
3111 yysize = yysize1;
3112 yyfmt = yystpcpy (yyfmt, yyprefix);
3113 yyprefix = yyor;
3114 }
3115
3116 yyf = YY_(yyformat);
3117 yysize1 = yysize + yystrlen (yyf);
3118 yysize_overflow |= (yysize1 < yysize);
3119 yysize = yysize1;
3120
3121 if (yysize_overflow)
3122 return YYSIZE_MAXIMUM;
3123
3124 if (yyresult)
3125 {
3126 /* Avoid sprintf, as that infringes on the user's name space.
3127 Don't have undefined behavior even if the translation
3128 produced a string with the wrong number of "%s"s. */
3129 char *yyp = yyresult;
3130 int yyi = 0;
3131 while ((*yyp = *yyf) != '\0')
3132 {
3133 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3134 {
3135 yyp += yytnamerr (yyp, yyarg[yyi++]);
3136 yyf += 2;
3137 }
3138 else
3139 {
3140 yyp++;
3141 yyf++;
3142 }
3143 }
3144 }
3145 return yysize;
3146 }
3147}
3148#endif /* YYERROR_VERBOSE */
3149
3150
3151/*-----------------------------------------------.
3152| Release the memory associated to this symbol. |
3153`-----------------------------------------------*/
3154
3155/*ARGSUSED*/
3156#if (defined __STDC__ || defined __C99__FUNC__ \
3157 || defined __cplusplus || defined _MSC_VER)
3158static void
3159yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3160#else
3161static void
3162yydestruct (yymsg, yytype, yyvaluep)
3163 const char *yymsg;
3164 int yytype;
3165 YYSTYPE *yyvaluep;
3166#endif
3167{
3168 YYUSE (yyvaluep);
3169
3170 if (!yymsg)
3171 yymsg = "Deleting";
3172 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3173
3174 switch (yytype)
3175 {
3176
3177 default:
3178 break;
3179 }
3180}
3181
3182
3183/* Prevent warnings from -Wmissing-prototypes. */
3184
3185#ifdef YYPARSE_PARAM
3186#if defined __STDC__ || defined __cplusplus
3187int yyparse (void *YYPARSE_PARAM);
3188#else
3189int yyparse ();
3190#endif
3191#else /* ! YYPARSE_PARAM */
3192#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003193int yyparse (void);
Scott Michel6d1aba82008-01-30 03:10:00 +00003194#else
Chris Lattner59363a32008-02-19 04:36:25 +00003195int yyparse ();
Christopher Lamb0a243582007-12-11 09:02:08 +00003196#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003197#endif /* ! YYPARSE_PARAM */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003198
Scott Michel5a6f17b2008-01-30 02:55:46 +00003199
Chris Lattner59363a32008-02-19 04:36:25 +00003200
3201/* The look-ahead symbol. */
3202int yychar;
3203
3204/* The semantic value of the look-ahead symbol. */
3205YYSTYPE yylval;
3206
3207/* Number of syntax errors so far. */
3208int yynerrs;
3209
3210
3211
3212/*----------.
3213| yyparse. |
3214`----------*/
3215
3216#ifdef YYPARSE_PARAM
3217#if (defined __STDC__ || defined __C99__FUNC__ \
3218 || defined __cplusplus || defined _MSC_VER)
3219int
3220yyparse (void *YYPARSE_PARAM)
3221#else
3222int
3223yyparse (YYPARSE_PARAM)
3224 void *YYPARSE_PARAM;
3225#endif
3226#else /* ! YYPARSE_PARAM */
3227#if (defined __STDC__ || defined __C99__FUNC__ \
3228 || defined __cplusplus || defined _MSC_VER)
3229int
3230yyparse (void)
3231#else
3232int
3233yyparse ()
3234
Scott Michel6d1aba82008-01-30 03:10:00 +00003235#endif
3236#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003237{
3238
3239 int yystate;
3240 int yyn;
3241 int yyresult;
3242 /* Number of tokens to shift before error messages enabled. */
3243 int yyerrstatus;
3244 /* Look-ahead token as an internal (translated) token number. */
3245 int yytoken = 0;
3246#if YYERROR_VERBOSE
3247 /* Buffer for error messages, and its allocated size. */
3248 char yymsgbuf[128];
3249 char *yymsg = yymsgbuf;
3250 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Scott Michel6d1aba82008-01-30 03:10:00 +00003251#endif
Scott Michel5a6f17b2008-01-30 02:55:46 +00003252
Chris Lattner59363a32008-02-19 04:36:25 +00003253 /* Three stacks and their tools:
3254 `yyss': related to states,
3255 `yyvs': related to semantic values,
3256 `yyls': related to locations.
3257
3258 Refer to the stacks thru separate pointers, to allow yyoverflow
3259 to reallocate them elsewhere. */
3260
3261 /* The state stack. */
3262 yytype_int16 yyssa[YYINITDEPTH];
3263 yytype_int16 *yyss = yyssa;
3264 yytype_int16 *yyssp;
3265
3266 /* The semantic value stack. */
3267 YYSTYPE yyvsa[YYINITDEPTH];
3268 YYSTYPE *yyvs = yyvsa;
3269 YYSTYPE *yyvsp;
3270
3271
3272
3273#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3274
3275 YYSIZE_T yystacksize = YYINITDEPTH;
3276
3277 /* The variables used to return semantic value and location from the
3278 action routines. */
3279 YYSTYPE yyval;
3280
3281
3282 /* The number of symbols on the RHS of the reduced rule.
3283 Keep to zero when no symbol should be popped. */
3284 int yylen = 0;
3285
3286 YYDPRINTF ((stderr, "Starting parse\n"));
3287
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003288 yystate = 0;
3289 yyerrstatus = 0;
3290 yynerrs = 0;
3291 yychar = YYEMPTY; /* Cause a token to be read. */
3292
3293 /* Initialize stack pointers.
3294 Waste one element of value and location stack
3295 so that they stay on the same level as the state stack.
3296 The wasted elements are never initialized. */
3297
Chris Lattner59363a32008-02-19 04:36:25 +00003298 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003299 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003300
Chris Lattner59363a32008-02-19 04:36:25 +00003301 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003302
Chris Lattner59363a32008-02-19 04:36:25 +00003303/*------------------------------------------------------------.
3304| yynewstate -- Push a new state, which is found in yystate. |
3305`------------------------------------------------------------*/
3306 yynewstate:
3307 /* In all cases, when you get here, the value and location stacks
3308 have just been pushed. So pushing a state here evens the stacks. */
3309 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003310
Chris Lattner59363a32008-02-19 04:36:25 +00003311 yysetstate:
3312 *yyssp = yystate;
3313
3314 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003315 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003316 /* Get the current used size of the three stacks, in elements. */
Chris Lattner59363a32008-02-19 04:36:25 +00003317 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003318
3319#ifdef yyoverflow
Chris Lattner59363a32008-02-19 04:36:25 +00003320 {
3321 /* Give user a chance to reallocate the stack. Use copies of
3322 these so that the &'s don't force the real ones into
3323 memory. */
3324 YYSTYPE *yyvs1 = yyvs;
3325 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003326
Chris Lattner59363a32008-02-19 04:36:25 +00003327
3328 /* Each stack pointer address is followed by the size of the
3329 data in use in that stack, in bytes. This used to be a
3330 conditional around just the two extra args, but that might
3331 be undefined if yyoverflow is a macro. */
3332 yyoverflow (YY_("memory exhausted"),
3333 &yyss1, yysize * sizeof (*yyssp),
3334 &yyvs1, yysize * sizeof (*yyvsp),
3335
3336 &yystacksize);
3337
3338 yyss = yyss1;
3339 yyvs = yyvs1;
3340 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003341#else /* no yyoverflow */
Chris Lattner59363a32008-02-19 04:36:25 +00003342# ifndef YYSTACK_RELOCATE
3343 goto yyexhaustedlab;
3344# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003345 /* Extend the stack our own way. */
Chris Lattner59363a32008-02-19 04:36:25 +00003346 if (YYMAXDEPTH <= yystacksize)
3347 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003348 yystacksize *= 2;
Chris Lattner59363a32008-02-19 04:36:25 +00003349 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003350 yystacksize = YYMAXDEPTH;
Chris Lattner59363a32008-02-19 04:36:25 +00003351
3352 {
3353 yytype_int16 *yyss1 = yyss;
3354 union yyalloc *yyptr =
3355 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3356 if (! yyptr)
3357 goto yyexhaustedlab;
3358 YYSTACK_RELOCATE (yyss);
3359 YYSTACK_RELOCATE (yyvs);
3360
3361# undef YYSTACK_RELOCATE
3362 if (yyss1 != yyssa)
3363 YYSTACK_FREE (yyss1);
3364 }
3365# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003366#endif /* no yyoverflow */
3367
Chris Lattner59363a32008-02-19 04:36:25 +00003368 yyssp = yyss + yysize - 1;
3369 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003370
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003371
Chris Lattner59363a32008-02-19 04:36:25 +00003372 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3373 (unsigned long int) yystacksize));
3374
3375 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003376 YYABORT;
3377 }
3378
Chris Lattner59363a32008-02-19 04:36:25 +00003379 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003380
3381 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003382
Chris Lattner59363a32008-02-19 04:36:25 +00003383/*-----------.
3384| yybackup. |
3385`-----------*/
3386yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003387
Chris Lattner59363a32008-02-19 04:36:25 +00003388 /* Do appropriate processing given the current state. Read a
3389 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003390
Chris Lattner59363a32008-02-19 04:36:25 +00003391 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003392 yyn = yypact[yystate];
Chris Lattner59363a32008-02-19 04:36:25 +00003393 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003394 goto yydefault;
3395
Chris Lattner59363a32008-02-19 04:36:25 +00003396 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003397
Chris Lattner59363a32008-02-19 04:36:25 +00003398 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003399 if (yychar == YYEMPTY)
3400 {
Chris Lattner59363a32008-02-19 04:36:25 +00003401 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003402 yychar = YYLEX;
3403 }
3404
Chris Lattner59363a32008-02-19 04:36:25 +00003405 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003406 {
Chris Lattner59363a32008-02-19 04:36:25 +00003407 yychar = yytoken = YYEOF;
3408 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003409 }
3410 else
3411 {
Chris Lattner59363a32008-02-19 04:36:25 +00003412 yytoken = YYTRANSLATE (yychar);
3413 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003414 }
3415
Chris Lattner59363a32008-02-19 04:36:25 +00003416 /* If the proper action on seeing token YYTOKEN is to reduce or to
3417 detect an error, take that action. */
3418 yyn += yytoken;
3419 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003420 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003421 yyn = yytable[yyn];
Chris Lattner59363a32008-02-19 04:36:25 +00003422 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003423 {
Chris Lattner59363a32008-02-19 04:36:25 +00003424 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003425 goto yyerrlab;
3426 yyn = -yyn;
3427 goto yyreduce;
3428 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003429
3430 if (yyn == YYFINAL)
3431 YYACCEPT;
3432
Chris Lattner59363a32008-02-19 04:36:25 +00003433 /* Count tokens shifted since error; after three, turn off error
3434 status. */
3435 if (yyerrstatus)
3436 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003437
Chris Lattner59363a32008-02-19 04:36:25 +00003438 /* Shift the look-ahead token. */
3439 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003440
Chris Lattner59363a32008-02-19 04:36:25 +00003441 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003442 if (yychar != YYEOF)
3443 yychar = YYEMPTY;
3444
Scott Michel6d1aba82008-01-30 03:10:00 +00003445 yystate = yyn;
Chris Lattner59363a32008-02-19 04:36:25 +00003446 *++yyvsp = yylval;
3447
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003448 goto yynewstate;
3449
Scott Michel6d1aba82008-01-30 03:10:00 +00003450
Chris Lattner59363a32008-02-19 04:36:25 +00003451/*-----------------------------------------------------------.
3452| yydefault -- do the default action for the current state. |
3453`-----------------------------------------------------------*/
3454yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003455 yyn = yydefact[yystate];
3456 if (yyn == 0)
3457 goto yyerrlab;
Chris Lattner59363a32008-02-19 04:36:25 +00003458 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003459
Chris Lattner59363a32008-02-19 04:36:25 +00003460
3461/*-----------------------------.
3462| yyreduce -- Do a reduction. |
3463`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003464yyreduce:
Chris Lattner59363a32008-02-19 04:36:25 +00003465 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003466 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003467
Chris Lattner59363a32008-02-19 04:36:25 +00003468 /* If YYLEN is nonzero, implement the default value of the action:
3469 `$$ = $1'.
3470
3471 Otherwise, the following line sets YYVAL to garbage.
3472 This behavior is undocumented and Bison
3473 users should not rely upon it. Assigning to YYVAL
3474 unconditionally makes the parser a bit smaller, and it avoids a
3475 GCC warning that YYVAL may be used uninitialized. */
3476 yyval = yyvsp[1-yylen];
3477
3478
3479 YY_REDUCE_PRINT (yyn);
3480 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003481 {
Chris Lattner59363a32008-02-19 04:36:25 +00003482 case 29:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003483#line 1119 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003484 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3485 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003486
Chris Lattner59363a32008-02-19 04:36:25 +00003487 case 30:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003488#line 1119 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003489 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3490 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003491
Chris Lattner59363a32008-02-19 04:36:25 +00003492 case 31:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003493#line 1120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003494 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3495 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003496
Chris Lattner59363a32008-02-19 04:36:25 +00003497 case 32:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003498#line 1120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003499 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3500 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003501
Chris Lattner59363a32008-02-19 04:36:25 +00003502 case 33:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003503#line 1121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003504 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3505 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003506
Chris Lattner59363a32008-02-19 04:36:25 +00003507 case 34:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003508#line 1121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003509 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3510 break;
3511
3512 case 35:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003513#line 1122 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003514 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3515 break;
3516
3517 case 36:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003518#line 1122 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003519 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3520 break;
3521
3522 case 37:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003523#line 1123 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003524 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3525 break;
3526
3527 case 38:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003528#line 1123 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003529 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3530 break;
3531
3532 case 39:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003533#line 1127 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003534 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3535 break;
3536
3537 case 40:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003538#line 1127 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003539 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3540 break;
3541
3542 case 41:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003543#line 1128 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003544 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3545 break;
3546
3547 case 42:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003548#line 1128 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003549 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3550 break;
3551
3552 case 43:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003553#line 1129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003554 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3555 break;
3556
3557 case 44:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003558#line 1129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003559 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3560 break;
3561
3562 case 45:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003563#line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003564 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3565 break;
3566
3567 case 46:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003568#line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003569 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3570 break;
3571
3572 case 47:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003573#line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003574 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3575 break;
3576
3577 case 48:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003578#line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003579 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3580 break;
3581
3582 case 49:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003583#line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003584 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3585 break;
3586
3587 case 50:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003588#line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003589 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3590 break;
3591
3592 case 51:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003593#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003594 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3595 break;
3596
3597 case 52:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003598#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003599 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3600 break;
3601
3602 case 53:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003603#line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003604 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3605 break;
3606
3607 case 54:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003608#line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003609 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3610 break;
3611
3612 case 65:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003613#line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003614 { (yyval.StrVal) = 0; ;}
3615 break;
3616
3617 case 66:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003618#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003619 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3620 break;
3621
3622 case 67:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003623#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003624 { (yyval.UIntVal)=0; ;}
3625 break;
3626
3627 case 68:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003628#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003629 {
3630 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003631 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003632 ;}
3633 break;
3634
3635 case 69:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003636#line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003637 {
3638 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003639 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003640 ;}
3641 break;
3642
3643 case 73:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003644#line 1163 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003645 {
3646 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003647 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003648 ;}
3649 break;
3650
3651 case 74:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003652#line 1168 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003653 {
3654 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003655 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003656 ;}
3657 break;
3658
3659 case 75:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003660#line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003661 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3662 break;
3663
3664 case 76:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003665#line 1175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003666 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3667 break;
3668
3669 case 77:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003670#line 1176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003671 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3672 break;
3673
3674 case 78:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003675#line 1177 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003676 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3677 break;
3678
3679 case 79:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003680#line 1178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003681 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3682 break;
3683
3684 case 80:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003685#line 1182 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003686 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3687 break;
3688
3689 case 81:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003690#line 1183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003691 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3692 break;
3693
3694 case 82:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003695#line 1184 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003696 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3697 break;
3698
3699 case 83:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003700#line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003701 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3702 break;
3703
3704 case 84:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003705#line 1189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003706 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3707 break;
3708
3709 case 85:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003710#line 1190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003711 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3712 break;
3713
3714 case 86:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003715#line 1191 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003716 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3717 break;
3718
3719 case 87:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003720#line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003721 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3722 break;
3723
3724 case 88:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003725#line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003726 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3727 break;
3728
3729 case 89:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003730#line 1197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003731 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3732 break;
3733
3734 case 90:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003735#line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003736 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3737 break;
3738
3739 case 91:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003740#line 1202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003741 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3742 break;
3743
3744 case 92:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003745#line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003746 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3747 break;
3748
3749 case 93:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003750#line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003751 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3752 break;
3753
3754 case 94:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003755#line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003756 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3757 break;
3758
3759 case 95:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003760#line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003761 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3762 break;
3763
3764 case 96:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003765#line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003766 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3767 break;
3768
3769 case 97:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003770#line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003771 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3772 break;
3773
3774 case 98:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003775#line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003776 { (yyval.UIntVal) = CallingConv::C; ;}
3777 break;
3778
3779 case 99:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003780#line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003781 { (yyval.UIntVal) = CallingConv::C; ;}
3782 break;
3783
3784 case 100:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003785#line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003786 { (yyval.UIntVal) = CallingConv::Fast; ;}
3787 break;
3788
3789 case 101:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003790#line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003791 { (yyval.UIntVal) = CallingConv::Cold; ;}
3792 break;
3793
3794 case 102:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003795#line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003796 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3797 break;
3798
3799 case 103:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003800#line 1219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003801 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3802 break;
3803
3804 case 104:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003805#line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003806 {
3807 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003808 GEN_ERROR("Calling conv too large");
Chris Lattner59363a32008-02-19 04:36:25 +00003809 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003810 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003811 ;}
3812 break;
3813
3814 case 105:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003815#line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003816 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3817 break;
3818
3819 case 106:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003820#line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003821 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3822 break;
3823
3824 case 107:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003825#line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003826 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3827 break;
3828
3829 case 108:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003830#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003831 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3832 break;
3833
3834 case 109:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003835#line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003836 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3837 break;
3838
3839 case 110:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003840#line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003841 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3842 break;
3843
3844 case 111:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003845#line 1233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003846 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3847 break;
3848
3849 case 112:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003850#line 1234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003851 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3852 break;
3853
3854 case 113:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003855#line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003856 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3857 break;
3858
3859 case 114:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003860#line 1236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3861 { (yyval.ParamAttrs) = (yyvsp[(2) - (2)].UInt64Val) << 16; ;}
Chris Lattner59363a32008-02-19 04:36:25 +00003862 break;
3863
3864 case 115:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003865#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003866 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3867 break;
3868
Dale Johannesena79ecf32008-02-20 21:15:43 +00003869 case 116:
3870#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003871 {
3872 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3873 ;}
3874 break;
3875
Dale Johannesena79ecf32008-02-20 21:15:43 +00003876 case 117:
3877#line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3878 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3879 break;
3880
3881 case 118:
3882#line 1246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3883 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3884 break;
3885
3886 case 119:
3887#line 1247 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3888 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3889 break;
3890
3891 case 120:
3892#line 1248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3893 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3894 break;
3895
3896 case 121:
3897#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3898 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3899 break;
3900
3901 case 122:
3902#line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3903 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3904 break;
3905
3906 case 123:
3907#line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3908 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3909 break;
3910
Chris Lattner59363a32008-02-19 04:36:25 +00003911 case 124:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003912#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3913 {
3914 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3915 ;}
Chris Lattner59363a32008-02-19 04:36:25 +00003916 break;
3917
3918 case 125:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003919#line 1259 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3920 { (yyval.StrVal) = 0; ;}
3921 break;
3922
3923 case 126:
3924#line 1260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003925 {
3926 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3927 ;}
3928 break;
3929
Dale Johannesena79ecf32008-02-20 21:15:43 +00003930 case 127:
3931#line 1267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003932 { (yyval.UIntVal) = 0; ;}
3933 break;
3934
Dale Johannesena79ecf32008-02-20 21:15:43 +00003935 case 128:
3936#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003937 {
3938 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3939 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003940 GEN_ERROR("Alignment must be a power of two");
3941 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003942;}
3943 break;
3944
Dale Johannesena79ecf32008-02-20 21:15:43 +00003945 case 129:
3946#line 1274 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003947 { (yyval.UIntVal) = 0; ;}
3948 break;
3949
Dale Johannesena79ecf32008-02-20 21:15:43 +00003950 case 130:
3951#line 1275 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003952 {
3953 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3954 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00003955 GEN_ERROR("Alignment must be a power of two");
3956 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003957;}
3958 break;
3959
Dale Johannesena79ecf32008-02-20 21:15:43 +00003960 case 131:
3961#line 1284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003962 {
3963 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3964 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003965 GEN_ERROR("Invalid character in section name");
Chris Lattner59363a32008-02-19 04:36:25 +00003966 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003967 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003968;}
3969 break;
3970
Dale Johannesena79ecf32008-02-20 21:15:43 +00003971 case 132:
3972#line 1292 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003973 { (yyval.StrVal) = 0; ;}
3974 break;
3975
Dale Johannesena79ecf32008-02-20 21:15:43 +00003976 case 133:
3977#line 1293 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003978 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3979 break;
3980
Chris Lattner59363a32008-02-19 04:36:25 +00003981 case 134:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003982#line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003983 {;}
3984 break;
3985
3986 case 135:
Dale Johannesena79ecf32008-02-20 21:15:43 +00003987#line 1299 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3988 {;}
3989 break;
3990
3991 case 136:
3992#line 1300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003993 {
3994 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3995 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003996 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003997 ;}
3998 break;
3999
Dale Johannesena79ecf32008-02-20 21:15:43 +00004000 case 137:
4001#line 1305 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004002 {
4003 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004004 GEN_ERROR("Alignment must be a power of two");
Chris Lattner59363a32008-02-19 04:36:25 +00004005 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004006 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004007 ;}
4008 break;
4009
Dale Johannesena79ecf32008-02-20 21:15:43 +00004010 case 145:
4011#line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004012 {
4013 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004014 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004015 ;}
4016 break;
4017
Dale Johannesena79ecf32008-02-20 21:15:43 +00004018 case 146:
4019#line 1325 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004020 {
4021 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004022 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004023 ;}
4024 break;
4025
Dale Johannesena79ecf32008-02-20 21:15:43 +00004026 case 147:
4027#line 1329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004028 { // Pointer type?
4029 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004030 GEN_ERROR("Cannot form a pointer to a basic block");
Chris Lattner59363a32008-02-19 04:36:25 +00004031 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4032 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004033 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004034 ;}
4035 break;
4036
Dale Johannesena79ecf32008-02-20 21:15:43 +00004037 case 148:
4038#line 1336 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004039 { // Named types are also simple types...
4040 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004041 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004042 (yyval.TypeVal) = new PATypeHolder(tmp);
4043 ;}
4044 break;
4045
Dale Johannesena79ecf32008-02-20 21:15:43 +00004046 case 149:
4047#line 1341 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004048 { // Type UpReference
4049 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004050 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Chris Lattner59363a32008-02-19 04:36:25 +00004051 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4052 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004053 UR_OUT("New Upreference!\n");
4054 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004055 ;}
4056 break;
4057
Dale Johannesena79ecf32008-02-20 21:15:43 +00004058 case 150:
4059#line 1349 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004060 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004061 // Allow but ignore attributes on function types; this permits auto-upgrade.
4062 // FIXME: remove in LLVM 3.0.
Chris Lattner59363a32008-02-19 04:36:25 +00004063 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004064 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4065 isa<OpaqueType>(RetTy)))
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004066 GEN_ERROR("LLVM Functions cannot return aggregates");
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004067
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004068 std::vector<const Type*> Params;
Chris Lattner59363a32008-02-19 04:36:25 +00004069 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004070 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004071 const Type *Ty = I->Ty->get();
4072 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004073 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004074
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004075 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4076 if (isVarArg) Params.pop_back();
4077
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004078 for (unsigned i = 0; i != Params.size(); ++i)
4079 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4080 GEN_ERROR("Function arguments must be value types!");
4081
4082 CHECK_FOR_ERROR
4083
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004084 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Chris Lattner59363a32008-02-19 04:36:25 +00004085 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4086 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4087 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004088 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004089 ;}
4090 break;
4091
Dale Johannesena79ecf32008-02-20 21:15:43 +00004092 case 151:
4093#line 1379 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004094 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004095 // Allow but ignore attributes on function types; this permits auto-upgrade.
4096 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004097 std::vector<const Type*> Params;
Chris Lattner59363a32008-02-19 04:36:25 +00004098 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004099 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004100 const Type* Ty = I->Ty->get();
4101 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004102 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004103
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004104 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4105 if (isVarArg) Params.pop_back();
4106
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004107 for (unsigned i = 0; i != Params.size(); ++i)
4108 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4109 GEN_ERROR("Function arguments must be value types!");
4110
4111 CHECK_FOR_ERROR
4112
Chris Lattner59363a32008-02-19 04:36:25 +00004113 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4114 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4115 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004116 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004117 ;}
4118 break;
4119
Dale Johannesena79ecf32008-02-20 21:15:43 +00004120 case 152:
4121#line 1404 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004122 { // Sized array type?
4123 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4124 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004125 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004126 ;}
4127 break;
4128
Dale Johannesena79ecf32008-02-20 21:15:43 +00004129 case 153:
4130#line 1409 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004131 { // Vector type?
4132 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4133 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004134 GEN_ERROR("Unsigned result not equal to signed result");
4135 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4136 GEN_ERROR("Element type of a VectorType must be primitive");
Chris Lattner59363a32008-02-19 04:36:25 +00004137 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4138 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004139 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004140 ;}
4141 break;
4142
Dale Johannesena79ecf32008-02-20 21:15:43 +00004143 case 154:
4144#line 1419 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004145 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004146 std::vector<const Type*> Elements;
Chris Lattner59363a32008-02-19 04:36:25 +00004147 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4148 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004149 Elements.push_back(*I);
4150
Chris Lattner59363a32008-02-19 04:36:25 +00004151 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4152 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004153 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004154 ;}
4155 break;
4156
Dale Johannesena79ecf32008-02-20 21:15:43 +00004157 case 155:
4158#line 1429 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004159 { // Empty structure type?
4160 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004161 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004162 ;}
4163 break;
4164
Dale Johannesena79ecf32008-02-20 21:15:43 +00004165 case 156:
4166#line 1433 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004167 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004168 std::vector<const Type*> Elements;
Chris Lattner59363a32008-02-19 04:36:25 +00004169 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4170 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004171 Elements.push_back(*I);
4172
Chris Lattner59363a32008-02-19 04:36:25 +00004173 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4174 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004175 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004176 ;}
4177 break;
4178
Dale Johannesena79ecf32008-02-20 21:15:43 +00004179 case 157:
4180#line 1443 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004181 { // Empty structure type?
4182 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004183 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004184 ;}
4185 break;
4186
Dale Johannesena79ecf32008-02-20 21:15:43 +00004187 case 158:
4188#line 1450 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004189 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004190 // Allow but ignore attributes on function types; this permits auto-upgrade.
4191 // FIXME: remove in LLVM 3.0.
Chris Lattner59363a32008-02-19 04:36:25 +00004192 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4193 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4194 ;}
4195 break;
4196
Dale Johannesena79ecf32008-02-20 21:15:43 +00004197 case 159:
4198#line 1459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004199 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004200 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004201 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4202 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004203 GEN_ERROR("LLVM functions cannot return aggregate types");
Chris Lattner59363a32008-02-19 04:36:25 +00004204 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4205 ;}
4206 break;
4207
Dale Johannesena79ecf32008-02-20 21:15:43 +00004208 case 160:
4209#line 1466 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004210 {
4211 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4212 ;}
4213 break;
4214
Dale Johannesena79ecf32008-02-20 21:15:43 +00004215 case 161:
4216#line 1471 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004217 {
4218 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4219 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004220 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004221 ;}
4222 break;
4223
Dale Johannesena79ecf32008-02-20 21:15:43 +00004224 case 162:
4225#line 1476 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004226 {
4227 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004228 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004229 ;}
4230 break;
4231
Dale Johannesena79ecf32008-02-20 21:15:43 +00004232 case 164:
4233#line 1484 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004234 {
4235 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004236 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4237 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner59363a32008-02-19 04:36:25 +00004238 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004239 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004240 ;}
4241 break;
4242
Dale Johannesena79ecf32008-02-20 21:15:43 +00004243 case 165:
4244#line 1491 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004245 {
4246 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004247 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4248 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner59363a32008-02-19 04:36:25 +00004249 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004250 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004251 ;}
4252 break;
4253
Dale Johannesena79ecf32008-02-20 21:15:43 +00004254 case 166:
4255#line 1498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004256 {
4257 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004258 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004259 ;}
4260 break;
4261
Dale Johannesena79ecf32008-02-20 21:15:43 +00004262 case 167:
4263#line 1506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004264 {
4265 (yyval.TypeList) = new std::list<PATypeHolder>();
4266 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4267 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004268 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004269 ;}
4270 break;
4271
Dale Johannesena79ecf32008-02-20 21:15:43 +00004272 case 168:
4273#line 1512 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004274 {
4275 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4276 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004277 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004278 ;}
4279 break;
4280
Dale Johannesena79ecf32008-02-20 21:15:43 +00004281 case 169:
4282#line 1524 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004283 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004284 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004285 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4286 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004287 if (ATy == 0)
4288 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004289 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004290 const Type *ETy = ATy->getElementType();
4291 int NumElements = ATy->getNumElements();
4292
4293 // Verify that we have the correct size...
Chris Lattner59363a32008-02-19 04:36:25 +00004294 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004295 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Chris Lattner59363a32008-02-19 04:36:25 +00004296 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004297 itostr(NumElements) + "");
4298
4299 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00004300 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4301 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004302 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4303 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner59363a32008-02-19 04:36:25 +00004304 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004305 }
4306
Chris Lattner59363a32008-02-19 04:36:25 +00004307 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4308 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004309 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004310 ;}
4311 break;
4312
Dale Johannesena79ecf32008-02-20 21:15:43 +00004313 case 170:
4314#line 1552 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004315 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004316 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004317 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4318 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004319 if (ATy == 0)
4320 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004321 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322
4323 int NumElements = ATy->getNumElements();
4324 if (NumElements != -1 && NumElements != 0)
4325 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4326 " arguments, but has size of " + itostr(NumElements) +"");
Chris Lattner59363a32008-02-19 04:36:25 +00004327 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4328 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004329 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004330 ;}
4331 break;
4332
Dale Johannesena79ecf32008-02-20 21:15:43 +00004333 case 171:
4334#line 1568 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004335 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004336 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004337 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4338 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004339 if (ATy == 0)
4340 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004341 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004342
4343 int NumElements = ATy->getNumElements();
4344 const Type *ETy = ATy->getElementType();
Chris Lattner59363a32008-02-19 04:36:25 +00004345 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004346 GEN_ERROR("Can't build string constant of size " +
Chris Lattner59363a32008-02-19 04:36:25 +00004347 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004348 " when array has size " + itostr(NumElements) + "");
4349 std::vector<Constant*> Vals;
4350 if (ETy == Type::Int8Ty) {
Chris Lattner59363a32008-02-19 04:36:25 +00004351 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4352 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004353 } else {
Chris Lattner59363a32008-02-19 04:36:25 +00004354 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004355 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4356 }
Chris Lattner59363a32008-02-19 04:36:25 +00004357 delete (yyvsp[(3) - (3)].StrVal);
4358 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4359 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004360 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004361 ;}
4362 break;
4363
Dale Johannesena79ecf32008-02-20 21:15:43 +00004364 case 172:
4365#line 1595 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004366 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004367 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004368 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4369 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004370 if (PTy == 0)
4371 GEN_ERROR("Cannot make packed constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004372 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004373 const Type *ETy = PTy->getElementType();
4374 int NumElements = PTy->getNumElements();
4375
4376 // Verify that we have the correct size...
Chris Lattner59363a32008-02-19 04:36:25 +00004377 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004378 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Chris Lattner59363a32008-02-19 04:36:25 +00004379 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004380 itostr(NumElements) + "");
4381
4382 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00004383 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4384 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004385 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4386 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner59363a32008-02-19 04:36:25 +00004387 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004388 }
4389
Chris Lattner59363a32008-02-19 04:36:25 +00004390 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4391 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004392 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004393 ;}
4394 break;
4395
Dale Johannesena79ecf32008-02-20 21:15:43 +00004396 case 173:
4397#line 1623 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004398 {
4399 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004400 if (STy == 0)
4401 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004402 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004403
Chris Lattner59363a32008-02-19 04:36:25 +00004404 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004405 GEN_ERROR("Illegal number of initializers for structure type");
4406
4407 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner59363a32008-02-19 04:36:25 +00004408 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4409 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004410 GEN_ERROR("Expected type '" +
4411 STy->getElementType(i)->getDescription() +
4412 "' for element #" + utostr(i) +
4413 " of structure initializer");
4414
4415 // Check to ensure that Type is not packed
4416 if (STy->isPacked())
4417 GEN_ERROR("Unpacked Initializer to vector type '" +
4418 STy->getDescription() + "'");
4419
Chris Lattner59363a32008-02-19 04:36:25 +00004420 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4421 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004422 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004423 ;}
4424 break;
4425
Dale Johannesena79ecf32008-02-20 21:15:43 +00004426 case 174:
4427#line 1649 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004428 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004429 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004430 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4431 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004432 if (STy == 0)
4433 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004434 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004435
4436 if (STy->getNumContainedTypes() != 0)
4437 GEN_ERROR("Illegal number of initializers for structure type");
4438
4439 // Check to ensure that Type is not packed
4440 if (STy->isPacked())
4441 GEN_ERROR("Unpacked Initializer to vector type '" +
4442 STy->getDescription() + "'");
4443
Chris Lattner59363a32008-02-19 04:36:25 +00004444 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4445 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004446 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004447 ;}
4448 break;
4449
Dale Johannesena79ecf32008-02-20 21:15:43 +00004450 case 175:
4451#line 1669 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004452 {
4453 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004454 if (STy == 0)
4455 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004456 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004457
Chris Lattner59363a32008-02-19 04:36:25 +00004458 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004459 GEN_ERROR("Illegal number of initializers for structure type");
4460
4461 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner59363a32008-02-19 04:36:25 +00004462 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4463 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004464 GEN_ERROR("Expected type '" +
4465 STy->getElementType(i)->getDescription() +
4466 "' for element #" + utostr(i) +
4467 " of structure initializer");
4468
4469 // Check to ensure that Type is packed
4470 if (!STy->isPacked())
4471 GEN_ERROR("Vector initializer to non-vector type '" +
4472 STy->getDescription() + "'");
4473
Chris Lattner59363a32008-02-19 04:36:25 +00004474 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4475 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004476 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004477 ;}
4478 break;
4479
Dale Johannesena79ecf32008-02-20 21:15:43 +00004480 case 176:
4481#line 1695 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004482 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004483 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004484 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4485 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004486 if (STy == 0)
4487 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004488 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004489
4490 if (STy->getNumContainedTypes() != 0)
4491 GEN_ERROR("Illegal number of initializers for structure type");
4492
4493 // Check to ensure that Type is packed
4494 if (!STy->isPacked())
4495 GEN_ERROR("Vector initializer to non-vector type '" +
4496 STy->getDescription() + "'");
4497
Chris Lattner59363a32008-02-19 04:36:25 +00004498 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4499 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004500 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004501 ;}
4502 break;
4503
Dale Johannesena79ecf32008-02-20 21:15:43 +00004504 case 177:
4505#line 1715 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004506 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004507 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004508 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4509 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004510 if (PTy == 0)
4511 GEN_ERROR("Cannot make null pointer constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004512 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004513
Chris Lattner59363a32008-02-19 04:36:25 +00004514 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4515 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004516 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004517 ;}
4518 break;
4519
Dale Johannesena79ecf32008-02-20 21:15:43 +00004520 case 178:
4521#line 1727 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004522 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004523 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004524 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4525 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4526 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004527 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004528 ;}
4529 break;
4530
Dale Johannesena79ecf32008-02-20 21:15:43 +00004531 case 179:
4532#line 1734 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004533 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004534 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004535 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4536 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004537 if (Ty == 0)
Devang Patel3b8849c2008-02-19 22:27:01 +00004538 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004539
4540 // ConstExprs can exist in the body of a function, thus creating
4541 // GlobalValues whenever they refer to a variable. Because we are in
4542 // the context of a function, getExistingVal will search the functions
4543 // symbol table instead of the module symbol table for the global symbol,
4544 // which throws things all off. To get around this, we just tell
4545 // getExistingVal that we are at global scope here.
4546 //
4547 Function *SavedCurFn = CurFun.CurrentFunction;
4548 CurFun.CurrentFunction = 0;
4549
Chris Lattner59363a32008-02-19 04:36:25 +00004550 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004551 CHECK_FOR_ERROR
4552
4553 CurFun.CurrentFunction = SavedCurFn;
4554
4555 // If this is an initializer for a constant pointer, which is referencing a
4556 // (currently) undefined variable, create a stub now that shall be replaced
4557 // in the future with the right type of variable.
4558 //
4559 if (V == 0) {
4560 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4561 const PointerType *PT = cast<PointerType>(Ty);
4562
4563 // First check to see if the forward references value is already created!
4564 PerModuleInfo::GlobalRefsType::iterator I =
Chris Lattner59363a32008-02-19 04:36:25 +00004565 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004566
4567 if (I != CurModule.GlobalRefs.end()) {
4568 V = I->second; // Placeholder already exists, use it...
Chris Lattner59363a32008-02-19 04:36:25 +00004569 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004570 } else {
4571 std::string Name;
Chris Lattner59363a32008-02-19 04:36:25 +00004572 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4573 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4574 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004575 GEN_ERROR("Invalid reference to global");
4576
4577 // Create the forward referenced global.
4578 GlobalValue *GV;
4579 if (const FunctionType *FTy =
4580 dyn_cast<FunctionType>(PT->getElementType())) {
4581 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4582 CurModule.CurrentModule);
4583 } else {
4584 GV = new GlobalVariable(PT->getElementType(), false,
4585 GlobalValue::ExternalWeakLinkage, 0,
4586 Name, CurModule.CurrentModule);
4587 }
4588
4589 // Keep track of the fact that we have a forward ref to recycle it
Chris Lattner59363a32008-02-19 04:36:25 +00004590 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004591 V = GV;
4592 }
4593 }
4594
Chris Lattner59363a32008-02-19 04:36:25 +00004595 (yyval.ConstVal) = cast<GlobalValue>(V);
4596 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004597 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004598 ;}
4599 break;
4600
Dale Johannesena79ecf32008-02-20 21:15:43 +00004601 case 180:
4602#line 1800 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004603 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004604 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004605 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4606 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004607 GEN_ERROR("Mismatched types for constant expression: " +
Chris Lattner59363a32008-02-19 04:36:25 +00004608 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4609 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4610 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004611 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004612 ;}
4613 break;
4614
Dale Johannesena79ecf32008-02-20 21:15:43 +00004615 case 181:
4616#line 1810 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004617 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004618 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004619 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4620 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004621 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4622 GEN_ERROR("Cannot create a null initialized value of this type");
Chris Lattner59363a32008-02-19 04:36:25 +00004623 (yyval.ConstVal) = Constant::getNullValue(Ty);
4624 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004625 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004626 ;}
4627 break;
4628
Dale Johannesena79ecf32008-02-20 21:15:43 +00004629 case 182:
4630#line 1820 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004631 { // integral constants
4632 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004633 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner59363a32008-02-19 04:36:25 +00004634 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004635 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004636 ;}
4637 break;
4638
Dale Johannesena79ecf32008-02-20 21:15:43 +00004639 case 183:
4640#line 1826 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004641 { // arbitrary precision integer constants
4642 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4643 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004644 GEN_ERROR("Constant value does not fit in type");
4645 }
Chris Lattner59363a32008-02-19 04:36:25 +00004646 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4647 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4648 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004649 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004650 ;}
4651 break;
4652
Dale Johannesena79ecf32008-02-20 21:15:43 +00004653 case 184:
4654#line 1836 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004655 { // integral constants
4656 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004657 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner59363a32008-02-19 04:36:25 +00004658 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004659 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004660 ;}
4661 break;
4662
Dale Johannesena79ecf32008-02-20 21:15:43 +00004663 case 185:
4664#line 1842 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004665 { // arbitrary precision integer constants
4666 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4667 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004668 GEN_ERROR("Constant value does not fit in type");
4669 }
Chris Lattner59363a32008-02-19 04:36:25 +00004670 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4671 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4672 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004673 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004674 ;}
4675 break;
4676
Dale Johannesena79ecf32008-02-20 21:15:43 +00004677 case 186:
4678#line 1852 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004679 { // Boolean constants
4680 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4681 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004682 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004683 ;}
4684 break;
4685
Dale Johannesena79ecf32008-02-20 21:15:43 +00004686 case 187:
4687#line 1857 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004688 { // Boolean constants
4689 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4690 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004691 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004692 ;}
4693 break;
4694
Dale Johannesena79ecf32008-02-20 21:15:43 +00004695 case 188:
4696#line 1862 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004697 { // Floating point constants
4698 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004699 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004700 // Lexer has no type info, so builds all float and double FP constants
4701 // as double. Fix this here. Long double is done right.
Chris Lattner59363a32008-02-19 04:36:25 +00004702 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4703 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4704 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4705 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004706 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004707 ;}
4708 break;
4709
Dale Johannesena79ecf32008-02-20 21:15:43 +00004710 case 189:
4711#line 1875 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004712 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004713 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004714 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4715 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4716 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4717 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004718 GEN_ERROR("invalid cast opcode for cast from '" +
4719 Val->getType()->getDescription() + "' to '" +
4720 DestTy->getDescription() + "'");
Chris Lattner59363a32008-02-19 04:36:25 +00004721 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4722 delete (yyvsp[(5) - (6)].TypeVal);
4723 ;}
4724 break;
4725
Dale Johannesena79ecf32008-02-20 21:15:43 +00004726 case 190:
4727#line 1887 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004728 {
4729 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004730 GEN_ERROR("GetElementPtr requires a pointer operand");
4731
4732 const Type *IdxTy =
Chris Lattner59363a32008-02-19 04:36:25 +00004733 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004734 true);
4735 if (!IdxTy)
4736 GEN_ERROR("Index list invalid for constant getelementptr");
4737
4738 SmallVector<Constant*, 8> IdxVec;
Chris Lattner59363a32008-02-19 04:36:25 +00004739 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4740 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741 IdxVec.push_back(C);
4742 else
4743 GEN_ERROR("Indices to constant getelementptr must be constants");
4744
Chris Lattner59363a32008-02-19 04:36:25 +00004745 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004746
Chris Lattner59363a32008-02-19 04:36:25 +00004747 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004748 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004749 ;}
4750 break;
4751
Dale Johannesena79ecf32008-02-20 21:15:43 +00004752 case 191:
4753#line 1909 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004754 {
4755 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004756 GEN_ERROR("Select condition must be of boolean type");
Chris Lattner59363a32008-02-19 04:36:25 +00004757 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004758 GEN_ERROR("Select operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004759 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004760 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004761 ;}
4762 break;
4763
Dale Johannesena79ecf32008-02-20 21:15:43 +00004764 case 192:
4765#line 1917 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004766 {
4767 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004768 GEN_ERROR("Binary operator types must match");
4769 CHECK_FOR_ERROR;
Chris Lattner59363a32008-02-19 04:36:25 +00004770 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4771 ;}
4772 break;
4773
Dale Johannesena79ecf32008-02-20 21:15:43 +00004774 case 193:
4775#line 1923 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004776 {
4777 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004778 GEN_ERROR("Logical operator types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004779 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4780 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4781 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004782 GEN_ERROR("Logical operator requires integral operands");
4783 }
Chris Lattner59363a32008-02-19 04:36:25 +00004784 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004785 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004786 ;}
4787 break;
4788
Dale Johannesena79ecf32008-02-20 21:15:43 +00004789 case 194:
4790#line 1934 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004791 {
4792 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004793 GEN_ERROR("icmp operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004794 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4795 ;}
4796 break;
4797
Dale Johannesena79ecf32008-02-20 21:15:43 +00004798 case 195:
4799#line 1939 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004800 {
4801 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004802 GEN_ERROR("fcmp operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004803 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4804 ;}
4805 break;
4806
Dale Johannesena79ecf32008-02-20 21:15:43 +00004807 case 196:
4808#line 1944 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004809 {
4810 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004811 GEN_ERROR("Invalid extractelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004812 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004813 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004814 ;}
4815 break;
4816
Dale Johannesena79ecf32008-02-20 21:15:43 +00004817 case 197:
4818#line 1950 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004819 {
4820 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004821 GEN_ERROR("Invalid insertelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004822 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004823 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004824 ;}
4825 break;
4826
Dale Johannesena79ecf32008-02-20 21:15:43 +00004827 case 198:
4828#line 1956 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004829 {
4830 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004831 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004832 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004833 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004834 ;}
4835 break;
4836
Dale Johannesena79ecf32008-02-20 21:15:43 +00004837 case 199:
4838#line 1965 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004839 {
4840 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004841 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004842 ;}
4843 break;
4844
Dale Johannesena79ecf32008-02-20 21:15:43 +00004845 case 200:
4846#line 1969 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004847 {
4848 (yyval.ConstVector) = new std::vector<Constant*>();
4849 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004850 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004851 ;}
4852 break;
4853
Dale Johannesena79ecf32008-02-20 21:15:43 +00004854 case 201:
4855#line 1977 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004856 { (yyval.BoolVal) = false; ;}
4857 break;
4858
Chris Lattner59363a32008-02-19 04:36:25 +00004859 case 202:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004860#line 1977 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004861 { (yyval.BoolVal) = true; ;}
4862 break;
4863
4864 case 203:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004865#line 1980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4866 { (yyval.BoolVal) = true; ;}
Chris Lattner59363a32008-02-19 04:36:25 +00004867 break;
4868
4869 case 204:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004870#line 1980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4871 { (yyval.BoolVal) = false; ;}
4872 break;
4873
4874 case 205:
4875#line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004876 {
4877 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4878 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00004879 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004880 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4881 if (!Aliasee)
4882 GEN_ERROR("Aliases can be created only to global values");
4883
Chris Lattner59363a32008-02-19 04:36:25 +00004884 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004885 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004886 delete (yyvsp[(1) - (2)].TypeVal);
4887 ;}
4888 break;
4889
Dale Johannesena79ecf32008-02-20 21:15:43 +00004890 case 206:
4891#line 1995 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004892 {
4893 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4894 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4895 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004896 GEN_ERROR("invalid cast opcode for cast from '" +
4897 Val->getType()->getDescription() + "' to '" +
4898 DestTy->getDescription() + "'");
4899
Chris Lattner59363a32008-02-19 04:36:25 +00004900 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004901 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004902 delete (yyvsp[(5) - (6)].TypeVal);
4903 ;}
4904 break;
4905
Chris Lattner59363a32008-02-19 04:36:25 +00004906 case 207:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004907#line 2016 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004908 {
4909 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Christopher Lamb668d9a02007-12-12 08:45:45 +00004910 CurModule.ModuleDone();
4911 CHECK_FOR_ERROR;
Chris Lattner59363a32008-02-19 04:36:25 +00004912 ;}
4913 break;
4914
Dale Johannesena79ecf32008-02-20 21:15:43 +00004915 case 208:
4916#line 2021 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4917 {
4918 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4919 CurModule.ModuleDone();
4920 CHECK_FOR_ERROR;
4921 ;}
Chris Lattner59363a32008-02-19 04:36:25 +00004922 break;
4923
4924 case 211:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004925#line 2034 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4926 { CurFun.isDeclare = false; ;}
4927 break;
4928
4929 case 212:
4930#line 2034 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004931 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004932 CurFun.FunctionDone();
4933 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004934 ;}
4935 break;
4936
Dale Johannesena79ecf32008-02-20 21:15:43 +00004937 case 213:
4938#line 2038 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004939 { CurFun.isDeclare = true; ;}
4940 break;
4941
Chris Lattner59363a32008-02-19 04:36:25 +00004942 case 214:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004943#line 2038 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004944 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00004945 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004946 ;}
4947 break;
4948
4949 case 215:
Dale Johannesena79ecf32008-02-20 21:15:43 +00004950#line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4951 {
4952 CHECK_FOR_ERROR
4953 ;}
4954 break;
4955
4956 case 216:
4957#line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004958 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004959 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004960 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004961 // Eagerly resolve types. This is not an optimization, this is a
4962 // requirement that is due to the fact that we could have this:
4963 //
4964 // %list = type { %list * }
4965 // %list = type { %list * } ; repeated type decl
4966 //
4967 // If types are not resolved eagerly, then the two types will not be
4968 // determined to be the same type!
4969 //
Chris Lattner59363a32008-02-19 04:36:25 +00004970 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004971
Chris Lattner59363a32008-02-19 04:36:25 +00004972 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004973 CHECK_FOR_ERROR
4974 // If this is a named type that is not a redefinition, add it to the slot
4975 // table.
Chris Lattner59363a32008-02-19 04:36:25 +00004976 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004977 }
4978
Chris Lattner59363a32008-02-19 04:36:25 +00004979 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004980 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004981 ;}
4982 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004983
Dale Johannesena79ecf32008-02-20 21:15:43 +00004984 case 217:
4985#line 2068 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004986 {
4987 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4988
4989 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004990 CHECK_FOR_ERROR
4991 // If this is a named type that is not a redefinition, add it to the slot
4992 // table.
Chris Lattner59363a32008-02-19 04:36:25 +00004993 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004994 }
4995 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004996 ;}
4997 break;
4998
Dale Johannesena79ecf32008-02-20 21:15:43 +00004999 case 218:
5000#line 2080 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005001 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005002 /* "Externally Visible" Linkage */
Chris Lattner59363a32008-02-19 04:36:25 +00005003 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005004 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner59363a32008-02-19 04:36:25 +00005005 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5006 (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005007 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005008 ;}
5009 break;
5010
Dale Johannesena79ecf32008-02-20 21:15:43 +00005011 case 219:
5012#line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005013 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005014 CurGV = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005015 ;}
5016 break;
5017
Dale Johannesena79ecf32008-02-20 21:15:43 +00005018 case 220:
5019#line 2091 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005020 {
5021 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005022 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner59363a32008-02-19 04:36:25 +00005023 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
Christopher Lamb668d9a02007-12-12 08:45:45 +00005024 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005025 ;}
5026 break;
5027
Dale Johannesena79ecf32008-02-20 21:15:43 +00005028 case 221:
5029#line 2096 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005030 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005031 CurGV = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005032 ;}
5033 break;
5034
Dale Johannesena79ecf32008-02-20 21:15:43 +00005035 case 222:
5036#line 2100 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005037 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005038 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005039 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5040 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
Christopher Lamb668d9a02007-12-12 08:45:45 +00005041 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005042 delete (yyvsp[(6) - (7)].TypeVal);
5043 ;}
5044 break;
5045
Dale Johannesena79ecf32008-02-20 21:15:43 +00005046 case 223:
5047#line 2106 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005048 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005049 CurGV = 0;
5050 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005051 ;}
5052 break;
5053
Dale Johannesena79ecf32008-02-20 21:15:43 +00005054 case 224:
5055#line 2110 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005056 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005057 std::string Name;
Chris Lattner59363a32008-02-19 04:36:25 +00005058 if ((yyvsp[(1) - (5)].StrVal)) {
5059 Name = *(yyvsp[(1) - (5)].StrVal);
5060 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005061 }
5062 if (Name.empty())
5063 GEN_ERROR("Alias name cannot be empty");
5064
Chris Lattner59363a32008-02-19 04:36:25 +00005065 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005066 if (Aliasee == 0)
5067 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5068
Chris Lattner59363a32008-02-19 04:36:25 +00005069 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005070 CurModule.CurrentModule);
Chris Lattner59363a32008-02-19 04:36:25 +00005071 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005072 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005073
5074
5075 // If there was a forward reference of this alias, resolve it now.
5076
5077 ValID ID;
5078 if (!Name.empty())
5079 ID = ValID::createGlobalName(Name);
5080 else
5081 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5082
5083 if (GlobalValue *FWGV =
5084 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5085 // Replace uses of the fwdref with the actual alias.
5086 FWGV->replaceAllUsesWith(GA);
5087 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5088 GV->eraseFromParent();
5089 else
5090 cast<Function>(FWGV)->eraseFromParent();
5091 }
5092 ID.destroy();
5093
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005094 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005095 ;}
5096 break;
5097
Dale Johannesena79ecf32008-02-20 21:15:43 +00005098 case 225:
5099#line 2150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005100 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005101 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005102 ;}
5103 break;
5104
Dale Johannesena79ecf32008-02-20 21:15:43 +00005105 case 226:
5106#line 2153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005107 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005108 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005109 ;}
5110 break;
5111
Dale Johannesena79ecf32008-02-20 21:15:43 +00005112 case 227:
5113#line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005114 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005115 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5116 if (AsmSoFar.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005117 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005118 else
Chris Lattner59363a32008-02-19 04:36:25 +00005119 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5120 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005121 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005122;}
5123 break;
5124
Dale Johannesena79ecf32008-02-20 21:15:43 +00005125 case 228:
5126#line 2169 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005127 {
5128 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5129 delete (yyvsp[(3) - (3)].StrVal);
5130 ;}
5131 break;
5132
Dale Johannesena79ecf32008-02-20 21:15:43 +00005133 case 229:
5134#line 2173 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005135 {
5136 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5137 delete (yyvsp[(3) - (3)].StrVal);
5138 ;}
5139 break;
5140
Dale Johannesena79ecf32008-02-20 21:15:43 +00005141 case 231:
5142#line 2180 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005143 {
5144 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5145 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005146 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005147 ;}
5148 break;
5149
Dale Johannesena79ecf32008-02-20 21:15:43 +00005150 case 232:
5151#line 2185 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005152 {
5153 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5154 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005155 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005156 ;}
5157 break;
5158
Dale Johannesena79ecf32008-02-20 21:15:43 +00005159 case 233:
5160#line 2190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005161 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005162 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005163 ;}
5164 break;
5165
Dale Johannesena79ecf32008-02-20 21:15:43 +00005166 case 234:
5167#line 2199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005168 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005169 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005170 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5171 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005172 GEN_ERROR("void typed arguments are invalid");
Chris Lattner59363a32008-02-19 04:36:25 +00005173 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5174 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5175 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005176 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005177 ;}
5178 break;
5179
Dale Johannesena79ecf32008-02-20 21:15:43 +00005180 case 235:
5181#line 2209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005182 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005183 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005184 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5185 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005186 GEN_ERROR("void typed arguments are invalid");
Chris Lattner59363a32008-02-19 04:36:25 +00005187 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5188 (yyval.ArgList) = new ArgListType;
5189 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005190 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005191 ;}
5192 break;
5193
Dale Johannesena79ecf32008-02-20 21:15:43 +00005194 case 236:
5195#line 2220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005196 {
5197 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005198 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005199 ;}
5200 break;
5201
Dale Johannesena79ecf32008-02-20 21:15:43 +00005202 case 237:
5203#line 2224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005204 {
5205 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005206 struct ArgListEntry E;
5207 E.Ty = new PATypeHolder(Type::VoidTy);
5208 E.Name = 0;
5209 E.Attrs = ParamAttr::None;
Chris Lattner59363a32008-02-19 04:36:25 +00005210 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005211 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005212 ;}
5213 break;
5214
Dale Johannesena79ecf32008-02-20 21:15:43 +00005215 case 238:
5216#line 2233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005217 {
5218 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005219 struct ArgListEntry E;
5220 E.Ty = new PATypeHolder(Type::VoidTy);
5221 E.Name = 0;
5222 E.Attrs = ParamAttr::None;
Chris Lattner59363a32008-02-19 04:36:25 +00005223 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005224 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005225 ;}
5226 break;
5227
Dale Johannesena79ecf32008-02-20 21:15:43 +00005228 case 239:
5229#line 2242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005230 {
5231 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005232 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005233 ;}
5234 break;
5235
Dale Johannesena79ecf32008-02-20 21:15:43 +00005236 case 240:
5237#line 2248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005238 {
5239 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5240 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005241
5242 // Check the function result for abstractness if this is a define. We should
5243 // have no abstract types at this point
Chris Lattner59363a32008-02-19 04:36:25 +00005244 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5245 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005246
5247 std::vector<const Type*> ParamTypeList;
5248 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00005249 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005250 ParamAttrsWithIndex PAWI;
5251 PAWI.index = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005252 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005253 Attrs.push_back(PAWI);
5254 }
Chris Lattner59363a32008-02-19 04:36:25 +00005255 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005256 unsigned index = 1;
Chris Lattner59363a32008-02-19 04:36:25 +00005257 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005258 const Type* Ty = I->Ty->get();
5259 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5260 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5261 ParamTypeList.push_back(Ty);
5262 if (Ty != Type::VoidTy)
5263 if (I->Attrs != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005264 ParamAttrsWithIndex PAWI;
5265 PAWI.index = index;
5266 PAWI.attrs = I->Attrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005267 Attrs.push_back(PAWI);
5268 }
5269 }
5270 }
5271
5272 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5273 if (isVarArg) ParamTypeList.pop_back();
5274
Duncan Sands637ec552007-11-28 17:07:01 +00005275 const ParamAttrsList *PAL = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005276 if (!Attrs.empty())
5277 PAL = ParamAttrsList::get(Attrs);
5278
Chris Lattner59363a32008-02-19 04:36:25 +00005279 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005280 const PointerType *PFT = PointerType::getUnqual(FT);
Chris Lattner59363a32008-02-19 04:36:25 +00005281 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005282
5283 ValID ID;
5284 if (!FunctionName.empty()) {
5285 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5286 } else {
5287 ID = ValID::createGlobalID(CurModule.Values.size());
5288 }
5289
5290 Function *Fn = 0;
5291 // See if this function was forward referenced. If so, recycle the object.
5292 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5293 // Move the function to the end of the list, from whereever it was
5294 // previously inserted.
5295 Fn = cast<Function>(FWRef);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005296 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005297 CurModule.CurrentModule->getFunctionList().remove(Fn);
5298 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5299 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5300 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005301 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005302 // The existing function doesn't have the same type. This is an overload
5303 // error.
5304 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005305 } else if (Fn->getParamAttrs() != PAL) {
5306 // The existing function doesn't have the same parameter attributes.
5307 // This is an overload error.
5308 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005309 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5310 // Neither the existing or the current function is a declaration and they
5311 // have the same name and same type. Clearly this is a redefinition.
5312 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005313 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005314 // Make sure to strip off any argument names so we can't get conflicts.
5315 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5316 AI != AE; ++AI)
5317 AI->setName("");
5318 }
5319 } else { // Not already defined?
5320 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5321 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005322 InsertValue(Fn, CurModule.Values);
5323 }
5324
5325 CurFun.FunctionStart(Fn);
5326
5327 if (CurFun.isDeclare) {
5328 // If we have declaration, always overwrite linkage. This will allow us to
5329 // correctly handle cases, when pointer to function is passed as argument to
5330 // another function.
5331 Fn->setLinkage(CurFun.Linkage);
5332 Fn->setVisibility(CurFun.Visibility);
5333 }
Chris Lattner59363a32008-02-19 04:36:25 +00005334 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005335 Fn->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00005336 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5337 if ((yyvsp[(8) - (10)].StrVal)) {
5338 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5339 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005340 }
Chris Lattner59363a32008-02-19 04:36:25 +00005341 if ((yyvsp[(10) - (10)].StrVal)) {
5342 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5343 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005344 }
5345
5346 // Add all of the arguments we parsed to the function...
Chris Lattner59363a32008-02-19 04:36:25 +00005347 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005348 if (isVarArg) { // Nuke the last entry
Chris Lattner59363a32008-02-19 04:36:25 +00005349 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005350 "Not a varargs marker!");
Chris Lattner59363a32008-02-19 04:36:25 +00005351 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5352 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005353 }
5354 Function::arg_iterator ArgIt = Fn->arg_begin();
5355 Function::arg_iterator ArgEnd = Fn->arg_end();
5356 unsigned Idx = 1;
Chris Lattner59363a32008-02-19 04:36:25 +00005357 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5358 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005359 delete I->Ty; // Delete the typeholder...
5360 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5361 CHECK_FOR_ERROR
5362 InsertValue(ArgIt);
5363 Idx++;
5364 }
5365
Chris Lattner59363a32008-02-19 04:36:25 +00005366 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005367 }
5368 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005369;}
5370 break;
5371
Dale Johannesena79ecf32008-02-20 21:15:43 +00005372 case 243:
5373#line 2383 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005374 {
5375 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005376
5377 // Make sure that we keep track of the linkage type even if there was a
5378 // previous "declare".
Chris Lattner59363a32008-02-19 04:36:25 +00005379 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5380 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5381;}
5382 break;
5383
Dale Johannesena79ecf32008-02-20 21:15:43 +00005384 case 246:
5385#line 2394 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005386 {
5387 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005388 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005389;}
5390 break;
5391
Dale Johannesena79ecf32008-02-20 21:15:43 +00005392 case 247:
5393#line 2399 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005394 {
5395 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5396 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5397 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005398 CurFun.FunctionDone();
5399 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005400 ;}
5401 break;
5402
Dale Johannesena79ecf32008-02-20 21:15:43 +00005403 case 248:
5404#line 2411 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005405 {
5406 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005407 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005408 ;}
5409 break;
5410
Dale Johannesena79ecf32008-02-20 21:15:43 +00005411 case 249:
5412#line 2415 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005413 {
5414 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005415 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005416 ;}
5417 break;
5418
Dale Johannesena79ecf32008-02-20 21:15:43 +00005419 case 250:
5420#line 2420 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005421 { // A reference to a direct constant
5422 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005423 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005424 ;}
5425 break;
5426
Dale Johannesena79ecf32008-02-20 21:15:43 +00005427 case 251:
5428#line 2424 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005429 {
5430 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005431 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005432 ;}
5433 break;
5434
Dale Johannesena79ecf32008-02-20 21:15:43 +00005435 case 252:
5436#line 2428 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005437 { // Perhaps it's an FP constant?
5438 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005439 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005440 ;}
5441 break;
5442
Dale Johannesena79ecf32008-02-20 21:15:43 +00005443 case 253:
5444#line 2432 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005445 {
5446 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005447 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005448 ;}
5449 break;
5450
Dale Johannesena79ecf32008-02-20 21:15:43 +00005451 case 254:
5452#line 2436 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005453 {
5454 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005455 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005456 ;}
5457 break;
5458
Dale Johannesena79ecf32008-02-20 21:15:43 +00005459 case 255:
5460#line 2440 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005461 {
5462 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005463 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005464 ;}
5465 break;
5466
Dale Johannesena79ecf32008-02-20 21:15:43 +00005467 case 256:
5468#line 2444 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005469 {
5470 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005471 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005472 ;}
5473 break;
5474
Dale Johannesena79ecf32008-02-20 21:15:43 +00005475 case 257:
5476#line 2448 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005477 { // A vector zero constant.
5478 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005479 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005480 ;}
5481 break;
5482
Dale Johannesena79ecf32008-02-20 21:15:43 +00005483 case 258:
5484#line 2452 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005485 { // Nonempty unsized packed vector
5486 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5487 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005488
5489 VectorType* pt = VectorType::get(ETy, NumElements);
5490 PATypeHolder* PTy = new PATypeHolder(
5491 HandleUpRefs(
5492 VectorType::get(
5493 ETy,
5494 NumElements)
5495 )
5496 );
5497
5498 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00005499 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5500 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005501 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5502 ETy->getDescription() +"' as required!\nIt is of type '" +
Chris Lattner59363a32008-02-19 04:36:25 +00005503 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005504 }
5505
Chris Lattner59363a32008-02-19 04:36:25 +00005506 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5507 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005508 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005509 ;}
5510 break;
5511
Dale Johannesena79ecf32008-02-20 21:15:43 +00005512 case 259:
5513#line 2477 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005514 {
5515 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005516 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005517 ;}
5518 break;
5519
Dale Johannesena79ecf32008-02-20 21:15:43 +00005520 case 260:
5521#line 2481 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005522 {
5523 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5524 delete (yyvsp[(3) - (5)].StrVal);
5525 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005526 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005527 ;}
5528 break;
5529
Dale Johannesena79ecf32008-02-20 21:15:43 +00005530 case 261:
5531#line 2491 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005532 { // Is it an integer reference...?
5533 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005534 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005535 ;}
5536 break;
5537
Dale Johannesena79ecf32008-02-20 21:15:43 +00005538 case 262:
5539#line 2495 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005540 {
5541 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005542 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005543 ;}
5544 break;
5545
Dale Johannesena79ecf32008-02-20 21:15:43 +00005546 case 263:
5547#line 2499 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005548 { // Is it a named reference...?
5549 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5550 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005551 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005552 ;}
5553 break;
5554
Dale Johannesena79ecf32008-02-20 21:15:43 +00005555 case 264:
5556#line 2504 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005557 { // Is it a named reference...?
5558 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5559 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005560 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005561 ;}
5562 break;
5563
Dale Johannesena79ecf32008-02-20 21:15:43 +00005564 case 267:
5565#line 2517 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005566 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005567 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005568 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5569 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5570 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005571 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005572 ;}
5573 break;
5574
Dale Johannesena79ecf32008-02-20 21:15:43 +00005575 case 268:
5576#line 2526 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005577 {
5578 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005579 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005580 ;}
5581 break;
5582
Dale Johannesena79ecf32008-02-20 21:15:43 +00005583 case 269:
5584#line 2530 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005585 { // Do not allow functions with 0 basic blocks
5586 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005587 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005588 ;}
5589 break;
5590
Dale Johannesena79ecf32008-02-20 21:15:43 +00005591 case 270:
5592#line 2539 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005593 {
5594 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005595 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005596 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5597 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5598 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005599 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005600 ;}
5601 break;
5602
Dale Johannesena79ecf32008-02-20 21:15:43 +00005603 case 271:
5604#line 2548 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005605 {
5606 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005607 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5608 if (CI2->getParent() == 0)
Chris Lattner59363a32008-02-19 04:36:25 +00005609 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5610 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5611 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005612 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005613 ;}
5614 break;
5615
Dale Johannesena79ecf32008-02-20 21:15:43 +00005616 case 272:
5617#line 2557 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005618 { // Empty space between instruction lists
5619 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005620 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005621 ;}
5622 break;
5623
Dale Johannesena79ecf32008-02-20 21:15:43 +00005624 case 273:
5625#line 2561 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005626 { // Labelled (named) basic block
5627 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5628 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005629 CHECK_FOR_ERROR
5630
Chris Lattner59363a32008-02-19 04:36:25 +00005631 ;}
5632 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005633
Dale Johannesena79ecf32008-02-20 21:15:43 +00005634 case 274:
5635#line 2568 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005636 { // Return with a result...
5637 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5638 CHECK_FOR_ERROR
5639 ;}
5640 break;
5641
Dale Johannesena79ecf32008-02-20 21:15:43 +00005642 case 275:
5643#line 2572 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005644 { // Return with no result...
5645 (yyval.TermInstVal) = new ReturnInst();
5646 CHECK_FOR_ERROR
5647 ;}
5648 break;
5649
Dale Johannesena79ecf32008-02-20 21:15:43 +00005650 case 276:
5651#line 2576 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005652 { // Unconditional Branch...
5653 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5654 CHECK_FOR_ERROR
5655 (yyval.TermInstVal) = new BranchInst(tmpBB);
5656 ;}
5657 break;
5658
Dale Johannesena79ecf32008-02-20 21:15:43 +00005659 case 277:
5660#line 2581 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005661 {
5662 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5663 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5664 CHECK_FOR_ERROR
5665 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5666 CHECK_FOR_ERROR
5667 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5668 CHECK_FOR_ERROR
5669 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5670 ;}
5671 break;
5672
Dale Johannesena79ecf32008-02-20 21:15:43 +00005673 case 278:
5674#line 2591 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005675 {
5676 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5677 CHECK_FOR_ERROR
5678 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5679 CHECK_FOR_ERROR
5680 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5681 (yyval.TermInstVal) = S;
5682
5683 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5684 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005685 for (; I != E; ++I) {
5686 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5687 S->addCase(CI, I->second);
5688 else
5689 GEN_ERROR("Switch case is constant, but not a simple integer");
5690 }
Chris Lattner59363a32008-02-19 04:36:25 +00005691 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005692 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005693 ;}
5694 break;
5695
Dale Johannesena79ecf32008-02-20 21:15:43 +00005696 case 279:
5697#line 2610 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005698 {
5699 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005700 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005701 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005702 CHECK_FOR_ERROR
5703 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Chris Lattner59363a32008-02-19 04:36:25 +00005704 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005705 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005706 ;}
5707 break;
5708
Dale Johannesena79ecf32008-02-20 21:15:43 +00005709 case 280:
5710#line 2620 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005711 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005712
5713 // Handle the short syntax
5714 const PointerType *PFTy = 0;
5715 const FunctionType *Ty = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005716 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005717 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5718 // Pull out the types of all of the arguments...
5719 std::vector<const Type*> ParamTypes;
Chris Lattner59363a32008-02-19 04:36:25 +00005720 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005721 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005722 const Type *Ty = I->Val->getType();
5723 if (Ty == Type::VoidTy)
5724 GEN_ERROR("Short call syntax cannot be used with varargs");
5725 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005726 }
Chris Lattner59363a32008-02-19 04:36:25 +00005727 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00005728 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005729 }
5730
Chris Lattner59363a32008-02-19 04:36:25 +00005731 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005732
Chris Lattner59363a32008-02-19 04:36:25 +00005733 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005734 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005735 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005736 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005737 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005738 CHECK_FOR_ERROR
5739
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005740 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00005741 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5742 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005743 Attrs.push_back(PAWI);
5744 }
5745
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005746 // Check the arguments
5747 ValueList Args;
Chris Lattner59363a32008-02-19 04:36:25 +00005748 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005749 // Make sure no arguments is a good thing!
5750 if (Ty->getNumParams() != 0)
5751 GEN_ERROR("No arguments passed to a function that "
5752 "expects arguments");
5753 } else { // Has arguments?
5754 // Loop through FunctionType's arguments and ensure they are specified
5755 // correctly!
5756 FunctionType::param_iterator I = Ty->param_begin();
5757 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner59363a32008-02-19 04:36:25 +00005758 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005759 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005760
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005761 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005762 if (ArgI->Val->getType() != *I)
5763 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5764 (*I)->getDescription() + "'");
5765 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005766 if (ArgI->Attrs != ParamAttr::None) {
5767 ParamAttrsWithIndex PAWI;
5768 PAWI.index = index;
5769 PAWI.attrs = ArgI->Attrs;
5770 Attrs.push_back(PAWI);
5771 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005772 }
5773
5774 if (Ty->isVarArg()) {
5775 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00005776 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005777 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner59363a32008-02-19 04:36:25 +00005778 if (ArgI->Attrs != ParamAttr::None) {
5779 ParamAttrsWithIndex PAWI;
5780 PAWI.index = index;
5781 PAWI.attrs = ArgI->Attrs;
5782 Attrs.push_back(PAWI);
5783 }
5784 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005785 } else if (I != E || ArgI != ArgE)
5786 GEN_ERROR("Invalid number of parameters detected");
5787 }
5788
Duncan Sands637ec552007-11-28 17:07:01 +00005789 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005790 if (!Attrs.empty())
5791 PAL = ParamAttrsList::get(Attrs);
5792
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005793 // Create the InvokeInst
Chris Lattnerd140ada2007-08-29 16:15:23 +00005794 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Chris Lattner59363a32008-02-19 04:36:25 +00005795 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005796 II->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00005797 (yyval.TermInstVal) = II;
5798 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005799 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005800 ;}
5801 break;
5802
Dale Johannesena79ecf32008-02-20 21:15:43 +00005803 case 281:
5804#line 2710 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005805 {
5806 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005807 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005808 ;}
5809 break;
5810
Dale Johannesena79ecf32008-02-20 21:15:43 +00005811 case 282:
5812#line 2714 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005813 {
5814 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005815 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005816 ;}
5817 break;
5818
Dale Johannesena79ecf32008-02-20 21:15:43 +00005819 case 283:
5820#line 2721 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005821 {
5822 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5823 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005824 CHECK_FOR_ERROR
5825 if (V == 0)
5826 GEN_ERROR("May only switch on a constant pool value");
5827
Chris Lattner59363a32008-02-19 04:36:25 +00005828 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005829 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005830 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5831 ;}
5832 break;
5833
Dale Johannesena79ecf32008-02-20 21:15:43 +00005834 case 284:
5835#line 2732 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005836 {
5837 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5838 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005839 CHECK_FOR_ERROR
5840
5841 if (V == 0)
5842 GEN_ERROR("May only switch on a constant pool value");
5843
Chris Lattner59363a32008-02-19 04:36:25 +00005844 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005845 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005846 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5847 ;}
5848 break;
5849
Dale Johannesena79ecf32008-02-20 21:15:43 +00005850 case 285:
5851#line 2745 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005852 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005853 // Is this definition named?? if so, assign the name...
Chris Lattner59363a32008-02-19 04:36:25 +00005854 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005855 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005856 InsertValue((yyvsp[(2) - (2)].InstVal));
5857 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005858 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005859 ;}
5860 break;
5861
Dale Johannesena79ecf32008-02-20 21:15:43 +00005862 case 286:
5863#line 2755 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005864 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005865 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005866 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5867 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5868 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005869 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005870 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005871 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005872 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5873 delete (yyvsp[(1) - (6)].TypeVal);
5874 ;}
5875 break;
5876
Dale Johannesena79ecf32008-02-20 21:15:43 +00005877 case 287:
5878#line 2766 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005879 {
5880 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5881 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005882 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005883 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005884 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005885 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5886 ;}
5887 break;
5888
Dale Johannesena79ecf32008-02-20 21:15:43 +00005889 case 288:
5890#line 2776 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005891 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005892 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005893 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005894 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005895 // Used for call and invoke instructions
Chris Lattner59363a32008-02-19 04:36:25 +00005896 (yyval.ParamList) = new ParamList();
5897 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5898 (yyval.ParamList)->push_back(E);
5899 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005900 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005901 ;}
5902 break;
5903
Dale Johannesena79ecf32008-02-20 21:15:43 +00005904 case 289:
5905#line 2787 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005906 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005907 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00005908 // Labels are only valid in ASMs
Chris Lattner59363a32008-02-19 04:36:25 +00005909 (yyval.ParamList) = new ParamList();
5910 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5911 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005912 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005913 ;}
5914 break;
5915
Dale Johannesena79ecf32008-02-20 21:15:43 +00005916 case 290:
5917#line 2795 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005918 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005919 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005920 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005921 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5922 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5923 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5924 (yyval.ParamList)->push_back(E);
5925 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005926 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005927 ;}
5928 break;
5929
Dale Johannesena79ecf32008-02-20 21:15:43 +00005930 case 291:
5931#line 2805 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005932 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005933 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Chris Lattner59363a32008-02-19 04:36:25 +00005934 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5935 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5936 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00005937 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005938 ;}
5939 break;
5940
Dale Johannesena79ecf32008-02-20 21:15:43 +00005941 case 292:
5942#line 2812 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005943 { (yyval.ParamList) = new ParamList(); ;}
5944 break;
5945
Dale Johannesena79ecf32008-02-20 21:15:43 +00005946 case 293:
5947#line 2815 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005948 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5949 break;
5950
Dale Johannesena79ecf32008-02-20 21:15:43 +00005951 case 294:
5952#line 2816 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005953 {
5954 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5955 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005956 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005957 ;}
5958 break;
5959
Dale Johannesena79ecf32008-02-20 21:15:43 +00005960 case 295:
5961#line 2823 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005962 {
5963 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005964 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005965 ;}
5966 break;
5967
Dale Johannesena79ecf32008-02-20 21:15:43 +00005968 case 296:
5969#line 2827 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005970 {
5971 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005972 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005973 ;}
5974 break;
5975
Dale Johannesena79ecf32008-02-20 21:15:43 +00005976 case 297:
5977#line 2832 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005978 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005979 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005980 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5981 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5982 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005983 GEN_ERROR(
5984 "Arithmetic operator requires integer, FP, or packed operands");
Chris Lattner59363a32008-02-19 04:36:25 +00005985 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005986 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005987 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005988 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005989 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5990 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005991 GEN_ERROR("binary operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00005992 delete (yyvsp[(2) - (5)].TypeVal);
5993 ;}
5994 break;
5995
Dale Johannesena79ecf32008-02-20 21:15:43 +00005996 case 298:
5997#line 2848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005998 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005999 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006000 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6001 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6002 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6003 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006004 GEN_ERROR("Logical operator requires integral operands");
6005 }
Chris Lattner59363a32008-02-19 04:36:25 +00006006 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006007 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006008 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006009 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006010 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6011 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006012 GEN_ERROR("binary operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006013 delete (yyvsp[(2) - (5)].TypeVal);
6014 ;}
6015 break;
6016
Dale Johannesena79ecf32008-02-20 21:15:43 +00006017 case 299:
6018#line 2865 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006019 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006020 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006021 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6022 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006023 GEN_ERROR("Vector types not supported by icmp instruction");
Chris Lattner59363a32008-02-19 04:36:25 +00006024 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006025 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006026 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006027 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006028 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6029 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006030 GEN_ERROR("icmp operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006031 delete (yyvsp[(3) - (6)].TypeVal);
6032 ;}
6033 break;
6034
Dale Johannesena79ecf32008-02-20 21:15:43 +00006035 case 300:
6036#line 2879 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006037 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006038 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006039 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6040 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006041 GEN_ERROR("Vector types not supported by fcmp instruction");
Chris Lattner59363a32008-02-19 04:36:25 +00006042 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006043 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006044 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006045 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006046 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6047 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006048 GEN_ERROR("fcmp operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006049 delete (yyvsp[(3) - (6)].TypeVal);
6050 ;}
6051 break;
6052
Dale Johannesena79ecf32008-02-20 21:15:43 +00006053 case 301:
6054#line 2893 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006055 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006056 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006057 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6058 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6059 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6060 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006061 GEN_ERROR("invalid cast opcode for cast from '" +
6062 Val->getType()->getDescription() + "' to '" +
6063 DestTy->getDescription() + "'");
Chris Lattner59363a32008-02-19 04:36:25 +00006064 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6065 delete (yyvsp[(4) - (4)].TypeVal);
6066 ;}
6067 break;
6068
Dale Johannesena79ecf32008-02-20 21:15:43 +00006069 case 302:
6070#line 2905 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006071 {
6072 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006073 GEN_ERROR("select condition must be boolean");
Chris Lattner59363a32008-02-19 04:36:25 +00006074 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006075 GEN_ERROR("select value types should match");
Chris Lattner59363a32008-02-19 04:36:25 +00006076 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006077 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006078 ;}
6079 break;
6080
Dale Johannesena79ecf32008-02-20 21:15:43 +00006081 case 303:
6082#line 2913 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006083 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006084 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006085 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6086 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6087 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006088 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006089 ;}
6090 break;
6091
Dale Johannesena79ecf32008-02-20 21:15:43 +00006092 case 304:
6093#line 2920 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006094 {
6095 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006096 GEN_ERROR("Invalid extractelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006097 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006098 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006099 ;}
6100 break;
6101
Dale Johannesena79ecf32008-02-20 21:15:43 +00006102 case 305:
6103#line 2926 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006104 {
6105 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006106 GEN_ERROR("Invalid insertelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006107 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006108 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006109 ;}
6110 break;
6111
Dale Johannesena79ecf32008-02-20 21:15:43 +00006112 case 306:
6113#line 2932 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006114 {
6115 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006116 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006117 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006118 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006119 ;}
6120 break;
6121
Dale Johannesena79ecf32008-02-20 21:15:43 +00006122 case 307:
6123#line 2938 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006124 {
6125 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006126 if (!Ty->isFirstClassType())
6127 GEN_ERROR("PHI node operands must be of first class type");
Chris Lattner59363a32008-02-19 04:36:25 +00006128 (yyval.InstVal) = new PHINode(Ty);
6129 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6130 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6131 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006132 GEN_ERROR("All elements of a PHI node must be of the same type");
Chris Lattner59363a32008-02-19 04:36:25 +00006133 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6134 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006135 }
Chris Lattner59363a32008-02-19 04:36:25 +00006136 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006137 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006138 ;}
6139 break;
6140
Dale Johannesena79ecf32008-02-20 21:15:43 +00006141 case 308:
6142#line 2954 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006143 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006144
6145 // Handle the short syntax
6146 const PointerType *PFTy = 0;
6147 const FunctionType *Ty = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00006148 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006149 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6150 // Pull out the types of all of the arguments...
6151 std::vector<const Type*> ParamTypes;
Chris Lattner59363a32008-02-19 04:36:25 +00006152 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006153 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006154 const Type *Ty = I->Val->getType();
6155 if (Ty == Type::VoidTy)
6156 GEN_ERROR("Short call syntax cannot be used with varargs");
6157 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006158 }
Chris Lattner59363a32008-02-19 04:36:25 +00006159 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006160 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006161 }
6162
Chris Lattner59363a32008-02-19 04:36:25 +00006163 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006164 CHECK_FOR_ERROR
6165
6166 // Check for call to invalid intrinsic to avoid crashing later.
6167 if (Function *theF = dyn_cast<Function>(V)) {
6168 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6169 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6170 !theF->getIntrinsicID(true))
6171 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6172 theF->getName() + "'");
6173 }
6174
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006175 // Set up the ParamAttrs for the function
6176 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00006177 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006178 ParamAttrsWithIndex PAWI;
6179 PAWI.index = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00006180 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006181 Attrs.push_back(PAWI);
6182 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006183 // Check the arguments
6184 ValueList Args;
Chris Lattner59363a32008-02-19 04:36:25 +00006185 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006186 // Make sure no arguments is a good thing!
6187 if (Ty->getNumParams() != 0)
6188 GEN_ERROR("No arguments passed to a function that "
6189 "expects arguments");
6190 } else { // Has arguments?
6191 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006192 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006193 FunctionType::param_iterator I = Ty->param_begin();
6194 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner59363a32008-02-19 04:36:25 +00006195 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006196 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006197
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006198 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006199 if (ArgI->Val->getType() != *I)
6200 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6201 (*I)->getDescription() + "'");
6202 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006203 if (ArgI->Attrs != ParamAttr::None) {
6204 ParamAttrsWithIndex PAWI;
6205 PAWI.index = index;
6206 PAWI.attrs = ArgI->Attrs;
6207 Attrs.push_back(PAWI);
6208 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006209 }
6210 if (Ty->isVarArg()) {
6211 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006212 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006213 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner59363a32008-02-19 04:36:25 +00006214 if (ArgI->Attrs != ParamAttr::None) {
6215 ParamAttrsWithIndex PAWI;
6216 PAWI.index = index;
6217 PAWI.attrs = ArgI->Attrs;
6218 Attrs.push_back(PAWI);
6219 }
6220 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006221 } else if (I != E || ArgI != ArgE)
6222 GEN_ERROR("Invalid number of parameters detected");
6223 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006224
6225 // Finish off the ParamAttrs and check them
Duncan Sands637ec552007-11-28 17:07:01 +00006226 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006227 if (!Attrs.empty())
6228 PAL = ParamAttrsList::get(Attrs);
6229
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006230 // Create the call node
David Greene9145dd22007-08-01 03:59:32 +00006231 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Chris Lattner59363a32008-02-19 04:36:25 +00006232 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6233 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006234 CI->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00006235 (yyval.InstVal) = CI;
6236 delete (yyvsp[(6) - (8)].ParamList);
6237 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006238 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006239 ;}
6240 break;
6241
Dale Johannesena79ecf32008-02-20 21:15:43 +00006242 case 309:
6243#line 3051 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006244 {
6245 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006246 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006247 ;}
6248 break;
6249
Dale Johannesena79ecf32008-02-20 21:15:43 +00006250 case 310:
6251#line 3056 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006252 {
6253 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006254 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006255 ;}
6256 break;
6257
Dale Johannesena79ecf32008-02-20 21:15:43 +00006258 case 311:
6259#line 3060 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006260 {
6261 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006262 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006263 ;}
6264 break;
6265
Dale Johannesena79ecf32008-02-20 21:15:43 +00006266 case 312:
6267#line 3067 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006268 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006269 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006270 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6271 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6272 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006273 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006274 ;}
6275 break;
6276
Dale Johannesena79ecf32008-02-20 21:15:43 +00006277 case 313:
6278#line 3074 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006279 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006280 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006281 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6282 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006283 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006284 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6285 delete (yyvsp[(2) - (6)].TypeVal);
6286 ;}
6287 break;
6288
Dale Johannesena79ecf32008-02-20 21:15:43 +00006289 case 314:
6290#line 3082 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006291 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006292 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006293 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6294 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6295 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006296 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006297 ;}
6298 break;
6299
Dale Johannesena79ecf32008-02-20 21:15:43 +00006300 case 315:
6301#line 3089 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006302 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006303 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006304 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6305 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006306 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006307 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6308 delete (yyvsp[(2) - (6)].TypeVal);
6309 ;}
6310 break;
6311
Dale Johannesena79ecf32008-02-20 21:15:43 +00006312 case 316:
6313#line 3097 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006314 {
6315 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006316 GEN_ERROR("Trying to free nonpointer type " +
Chris Lattner59363a32008-02-19 04:36:25 +00006317 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6318 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006319 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006320 ;}
6321 break;
6322
Dale Johannesena79ecf32008-02-20 21:15:43 +00006323 case 317:
6324#line 3105 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006325 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006326 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006327 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6328 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 GEN_ERROR("Can't load from nonpointer type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006330 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6331 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006332 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006333 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6334 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006335 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006336 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6337 delete (yyvsp[(3) - (5)].TypeVal);
6338 ;}
6339 break;
6340
Dale Johannesena79ecf32008-02-20 21:15:43 +00006341 case 318:
6342#line 3119 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006343 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006344 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006345 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6346 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006347 if (!PT)
6348 GEN_ERROR("Can't store to a nonpointer type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006349 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006350 const Type *ElTy = PT->getElementType();
Chris Lattner59363a32008-02-19 04:36:25 +00006351 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6352 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006353 "' into space of type '" + ElTy->getDescription() + "'");
6354
Chris Lattner59363a32008-02-19 04:36:25 +00006355 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006356 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006357 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6358 delete (yyvsp[(5) - (7)].TypeVal);
6359 ;}
6360 break;
6361
Dale Johannesena79ecf32008-02-20 21:15:43 +00006362 case 319:
6363#line 3136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel3b8849c2008-02-19 22:27:01 +00006364 {
6365 ValID TmpVID = ValID::createLocalName(*(yyvsp[(3) - (5)].StrVal));
6366 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), TmpVID);
Devang Pateleb293342008-02-20 19:13:10 +00006367 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel3b8849c2008-02-19 22:27:01 +00006368 GEN_ERROR("Invalid getresult operands");
Devang Pateleb293342008-02-20 19:13:10 +00006369 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
Devang Patel3b8849c2008-02-19 22:27:01 +00006370 CHECK_FOR_ERROR
6371 ;}
6372 break;
6373
Dale Johannesena79ecf32008-02-20 21:15:43 +00006374 case 320:
6375#line 3144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006376 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006377 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006378 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6379 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006380 GEN_ERROR("getelementptr insn requires pointer operand");
6381
Chris Lattner59363a32008-02-19 04:36:25 +00006382 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006383 GEN_ERROR("Invalid getelementptr indices for type '" +
Chris Lattner59363a32008-02-19 04:36:25 +00006384 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6385 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006386 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006387 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6388 delete (yyvsp[(2) - (4)].TypeVal);
6389 delete (yyvsp[(4) - (4)].ValueList);
6390 ;}
6391 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006392
Chris Lattner59363a32008-02-19 04:36:25 +00006393
6394/* Line 1267 of yacc.c. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00006395#line 6396 "llvmAsmParser.tab.c"
Chris Lattner59363a32008-02-19 04:36:25 +00006396 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006397 }
Chris Lattner59363a32008-02-19 04:36:25 +00006398 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6399
6400 YYPOPSTACK (yylen);
6401 yylen = 0;
6402 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006403
6404 *++yyvsp = yyval;
6405
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006406
Chris Lattner59363a32008-02-19 04:36:25 +00006407 /* Now `shift' the result of the reduction. Determine what state
6408 that goes to, based on the state we popped back to and the rule
6409 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006410
6411 yyn = yyr1[yyn];
6412
Chris Lattner59363a32008-02-19 04:36:25 +00006413 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6414 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006415 yystate = yytable[yystate];
6416 else
Chris Lattner59363a32008-02-19 04:36:25 +00006417 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006418
6419 goto yynewstate;
6420
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006421
Chris Lattner59363a32008-02-19 04:36:25 +00006422/*------------------------------------.
6423| yyerrlab -- here on detecting error |
6424`------------------------------------*/
6425yyerrlab:
6426 /* If not already recovering from an error, report this error. */
6427 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006428 {
6429 ++yynerrs;
Chris Lattner59363a32008-02-19 04:36:25 +00006430#if ! YYERROR_VERBOSE
6431 yyerror (YY_("syntax error"));
6432#else
6433 {
6434 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6435 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6436 {
6437 YYSIZE_T yyalloc = 2 * yysize;
6438 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6439 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6440 if (yymsg != yymsgbuf)
6441 YYSTACK_FREE (yymsg);
6442 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6443 if (yymsg)
6444 yymsg_alloc = yyalloc;
6445 else
6446 {
6447 yymsg = yymsgbuf;
6448 yymsg_alloc = sizeof yymsgbuf;
6449 }
6450 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006451
Chris Lattner59363a32008-02-19 04:36:25 +00006452 if (0 < yysize && yysize <= yymsg_alloc)
6453 {
6454 (void) yysyntax_error (yymsg, yystate, yychar);
6455 yyerror (yymsg);
6456 }
6457 else
6458 {
6459 yyerror (YY_("syntax error"));
6460 if (yysize != 0)
6461 goto yyexhaustedlab;
6462 }
6463 }
6464#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006465 }
6466
Chris Lattner59363a32008-02-19 04:36:25 +00006467
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006468
6469 if (yyerrstatus == 3)
6470 {
Chris Lattner59363a32008-02-19 04:36:25 +00006471 /* If just tried and failed to reuse look-ahead token after an
6472 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006473
Chris Lattner59363a32008-02-19 04:36:25 +00006474 if (yychar <= YYEOF)
6475 {
6476 /* Return failure if at end of input. */
6477 if (yychar == YYEOF)
6478 YYABORT;
6479 }
6480 else
6481 {
6482 yydestruct ("Error: discarding",
6483 yytoken, &yylval);
6484 yychar = YYEMPTY;
6485 }
6486 }
6487
6488 /* Else will try to reuse look-ahead token after shifting the error
6489 token. */
6490 goto yyerrlab1;
6491
6492
6493/*---------------------------------------------------.
6494| yyerrorlab -- error raised explicitly by YYERROR. |
6495`---------------------------------------------------*/
6496yyerrorlab:
6497
6498 /* Pacify compilers like GCC when the user code never invokes
6499 YYERROR and the label yyerrorlab therefore never appears in user
6500 code. */
6501 if (/*CONSTCOND*/ 0)
6502 goto yyerrorlab;
6503
6504 /* Do not reclaim the symbols of the rule which action triggered
6505 this YYERROR. */
6506 YYPOPSTACK (yylen);
6507 yylen = 0;
6508 YY_STACK_PRINT (yyss, yyssp);
6509 yystate = *yyssp;
6510 goto yyerrlab1;
6511
6512
6513/*-------------------------------------------------------------.
6514| yyerrlab1 -- common code for both syntax error and YYERROR. |
6515`-------------------------------------------------------------*/
6516yyerrlab1:
6517 yyerrstatus = 3; /* Each real token shifted decrements this. */
6518
6519 for (;;)
6520 {
6521 yyn = yypact[yystate];
6522 if (yyn != YYPACT_NINF)
6523 {
6524 yyn += YYTERROR;
6525 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6526 {
6527 yyn = yytable[yyn];
6528 if (0 < yyn)
6529 break;
6530 }
6531 }
6532
6533 /* Pop the current state because it cannot handle the error token. */
6534 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006535 YYABORT;
6536
Dale Johannesen3afee192007-09-07 21:07:57 +00006537
Chris Lattner59363a32008-02-19 04:36:25 +00006538 yydestruct ("Error: popping",
6539 yystos[yystate], yyvsp);
6540 YYPOPSTACK (1);
6541 yystate = *yyssp;
6542 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006543 }
6544
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006545 if (yyn == YYFINAL)
6546 YYACCEPT;
6547
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006548 *++yyvsp = yylval;
Chris Lattner59363a32008-02-19 04:36:25 +00006549
6550
6551 /* Shift the error token. */
6552 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006553
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006554 yystate = yyn;
6555 goto yynewstate;
6556
Scott Michel6d1aba82008-01-30 03:10:00 +00006557
Chris Lattner59363a32008-02-19 04:36:25 +00006558/*-------------------------------------.
6559| yyacceptlab -- YYACCEPT comes here. |
6560`-------------------------------------*/
6561yyacceptlab:
6562 yyresult = 0;
6563 goto yyreturn;
6564
6565/*-----------------------------------.
6566| yyabortlab -- YYABORT comes here. |
6567`-----------------------------------*/
6568yyabortlab:
6569 yyresult = 1;
6570 goto yyreturn;
6571
6572#ifndef yyoverflow
6573/*-------------------------------------------------.
6574| yyexhaustedlab -- memory exhaustion comes here. |
6575`-------------------------------------------------*/
6576yyexhaustedlab:
6577 yyerror (YY_("memory exhausted"));
6578 yyresult = 2;
6579 /* Fall through. */
Scott Michel5a6f17b2008-01-30 02:55:46 +00006580#endif
Chris Lattner59363a32008-02-19 04:36:25 +00006581
6582yyreturn:
6583 if (yychar != YYEOF && yychar != YYEMPTY)
6584 yydestruct ("Cleanup: discarding lookahead",
6585 yytoken, &yylval);
6586 /* Do not reclaim the symbols of the rule which action triggered
6587 this YYABORT or YYACCEPT. */
6588 YYPOPSTACK (yylen);
6589 YY_STACK_PRINT (yyss, yyssp);
6590 while (yyssp != yyss)
6591 {
6592 yydestruct ("Cleanup: popping",
6593 yystos[*yyssp], yyvsp);
6594 YYPOPSTACK (1);
Scott Michel6d1aba82008-01-30 03:10:00 +00006595 }
Chris Lattner59363a32008-02-19 04:36:25 +00006596#ifndef yyoverflow
6597 if (yyss != yyssa)
6598 YYSTACK_FREE (yyss);
6599#endif
6600#if YYERROR_VERBOSE
6601 if (yymsg != yymsgbuf)
6602 YYSTACK_FREE (yymsg);
6603#endif
6604 /* Make sure YYID is used. */
6605 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006606}
Chris Lattner59363a32008-02-19 04:36:25 +00006607
6608
Dale Johannesena79ecf32008-02-20 21:15:43 +00006609#line 3161 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006610
6611
6612// common code from the two 'RunVMAsmParser' functions
6613static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006614 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006615 // Check to make sure the parser succeeded
6616 if (yyparse()) {
6617 if (ParserResult)
6618 delete ParserResult;
6619 return 0;
6620 }
6621
6622 // Emit an error if there are any unresolved types left.
6623 if (!CurModule.LateResolveTypes.empty()) {
6624 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6625 if (DID.Type == ValID::LocalName) {
6626 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6627 } else {
6628 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6629 }
6630 if (ParserResult)
6631 delete ParserResult;
6632 return 0;
6633 }
6634
6635 // Emit an error if there are any unresolved values left.
6636 if (!CurModule.LateResolveValues.empty()) {
6637 Value *V = CurModule.LateResolveValues.back();
6638 std::map<Value*, std::pair<ValID, int> >::iterator I =
6639 CurModule.PlaceHolderInfo.find(V);
6640
6641 if (I != CurModule.PlaceHolderInfo.end()) {
6642 ValID &DID = I->second.first;
6643 if (DID.Type == ValID::LocalName) {
6644 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6645 } else {
6646 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6647 }
6648 if (ParserResult)
6649 delete ParserResult;
6650 return 0;
6651 }
6652 }
6653
6654 // Check to make sure that parsing produced a result
6655 if (!ParserResult)
6656 return 0;
6657
6658 // Reset ParserResult variable while saving its value for the result.
6659 Module *Result = ParserResult;
6660 ParserResult = 0;
6661
6662 return Result;
6663}
6664
6665void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006666 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006667 // TODO: column number in exception
6668 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006669 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006670 TriggerError = 1;
6671}
6672
6673int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006674 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006675 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006676 if (yychar != YYEMPTY && yychar != 0) {
6677 errMsg += " while reading token: '";
6678 errMsg += std::string(LLLgetTokenStart(),
6679 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6680 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006681 GenerateError(errMsg);
6682 return 0;
6683}
Chris Lattner59363a32008-02-19 04:36:25 +00006684