blob: 3fcc87a9e2071da57a52872d298116ac7b32a07c [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. */
Devang Patel087fe2b2008-02-23 00:38:56 +0000381#line 14 "/Volumes/Nanpura/mrv/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"
Dale Johannesen98738822008-02-22 22:17:59 +0000396#include "llvm/ParamAttrsList.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000397#include <algorithm>
398#include <list>
399#include <map>
400#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000401
402// The following is a gross hack. In order to rid the libAsmParser library of
403// exceptions, we have to have a way of getting the yyparse function to go into
404// an error situation. So, whenever we want an error to occur, the GenerateError
405// function (see bottom of file) sets TriggerError. Then, at the end of each
406// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
407// (a goto) to put YACC in error state. Furthermore, several calls to
408// GenerateError are made from inside productions and they must simulate the
409// previous exception behavior by exiting the production immediately. We have
410// replaced these with the GEN_ERROR macro which calls GeneratError and then
411// immediately invokes YYERROR. This would be so much cleaner if it was a
412// recursive descent parser.
413static bool TriggerError = false;
414#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
415#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
416
417int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
418int yylex(); // declaration" of xxx warnings.
419int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000420using namespace llvm;
421
422static Module *ParserResult;
423
424// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
425// relating to upreferences in the input stream.
426//
427//#define DEBUG_UPREFS 1
428#ifdef DEBUG_UPREFS
429#define UR_OUT(X) cerr << X
430#else
431#define UR_OUT(X)
432#endif
433
434#define YYERROR_VERBOSE 1
435
436static GlobalVariable *CurGV;
437
438
439// This contains info used when building the body of a function. It is
440// destroyed when the function is completed.
441//
442typedef std::vector<Value *> ValueList; // Numbered defs
443
444static void
445ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
446
447static struct PerModuleInfo {
448 Module *CurrentModule;
449 ValueList Values; // Module level numbered definitions
450 ValueList LateResolveValues;
451 std::vector<PATypeHolder> Types;
452 std::map<ValID, PATypeHolder> LateResolveTypes;
453
454 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
455 /// how they were referenced and on which line of the input they came from so
456 /// that we can resolve them later and print error messages as appropriate.
457 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
458
459 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
460 // references to global values. Global values may be referenced before they
461 // are defined, and if so, the temporary object that they represent is held
462 // here. This is used for forward references of GlobalValues.
463 //
464 typedef std::map<std::pair<const PointerType *,
465 ValID>, GlobalValue*> GlobalRefsType;
466 GlobalRefsType GlobalRefs;
467
468 void ModuleDone() {
469 // If we could not resolve some functions at function compilation time
470 // (calls to functions before they are defined), resolve them now... Types
471 // are resolved when the constant pool has been completely parsed.
472 //
473 ResolveDefinitions(LateResolveValues);
474 if (TriggerError)
475 return;
476
477 // Check to make sure that all global value forward references have been
478 // resolved!
479 //
480 if (!GlobalRefs.empty()) {
481 std::string UndefinedReferences = "Unresolved global references exist:\n";
482
483 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
484 I != E; ++I) {
485 UndefinedReferences += " " + I->first.first->getDescription() + " " +
486 I->first.second.getName() + "\n";
487 }
488 GenerateError(UndefinedReferences);
489 return;
490 }
491
Chandler Carruth563d4a42007-08-04 01:56:21 +0000492 // Look for intrinsic functions and CallInst that need to be upgraded
493 for (Module::iterator FI = CurrentModule->begin(),
494 FE = CurrentModule->end(); FI != FE; )
495 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
496
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000497 Values.clear(); // Clear out function local definitions
498 Types.clear();
499 CurrentModule = 0;
500 }
501
502 // GetForwardRefForGlobal - Check to see if there is a forward reference
503 // for this global. If so, remove it from the GlobalRefs map and return it.
504 // If not, just return null.
505 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
506 // Check to see if there is a forward reference to this global variable...
507 // if there is, eliminate it and patch the reference to use the new def'n.
508 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
509 GlobalValue *Ret = 0;
510 if (I != GlobalRefs.end()) {
511 Ret = I->second;
512 GlobalRefs.erase(I);
513 }
514 return Ret;
515 }
516
517 bool TypeIsUnresolved(PATypeHolder* PATy) {
518 // If it isn't abstract, its resolved
519 const Type* Ty = PATy->get();
520 if (!Ty->isAbstract())
521 return false;
522 // Traverse the type looking for abstract types. If it isn't abstract then
523 // we don't need to traverse that leg of the type.
524 std::vector<const Type*> WorkList, SeenList;
525 WorkList.push_back(Ty);
526 while (!WorkList.empty()) {
527 const Type* Ty = WorkList.back();
528 SeenList.push_back(Ty);
529 WorkList.pop_back();
530 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
531 // Check to see if this is an unresolved type
532 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
533 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
534 for ( ; I != E; ++I) {
535 if (I->second.get() == OpTy)
536 return true;
537 }
538 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
539 const Type* TheTy = SeqTy->getElementType();
540 if (TheTy->isAbstract() && TheTy != Ty) {
541 std::vector<const Type*>::iterator I = SeenList.begin(),
542 E = SeenList.end();
543 for ( ; I != E; ++I)
544 if (*I == TheTy)
545 break;
546 if (I == E)
547 WorkList.push_back(TheTy);
548 }
549 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
550 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
551 const Type* TheTy = StrTy->getElementType(i);
552 if (TheTy->isAbstract() && TheTy != Ty) {
553 std::vector<const Type*>::iterator I = SeenList.begin(),
554 E = SeenList.end();
555 for ( ; I != E; ++I)
556 if (*I == TheTy)
557 break;
558 if (I == E)
559 WorkList.push_back(TheTy);
560 }
561 }
562 }
563 }
564 return false;
565 }
566} CurModule;
567
568static struct PerFunctionInfo {
569 Function *CurrentFunction; // Pointer to current function being created
570
571 ValueList Values; // Keep track of #'d definitions
572 unsigned NextValNum;
573 ValueList LateResolveValues;
574 bool isDeclare; // Is this function a forward declararation?
575 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
576 GlobalValue::VisibilityTypes Visibility;
577
578 /// BBForwardRefs - When we see forward references to basic blocks, keep
579 /// track of them here.
580 std::map<ValID, BasicBlock*> BBForwardRefs;
581
582 inline PerFunctionInfo() {
583 CurrentFunction = 0;
584 isDeclare = false;
585 Linkage = GlobalValue::ExternalLinkage;
586 Visibility = GlobalValue::DefaultVisibility;
587 }
588
589 inline void FunctionStart(Function *M) {
590 CurrentFunction = M;
591 NextValNum = 0;
592 }
593
594 void FunctionDone() {
595 // Any forward referenced blocks left?
596 if (!BBForwardRefs.empty()) {
597 GenerateError("Undefined reference to label " +
598 BBForwardRefs.begin()->second->getName());
599 return;
600 }
601
602 // Resolve all forward references now.
603 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
604
605 Values.clear(); // Clear out function local definitions
606 BBForwardRefs.clear();
607 CurrentFunction = 0;
608 isDeclare = false;
609 Linkage = GlobalValue::ExternalLinkage;
610 Visibility = GlobalValue::DefaultVisibility;
611 }
612} CurFun; // Info for the current function...
613
614static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
615
616
617//===----------------------------------------------------------------------===//
618// Code to handle definitions of all the types
619//===----------------------------------------------------------------------===//
620
621static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
622 // Things that have names or are void typed don't get slot numbers
623 if (V->hasName() || (V->getType() == Type::VoidTy))
624 return;
625
626 // In the case of function values, we have to allow for the forward reference
627 // of basic blocks, which are included in the numbering. Consequently, we keep
628 // track of the next insertion location with NextValNum. When a BB gets
629 // inserted, it could change the size of the CurFun.Values vector.
630 if (&ValueTab == &CurFun.Values) {
631 if (ValueTab.size() <= CurFun.NextValNum)
632 ValueTab.resize(CurFun.NextValNum+1);
633 ValueTab[CurFun.NextValNum++] = V;
634 return;
635 }
636 // For all other lists, its okay to just tack it on the back of the vector.
637 ValueTab.push_back(V);
638}
639
640static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
641 switch (D.Type) {
642 case ValID::LocalID: // Is it a numbered definition?
643 // Module constants occupy the lowest numbered slots...
644 if (D.Num < CurModule.Types.size())
645 return CurModule.Types[D.Num];
646 break;
647 case ValID::LocalName: // Is it a named definition?
648 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
649 D.destroy(); // Free old strdup'd memory...
650 return N;
651 }
652 break;
653 default:
654 GenerateError("Internal parser error: Invalid symbol type reference");
655 return 0;
656 }
657
658 // If we reached here, we referenced either a symbol that we don't know about
659 // or an id number that hasn't been read yet. We may be referencing something
660 // forward, so just create an entry to be resolved later and get to it...
661 //
662 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
663
664
665 if (inFunctionScope()) {
666 if (D.Type == ValID::LocalName) {
667 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
668 return 0;
669 } else {
670 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
671 return 0;
672 }
673 }
674
675 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
676 if (I != CurModule.LateResolveTypes.end())
677 return I->second;
678
679 Type *Typ = OpaqueType::get();
680 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
681 return Typ;
682 }
683
684// getExistingVal - Look up the value specified by the provided type and
685// the provided ValID. If the value exists and has already been defined, return
686// it. Otherwise return null.
687//
688static Value *getExistingVal(const Type *Ty, const ValID &D) {
689 if (isa<FunctionType>(Ty)) {
690 GenerateError("Functions are not values and "
691 "must be referenced as pointers");
692 return 0;
693 }
694
695 switch (D.Type) {
696 case ValID::LocalID: { // Is it a numbered definition?
697 // Check that the number is within bounds.
698 if (D.Num >= CurFun.Values.size())
699 return 0;
700 Value *Result = CurFun.Values[D.Num];
701 if (Ty != Result->getType()) {
702 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
703 Result->getType()->getDescription() + "' does not match "
704 "expected type, '" + Ty->getDescription() + "'");
705 return 0;
706 }
707 return Result;
708 }
709 case ValID::GlobalID: { // Is it a numbered definition?
710 if (D.Num >= CurModule.Values.size())
711 return 0;
712 Value *Result = CurModule.Values[D.Num];
713 if (Ty != Result->getType()) {
714 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
715 Result->getType()->getDescription() + "' does not match "
716 "expected type, '" + Ty->getDescription() + "'");
717 return 0;
718 }
719 return Result;
720 }
721
722 case ValID::LocalName: { // Is it a named definition?
723 if (!inFunctionScope())
724 return 0;
725 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
726 Value *N = SymTab.lookup(D.getName());
727 if (N == 0)
728 return 0;
729 if (N->getType() != Ty)
730 return 0;
731
732 D.destroy(); // Free old strdup'd memory...
733 return N;
734 }
735 case ValID::GlobalName: { // Is it a named definition?
736 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
737 Value *N = SymTab.lookup(D.getName());
738 if (N == 0)
739 return 0;
740 if (N->getType() != Ty)
741 return 0;
742
743 D.destroy(); // Free old strdup'd memory...
744 return N;
745 }
746
747 // Check to make sure that "Ty" is an integral type, and that our
748 // value will fit into the specified type...
749 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000750 if (!isa<IntegerType>(Ty) ||
751 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000752 GenerateError("Signed integral constant '" +
753 itostr(D.ConstPool64) + "' is invalid for type '" +
754 Ty->getDescription() + "'");
755 return 0;
756 }
757 return ConstantInt::get(Ty, D.ConstPool64, true);
758
759 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000760 if (isa<IntegerType>(Ty) &&
761 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000762 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000763
764 if (!isa<IntegerType>(Ty) ||
765 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
766 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
767 "' is invalid or out of range for type '" +
768 Ty->getDescription() + "'");
769 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000770 }
Chris Lattner59363a32008-02-19 04:36:25 +0000771 // This is really a signed reference. Transmogrify.
772 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000773
774 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000775 if (!Ty->isFloatingPoint() ||
776 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000777 GenerateError("FP constant invalid for type");
778 return 0;
779 }
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000780 // Lexer has no type info, so builds all float and double FP constants
781 // as double. Fix this here. Long double does not need this.
782 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
783 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000784 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
785 return ConstantFP::get(Ty, *D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000786
787 case ValID::ConstNullVal: // Is it a null value?
788 if (!isa<PointerType>(Ty)) {
789 GenerateError("Cannot create a a non pointer null");
790 return 0;
791 }
792 return ConstantPointerNull::get(cast<PointerType>(Ty));
793
794 case ValID::ConstUndefVal: // Is it an undef value?
795 return UndefValue::get(Ty);
796
797 case ValID::ConstZeroVal: // Is it a zero value?
798 return Constant::getNullValue(Ty);
799
800 case ValID::ConstantVal: // Fully resolved constant?
801 if (D.ConstantValue->getType() != Ty) {
802 GenerateError("Constant expression type different from required type");
803 return 0;
804 }
805 return D.ConstantValue;
806
807 case ValID::InlineAsmVal: { // Inline asm expression
808 const PointerType *PTy = dyn_cast<PointerType>(Ty);
809 const FunctionType *FTy =
810 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
811 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
812 GenerateError("Invalid type for asm constraint string");
813 return 0;
814 }
815 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
816 D.IAD->HasSideEffects);
817 D.destroy(); // Free InlineAsmDescriptor.
818 return IA;
819 }
820 default:
821 assert(0 && "Unhandled case!");
822 return 0;
823 } // End of switch
824
825 assert(0 && "Unhandled case!");
826 return 0;
827}
828
829// getVal - This function is identical to getExistingVal, except that if a
830// value is not already defined, it "improvises" by creating a placeholder var
831// that looks and acts just like the requested variable. When the value is
832// defined later, all uses of the placeholder variable are replaced with the
833// real thing.
834//
835static Value *getVal(const Type *Ty, const ValID &ID) {
836 if (Ty == Type::LabelTy) {
837 GenerateError("Cannot use a basic block here");
838 return 0;
839 }
840
841 // See if the value has already been defined.
842 Value *V = getExistingVal(Ty, ID);
843 if (V) return V;
844 if (TriggerError) return 0;
845
846 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
847 GenerateError("Invalid use of a composite type");
848 return 0;
849 }
850
851 // If we reached here, we referenced either a symbol that we don't know about
852 // or an id number that hasn't been read yet. We may be referencing something
853 // forward, so just create an entry to be resolved later and get to it...
854 //
855 switch (ID.Type) {
856 case ValID::GlobalName:
857 case ValID::GlobalID: {
858 const PointerType *PTy = dyn_cast<PointerType>(Ty);
859 if (!PTy) {
860 GenerateError("Invalid type for reference to global" );
861 return 0;
862 }
863 const Type* ElTy = PTy->getElementType();
864 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
865 V = new Function(FTy, GlobalValue::ExternalLinkage);
866 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000867 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
868 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000869 break;
870 }
871 default:
872 V = new Argument(Ty);
873 }
874
875 // Remember where this forward reference came from. FIXME, shouldn't we try
876 // to recycle these things??
877 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000878 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000879
880 if (inFunctionScope())
881 InsertValue(V, CurFun.LateResolveValues);
882 else
883 InsertValue(V, CurModule.LateResolveValues);
884 return V;
885}
886
887/// defineBBVal - This is a definition of a new basic block with the specified
888/// identifier which must be the same as CurFun.NextValNum, if its numeric.
889static BasicBlock *defineBBVal(const ValID &ID) {
890 assert(inFunctionScope() && "Can't get basic block at global scope!");
891
892 BasicBlock *BB = 0;
893
894 // First, see if this was forward referenced
895
896 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
897 if (BBI != CurFun.BBForwardRefs.end()) {
898 BB = BBI->second;
899 // The forward declaration could have been inserted anywhere in the
900 // function: insert it into the correct place now.
901 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
902 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
903
904 // We're about to erase the entry, save the key so we can clean it up.
905 ValID Tmp = BBI->first;
906
907 // Erase the forward ref from the map as its no longer "forward"
908 CurFun.BBForwardRefs.erase(ID);
909
910 // The key has been removed from the map but so we don't want to leave
911 // strdup'd memory around so destroy it too.
912 Tmp.destroy();
913
914 // If its a numbered definition, bump the number and set the BB value.
915 if (ID.Type == ValID::LocalID) {
916 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
917 InsertValue(BB);
918 }
919
920 ID.destroy();
921 return BB;
922 }
923
924 // We haven't seen this BB before and its first mention is a definition.
925 // Just create it and return it.
926 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
927 BB = new BasicBlock(Name, CurFun.CurrentFunction);
928 if (ID.Type == ValID::LocalID) {
929 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
930 InsertValue(BB);
931 }
932
933 ID.destroy(); // Free strdup'd memory
934 return BB;
935}
936
937/// getBBVal - get an existing BB value or create a forward reference for it.
938///
939static BasicBlock *getBBVal(const ValID &ID) {
940 assert(inFunctionScope() && "Can't get basic block at global scope!");
941
942 BasicBlock *BB = 0;
943
944 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
945 if (BBI != CurFun.BBForwardRefs.end()) {
946 BB = BBI->second;
947 } if (ID.Type == ValID::LocalName) {
948 std::string Name = ID.getName();
949 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000950 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000951 if (N->getType()->getTypeID() == Type::LabelTyID)
952 BB = cast<BasicBlock>(N);
953 else
954 GenerateError("Reference to label '" + Name + "' is actually of type '"+
955 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000956 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000957 } else if (ID.Type == ValID::LocalID) {
958 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
959 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
960 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
961 else
962 GenerateError("Reference to label '%" + utostr(ID.Num) +
963 "' is actually of type '"+
964 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
965 }
966 } else {
967 GenerateError("Illegal label reference " + ID.getName());
968 return 0;
969 }
970
971 // If its already been defined, return it now.
972 if (BB) {
973 ID.destroy(); // Free strdup'd memory.
974 return BB;
975 }
976
977 // Otherwise, this block has not been seen before, create it.
978 std::string Name;
979 if (ID.Type == ValID::LocalName)
980 Name = ID.getName();
981 BB = new BasicBlock(Name, CurFun.CurrentFunction);
982
983 // Insert it in the forward refs map.
984 CurFun.BBForwardRefs[ID] = BB;
985
986 return BB;
987}
988
989
990//===----------------------------------------------------------------------===//
991// Code to handle forward references in instructions
992//===----------------------------------------------------------------------===//
993//
994// This code handles the late binding needed with statements that reference
995// values not defined yet... for example, a forward branch, or the PHI node for
996// a loop body.
997//
998// This keeps a table (CurFun.LateResolveValues) of all such forward references
999// and back patchs after we are done.
1000//
1001
1002// ResolveDefinitions - If we could not resolve some defs at parsing
1003// time (forward branches, phi functions for loops, etc...) resolve the
1004// defs now...
1005//
1006static void
1007ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1008 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1009 while (!LateResolvers.empty()) {
1010 Value *V = LateResolvers.back();
1011 LateResolvers.pop_back();
1012
1013 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1014 CurModule.PlaceHolderInfo.find(V);
1015 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1016
1017 ValID &DID = PHI->second.first;
1018
1019 Value *TheRealValue = getExistingVal(V->getType(), DID);
1020 if (TriggerError)
1021 return;
1022 if (TheRealValue) {
1023 V->replaceAllUsesWith(TheRealValue);
1024 delete V;
1025 CurModule.PlaceHolderInfo.erase(PHI);
1026 } else if (FutureLateResolvers) {
1027 // Functions have their unresolved items forwarded to the module late
1028 // resolver table
1029 InsertValue(V, *FutureLateResolvers);
1030 } else {
1031 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1032 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1033 "' of type '" + V->getType()->getDescription() + "'",
1034 PHI->second.second);
1035 return;
1036 } else {
1037 GenerateError("Reference to an invalid definition: #" +
1038 itostr(DID.Num) + " of type '" +
1039 V->getType()->getDescription() + "'",
1040 PHI->second.second);
1041 return;
1042 }
1043 }
1044 }
1045 LateResolvers.clear();
1046}
1047
1048// ResolveTypeTo - A brand new type was just declared. This means that (if
1049// name is not null) things referencing Name can be resolved. Otherwise, things
1050// refering to the number can be resolved. Do this now.
1051//
1052static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1053 ValID D;
1054 if (Name)
1055 D = ValID::createLocalName(*Name);
1056 else
1057 D = ValID::createLocalID(CurModule.Types.size());
1058
1059 std::map<ValID, PATypeHolder>::iterator I =
1060 CurModule.LateResolveTypes.find(D);
1061 if (I != CurModule.LateResolveTypes.end()) {
1062 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1063 CurModule.LateResolveTypes.erase(I);
1064 }
1065}
1066
1067// setValueName - Set the specified value to the name given. The name may be
1068// null potentially, in which case this is a noop. The string passed in is
1069// assumed to be a malloc'd string buffer, and is free'd by this function.
1070//
1071static void setValueName(Value *V, std::string *NameStr) {
1072 if (!NameStr) return;
1073 std::string Name(*NameStr); // Copy string
1074 delete NameStr; // Free old string
1075
1076 if (V->getType() == Type::VoidTy) {
1077 GenerateError("Can't assign name '" + Name+"' to value with void type");
1078 return;
1079 }
1080
1081 assert(inFunctionScope() && "Must be in function scope!");
1082 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1083 if (ST.lookup(Name)) {
1084 GenerateError("Redefinition of value '" + Name + "' of type '" +
1085 V->getType()->getDescription() + "'");
1086 return;
1087 }
1088
1089 // Set the name.
1090 V->setName(Name);
1091}
1092
1093/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1094/// this is a declaration, otherwise it is a definition.
1095static GlobalVariable *
1096ParseGlobalVariable(std::string *NameStr,
1097 GlobalValue::LinkageTypes Linkage,
1098 GlobalValue::VisibilityTypes Visibility,
1099 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001100 Constant *Initializer, bool IsThreadLocal,
1101 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001102 if (isa<FunctionType>(Ty)) {
1103 GenerateError("Cannot declare global vars of function type");
1104 return 0;
1105 }
1106
Christopher Lamb0a243582007-12-11 09:02:08 +00001107 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001108
1109 std::string Name;
1110 if (NameStr) {
1111 Name = *NameStr; // Copy string
1112 delete NameStr; // Free old string
1113 }
1114
1115 // See if this global value was forward referenced. If so, recycle the
1116 // object.
1117 ValID ID;
1118 if (!Name.empty()) {
1119 ID = ValID::createGlobalName(Name);
1120 } else {
1121 ID = ValID::createGlobalID(CurModule.Values.size());
1122 }
1123
1124 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1125 // Move the global to the end of the list, from whereever it was
1126 // previously inserted.
1127 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1128 CurModule.CurrentModule->getGlobalList().remove(GV);
1129 CurModule.CurrentModule->getGlobalList().push_back(GV);
1130 GV->setInitializer(Initializer);
1131 GV->setLinkage(Linkage);
1132 GV->setVisibility(Visibility);
1133 GV->setConstant(isConstantGlobal);
1134 GV->setThreadLocal(IsThreadLocal);
1135 InsertValue(GV, CurModule.Values);
1136 return GV;
1137 }
1138
1139 // If this global has a name
1140 if (!Name.empty()) {
1141 // if the global we're parsing has an initializer (is a definition) and
1142 // has external linkage.
1143 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1144 // If there is already a global with external linkage with this name
1145 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1146 // If we allow this GVar to get created, it will be renamed in the
1147 // symbol table because it conflicts with an existing GVar. We can't
1148 // allow redefinition of GVars whose linking indicates that their name
1149 // must stay the same. Issue the error.
1150 GenerateError("Redefinition of global variable named '" + Name +
1151 "' of type '" + Ty->getDescription() + "'");
1152 return 0;
1153 }
1154 }
1155
1156 // Otherwise there is no existing GV to use, create one now.
1157 GlobalVariable *GV =
1158 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001159 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001160 GV->setVisibility(Visibility);
1161 InsertValue(GV, CurModule.Values);
1162 return GV;
1163}
1164
1165// setTypeName - Set the specified type to the name given. The name may be
1166// null potentially, in which case this is a noop. The string passed in is
1167// assumed to be a malloc'd string buffer, and is freed by this function.
1168//
1169// This function returns true if the type has already been defined, but is
1170// allowed to be redefined in the specified context. If the name is a new name
1171// for the type plane, it is inserted and false is returned.
1172static bool setTypeName(const Type *T, std::string *NameStr) {
1173 assert(!inFunctionScope() && "Can't give types function-local names!");
1174 if (NameStr == 0) return false;
1175
1176 std::string Name(*NameStr); // Copy string
1177 delete NameStr; // Free old string
1178
1179 // We don't allow assigning names to void type
1180 if (T == Type::VoidTy) {
1181 GenerateError("Can't assign name '" + Name + "' to the void type");
1182 return false;
1183 }
1184
1185 // Set the type name, checking for conflicts as we do so.
1186 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1187
1188 if (AlreadyExists) { // Inserting a name that is already defined???
1189 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1190 assert(Existing && "Conflict but no matching type?!");
1191
1192 // There is only one case where this is allowed: when we are refining an
1193 // opaque type. In this case, Existing will be an opaque type.
1194 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1195 // We ARE replacing an opaque type!
1196 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1197 return true;
1198 }
1199
1200 // Otherwise, this is an attempt to redefine a type. That's okay if
1201 // the redefinition is identical to the original. This will be so if
1202 // Existing and T point to the same Type object. In this one case we
1203 // allow the equivalent redefinition.
1204 if (Existing == T) return true; // Yes, it's equal.
1205
1206 // Any other kind of (non-equivalent) redefinition is an error.
1207 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1208 T->getDescription() + "'");
1209 }
1210
1211 return false;
1212}
1213
1214//===----------------------------------------------------------------------===//
1215// Code for handling upreferences in type names...
1216//
1217
1218// TypeContains - Returns true if Ty directly contains E in it.
1219//
1220static bool TypeContains(const Type *Ty, const Type *E) {
1221 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1222 E) != Ty->subtype_end();
1223}
1224
1225namespace {
1226 struct UpRefRecord {
1227 // NestingLevel - The number of nesting levels that need to be popped before
1228 // this type is resolved.
1229 unsigned NestingLevel;
1230
1231 // LastContainedTy - This is the type at the current binding level for the
1232 // type. Every time we reduce the nesting level, this gets updated.
1233 const Type *LastContainedTy;
1234
1235 // UpRefTy - This is the actual opaque type that the upreference is
1236 // represented with.
1237 OpaqueType *UpRefTy;
1238
1239 UpRefRecord(unsigned NL, OpaqueType *URTy)
1240 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1241 };
1242}
1243
1244// UpRefs - A list of the outstanding upreferences that need to be resolved.
1245static std::vector<UpRefRecord> UpRefs;
1246
1247/// HandleUpRefs - Every time we finish a new layer of types, this function is
1248/// called. It loops through the UpRefs vector, which is a list of the
1249/// currently active types. For each type, if the up reference is contained in
1250/// the newly completed type, we decrement the level count. When the level
1251/// count reaches zero, the upreferenced type is the type that is passed in:
1252/// thus we can complete the cycle.
1253///
1254static PATypeHolder HandleUpRefs(const Type *ty) {
1255 // If Ty isn't abstract, or if there are no up-references in it, then there is
1256 // nothing to resolve here.
1257 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1258
1259 PATypeHolder Ty(ty);
1260 UR_OUT("Type '" << Ty->getDescription() <<
1261 "' newly formed. Resolving upreferences.\n" <<
1262 UpRefs.size() << " upreferences active!\n");
1263
1264 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1265 // to zero), we resolve them all together before we resolve them to Ty. At
1266 // the end of the loop, if there is anything to resolve to Ty, it will be in
1267 // this variable.
1268 OpaqueType *TypeToResolve = 0;
1269
1270 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1271 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1272 << UpRefs[i].second->getDescription() << ") = "
1273 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1274 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1275 // Decrement level of upreference
1276 unsigned Level = --UpRefs[i].NestingLevel;
1277 UpRefs[i].LastContainedTy = Ty;
1278 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1279 if (Level == 0) { // Upreference should be resolved!
1280 if (!TypeToResolve) {
1281 TypeToResolve = UpRefs[i].UpRefTy;
1282 } else {
1283 UR_OUT(" * Resolving upreference for "
1284 << UpRefs[i].second->getDescription() << "\n";
1285 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1286 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1287 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1288 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1289 }
1290 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1291 --i; // Do not skip the next element...
1292 }
1293 }
1294 }
1295
1296 if (TypeToResolve) {
1297 UR_OUT(" * Resolving upreference for "
1298 << UpRefs[i].second->getDescription() << "\n";
1299 std::string OldName = TypeToResolve->getDescription());
1300 TypeToResolve->refineAbstractTypeTo(Ty);
1301 }
1302
1303 return Ty;
1304}
1305
1306//===----------------------------------------------------------------------===//
1307// RunVMAsmParser - Define an interface to this parser
1308//===----------------------------------------------------------------------===//
1309//
1310static Module* RunParser(Module * M);
1311
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001312Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1313 InitLLLexer(MB);
1314 Module *M = RunParser(new Module(LLLgetFilename()));
1315 FreeLexer();
1316 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001317}
1318
1319
Chris Lattner59363a32008-02-19 04:36:25 +00001320
1321/* Enabling traces. */
1322#ifndef YYDEBUG
1323# define YYDEBUG 0
1324#endif
1325
1326/* Enabling verbose error messages. */
1327#ifdef YYERROR_VERBOSE
1328# undef YYERROR_VERBOSE
1329# define YYERROR_VERBOSE 1
1330#else
1331# define YYERROR_VERBOSE 0
1332#endif
1333
1334/* Enabling the token table. */
1335#ifndef YYTOKEN_TABLE
1336# define YYTOKEN_TABLE 0
1337#endif
1338
1339#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1340typedef union YYSTYPE
Devang Patel087fe2b2008-02-23 00:38:56 +00001341#line 953 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00001342{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001343 llvm::Module *ModuleVal;
1344 llvm::Function *FunctionVal;
1345 llvm::BasicBlock *BasicBlockVal;
1346 llvm::TerminatorInst *TermInstVal;
1347 llvm::Instruction *InstVal;
1348 llvm::Constant *ConstVal;
1349
1350 const llvm::Type *PrimType;
1351 std::list<llvm::PATypeHolder> *TypeList;
1352 llvm::PATypeHolder *TypeVal;
1353 llvm::Value *ValueVal;
1354 std::vector<llvm::Value*> *ValueList;
1355 llvm::ArgListType *ArgList;
1356 llvm::TypeWithAttrs TypeWithAttrs;
1357 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001358 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001359
1360 // Represent the RHS of PHI node
1361 std::list<std::pair<llvm::Value*,
1362 llvm::BasicBlock*> > *PHIList;
1363 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1364 std::vector<llvm::Constant*> *ConstVector;
1365
1366 llvm::GlobalValue::LinkageTypes Linkage;
1367 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesend915ee52008-02-19 21:40:51 +00001368 llvm::ParameterAttributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001369 llvm::APInt *APIntVal;
1370 int64_t SInt64Val;
1371 uint64_t UInt64Val;
1372 int SIntVal;
1373 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001374 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001375 bool BoolVal;
1376
1377 std::string *StrVal; // This memory must be deleted
1378 llvm::ValID ValIDVal;
1379
1380 llvm::Instruction::BinaryOps BinaryOpVal;
1381 llvm::Instruction::TermOps TermOpVal;
1382 llvm::Instruction::MemoryOps MemOpVal;
1383 llvm::Instruction::CastOps CastOpVal;
1384 llvm::Instruction::OtherOps OtherOpVal;
1385 llvm::ICmpInst::Predicate IPredicate;
1386 llvm::FCmpInst::Predicate FPredicate;
Chris Lattner59363a32008-02-19 04:36:25 +00001387}
Devang Pateleb293342008-02-20 19:13:10 +00001388/* Line 193 of yacc.c. */
Dale Johannesen98738822008-02-22 22:17:59 +00001389#line 1390 "llvmAsmParser.tab.c"
Chris Lattner59363a32008-02-19 04:36:25 +00001390 YYSTYPE;
1391# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1392# define YYSTYPE_IS_DECLARED 1
1393# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001394#endif
1395
1396
1397
Chris Lattner59363a32008-02-19 04:36:25 +00001398/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001399
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001400
Chris Lattner59363a32008-02-19 04:36:25 +00001401/* Line 216 of yacc.c. */
Dale Johannesen98738822008-02-22 22:17:59 +00001402#line 1403 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001403
Chris Lattner59363a32008-02-19 04:36:25 +00001404#ifdef short
1405# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001406#endif
1407
Chris Lattner59363a32008-02-19 04:36:25 +00001408#ifdef YYTYPE_UINT8
1409typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001410#else
Chris Lattner59363a32008-02-19 04:36:25 +00001411typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001412#endif
1413
Chris Lattner59363a32008-02-19 04:36:25 +00001414#ifdef YYTYPE_INT8
1415typedef YYTYPE_INT8 yytype_int8;
1416#elif (defined __STDC__ || defined __C99__FUNC__ \
1417 || defined __cplusplus || defined _MSC_VER)
1418typedef signed char yytype_int8;
1419#else
1420typedef short int yytype_int8;
1421#endif
1422
1423#ifdef YYTYPE_UINT16
1424typedef YYTYPE_UINT16 yytype_uint16;
1425#else
1426typedef unsigned short int yytype_uint16;
1427#endif
1428
1429#ifdef YYTYPE_INT16
1430typedef YYTYPE_INT16 yytype_int16;
1431#else
1432typedef short int yytype_int16;
1433#endif
1434
1435#ifndef YYSIZE_T
1436# ifdef __SIZE_TYPE__
1437# define YYSIZE_T __SIZE_TYPE__
1438# elif defined size_t
1439# define YYSIZE_T size_t
1440# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1441 || defined __cplusplus || defined _MSC_VER)
1442# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1443# define YYSIZE_T size_t
1444# else
1445# define YYSIZE_T unsigned int
1446# endif
1447#endif
1448
1449#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1450
1451#ifndef YY_
Devang Pateleb293342008-02-20 19:13:10 +00001452# if defined YYENABLE_NLS && YYENABLE_NLS
Chris Lattner59363a32008-02-19 04:36:25 +00001453# if ENABLE_NLS
1454# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1455# define YY_(msgid) dgettext ("bison-runtime", msgid)
1456# endif
1457# endif
1458# ifndef YY_
1459# define YY_(msgid) msgid
1460# endif
1461#endif
1462
1463/* Suppress unused-variable warnings by "using" E. */
1464#if ! defined lint || defined __GNUC__
1465# define YYUSE(e) ((void) (e))
1466#else
1467# define YYUSE(e) /* empty */
1468#endif
1469
1470/* Identity function, used to suppress warnings about constant conditions. */
1471#ifndef lint
1472# define YYID(n) (n)
1473#else
1474#if (defined __STDC__ || defined __C99__FUNC__ \
1475 || defined __cplusplus || defined _MSC_VER)
1476static int
1477YYID (int i)
1478#else
1479static int
1480YYID (i)
1481 int i;
1482#endif
1483{
1484 return i;
1485}
1486#endif
1487
1488#if ! defined yyoverflow || YYERROR_VERBOSE
1489
1490/* The parser invokes alloca or malloc; define the necessary symbols. */
1491
1492# ifdef YYSTACK_USE_ALLOCA
1493# if YYSTACK_USE_ALLOCA
1494# ifdef __GNUC__
1495# define YYSTACK_ALLOC __builtin_alloca
1496# elif defined __BUILTIN_VA_ARG_INCR
1497# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1498# elif defined _AIX
1499# define YYSTACK_ALLOC __alloca
1500# elif defined _MSC_VER
1501# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1502# define alloca _alloca
1503# else
1504# define YYSTACK_ALLOC alloca
1505# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1506 || defined __cplusplus || defined _MSC_VER)
1507# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1508# ifndef _STDLIB_H
1509# define _STDLIB_H 1
1510# endif
1511# endif
1512# endif
1513# endif
1514# endif
1515
1516# ifdef YYSTACK_ALLOC
1517 /* Pacify GCC's `empty if-body' warning. */
1518# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1519# ifndef YYSTACK_ALLOC_MAXIMUM
1520 /* The OS might guarantee only one guard page at the bottom of the stack,
1521 and a page size can be as small as 4096 bytes. So we cannot safely
1522 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1523 to allow for a few compiler-allocated temporary stack slots. */
1524# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1525# endif
1526# else
1527# define YYSTACK_ALLOC YYMALLOC
1528# define YYSTACK_FREE YYFREE
1529# ifndef YYSTACK_ALLOC_MAXIMUM
1530# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1531# endif
1532# if (defined __cplusplus && ! defined _STDLIB_H \
1533 && ! ((defined YYMALLOC || defined malloc) \
1534 && (defined YYFREE || defined free)))
1535# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1536# ifndef _STDLIB_H
1537# define _STDLIB_H 1
1538# endif
1539# endif
1540# ifndef YYMALLOC
1541# define YYMALLOC malloc
1542# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1543 || defined __cplusplus || defined _MSC_VER)
1544void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1545# endif
1546# endif
1547# ifndef YYFREE
1548# define YYFREE free
1549# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1550 || defined __cplusplus || defined _MSC_VER)
1551void free (void *); /* INFRINGES ON USER NAME SPACE */
1552# endif
1553# endif
1554# endif
1555#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1556
1557
1558#if (! defined yyoverflow \
1559 && (! defined __cplusplus \
1560 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1561
1562/* A type that is properly aligned for any stack member. */
1563union yyalloc
1564{
1565 yytype_int16 yyss;
1566 YYSTYPE yyvs;
1567 };
1568
1569/* The size of the maximum gap between one aligned stack and the next. */
1570# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1571
1572/* The size of an array large to enough to hold all stacks, each with
1573 N elements. */
1574# define YYSTACK_BYTES(N) \
1575 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1576 + YYSTACK_GAP_MAXIMUM)
1577
1578/* Copy COUNT objects from FROM to TO. The source and destination do
1579 not overlap. */
1580# ifndef YYCOPY
1581# if defined __GNUC__ && 1 < __GNUC__
1582# define YYCOPY(To, From, Count) \
1583 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1584# else
1585# define YYCOPY(To, From, Count) \
1586 do \
1587 { \
1588 YYSIZE_T yyi; \
1589 for (yyi = 0; yyi < (Count); yyi++) \
1590 (To)[yyi] = (From)[yyi]; \
1591 } \
1592 while (YYID (0))
1593# endif
1594# endif
1595
1596/* Relocate STACK from its old location to the new one. The
1597 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1598 elements in the stack, and YYPTR gives the new location of the
1599 stack. Advance YYPTR to a properly aligned location for the next
1600 stack. */
1601# define YYSTACK_RELOCATE(Stack) \
1602 do \
1603 { \
1604 YYSIZE_T yynewbytes; \
1605 YYCOPY (&yyptr->Stack, Stack, yysize); \
1606 Stack = &yyptr->Stack; \
1607 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1608 yyptr += yynewbytes / sizeof (*yyptr); \
1609 } \
1610 while (YYID (0))
1611
1612#endif
1613
1614/* YYFINAL -- State number of the termination state. */
1615#define YYFINAL 43
1616/* YYLAST -- Last index in YYTABLE. */
Devang Patelbf507402008-02-20 22:40:23 +00001617#define YYLAST 1978
Chris Lattner59363a32008-02-19 04:36:25 +00001618
1619/* YYNTOKENS -- Number of terminals. */
Devang Patel3b8849c2008-02-19 22:27:01 +00001620#define YYNTOKENS 165
Chris Lattner59363a32008-02-19 04:36:25 +00001621/* YYNNTS -- Number of nonterminals. */
Devang Patelbf507402008-02-20 22:40:23 +00001622#define YYNNTS 85
Chris Lattner59363a32008-02-19 04:36:25 +00001623/* YYNRULES -- Number of rules. */
Devang Patelbf507402008-02-20 22:40:23 +00001624#define YYNRULES 322
Chris Lattner59363a32008-02-19 04:36:25 +00001625/* YYNRULES -- Number of states. */
Devang Patelbf507402008-02-20 22:40:23 +00001626#define YYNSTATES 629
Chris Lattner59363a32008-02-19 04:36:25 +00001627
1628/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1629#define YYUNDEFTOK 2
Devang Patel3b8849c2008-02-19 22:27:01 +00001630#define YYMAXUTOK 405
Chris Lattner59363a32008-02-19 04:36:25 +00001631
1632#define YYTRANSLATE(YYX) \
1633 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1634
1635/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1636static const yytype_uint8 yytranslate[] =
1637{
1638 0, 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,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001642 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001644 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001647 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
Chris Lattner59363a32008-02-19 04:36:25 +00001648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001650 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001651 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, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1664 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1665 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1666 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1667 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1668 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1669 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1670 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1671 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1672 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1673 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1674 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1675 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1676 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1677 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Devang Patel3b8849c2008-02-19 22:27:01 +00001678 145, 146, 147, 148, 149, 150
Chris Lattner59363a32008-02-19 04:36:25 +00001679};
1680
1681#if YYDEBUG
1682/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1683 YYRHS. */
1684static const yytype_uint16 yyprhs[] =
1685{
1686 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1687 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1688 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1689 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1690 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1691 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1692 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1693 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1694 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1695 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1696 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001697 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1698 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1699 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1700 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1701 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1702 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1703 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1704 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1705 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1706 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1707 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1708 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1709 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1710 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1711 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
Devang Patelbf507402008-02-20 22:40:23 +00001712 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1713 747, 750, 753, 757, 760, 761, 763, 766, 769, 773,
1714 783, 793, 802, 817, 819, 821, 828, 834, 837, 844,
1715 852, 857, 862, 869, 876, 877, 878, 882, 885, 887,
1716 893, 899, 906, 913, 918, 925, 930, 935, 942, 949,
1717 952, 961, 963, 965, 966, 970, 977, 981, 988, 991,
1718 997, 1005, 1011
Chris Lattner59363a32008-02-19 04:36:25 +00001719};
1720
1721/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1722static const yytype_int16 yyrhs[] =
1723{
Devang Patel3b8849c2008-02-19 22:27:01 +00001724 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
Chris Lattner59363a32008-02-19 04:36:25 +00001725 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1726 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1727 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1728 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1729 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1730 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1731 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1732 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1733 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1734 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1735 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patel3b8849c2008-02-19 22:27:01 +00001736 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1737 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1738 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
Chris Lattner59363a32008-02-19 04:36:25 +00001739 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00001740 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1741 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
Chris Lattner59363a32008-02-19 04:36:25 +00001742 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1743 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
Devang Patel3b8849c2008-02-19 22:27:01 +00001744 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1745 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001746 143, -1, 144, -1, 53, 4, -1, -1, 188, 187,
1747 -1, 138, -1, 141, -1, 137, -1, 136, -1, 145,
1748 -1, 146, -1, -1, 190, 189, -1, -1, 147, 22,
1749 -1, -1, 53, 4, -1, -1, 154, 53, 4, -1,
1750 34, 22, -1, -1, 194, -1, -1, 154, 197, 196,
1751 -1, 194, -1, 53, 4, -1, 11, -1, 12, -1,
1752 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1753 49, -1, 198, -1, 199, 175, 155, -1, 233, -1,
1754 156, 4, -1, 199, 151, 203, 152, 190, -1, 10,
1755 151, 203, 152, 190, -1, 157, 4, 158, 199, 159,
1756 -1, 160, 4, 158, 199, 161, -1, 162, 204, 163,
1757 -1, 162, 163, -1, 160, 162, 204, 163, 161, -1,
1758 160, 162, 163, 161, -1, 199, 188, -1, 199, -1,
1759 10, -1, 200, -1, 202, 154, 200, -1, 202, -1,
1760 202, 154, 39, -1, 39, -1, -1, 199, -1, 204,
1761 154, 199, -1, 199, 157, 207, 159, -1, 199, 157,
1762 159, -1, 199, 164, 22, -1, 199, 160, 207, 161,
1763 -1, 199, 162, 207, 163, -1, 199, 162, 163, -1,
1764 199, 160, 162, 207, 163, 161, -1, 199, 160, 162,
1765 163, 161, -1, 199, 40, -1, 199, 41, -1, 199,
1766 233, -1, 199, 206, -1, 199, 25, -1, 171, 3,
1767 -1, 171, 5, -1, 171, 4, -1, 171, 6, -1,
1768 11, 26, -1, 11, 27, -1, 172, 9, -1, 168,
Devang Patelbf507402008-02-20 22:40:23 +00001769 151, 205, 38, 199, 152, -1, 116, 151, 205, 245,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001770 152, -1, 130, 151, 205, 154, 205, 154, 205, 152,
1771 -1, 166, 151, 205, 154, 205, 152, -1, 167, 151,
1772 205, 154, 205, 152, -1, 89, 169, 151, 205, 154,
1773 205, 152, -1, 90, 170, 151, 205, 154, 205, 152,
1774 -1, 132, 151, 205, 154, 205, 152, -1, 133, 151,
1775 205, 154, 205, 154, 205, 152, -1, 134, 151, 205,
1776 154, 205, 154, 205, 152, -1, 207, 154, 205, -1,
1777 205, -1, 32, -1, 33, -1, 37, -1, -1, 201,
1778 233, -1, 122, 151, 210, 38, 199, 152, -1, 212,
1779 -1, -1, 213, -1, 212, 213, -1, -1, 31, 214,
1780 229, -1, -1, 30, 215, 230, -1, 59, 58, 219,
1781 -1, 176, 18, 199, -1, 176, 18, 10, -1, -1,
1782 178, 182, 209, 208, 205, 175, 216, 196, -1, -1,
1783 178, 180, 182, 209, 208, 205, 175, 217, 196, -1,
1784 -1, 178, 181, 182, 209, 208, 199, 175, 218, 196,
1785 -1, 178, 182, 35, 185, 210, -1, 51, 220, -1,
1786 55, 153, 221, -1, 22, -1, 52, 153, 22, -1,
1787 67, 153, 22, -1, 157, 222, 159, -1, 222, 154,
1788 22, -1, 22, -1, -1, 223, 154, 199, 188, 174,
1789 -1, 199, 188, 174, -1, 223, -1, 223, 154, 39,
1790 -1, 39, -1, -1, 186, 201, 177, 151, 224, 152,
1791 190, 195, 192, 191, -1, 28, -1, 162, -1, 184,
Devang Patelbf507402008-02-20 22:40:23 +00001792 182, 225, 226, -1, 29, -1, 163, -1, 237, 228,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001793 -1, 183, 182, 225, -1, -1, 60, -1, 3, -1,
1794 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1795 41, -1, 25, -1, 160, 207, 161, -1, 206, -1,
1796 58, 231, 22, 154, 22, -1, 7, -1, 8, -1,
1797 173, -1, 177, -1, 233, -1, 232, -1, 199, 234,
Devang Patel087fe2b2008-02-23 00:38:56 +00001798 -1, 235, -1, 236, 154, 235, -1, 237, 238, -1,
Devang Patelbf507402008-02-20 22:40:23 +00001799 227, 238, -1, 239, 176, 240, -1, 239, 242, -1,
1800 -1, 21, -1, 68, 236, -1, 68, 10, -1, 69,
1801 17, 234, -1, 69, 11, 234, 154, 17, 234, 154,
1802 17, 234, -1, 70, 171, 234, 154, 17, 234, 157,
1803 241, 159, -1, 70, 171, 234, 154, 17, 234, 157,
1804 159, -1, 71, 186, 201, 234, 151, 244, 152, 190,
1805 38, 17, 234, 72, 17, 234, -1, 72, -1, 73,
1806 -1, 241, 171, 232, 154, 17, 234, -1, 171, 232,
1807 154, 17, 234, -1, 176, 247, -1, 199, 157, 234,
1808 154, 234, 159, -1, 243, 154, 157, 234, 154, 234,
1809 159, -1, 199, 188, 234, 188, -1, 17, 188, 234,
1810 188, -1, 244, 154, 199, 188, 234, 188, -1, 244,
1811 154, 17, 188, 234, 188, -1, -1, -1, 245, 154,
1812 235, -1, 57, 56, -1, 56, -1, 166, 199, 234,
1813 154, 234, -1, 167, 199, 234, 154, 234, -1, 89,
1814 169, 199, 234, 154, 234, -1, 90, 170, 199, 234,
1815 154, 234, -1, 168, 235, 38, 199, -1, 130, 235,
1816 154, 235, 154, 235, -1, 131, 235, 154, 199, -1,
1817 132, 235, 154, 235, -1, 133, 235, 154, 235, 154,
1818 235, -1, 134, 235, 154, 235, 154, 235, -1, 129,
1819 243, -1, 246, 186, 201, 234, 151, 244, 152, 190,
1820 -1, 249, -1, 36, -1, -1, 111, 199, 193, -1,
1821 111, 199, 154, 11, 234, 193, -1, 112, 199, 193,
1822 -1, 112, 199, 154, 11, 234, 193, -1, 113, 235,
1823 -1, 248, 114, 199, 234, 193, -1, 248, 115, 235,
Devang Patelb52f9e72008-02-22 19:31:30 +00001824 154, 199, 234, 193, -1, 135, 199, 233, 154, 4,
Devang Patelbf507402008-02-20 22:40:23 +00001825 -1, 116, 199, 234, 245, -1
Chris Lattner59363a32008-02-19 04:36:25 +00001826};
1827
1828/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1829static const yytype_uint16 yyrline[] =
1830{
Dale Johannesen98738822008-02-22 22:17:59 +00001831 0, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
1832 1115, 1116, 1116, 1116, 1116, 1116, 1116, 1117, 1117, 1117,
1833 1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118, 1118, 1121,
1834 1121, 1122, 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1129,
1835 1129, 1130, 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134,
1836 1134, 1135, 1135, 1136, 1137, 1142, 1143, 1143, 1143, 1143,
1837 1143, 1145, 1145, 1145, 1146, 1146, 1148, 1149, 1153, 1157,
1838 1162, 1162, 1164, 1165, 1170, 1176, 1177, 1178, 1179, 1180,
1839 1184, 1185, 1186, 1190, 1191, 1192, 1193, 1197, 1198, 1199,
1840 1203, 1204, 1205, 1206, 1207, 1211, 1212, 1213, 1216, 1217,
1841 1218, 1219, 1220, 1221, 1222, 1229, 1230, 1231, 1232, 1233,
1842 1234, 1235, 1236, 1237, 1238, 1242, 1243, 1248, 1249, 1250,
1843 1251, 1252, 1253, 1256, 1257, 1262, 1263, 1270, 1271, 1277,
1844 1278, 1287, 1295, 1296, 1301, 1302, 1303, 1308, 1321, 1321,
1845 1321, 1321, 1321, 1321, 1321, 1324, 1328, 1332, 1339, 1344,
1846 1352, 1382, 1407, 1412, 1422, 1432, 1436, 1446, 1453, 1462,
1847 1469, 1474, 1479, 1486, 1487, 1494, 1501, 1509, 1515, 1527,
1848 1555, 1571, 1598, 1626, 1652, 1672, 1698, 1718, 1730, 1737,
1849 1803, 1813, 1823, 1829, 1839, 1845, 1855, 1860, 1865, 1878,
1850 1890, 1912, 1920, 1926, 1937, 1942, 1947, 1953, 1959, 1968,
1851 1972, 1980, 1980, 1983, 1983, 1986, 1998, 2019, 2024, 2032,
1852 2033, 2037, 2037, 2041, 2041, 2044, 2047, 2071, 2083, 2082,
1853 2094, 2093, 2103, 2102, 2113, 2153, 2156, 2162, 2172, 2176,
1854 2181, 2183, 2188, 2193, 2202, 2212, 2223, 2227, 2236, 2245,
1855 2250, 2384, 2384, 2386, 2395, 2395, 2397, 2402, 2414, 2418,
1856 2423, 2427, 2431, 2435, 2439, 2443, 2447, 2451, 2455, 2480,
1857 2484, 2494, 2498, 2502, 2507, 2514, 2514, 2520, 2529, 2534,
Devang Patel087fe2b2008-02-23 00:38:56 +00001858 2539, 2543, 2552, 2561, 2570, 2574, 2582, 2587, 2591, 2596,
1859 2606, 2625, 2634, 2725, 2729, 2736, 2747, 2760, 2770, 2781,
1860 2791, 2802, 2810, 2820, 2827, 2830, 2831, 2838, 2842, 2847,
1861 2863, 2880, 2894, 2908, 2920, 2928, 2935, 2941, 2947, 2953,
1862 2968, 3066, 3071, 3075, 3082, 3089, 3097, 3104, 3112, 3120,
1863 3134, 3151, 3159
Chris Lattner59363a32008-02-19 04:36:25 +00001864};
1865#endif
1866
1867#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1868/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1869 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1870static const char *const yytname[] =
1871{
1872 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1873 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1874 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1875 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1876 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1877 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1878 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1879 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1880 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1881 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1882 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1883 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1884 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1885 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1886 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1887 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1888 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1889 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1890 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1891 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
Devang Patel3b8849c2008-02-19 22:27:01 +00001892 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1893 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1894 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1895 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1896 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1897 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1898 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1899 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Chris Lattner59363a32008-02-19 04:36:25 +00001900 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1901 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1902 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1903 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1904 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1905 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1906 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1907 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1908 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1909 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1910 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
Devang Patelbf507402008-02-20 22:40:23 +00001911 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1912 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1913 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1914 "InstVal", "OptVolatile", "MemoryInst", 0
Chris Lattner59363a32008-02-19 04:36:25 +00001915};
1916#endif
1917
1918# ifdef YYPRINT
1919/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1920 token YYLEX-NUM. */
1921static const yytype_uint16 yytoknum[] =
1922{
1923 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1924 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1925 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1926 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1927 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1928 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1929 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1930 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1931 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1932 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1933 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1934 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1935 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1936 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1937 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel3b8849c2008-02-19 22:27:01 +00001938 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1939 60, 62, 123, 125, 99
Chris Lattner59363a32008-02-19 04:36:25 +00001940};
1941# endif
1942
1943/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1944static const yytype_uint8 yyr1[] =
1945{
Devang Patel3b8849c2008-02-19 22:27:01 +00001946 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1947 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
Chris Lattner59363a32008-02-19 04:36:25 +00001948 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
Devang Patel3b8849c2008-02-19 22:27:01 +00001949 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1950 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1951 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1952 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1953 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1954 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1955 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1956 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001957 187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
1958 189, 189, 189, 190, 190, 191, 191, 192, 192, 193,
1959 193, 194, 195, 195, 196, 196, 197, 197, 198, 198,
1960 198, 198, 198, 198, 198, 199, 199, 199, 199, 199,
1961 199, 199, 199, 199, 199, 199, 199, 199, 200, 201,
1962 201, 202, 202, 203, 203, 203, 203, 204, 204, 205,
Devang Patel3b8849c2008-02-19 22:27:01 +00001963 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001964 205, 205, 205, 205, 205, 205, 205, 205, 205, 206,
1965 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1966 207, 208, 208, 209, 209, 210, 210, 211, 211, 212,
1967 212, 214, 213, 215, 213, 213, 213, 213, 216, 213,
1968 217, 213, 218, 213, 213, 213, 213, 219, 220, 220,
1969 221, 222, 222, 222, 223, 223, 224, 224, 224, 224,
1970 225, 226, 226, 227, 228, 228, 229, 230, 231, 231,
Devang Patel3b8849c2008-02-19 22:27:01 +00001971 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001972 232, 233, 233, 233, 233, 234, 234, 235, 236, 236,
Devang Patelbf507402008-02-20 22:40:23 +00001973 237, 237, 238, 239, 239, 239, 240, 240, 240, 240,
1974 240, 240, 240, 240, 240, 241, 241, 242, 243, 243,
1975 244, 244, 244, 244, 244, 245, 245, 246, 246, 247,
1976 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
1977 247, 247, 248, 248, 249, 249, 249, 249, 249, 249,
1978 249, 249, 249
Chris Lattner59363a32008-02-19 04:36:25 +00001979};
1980
1981/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1982static const yytype_uint8 yyr2[] =
1983{
1984 0, 2, 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, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1991 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1992 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1993 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1994 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001995 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1996 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1997 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1998 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
1999 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2000 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2001 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2002 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2003 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2004 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2005 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2006 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2007 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2008 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2009 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
Devang Patelbf507402008-02-20 22:40:23 +00002010 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2011 2, 2, 3, 2, 0, 1, 2, 2, 3, 9,
2012 9, 8, 14, 1, 1, 6, 5, 2, 6, 7,
2013 4, 4, 6, 6, 0, 0, 3, 2, 1, 5,
2014 5, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2015 8, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2016 7, 5, 4
Chris Lattner59363a32008-02-19 04:36:25 +00002017};
2018
2019/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2020 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2021 means the default is an error. */
2022static const yytype_uint16 yydefact[] =
2023{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002024 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2025 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2026 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
Chris Lattner59363a32008-02-19 04:36:25 +00002027 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002028 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
Devang Patelbf507402008-02-20 22:40:23 +00002029 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002030 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2031 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2032 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
Devang Patelbf507402008-02-20 22:40:23 +00002033 275, 271, 69, 244, 245, 246, 270, 228, 229, 232,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002034 0, 166, 149, 0, 0, 0, 0, 155, 167, 0,
2035 0, 166, 0, 0, 0, 97, 96, 0, 201, 202,
2036 0, 0, 99, 100, 101, 102, 103, 0, 247, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002037 313, 273, 0, 230, 165, 115, 161, 163, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002038 0, 0, 0, 0, 154, 0, 0, 147, 0, 0,
2039 160, 0, 159, 0, 224, 138, 139, 140, 143, 142,
2040 141, 0, 0, 67, 67, 104, 0, 241, 242, 243,
Devang Patelbf507402008-02-20 22:40:23 +00002041 312, 298, 0, 0, 0, 0, 98, 283, 284, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00002042 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2043 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2044 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2045 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002046 0, 0, 272, 98, 287, 0, 311, 231, 158, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002047 123, 67, 67, 157, 0, 168, 0, 123, 67, 67,
2048 0, 205, 186, 187, 182, 184, 183, 185, 188, 181,
2049 177, 178, 0, 0, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 0, 0, 180, 179, 218, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002051 297, 277, 67, 268, 276, 0, 0, 55, 0, 0,
2052 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2053 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2054 42, 43, 44, 45, 46, 47, 48, 0, 129, 129,
2055 318, 67, 67, 309, 0, 0, 0, 0, 0, 67,
2056 67, 67, 0, 0, 0, 0, 0, 106, 108, 107,
2057 105, 109, 110, 111, 112, 113, 116, 164, 162, 151,
2058 152, 153, 156, 66, 150, 220, 222, 0, 0, 0,
2059 0, 0, 0, 0, 0, 170, 200, 0, 0, 0,
2060 174, 0, 171, 0, 0, 0, 134, 239, 250, 251,
2061 252, 257, 253, 254, 255, 256, 248, 0, 259, 266,
2062 265, 267, 0, 0, 278, 0, 0, 67, 67, 0,
2063 314, 0, 316, 295, 0, 0, 0, 0, 0, 0,
2064 0, 0, 0, 0, 0, 0, 67, 0, 114, 120,
2065 119, 117, 118, 121, 122, 124, 134, 134, 0, 0,
2066 0, 295, 0, 0, 0, 0, 0, 169, 155, 167,
2067 0, 172, 173, 0, 0, 0, 0, 219, 238, 115,
2068 236, 0, 249, 0, 0, 269, 0, 0, 0, 0,
2069 0, 0, 0, 0, 322, 0, 0, 0, 305, 306,
2070 0, 0, 0, 0, 0, 303, 0, 129, 0, 221,
2071 223, 67, 0, 0, 0, 0, 0, 0, 0, 199,
2072 176, 0, 0, 0, 0, 0, 0, 136, 134, 65,
2073 0, 123, 0, 258, 0, 0, 294, 0, 0, 129,
2074 130, 129, 0, 0, 0, 0, 0, 0, 321, 299,
2075 300, 294, 0, 319, 67, 206, 0, 0, 190, 0,
2076 0, 0, 0, 175, 0, 0, 67, 131, 137, 135,
2077 64, 235, 237, 115, 132, 0, 0, 0, 115, 115,
2078 0, 301, 302, 315, 317, 296, 0, 0, 304, 307,
2079 308, 0, 129, 0, 0, 0, 196, 0, 0, 192,
2080 193, 189, 65, 133, 127, 260, 0, 0, 0, 0,
2081 123, 0, 288, 0, 123, 320, 194, 195, 0, 0,
2082 0, 234, 0, 125, 0, 281, 0, 0, 106, 108,
2083 115, 115, 0, 115, 115, 289, 310, 191, 197, 198,
2084 128, 0, 240, 279, 0, 280, 0, 291, 290, 0,
2085 0, 0, 126, 0, 0, 0, 115, 115, 0, 0,
2086 0, 293, 292, 286, 0, 0, 285, 0, 282
Chris Lattner59363a32008-02-19 04:36:25 +00002087};
2088
2089/* YYDEFGOTO[NTERM-NUM]. */
2090static const yytype_int16 yydefgoto[] =
2091{
Devang Patelbf507402008-02-20 22:40:23 +00002092 -1, 263, 264, 265, 290, 307, 161, 162, 78, 531,
Chris Lattner59363a32008-02-19 04:36:25 +00002093 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
Devang Patelbf507402008-02-20 22:40:23 +00002094 117, 127, 336, 228, 415, 339, 602, 583, 390, 487,
2095 564, 437, 488, 80, 163, 136, 153, 137, 138, 109,
2096 356, 378, 357, 120, 87, 154, 16, 17, 18, 20,
2097 19, 366, 416, 417, 62, 23, 60, 100, 440, 441,
2098 128, 169, 54, 95, 55, 48, 443, 379, 82, 381,
2099 273, 274, 56, 91, 92, 222, 587, 131, 313, 540,
2100 454, 223, 224, 225, 226
Chris Lattner59363a32008-02-19 04:36:25 +00002101};
2102
2103/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2104 STATE-NUM. */
Devang Patelb52f9e72008-02-22 19:31:30 +00002105#define YYPACT_NINF -572
Chris Lattner59363a32008-02-19 04:36:25 +00002106static const yytype_int16 yypact[] =
2107{
Devang Patelb52f9e72008-02-22 19:31:30 +00002108 284, -572, -572, -572, -572, -572, -572, -572, -13, -121,
Devang Patel087fe2b2008-02-23 00:38:56 +00002109 36, -94, 101, -55, 19, -572, 135, 883, -572, 165,
2110 162, 13, 27, -572, 4, 199, -572, 1464, -572, -572,
Devang Patelb52f9e72008-02-22 19:31:30 +00002111 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
Devang Patel087fe2b2008-02-23 00:38:56 +00002112 106, 106, 203, -572, -572, -572, -572, 106, -572, -572,
2113 -572, -572, -572, 106, 210, -572, -10, 215, 219, 224,
2114 -572, -572, -572, -572, -572, 99, -572, -572, -572, -572,
2115 -572, -572, -572, -572, 265, 271, 2, 126, -572, -572,
2116 -572, 1, -572, 259, 259, 205, -572, 9, 382, 382,
2117 -572, -572, 78, -572, -572, -572, -572, -572, -572, -572,
2118 -32, 1059, -572, 147, 151, 506, 99, -572, 1, -114,
2119 166, 1059, 158, 9, 9, -572, -572, 1014, -572, -572,
2120 1504, 315, -572, -572, -572, -572, -572, 1562, -572, -2,
2121 1843, -572, 294, -572, -572, 1, -572, 172, 168, 1620,
2122 1620, 170, -68, 1620, -572, 329, 185, -572, 1504, 1620,
2123 99, 187, 1, 339, -572, 77, 333, 335, 336, 340,
2124 341, 262, 342, 1115, 298, -572, 139, -572, -572, -572,
2125 -572, -572, 292, 1660, 59, 343, 382, -572, -572, -572,
Devang Patelb52f9e72008-02-22 19:31:30 +00002126 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
Devang Patel087fe2b2008-02-23 00:38:56 +00002127 -572, -572, -572, -572, 312, 787, 1620, 1620, 1620, 1620,
Devang Patelb52f9e72008-02-22 19:31:30 +00002128 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
2129 -572, -572, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620,
Devang Patel087fe2b2008-02-23 00:38:56 +00002130 1620, 1620, -572, 382, -572, -42, -572, -572, 434, 1345,
2131 -572, -31, -30, -572, 194, 1, 208, -572, 298, 3,
Devang Patelb52f9e72008-02-22 19:31:30 +00002132 1014, -572, -572, -572, -572, -572, -572, -572, -572, -572,
Devang Patel087fe2b2008-02-23 00:38:56 +00002133 -572, -572, 312, 787, 213, 214, 218, 225, 228, 1385,
2134 1678, 609, 346, 230, 231, 238, -572, -572, -572, 242,
2135 -572, 99, 702, -572, 241, 841, 841, -572, 841, 1562,
Devang Patelb52f9e72008-02-22 19:31:30 +00002136 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
2137 1620, -572, -572, -572, -572, -572, -572, -572, -572, -572,
Devang Patel087fe2b2008-02-23 00:38:56 +00002138 -572, -572, -572, -572, -572, -572, -572, 1620, 97, 125,
2139 -572, 702, -25, 244, 245, 261, 263, 266, 269, 14,
2140 702, 702, 358, 1562, 1620, 1620, 409, -572, -572, -572,
Devang Patelb52f9e72008-02-22 19:31:30 +00002141 -572, -572, -572, -572, -572, -572, -572, -572, -572, -93,
Devang Patel087fe2b2008-02-23 00:38:56 +00002142 -572, -572, -572, -572, -93, -572, 158, 378, 275, 277,
2143 1504, 1504, 1504, 1504, 1504, -572, -572, 80, 788, -83,
2144 -572, -64, -572, 1504, 1504, 1504, 276, 1406, -572, -572,
2145 -572, -572, -572, -572, -572, -572, 369, 1504, -572, -572,
2146 -572, -572, 1620, 281, -572, 282, 841, 702, 702, 5,
2147 -572, 7, -572, -572, 841, 274, 1620, 1620, 1620, 1620,
2148 1620, 283, 285, 287, 1620, 841, 702, 295, -572, -572,
2149 -572, -572, -572, -572, -572, -572, 276, 276, 1620, 1504,
2150 1504, -572, 296, 299, 300, 301, 1504, -572, 306, 969,
2151 -58, -572, -572, 302, 303, 421, -3, -572, -572, 1,
2152 307, 308, -572, 440, 22, -572, 451, 452, 321, 319,
2153 320, 841, 471, 841, 323, 324, 841, 328, 1, -572,
2154 330, 332, 479, 841, 841, 1, 337, 344, 1620, -572,
2155 -572, -45, 347, 349, 133, 1504, 1504, 1504, 1504, -572,
2156 -572, 334, 1504, 1504, 1620, 468, 487, -572, 276, 1746,
2157 1446, -572, 350, -572, 841, 841, 1718, 841, 841, 344,
2158 -572, 344, 1620, 841, 351, 1620, 1620, 1620, -572, -572,
2159 -572, 1718, 441, -572, 702, -572, 1504, 1504, -572, 352,
2160 348, 353, 357, -572, 360, 363, 64, -572, -572, -572,
2161 -572, -572, -572, 1, 81, 474, 370, 374, 123, 1,
2162 138, -572, -572, -572, -572, -572, 368, 841, -572, -572,
2163 -572, 171, 344, 380, 381, 1504, -572, 1504, 1504, -572,
2164 -572, -572, 1746, -572, 483, -572, 520, -4, 560, 560,
2165 -572, 1736, -572, 379, -572, -572, -572, -572, 394, 395,
2166 398, -572, 550, 410, 841, -572, 1255, -1, 405, 407,
2167 -572, -572, 87, 123, 1, -572, -93, -572, -572, -572,
2168 -572, 537, -572, -572, 411, -572, 1255, 434, 434, 544,
2169 560, 560, -572, 549, 418, 841, -572, -572, 841, 558,
2170 509, 434, 434, -572, 841, 571, -572, 841, -572
Chris Lattner59363a32008-02-19 04:36:25 +00002171};
2172
2173/* YYPGOTO[NTERM-NUM]. */
2174static const yytype_int16 yypgoto[] =
2175{
Devang Patel087fe2b2008-02-23 00:38:56 +00002176 -572, 459, 460, 461, 345, 354, -173, -572, 0, 30,
2177 -150, 502, 8, -572, -572, -572, -572, 189, -572, -572,
2178 -572, -149, -572, -409, -572, -234, -572, -572, -289, 61,
2179 -572, -404, -572, -572, -26, 367, -122, -572, 488, 493,
2180 -92, -159, -214, 84, 217, 362, -572, -572, 586, -572,
Devang Patelb52f9e72008-02-22 19:31:30 +00002181 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
Devang Patel087fe2b2008-02-23 00:38:56 +00002182 515, -572, -572, -572, -572, -572, -572, -571, -76, 46,
2183 -105, -572, -572, 552, -572, -572, -572, -572, -572, 94,
2184 188, -572, -572, -572, -572
Chris Lattner59363a32008-02-19 04:36:25 +00002185};
2186
2187/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2188 positive, shift that token. If negative, reduce the rule which
2189 number is the opposite. If zero, do what YYDEFACT says.
2190 If YYTABLE_NINF, syntax error. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00002191#define YYTABLE_NINF -209
Chris Lattner59363a32008-02-19 04:36:25 +00002192static const yytype_int16 yytable[] =
2193{
Devang Patelbf507402008-02-20 22:40:23 +00002194 11, 81, 278, 344, 266, 166, 104, 277, 13, 110,
Devang Patelb52f9e72008-02-22 19:31:30 +00002195 277, 90, 469, 470, 268, 604, 451, 11, 453, 93,
2196 392, 63, 64, 110, 110, 13, 167, 279, 164, 110,
2197 489, 485, 24, 1, 2, 614, 3, 4, 5, 21,
2198 143, 118, 119, 409, 410, 411, 359, 361, 412, 144,
2199 486, 108, 413, 414, 22, 110, 238, 110, 452, 26,
2200 452, 29, 30, 31, 32, 33, 34, 35, 110, 36,
Devang Patel087fe2b2008-02-23 00:38:56 +00002201 275, 426, 324, 325, 323, 135, 276, 241, 431, 108,
2202 -55, -55, -55, -55, 529, 135, 143, 267, 345, 346,
2203 426, 152, 11, 310, 25, 234, 426, 1, 28, 432,
2204 3, 152, 5, 242, 243, 481, 111, 515, 314, 315,
2205 316, 317, 318, 231, 232, 485, 322, 235, 110, 27,
2206 111, 111, 132, 239, 562, 609, 111, 133, 340, 568,
2207 569, 341, 394, 63, 64, 43, 106, 66, 67, 68,
Devang Patelb52f9e72008-02-22 19:31:30 +00002208 69, 70, 71, 72, 430, 1, 2, 272, 3, 4,
Devang Patel087fe2b2008-02-23 00:38:56 +00002209 5, 110, 111, 94, 111, 585, -67, 386, 605, 2,
2210 168, 59, 4, 444, 105, 111, 57, 37, 38, 39,
2211 308, 309, 272, 311, 269, 73, 426, -144, 513, 110,
2212 58, 607, 608, 493, 610, 611, 312, 272, 272, 272,
Devang Patelb52f9e72008-02-22 19:31:30 +00002213 272, 272, 319, 320, 321, 272, 380, 148, 149, 380,
2214 380, 405, 380, 135, 49, 50, 51, 621, 622, 52,
Devang Patel087fe2b2008-02-23 00:38:56 +00002215 543, 45, 544, 46, 152, 111, 561, 409, 410, 411,
2216 407, 61, 412, 409, 410, 411, 413, 414, 412, 83,
2217 84, 90, 413, 414, 426, 380, 88, 97, 85, 427,
2218 86, 98, 89, 401, 380, 380, 99, 115, 111, 116,
2219 101, 389, -67, 152, 37, 38, 39, 534, 421, 422,
2220 423, 424, 425, 575, 387, 244, 245, 246, 247, 102,
2221 266, 433, 434, 435, -144, 103, 111, 445, -144, 391,
2222 -67, 388, 74, 75, -208, 518, 76, 502, 77, 107,
2223 570, 457, 571, 459, 460, 461, 86, 152, 406, 272,
2224 113, 114, -69, 1, 2, 139, 3, 4, 5, 140,
2225 380, 380, 380, 147, 6, 7, 227, 145, 380, 165,
2226 230, 383, 384, 574, 385, 571, 229, 472, 473, 380,
2227 380, 233, 429, 236, 479, 8, 592, 237, 240, 9,
2228 596, 439, -56, 10, -57, -60, 63, 64, 270, -59,
2229 -58, 248, 110, 267, 277, 342, 272, 393, 1, 2,
2230 343, 3, 4, 5, 350, 351, 402, 403, 362, 352,
2231 272, 458, 272, 272, 272, 380, 353, 380, 465, 354,
2232 380, 363, 364, 519, 520, 521, 522, 380, 380, 365,
2233 524, 525, 471, 367, 586, 382, 404, 545, 395, 396,
2234 548, 549, 550, 280, 281, 282, 283, 284, 285, 286,
2235 287, 288, 289, 408, 606, 397, 418, 398, 380, 380,
2236 399, 380, 380, 400, 553, 554, 419, 380, 420, 442,
2237 436, 456, 448, 449, 450, 446, 447, 462, 380, 463,
2238 455, 464, 514, 121, 122, 123, 124, 125, 126, 468,
2239 475, 466, 467, 476, 477, 478, 482, 483, 526, 484,
2240 491, 490, 492, 578, 533, 579, 580, 480, 494, 495,
2241 539, 380, 496, 497, 498, 500, 272, 502, 503, 272,
2242 272, 272, 505, 508, 506, 539, 507, 326, 511, 530,
2243 527, 528, 380, 380, 452, 523, 565, 499, 512, 501,
2244 556, 516, 504, 517, 535, 547, 555, 557, 380, 509,
2245 510, 558, 559, 63, 64, 560, 106, 66, 67, 68,
2246 69, 70, 71, 72, 566, 1, 2, 572, 3, 4,
2247 5, 567, 576, 577, 380, 380, 582, 584, 595, 380,
2248 536, 537, 380, 541, 542, 594, 597, 598, 380, 546,
2249 599, 380, 327, 328, 600, 73, -18, 601, -19, 612,
2250 552, 615, 530, 368, 369, 613, 618, 63, 64, 370,
2251 329, 330, 619, 331, 332, 624, 333, 334, 335, 1,
2252 2, 625, 3, 4, 5, 371, 372, 373, 627, 219,
2253 220, 221, 581, 573, 130, 563, 338, 348, 142, 146,
2254 374, 375, 347, 44, 129, 551, 0, 349, 96, 474,
2255 0, 0, 0, 326, 590, 591, 63, 64, 376, 106,
Devang Patelbf507402008-02-20 22:40:23 +00002256 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2257 603, 3, 4, 5, 179, 180, 181, 182, 183, 184,
2258 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2259 253, 0, 0, 0, 0, 0, 616, 617, 73, 0,
2260 0, 620, 74, 75, 623, 0, 76, 0, 77, 141,
2261 626, 0, 0, 628, 0, 0, 254, 200, 588, 589,
2262 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
2263 255, 0, 256, 257, 258, 0, 329, 330, 0, 331,
2264 332, 0, 333, 334, 335, 368, 369, 0, 0, 63,
2265 64, 370, 0, 0, 0, 0, 0, 0, 0, 0,
2266 377, 1, 2, 0, 3, 4, 5, 371, 372, 373,
2267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2268 0, 0, 374, 375, 0, 0, 0, 0, 0, 0,
2269 0, 0, 0, 0, 0, 0, 110, 0, 0, 0,
2270 376, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2271 0, 77, 360, 0, 0, 0, 179, 180, 181, 182,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002272 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
Devang Patelbf507402008-02-20 22:40:23 +00002273 193, 252, 253, 0, 0, 63, 64, 0, 106, 155,
2274 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
2275 3, 4, 5, 291, 292, 0, 0, 0, 254, 200,
2276 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2277 211, 0, 255, 0, 256, 257, 258, 73, 0, 0,
2278 0, 0, 0, 0, 368, 369, 0, 0, 63, 64,
2279 370, 0, 0, 111, 0, 0, 0, 0, 0, 0,
2280 1, 2, 377, 3, 4, 5, 371, 372, 373, 0,
Chris Lattner59363a32008-02-19 04:36:25 +00002281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002282 0, 374, 375, -207, 293, 294, 295, 296, 297, 298,
2283 299, 300, 301, 302, 303, 304, 305, 306, 0, 376,
2284 0, -69, 1, 2, 0, 3, 4, 5, 0, 0,
2285 0, 0, 0, 6, 7, 179, 180, 181, 182, 183,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002286 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
Devang Patelbf507402008-02-20 22:40:23 +00002287 252, 253, 0, 0, 8, 0, 0, 0, 9, 0,
2288 0, 0, 10, 0, 74, 75, 0, 0, 76, 0,
2289 77, 428, 0, 0, 0, 0, 0, 254, 200, 201,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002290 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
Devang Patelbf507402008-02-20 22:40:23 +00002291 0, 255, 0, 256, 257, 258, 63, 64, 0, 0,
2292 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2293 0, 3, 4, 5, 249, 0, 0, 0, 0, 0,
2294 0, 377, 0, 0, 0, 0, 0, 0, 0, 250,
2295 251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2296 0, 63, 64, 110, 150, 66, 67, 68, 69, 70,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002297 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002298 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2299 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2300 0, 0, 0, 73, 0, 0, 63, 64, 0, 106,
2301 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2302 0, 3, 4, 5, 0, 254, 200, 201, 202, 203,
2303 204, 205, 206, 207, 208, 209, 210, 211, 134, 255,
2304 0, 256, 257, 258, 0, 0, 0, 0, 73, 0,
Devang Patel3b8849c2008-02-19 22:27:01 +00002305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002306 111, 0, 63, 64, -67, 0, 259, 0, 0, 260,
2307 0, 261, 0, 262, 1, 2, 151, 3, 4, 5,
2308 249, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2309 0, 0, 0, 0, 0, 250, 251, 0, 0, 0,
2310 0, 0, 0, 0, 0, 0, 0, 0, 0, 110,
2311 74, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2312 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2313 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2314 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2315 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2316 0, 77, 0, 0, 0, 0, 0, 0, 0, 0,
2317 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2318 208, 209, 210, 211, 0, 255, 0, 256, 257, 258,
2319 0, 0, 0, 0, 0, 0, 0, 0, 368, 369,
2320 0, 0, 0, 0, 370, 0, 111, 0, 0, 0,
2321 0, 0, 259, 0, 0, 260, 0, 261, 0, 262,
2322 371, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2323 0, 0, 0, 0, 0, 374, 375, 0, 0, 0,
2324 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 376, 0, 0, 0, 0, 0, 0,
2326 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2327 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2328 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2329 0, 0, 63, 64, 0, 106, 66, 67, 68, 69,
2330 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2331 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2332 208, 209, 210, 211, 337, 255, 0, 256, 257, 258,
2333 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2334 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2335 0, 0, 0, 63, 64, 377, 106, 66, 67, 68,
2336 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2337 5, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2338 0, 0, 0, 0, 0, 438, 0, 0, 0, 0,
2339 0, 0, 0, 63, 64, 73, 106, 66, 67, 68,
2340 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2341 5, 63, 64, 0, 65, 66, 67, 68, 69, 70,
2342 71, 72, 0, 1, 2, 532, 3, 4, 5, 0,
2343 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2344 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2345 0, 63, 64, 73, 106, 155, 156, 157, 158, 159,
2346 160, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2347 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2348 0, 74, 75, 0, 355, 76, 0, 77, 0, 0,
2349 0, 0, 0, 73, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002350 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
Devang Patelbf507402008-02-20 22:40:23 +00002351 64, 0, 150, 66, 67, 68, 69, 70, 71, 72,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002352 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002354 0, 0, 74, 75, 0, 0, 76, 0, 77, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002355 0, 73, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002356 74, 75, 0, 0, 76, 0, 77, 63, 64, 0,
2357 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2358 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2359 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002360 74, 75, 0, 0, 76, 0, 77, 63, 64, 73,
Devang Patelbf507402008-02-20 22:40:23 +00002361 271, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2362 2, 0, 3, 4, 5, 63, 64, 0, 106, 155,
2363 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002364 3, 4, 5, 0, 0, 0, 0, 0, 0, 73,
2365 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
Devang Patelbf507402008-02-20 22:40:23 +00002366 0, 0, 76, 0, 77, 63, 64, 73, 106, 66,
2367 67, 68, 69, 70, 71, 538, 0, 1, 2, 0,
2368 3, 4, 5, 63, 64, 0, 106, 66, 67, 68,
2369 69, 70, 71, 593, 0, 1, 2, 0, 3, 4,
2370 5, 0, 0, 0, 0, 1, 0, 73, 3, 0,
2371 5, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2372 76, 0, 77, 0, 0, 73, 0, 0, 0, 0,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 326,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002374 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002375 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002376 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
2377 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2378 358, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002380 0, 0, 0, 0, 327, 328, 0, 0, 0, 0,
2381 0, 0, 0, 0, 74, 75, 0, 0, 76, 170,
2382 77, 0, 329, 330, 0, 331, 332, 0, 333, 334,
2383 335, 0, 74, 75, 0, 0, 76, 0, 77, 171,
2384 172, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2385 0, 173, 174, 175, 176, 177, 178, 179, 180, 181,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002386 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2387 192, 193, 194, 195, 0, 0, 0, 0, 0, 0,
2388 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2389 0, 0, 0, 0, 196, 197, 198, 0, 0, 199,
2390 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2391 210, 211, 212, 213, 214, 215, 216, 217, 218
Chris Lattner59363a32008-02-19 04:36:25 +00002392};
2393
2394static const yytype_int16 yycheck[] =
2395{
Devang Patelbf507402008-02-20 22:40:23 +00002396 0, 27, 175, 237, 163, 127, 4, 11, 0, 54,
Devang Patelb52f9e72008-02-22 19:31:30 +00002397 11, 21, 416, 417, 164, 586, 11, 17, 11, 29,
2398 309, 7, 8, 54, 54, 17, 28, 176, 120, 54,
2399 439, 34, 153, 19, 20, 606, 22, 23, 24, 52,
2400 154, 32, 33, 136, 137, 138, 260, 261, 141, 163,
2401 53, 77, 145, 146, 67, 54, 148, 54, 53, 153,
2402 53, 42, 43, 44, 45, 46, 47, 48, 54, 50,
Devang Patel087fe2b2008-02-23 00:38:56 +00002403 11, 154, 114, 115, 223, 101, 17, 153, 161, 105,
2404 3, 4, 5, 6, 488, 111, 154, 163, 238, 239,
2405 154, 117, 92, 198, 58, 163, 154, 19, 153, 163,
2406 22, 127, 24, 26, 27, 163, 151, 152, 213, 214,
2407 215, 216, 217, 139, 140, 34, 221, 143, 54, 18,
2408 151, 151, 154, 149, 533, 38, 151, 159, 159, 538,
2409 539, 161, 157, 7, 8, 0, 10, 11, 12, 13,
Devang Patelb52f9e72008-02-22 19:31:30 +00002410 14, 15, 16, 17, 358, 19, 20, 173, 22, 23,
Devang Patel087fe2b2008-02-23 00:38:56 +00002411 24, 54, 151, 163, 151, 159, 155, 279, 159, 20,
2412 162, 157, 23, 377, 162, 151, 153, 148, 149, 150,
2413 196, 197, 198, 199, 166, 49, 154, 54, 467, 54,
2414 153, 590, 591, 161, 593, 594, 212, 213, 214, 215,
Devang Patelb52f9e72008-02-22 19:31:30 +00002415 216, 217, 218, 219, 220, 221, 272, 113, 114, 275,
2416 276, 323, 278, 229, 42, 43, 44, 616, 617, 47,
Devang Patel087fe2b2008-02-23 00:38:56 +00002417 499, 46, 501, 48, 240, 151, 152, 136, 137, 138,
Devang Patelb52f9e72008-02-22 19:31:30 +00002418 325, 22, 141, 136, 137, 138, 145, 146, 141, 40,
Devang Patel087fe2b2008-02-23 00:38:56 +00002419 41, 21, 145, 146, 154, 311, 47, 22, 35, 159,
2420 37, 22, 53, 319, 320, 321, 22, 42, 151, 44,
2421 151, 154, 155, 279, 148, 149, 150, 491, 350, 351,
2422 352, 353, 354, 552, 290, 3, 4, 5, 6, 4,
2423 429, 363, 364, 365, 151, 4, 151, 382, 155, 154,
2424 155, 307, 156, 157, 0, 152, 160, 154, 162, 163,
2425 152, 396, 154, 398, 399, 400, 37, 323, 324, 325,
2426 83, 84, 18, 19, 20, 158, 22, 23, 24, 158,
2427 386, 387, 388, 155, 30, 31, 22, 151, 394, 4,
2428 152, 275, 276, 152, 278, 154, 154, 419, 420, 405,
2429 406, 161, 358, 4, 426, 51, 570, 152, 151, 55,
2430 574, 367, 9, 59, 9, 9, 7, 8, 56, 9,
2431 9, 9, 54, 429, 11, 161, 382, 311, 19, 20,
2432 152, 22, 23, 24, 151, 151, 320, 321, 22, 151,
2433 396, 397, 398, 399, 400, 451, 151, 453, 404, 151,
Devang Patelb52f9e72008-02-22 19:31:30 +00002434 456, 151, 151, 475, 476, 477, 478, 463, 464, 151,
Devang Patel087fe2b2008-02-23 00:38:56 +00002435 482, 483, 418, 151, 567, 154, 38, 502, 154, 154,
2436 505, 506, 507, 91, 92, 93, 94, 95, 96, 97,
2437 98, 99, 100, 4, 587, 154, 38, 154, 494, 495,
2438 154, 497, 498, 154, 516, 517, 151, 503, 151, 60,
2439 154, 157, 386, 387, 388, 154, 154, 154, 514, 154,
2440 394, 154, 468, 61, 62, 63, 64, 65, 66, 154,
2441 154, 405, 406, 154, 154, 154, 154, 154, 484, 38,
2442 152, 154, 22, 555, 490, 557, 558, 161, 17, 17,
2443 496, 547, 151, 154, 154, 4, 502, 154, 154, 505,
2444 506, 507, 154, 4, 154, 511, 154, 53, 151, 489,
2445 22, 4, 568, 569, 53, 161, 22, 451, 154, 453,
2446 152, 154, 456, 154, 154, 154, 154, 154, 584, 463,
2447 464, 154, 152, 7, 8, 152, 10, 11, 12, 13,
2448 14, 15, 16, 17, 154, 19, 20, 159, 22, 23,
2449 24, 157, 152, 152, 610, 611, 53, 17, 159, 615,
2450 494, 495, 618, 497, 498, 571, 152, 152, 624, 503,
2451 152, 627, 118, 119, 4, 49, 151, 147, 151, 22,
2452 514, 17, 562, 3, 4, 154, 17, 7, 8, 9,
2453 136, 137, 154, 139, 140, 17, 142, 143, 144, 19,
2454 20, 72, 22, 23, 24, 25, 26, 27, 17, 130,
2455 130, 130, 562, 547, 92, 534, 229, 252, 105, 111,
2456 40, 41, 240, 17, 89, 511, -1, 253, 56, 421,
2457 -1, -1, -1, 53, 568, 569, 7, 8, 58, 10,
Devang Patelbf507402008-02-20 22:40:23 +00002458 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2459 584, 22, 23, 24, 74, 75, 76, 77, 78, 79,
2460 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2461 90, -1, -1, -1, -1, -1, 610, 611, 49, -1,
2462 -1, 615, 156, 157, 618, -1, 160, -1, 162, 163,
2463 624, -1, -1, 627, -1, -1, 116, 117, 118, 119,
2464 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
2465 130, -1, 132, 133, 134, -1, 136, 137, -1, 139,
2466 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
2467 8, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2468 160, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2469 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2470 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2471 -1, -1, -1, -1, -1, -1, 54, -1, -1, -1,
2472 58, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2473 -1, 162, 163, -1, -1, -1, 74, 75, 76, 77,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002474 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
Devang Patelbf507402008-02-20 22:40:23 +00002475 88, 89, 90, -1, -1, 7, 8, -1, 10, 11,
2476 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2477 22, 23, 24, 26, 27, -1, -1, -1, 116, 117,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002478 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
Devang Patelbf507402008-02-20 22:40:23 +00002479 128, -1, 130, -1, 132, 133, 134, 49, -1, -1,
2480 -1, -1, -1, -1, 3, 4, -1, -1, 7, 8,
2481 9, -1, -1, 151, -1, -1, -1, -1, -1, -1,
2482 19, 20, 160, 22, 23, 24, 25, 26, 27, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002483 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002484 -1, 40, 41, 0, 97, 98, 99, 100, 101, 102,
2485 103, 104, 105, 106, 107, 108, 109, 110, -1, 58,
2486 -1, 18, 19, 20, -1, 22, 23, 24, -1, -1,
2487 -1, -1, -1, 30, 31, 74, 75, 76, 77, 78,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002488 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
Devang Patelbf507402008-02-20 22:40:23 +00002489 89, 90, -1, -1, 51, -1, -1, -1, 55, -1,
2490 -1, -1, 59, -1, 156, 157, -1, -1, 160, -1,
2491 162, 163, -1, -1, -1, -1, -1, 116, 117, 118,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002492 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
Devang Patelbf507402008-02-20 22:40:23 +00002493 -1, 130, -1, 132, 133, 134, 7, 8, -1, -1,
2494 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2495 -1, 22, 23, 24, 25, -1, -1, -1, -1, -1,
2496 -1, 160, -1, -1, -1, -1, -1, -1, -1, 40,
2497 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2498 -1, 7, 8, 54, 10, 11, 12, 13, 14, 15,
2499 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2500 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2501 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2502 -1, -1, -1, 49, -1, -1, 7, 8, -1, 10,
2503 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2504 -1, 22, 23, 24, -1, 116, 117, 118, 119, 120,
2505 121, 122, 123, 124, 125, 126, 127, 128, 39, 130,
2506 -1, 132, 133, 134, -1, -1, -1, -1, 49, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002507 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002508 151, -1, 7, 8, 155, -1, 157, -1, -1, 160,
2509 -1, 162, -1, 164, 19, 20, 122, 22, 23, 24,
2510 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2511 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2512 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2513 156, 157, -1, -1, 160, -1, 162, -1, -1, -1,
2514 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2515 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2516 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2517 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2518 -1, 162, -1, -1, -1, -1, -1, -1, -1, -1,
2519 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2520 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
2521 -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2522 -1, -1, -1, -1, 9, -1, 151, -1, -1, -1,
2523 -1, -1, 157, -1, -1, 160, -1, 162, -1, 164,
2524 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2525 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002526 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002527 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1,
2528 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2529 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2530 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2531 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2532 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2533 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2534 125, 126, 127, 128, 39, 130, -1, 132, 133, 134,
2535 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2536 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2537 -1, -1, -1, 7, 8, 160, 10, 11, 12, 13,
2538 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2539 24, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2540 -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002541 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
2542 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
Devang Patelbf507402008-02-20 22:40:23 +00002543 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2544 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002545 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002546 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2547 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002548 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002549 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002550 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2551 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002552 -1, -1, 156, 157, -1, -1, 160, -1, 162, 7,
2553 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2554 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2555 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002556 -1, -1, 156, 157, -1, -1, 160, -1, 162, -1,
2557 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
2558 156, 157, -1, -1, 160, -1, 162, 7, 8, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002559 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2560 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002561 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002562 156, 157, -1, -1, 160, -1, 162, 7, 8, 49,
2563 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2564 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2565 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2566 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2567 -1, -1, -1, -1, -1, -1, -1, -1, 156, 157,
Devang Patelbf507402008-02-20 22:40:23 +00002568 -1, -1, 160, -1, 162, 7, 8, 49, 10, 11,
2569 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2570 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
2571 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2572 24, -1, -1, -1, -1, 19, -1, 49, 22, -1,
2573 24, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2574 160, -1, 162, -1, -1, 49, -1, -1, -1, -1,
2575 -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002576 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002577 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2578 160, -1, 162, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002579 -1, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2580 162, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002581 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002582 -1, -1, -1, -1, 118, 119, -1, -1, -1, -1,
2583 -1, -1, -1, -1, 156, 157, -1, -1, 160, 36,
2584 162, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2585 144, -1, 156, 157, -1, -1, 160, -1, 162, 56,
2586 57, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2587 -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002588 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2589 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
2590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2591 -1, -1, -1, -1, 111, 112, 113, -1, -1, 116,
2592 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2593 127, 128, 129, 130, 131, 132, 133, 134, 135
Chris Lattner59363a32008-02-19 04:36:25 +00002594};
2595
2596/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2597 symbol of state STATE-NUM. */
2598static const yytype_uint8 yystos[] =
2599{
2600 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
Devang Patel3b8849c2008-02-19 22:27:01 +00002601 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2602 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2603 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2604 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
Devang Patelbf507402008-02-20 22:40:23 +00002605 43, 44, 47, 184, 227, 229, 237, 153, 153, 157,
Devang Patel3b8849c2008-02-19 22:27:01 +00002606 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2607 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2608 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
Devang Patelbf507402008-02-20 22:40:23 +00002609 21, 238, 239, 29, 163, 228, 238, 22, 22, 22,
Devang Patel3b8849c2008-02-19 22:27:01 +00002610 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2611 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2612 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
Devang Patelbf507402008-02-20 22:40:23 +00002613 176, 242, 154, 159, 39, 199, 200, 202, 203, 158,
Devang Patel3b8849c2008-02-19 22:27:01 +00002614 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2615 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2616 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
Chris Lattner59363a32008-02-19 04:36:25 +00002617 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2618 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2619 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2620 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
Devang Patel3b8849c2008-02-19 22:27:01 +00002621 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
Devang Patelbf507402008-02-20 22:40:23 +00002622 167, 168, 240, 246, 247, 248, 249, 22, 188, 154,
Devang Patel3b8849c2008-02-19 22:27:01 +00002623 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2624 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2625 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2626 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
Devang Patelbf507402008-02-20 22:40:23 +00002627 56, 10, 199, 235, 236, 11, 17, 11, 171, 186,
2628 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2629 169, 26, 27, 97, 98, 99, 100, 101, 102, 103,
2630 104, 105, 106, 107, 108, 109, 110, 170, 199, 199,
2631 235, 199, 199, 243, 235, 235, 235, 235, 235, 199,
2632 199, 199, 235, 186, 114, 115, 53, 118, 119, 136,
2633 137, 139, 140, 142, 143, 144, 187, 39, 200, 190,
2634 159, 161, 161, 152, 190, 175, 175, 210, 169, 170,
2635 151, 151, 151, 151, 151, 159, 205, 207, 162, 207,
2636 163, 207, 22, 151, 151, 151, 216, 151, 3, 4,
2637 9, 25, 26, 27, 40, 41, 58, 160, 206, 232,
2638 233, 234, 154, 234, 234, 234, 201, 199, 199, 154,
2639 193, 154, 193, 234, 157, 154, 154, 154, 154, 154,
Devang Patelb52f9e72008-02-22 19:31:30 +00002640 154, 233, 234, 234, 38, 201, 199, 235, 4, 136,
Devang Patelbf507402008-02-20 22:40:23 +00002641 137, 138, 141, 145, 146, 189, 217, 218, 38, 151,
2642 151, 205, 205, 205, 205, 205, 154, 159, 163, 199,
2643 207, 161, 163, 205, 205, 205, 154, 196, 39, 199,
Devang Patel087fe2b2008-02-23 00:38:56 +00002644 223, 224, 60, 231, 207, 235, 154, 154, 234, 234,
Devang Patelbf507402008-02-20 22:40:23 +00002645 234, 11, 53, 11, 245, 234, 157, 235, 199, 235,
2646 235, 235, 154, 154, 154, 199, 234, 234, 154, 196,
2647 196, 199, 205, 205, 245, 154, 154, 154, 154, 205,
2648 161, 163, 154, 154, 38, 34, 53, 194, 197, 188,
2649 154, 152, 22, 161, 17, 17, 151, 154, 154, 234,
2650 4, 234, 154, 154, 234, 154, 154, 154, 4, 234,
2651 234, 151, 154, 193, 199, 152, 154, 154, 152, 205,
2652 205, 205, 205, 161, 205, 205, 199, 22, 4, 196,
2653 173, 174, 39, 199, 190, 154, 234, 234, 17, 199,
2654 244, 234, 234, 193, 193, 235, 234, 154, 235, 235,
2655 235, 244, 234, 205, 205, 154, 152, 154, 154, 152,
2656 152, 152, 188, 194, 195, 22, 154, 157, 188, 188,
2657 152, 154, 159, 234, 152, 193, 152, 152, 205, 205,
2658 205, 174, 53, 192, 17, 159, 171, 241, 118, 119,
2659 234, 234, 190, 17, 199, 159, 190, 152, 152, 152,
2660 4, 147, 191, 234, 232, 159, 171, 188, 188, 38,
2661 188, 188, 22, 154, 232, 17, 234, 234, 17, 154,
2662 234, 188, 188, 234, 17, 72, 234, 17, 234
Chris Lattner59363a32008-02-19 04:36:25 +00002663};
David Greene9145dd22007-08-01 03:59:32 +00002664
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002665#define yyerrok (yyerrstatus = 0)
2666#define yyclearin (yychar = YYEMPTY)
Chris Lattner59363a32008-02-19 04:36:25 +00002667#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002668#define YYEOF 0
Chris Lattner59363a32008-02-19 04:36:25 +00002669
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002670#define YYACCEPT goto yyacceptlab
Chris Lattner59363a32008-02-19 04:36:25 +00002671#define YYABORT goto yyabortlab
2672#define YYERROR goto yyerrorlab
2673
2674
2675/* Like YYERROR except do call yyerror. This remains here temporarily
2676 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002677 Once GCC version 2 has supplanted version 1, this can go. */
Chris Lattner59363a32008-02-19 04:36:25 +00002678
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002679#define YYFAIL goto yyerrlab
Chris Lattner59363a32008-02-19 04:36:25 +00002680
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002681#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner59363a32008-02-19 04:36:25 +00002682
2683#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002684do \
2685 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner59363a32008-02-19 04:36:25 +00002686 { \
2687 yychar = (Token); \
2688 yylval = (Value); \
2689 yytoken = YYTRANSLATE (yychar); \
2690 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002691 goto yybackup; \
2692 } \
2693 else \
Chris Lattner59363a32008-02-19 04:36:25 +00002694 { \
2695 yyerror (YY_("syntax error: cannot back up")); \
2696 YYERROR; \
2697 } \
2698while (YYID (0))
2699
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002700
2701#define YYTERROR 1
2702#define YYERRCODE 256
2703
Chris Lattner59363a32008-02-19 04:36:25 +00002704
2705/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2706 If N is 0, then set CURRENT to the empty location which ends
2707 the previous symbol: RHS[0] (always defined). */
2708
2709#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2710#ifndef YYLLOC_DEFAULT
2711# define YYLLOC_DEFAULT(Current, Rhs, N) \
2712 do \
2713 if (YYID (N)) \
2714 { \
2715 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2716 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2717 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2718 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2719 } \
2720 else \
2721 { \
2722 (Current).first_line = (Current).last_line = \
2723 YYRHSLOC (Rhs, 0).last_line; \
2724 (Current).first_column = (Current).last_column = \
2725 YYRHSLOC (Rhs, 0).last_column; \
2726 } \
2727 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002728#endif
2729
Chris Lattner59363a32008-02-19 04:36:25 +00002730
2731/* YY_LOCATION_PRINT -- Print the location on the stream.
2732 This macro was not mandated originally: define only if we know
2733 we won't break user code: when these are the locations we know. */
2734
2735#ifndef YY_LOCATION_PRINT
Devang Pateleb293342008-02-20 19:13:10 +00002736# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Chris Lattner59363a32008-02-19 04:36:25 +00002737# define YY_LOCATION_PRINT(File, Loc) \
2738 fprintf (File, "%d.%d-%d.%d", \
2739 (Loc).first_line, (Loc).first_column, \
2740 (Loc).last_line, (Loc).last_column)
2741# else
2742# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2743# endif
2744#endif
2745
2746
2747/* YYLEX -- calling `yylex' with the right arguments. */
2748
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002749#ifdef YYLEX_PARAM
Chris Lattner59363a32008-02-19 04:36:25 +00002750# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002751#else
Chris Lattner59363a32008-02-19 04:36:25 +00002752# define YYLEX yylex ()
Scott Michel6d1aba82008-01-30 03:10:00 +00002753#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002754
2755/* Enable debugging if requested. */
2756#if YYDEBUG
2757
2758# ifndef YYFPRINTF
2759# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2760# define YYFPRINTF fprintf
2761# endif
2762
2763# define YYDPRINTF(Args) \
2764do { \
2765 if (yydebug) \
2766 YYFPRINTF Args; \
2767} while (YYID (0))
2768
2769# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2770do { \
2771 if (yydebug) \
2772 { \
2773 YYFPRINTF (stderr, "%s ", Title); \
2774 yy_symbol_print (stderr, \
2775 Type, Value); \
2776 YYFPRINTF (stderr, "\n"); \
2777 } \
2778} while (YYID (0))
2779
2780
2781/*--------------------------------.
2782| Print this symbol on YYOUTPUT. |
2783`--------------------------------*/
2784
2785/*ARGSUSED*/
2786#if (defined __STDC__ || defined __C99__FUNC__ \
2787 || defined __cplusplus || defined _MSC_VER)
2788static void
2789yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Scott Michel6d1aba82008-01-30 03:10:00 +00002790#else
Chris Lattner59363a32008-02-19 04:36:25 +00002791static void
2792yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2793 FILE *yyoutput;
2794 int yytype;
2795 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002796#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002797{
2798 if (!yyvaluep)
2799 return;
2800# ifdef YYPRINT
2801 if (yytype < YYNTOKENS)
2802 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2803# else
2804 YYUSE (yyoutput);
2805# endif
2806 switch (yytype)
2807 {
2808 default:
2809 break;
2810 }
2811}
2812
2813
2814/*--------------------------------.
2815| Print this symbol on YYOUTPUT. |
2816`--------------------------------*/
2817
2818#if (defined __STDC__ || defined __C99__FUNC__ \
2819 || defined __cplusplus || defined _MSC_VER)
2820static void
2821yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2822#else
2823static void
2824yy_symbol_print (yyoutput, yytype, yyvaluep)
2825 FILE *yyoutput;
2826 int yytype;
2827 YYSTYPE const * const yyvaluep;
Christopher Lamb0a243582007-12-11 09:02:08 +00002828#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002829{
2830 if (yytype < YYNTOKENS)
2831 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2832 else
2833 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Scott Michel5a6f17b2008-01-30 02:55:46 +00002834
Chris Lattner59363a32008-02-19 04:36:25 +00002835 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2836 YYFPRINTF (yyoutput, ")");
2837}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002838
Chris Lattner59363a32008-02-19 04:36:25 +00002839/*------------------------------------------------------------------.
2840| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2841| TOP (included). |
2842`------------------------------------------------------------------*/
Scott Michel5a6f17b2008-01-30 02:55:46 +00002843
Chris Lattner59363a32008-02-19 04:36:25 +00002844#if (defined __STDC__ || defined __C99__FUNC__ \
2845 || defined __cplusplus || defined _MSC_VER)
2846static void
2847yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2848#else
2849static void
2850yy_stack_print (bottom, top)
2851 yytype_int16 *bottom;
2852 yytype_int16 *top;
Christopher Lamb0a243582007-12-11 09:02:08 +00002853#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002854{
2855 YYFPRINTF (stderr, "Stack now");
2856 for (; bottom <= top; ++bottom)
2857 YYFPRINTF (stderr, " %d", *bottom);
2858 YYFPRINTF (stderr, "\n");
2859}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002860
Chris Lattner59363a32008-02-19 04:36:25 +00002861# define YY_STACK_PRINT(Bottom, Top) \
2862do { \
2863 if (yydebug) \
2864 yy_stack_print ((Bottom), (Top)); \
2865} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00002866
Chris Lattner59363a32008-02-19 04:36:25 +00002867
2868/*------------------------------------------------.
2869| Report that the YYRULE is going to be reduced. |
2870`------------------------------------------------*/
2871
2872#if (defined __STDC__ || defined __C99__FUNC__ \
2873 || defined __cplusplus || defined _MSC_VER)
2874static void
2875yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2876#else
2877static void
2878yy_reduce_print (yyvsp, yyrule)
2879 YYSTYPE *yyvsp;
2880 int yyrule;
Dale Johannesen3afee192007-09-07 21:07:57 +00002881#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002882{
2883 int yynrhs = yyr2[yyrule];
2884 int yyi;
2885 unsigned long int yylno = yyrline[yyrule];
2886 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2887 yyrule - 1, yylno);
2888 /* The symbols being reduced. */
2889 for (yyi = 0; yyi < yynrhs; yyi++)
2890 {
2891 fprintf (stderr, " $%d = ", yyi + 1);
2892 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2893 &(yyvsp[(yyi + 1) - (yynrhs)])
2894 );
2895 fprintf (stderr, "\n");
2896 }
2897}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002898
Chris Lattner59363a32008-02-19 04:36:25 +00002899# define YY_REDUCE_PRINT(Rule) \
2900do { \
2901 if (yydebug) \
2902 yy_reduce_print (yyvsp, Rule); \
2903} while (YYID (0))
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002904
Chris Lattner59363a32008-02-19 04:36:25 +00002905/* Nonzero means print parse trace. It is left uninitialized so that
2906 multiple parsers can coexist. */
2907int yydebug;
2908#else /* !YYDEBUG */
2909# define YYDPRINTF(Args)
2910# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2911# define YY_STACK_PRINT(Bottom, Top)
2912# define YY_REDUCE_PRINT(Rule)
2913#endif /* !YYDEBUG */
2914
2915
2916/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002917#ifndef YYINITDEPTH
Chris Lattner59363a32008-02-19 04:36:25 +00002918# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002919#endif
2920
Chris Lattner59363a32008-02-19 04:36:25 +00002921/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2922 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002923
Chris Lattner59363a32008-02-19 04:36:25 +00002924 Do not make this value too large; the results are undefined if
2925 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2926 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00002927
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002928#ifndef YYMAXDEPTH
Chris Lattner59363a32008-02-19 04:36:25 +00002929# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002930#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002931
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002932
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002933
Chris Lattner59363a32008-02-19 04:36:25 +00002934#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002935
Chris Lattner59363a32008-02-19 04:36:25 +00002936# ifndef yystrlen
2937# if defined __GLIBC__ && defined _STRING_H
2938# define yystrlen strlen
2939# else
2940/* Return the length of YYSTR. */
2941#if (defined __STDC__ || defined __C99__FUNC__ \
2942 || defined __cplusplus || defined _MSC_VER)
2943static YYSIZE_T
2944yystrlen (const char *yystr)
Scott Michel5a6f17b2008-01-30 02:55:46 +00002945#else
Chris Lattner59363a32008-02-19 04:36:25 +00002946static YYSIZE_T
2947yystrlen (yystr)
2948 const char *yystr;
2949#endif
2950{
2951 YYSIZE_T yylen;
2952 for (yylen = 0; yystr[yylen]; yylen++)
2953 continue;
2954 return yylen;
2955}
2956# endif
2957# endif
2958
2959# ifndef yystpcpy
2960# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2961# define yystpcpy stpcpy
2962# else
2963/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2964 YYDEST. */
2965#if (defined __STDC__ || defined __C99__FUNC__ \
2966 || defined __cplusplus || defined _MSC_VER)
2967static char *
2968yystpcpy (char *yydest, const char *yysrc)
2969#else
2970static char *
2971yystpcpy (yydest, yysrc)
2972 char *yydest;
2973 const char *yysrc;
2974#endif
2975{
2976 char *yyd = yydest;
2977 const char *yys = yysrc;
2978
2979 while ((*yyd++ = *yys++) != '\0')
2980 continue;
2981
2982 return yyd - 1;
2983}
2984# endif
2985# endif
2986
2987# ifndef yytnamerr
2988/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2989 quotes and backslashes, so that it's suitable for yyerror. The
2990 heuristic is that double-quoting is unnecessary unless the string
2991 contains an apostrophe, a comma, or backslash (other than
2992 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2993 null, do not copy; instead, return the length of what the result
2994 would have been. */
2995static YYSIZE_T
2996yytnamerr (char *yyres, const char *yystr)
2997{
2998 if (*yystr == '"')
2999 {
3000 YYSIZE_T yyn = 0;
3001 char const *yyp = yystr;
3002
3003 for (;;)
3004 switch (*++yyp)
3005 {
3006 case '\'':
3007 case ',':
3008 goto do_not_strip_quotes;
3009
3010 case '\\':
3011 if (*++yyp != '\\')
3012 goto do_not_strip_quotes;
3013 /* Fall through. */
3014 default:
3015 if (yyres)
3016 yyres[yyn] = *yyp;
3017 yyn++;
3018 break;
3019
3020 case '"':
3021 if (yyres)
3022 yyres[yyn] = '\0';
3023 return yyn;
3024 }
3025 do_not_strip_quotes: ;
3026 }
3027
3028 if (! yyres)
3029 return yystrlen (yystr);
3030
3031 return yystpcpy (yyres, yystr) - yyres;
3032}
3033# endif
3034
3035/* Copy into YYRESULT an error message about the unexpected token
3036 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3037 including the terminating null byte. If YYRESULT is null, do not
3038 copy anything; just return the number of bytes that would be
3039 copied. As a special case, return 0 if an ordinary "syntax error"
3040 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3041 size calculation. */
3042static YYSIZE_T
3043yysyntax_error (char *yyresult, int yystate, int yychar)
3044{
3045 int yyn = yypact[yystate];
3046
3047 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3048 return 0;
3049 else
3050 {
3051 int yytype = YYTRANSLATE (yychar);
3052 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3053 YYSIZE_T yysize = yysize0;
3054 YYSIZE_T yysize1;
3055 int yysize_overflow = 0;
3056 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3057 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3058 int yyx;
3059
3060# if 0
3061 /* This is so xgettext sees the translatable formats that are
3062 constructed on the fly. */
3063 YY_("syntax error, unexpected %s");
3064 YY_("syntax error, unexpected %s, expecting %s");
3065 YY_("syntax error, unexpected %s, expecting %s or %s");
3066 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3067 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3068# endif
3069 char *yyfmt;
3070 char const *yyf;
3071 static char const yyunexpected[] = "syntax error, unexpected %s";
3072 static char const yyexpecting[] = ", expecting %s";
3073 static char const yyor[] = " or %s";
3074 char yyformat[sizeof yyunexpected
3075 + sizeof yyexpecting - 1
3076 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3077 * (sizeof yyor - 1))];
3078 char const *yyprefix = yyexpecting;
3079
3080 /* Start YYX at -YYN if negative to avoid negative indexes in
3081 YYCHECK. */
3082 int yyxbegin = yyn < 0 ? -yyn : 0;
3083
3084 /* Stay within bounds of both yycheck and yytname. */
3085 int yychecklim = YYLAST - yyn + 1;
3086 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3087 int yycount = 1;
3088
3089 yyarg[0] = yytname[yytype];
3090 yyfmt = yystpcpy (yyformat, yyunexpected);
3091
3092 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3093 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3094 {
3095 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3096 {
3097 yycount = 1;
3098 yysize = yysize0;
3099 yyformat[sizeof yyunexpected - 1] = '\0';
3100 break;
3101 }
3102 yyarg[yycount++] = yytname[yyx];
3103 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3104 yysize_overflow |= (yysize1 < yysize);
3105 yysize = yysize1;
3106 yyfmt = yystpcpy (yyfmt, yyprefix);
3107 yyprefix = yyor;
3108 }
3109
3110 yyf = YY_(yyformat);
3111 yysize1 = yysize + yystrlen (yyf);
3112 yysize_overflow |= (yysize1 < yysize);
3113 yysize = yysize1;
3114
3115 if (yysize_overflow)
3116 return YYSIZE_MAXIMUM;
3117
3118 if (yyresult)
3119 {
3120 /* Avoid sprintf, as that infringes on the user's name space.
3121 Don't have undefined behavior even if the translation
3122 produced a string with the wrong number of "%s"s. */
3123 char *yyp = yyresult;
3124 int yyi = 0;
3125 while ((*yyp = *yyf) != '\0')
3126 {
3127 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3128 {
3129 yyp += yytnamerr (yyp, yyarg[yyi++]);
3130 yyf += 2;
3131 }
3132 else
3133 {
3134 yyp++;
3135 yyf++;
3136 }
3137 }
3138 }
3139 return yysize;
3140 }
3141}
3142#endif /* YYERROR_VERBOSE */
3143
3144
3145/*-----------------------------------------------.
3146| Release the memory associated to this symbol. |
3147`-----------------------------------------------*/
3148
3149/*ARGSUSED*/
3150#if (defined __STDC__ || defined __C99__FUNC__ \
3151 || defined __cplusplus || defined _MSC_VER)
3152static void
3153yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3154#else
3155static void
3156yydestruct (yymsg, yytype, yyvaluep)
3157 const char *yymsg;
3158 int yytype;
3159 YYSTYPE *yyvaluep;
3160#endif
3161{
3162 YYUSE (yyvaluep);
3163
3164 if (!yymsg)
3165 yymsg = "Deleting";
3166 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3167
3168 switch (yytype)
3169 {
3170
3171 default:
3172 break;
3173 }
3174}
3175
3176
3177/* Prevent warnings from -Wmissing-prototypes. */
3178
3179#ifdef YYPARSE_PARAM
3180#if defined __STDC__ || defined __cplusplus
3181int yyparse (void *YYPARSE_PARAM);
3182#else
3183int yyparse ();
3184#endif
3185#else /* ! YYPARSE_PARAM */
3186#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003187int yyparse (void);
Scott Michel6d1aba82008-01-30 03:10:00 +00003188#else
Chris Lattner59363a32008-02-19 04:36:25 +00003189int yyparse ();
Christopher Lamb0a243582007-12-11 09:02:08 +00003190#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003191#endif /* ! YYPARSE_PARAM */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003192
Scott Michel5a6f17b2008-01-30 02:55:46 +00003193
Chris Lattner59363a32008-02-19 04:36:25 +00003194
3195/* The look-ahead symbol. */
3196int yychar;
3197
3198/* The semantic value of the look-ahead symbol. */
3199YYSTYPE yylval;
3200
3201/* Number of syntax errors so far. */
3202int yynerrs;
3203
3204
3205
3206/*----------.
3207| yyparse. |
3208`----------*/
3209
3210#ifdef YYPARSE_PARAM
3211#if (defined __STDC__ || defined __C99__FUNC__ \
3212 || defined __cplusplus || defined _MSC_VER)
3213int
3214yyparse (void *YYPARSE_PARAM)
3215#else
3216int
3217yyparse (YYPARSE_PARAM)
3218 void *YYPARSE_PARAM;
3219#endif
3220#else /* ! YYPARSE_PARAM */
3221#if (defined __STDC__ || defined __C99__FUNC__ \
3222 || defined __cplusplus || defined _MSC_VER)
3223int
3224yyparse (void)
3225#else
3226int
3227yyparse ()
3228
Scott Michel6d1aba82008-01-30 03:10:00 +00003229#endif
3230#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003231{
3232
3233 int yystate;
3234 int yyn;
3235 int yyresult;
3236 /* Number of tokens to shift before error messages enabled. */
3237 int yyerrstatus;
3238 /* Look-ahead token as an internal (translated) token number. */
3239 int yytoken = 0;
3240#if YYERROR_VERBOSE
3241 /* Buffer for error messages, and its allocated size. */
3242 char yymsgbuf[128];
3243 char *yymsg = yymsgbuf;
3244 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Scott Michel6d1aba82008-01-30 03:10:00 +00003245#endif
Scott Michel5a6f17b2008-01-30 02:55:46 +00003246
Chris Lattner59363a32008-02-19 04:36:25 +00003247 /* Three stacks and their tools:
3248 `yyss': related to states,
3249 `yyvs': related to semantic values,
3250 `yyls': related to locations.
3251
3252 Refer to the stacks thru separate pointers, to allow yyoverflow
3253 to reallocate them elsewhere. */
3254
3255 /* The state stack. */
3256 yytype_int16 yyssa[YYINITDEPTH];
3257 yytype_int16 *yyss = yyssa;
3258 yytype_int16 *yyssp;
3259
3260 /* The semantic value stack. */
3261 YYSTYPE yyvsa[YYINITDEPTH];
3262 YYSTYPE *yyvs = yyvsa;
3263 YYSTYPE *yyvsp;
3264
3265
3266
3267#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3268
3269 YYSIZE_T yystacksize = YYINITDEPTH;
3270
3271 /* The variables used to return semantic value and location from the
3272 action routines. */
3273 YYSTYPE yyval;
3274
3275
3276 /* The number of symbols on the RHS of the reduced rule.
3277 Keep to zero when no symbol should be popped. */
3278 int yylen = 0;
3279
3280 YYDPRINTF ((stderr, "Starting parse\n"));
3281
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003282 yystate = 0;
3283 yyerrstatus = 0;
3284 yynerrs = 0;
3285 yychar = YYEMPTY; /* Cause a token to be read. */
3286
3287 /* Initialize stack pointers.
3288 Waste one element of value and location stack
3289 so that they stay on the same level as the state stack.
3290 The wasted elements are never initialized. */
3291
Chris Lattner59363a32008-02-19 04:36:25 +00003292 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003293 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003294
Chris Lattner59363a32008-02-19 04:36:25 +00003295 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003296
Chris Lattner59363a32008-02-19 04:36:25 +00003297/*------------------------------------------------------------.
3298| yynewstate -- Push a new state, which is found in yystate. |
3299`------------------------------------------------------------*/
3300 yynewstate:
3301 /* In all cases, when you get here, the value and location stacks
3302 have just been pushed. So pushing a state here evens the stacks. */
3303 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003304
Chris Lattner59363a32008-02-19 04:36:25 +00003305 yysetstate:
3306 *yyssp = yystate;
3307
3308 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003309 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003310 /* Get the current used size of the three stacks, in elements. */
Chris Lattner59363a32008-02-19 04:36:25 +00003311 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003312
3313#ifdef yyoverflow
Chris Lattner59363a32008-02-19 04:36:25 +00003314 {
3315 /* Give user a chance to reallocate the stack. Use copies of
3316 these so that the &'s don't force the real ones into
3317 memory. */
3318 YYSTYPE *yyvs1 = yyvs;
3319 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003320
Chris Lattner59363a32008-02-19 04:36:25 +00003321
3322 /* Each stack pointer address is followed by the size of the
3323 data in use in that stack, in bytes. This used to be a
3324 conditional around just the two extra args, but that might
3325 be undefined if yyoverflow is a macro. */
3326 yyoverflow (YY_("memory exhausted"),
3327 &yyss1, yysize * sizeof (*yyssp),
3328 &yyvs1, yysize * sizeof (*yyvsp),
3329
3330 &yystacksize);
3331
3332 yyss = yyss1;
3333 yyvs = yyvs1;
3334 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003335#else /* no yyoverflow */
Chris Lattner59363a32008-02-19 04:36:25 +00003336# ifndef YYSTACK_RELOCATE
3337 goto yyexhaustedlab;
3338# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003339 /* Extend the stack our own way. */
Chris Lattner59363a32008-02-19 04:36:25 +00003340 if (YYMAXDEPTH <= yystacksize)
3341 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003342 yystacksize *= 2;
Chris Lattner59363a32008-02-19 04:36:25 +00003343 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003344 yystacksize = YYMAXDEPTH;
Chris Lattner59363a32008-02-19 04:36:25 +00003345
3346 {
3347 yytype_int16 *yyss1 = yyss;
3348 union yyalloc *yyptr =
3349 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3350 if (! yyptr)
3351 goto yyexhaustedlab;
3352 YYSTACK_RELOCATE (yyss);
3353 YYSTACK_RELOCATE (yyvs);
3354
3355# undef YYSTACK_RELOCATE
3356 if (yyss1 != yyssa)
3357 YYSTACK_FREE (yyss1);
3358 }
3359# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003360#endif /* no yyoverflow */
3361
Chris Lattner59363a32008-02-19 04:36:25 +00003362 yyssp = yyss + yysize - 1;
3363 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003364
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003365
Chris Lattner59363a32008-02-19 04:36:25 +00003366 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3367 (unsigned long int) yystacksize));
3368
3369 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003370 YYABORT;
3371 }
3372
Chris Lattner59363a32008-02-19 04:36:25 +00003373 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003374
3375 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003376
Chris Lattner59363a32008-02-19 04:36:25 +00003377/*-----------.
3378| yybackup. |
3379`-----------*/
3380yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003381
Chris Lattner59363a32008-02-19 04:36:25 +00003382 /* Do appropriate processing given the current state. Read a
3383 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003384
Chris Lattner59363a32008-02-19 04:36:25 +00003385 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003386 yyn = yypact[yystate];
Chris Lattner59363a32008-02-19 04:36:25 +00003387 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003388 goto yydefault;
3389
Chris Lattner59363a32008-02-19 04:36:25 +00003390 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003391
Chris Lattner59363a32008-02-19 04:36:25 +00003392 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003393 if (yychar == YYEMPTY)
3394 {
Chris Lattner59363a32008-02-19 04:36:25 +00003395 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003396 yychar = YYLEX;
3397 }
3398
Chris Lattner59363a32008-02-19 04:36:25 +00003399 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003400 {
Chris Lattner59363a32008-02-19 04:36:25 +00003401 yychar = yytoken = YYEOF;
3402 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003403 }
3404 else
3405 {
Chris Lattner59363a32008-02-19 04:36:25 +00003406 yytoken = YYTRANSLATE (yychar);
3407 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003408 }
3409
Chris Lattner59363a32008-02-19 04:36:25 +00003410 /* If the proper action on seeing token YYTOKEN is to reduce or to
3411 detect an error, take that action. */
3412 yyn += yytoken;
3413 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003414 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003415 yyn = yytable[yyn];
Chris Lattner59363a32008-02-19 04:36:25 +00003416 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003417 {
Chris Lattner59363a32008-02-19 04:36:25 +00003418 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003419 goto yyerrlab;
3420 yyn = -yyn;
3421 goto yyreduce;
3422 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003423
3424 if (yyn == YYFINAL)
3425 YYACCEPT;
3426
Chris Lattner59363a32008-02-19 04:36:25 +00003427 /* Count tokens shifted since error; after three, turn off error
3428 status. */
3429 if (yyerrstatus)
3430 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003431
Chris Lattner59363a32008-02-19 04:36:25 +00003432 /* Shift the look-ahead token. */
3433 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003434
Chris Lattner59363a32008-02-19 04:36:25 +00003435 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003436 if (yychar != YYEOF)
3437 yychar = YYEMPTY;
3438
Scott Michel6d1aba82008-01-30 03:10:00 +00003439 yystate = yyn;
Chris Lattner59363a32008-02-19 04:36:25 +00003440 *++yyvsp = yylval;
3441
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003442 goto yynewstate;
3443
Scott Michel6d1aba82008-01-30 03:10:00 +00003444
Chris Lattner59363a32008-02-19 04:36:25 +00003445/*-----------------------------------------------------------.
3446| yydefault -- do the default action for the current state. |
3447`-----------------------------------------------------------*/
3448yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003449 yyn = yydefact[yystate];
3450 if (yyn == 0)
3451 goto yyerrlab;
Chris Lattner59363a32008-02-19 04:36:25 +00003452 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003453
Chris Lattner59363a32008-02-19 04:36:25 +00003454
3455/*-----------------------------.
3456| yyreduce -- Do a reduction. |
3457`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003458yyreduce:
Chris Lattner59363a32008-02-19 04:36:25 +00003459 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003460 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003461
Chris Lattner59363a32008-02-19 04:36:25 +00003462 /* If YYLEN is nonzero, implement the default value of the action:
3463 `$$ = $1'.
3464
3465 Otherwise, the following line sets YYVAL to garbage.
3466 This behavior is undocumented and Bison
3467 users should not rely upon it. Assigning to YYVAL
3468 unconditionally makes the parser a bit smaller, and it avoids a
3469 GCC warning that YYVAL may be used uninitialized. */
3470 yyval = yyvsp[1-yylen];
3471
3472
3473 YY_REDUCE_PRINT (yyn);
3474 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003475 {
Chris Lattner59363a32008-02-19 04:36:25 +00003476 case 29:
Devang Patel087fe2b2008-02-23 00:38:56 +00003477#line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003478 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3479 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003480
Chris Lattner59363a32008-02-19 04:36:25 +00003481 case 30:
Devang Patel087fe2b2008-02-23 00:38:56 +00003482#line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003483 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3484 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003485
Chris Lattner59363a32008-02-19 04:36:25 +00003486 case 31:
Devang Patel087fe2b2008-02-23 00:38:56 +00003487#line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003488 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3489 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003490
Chris Lattner59363a32008-02-19 04:36:25 +00003491 case 32:
Devang Patel087fe2b2008-02-23 00:38:56 +00003492#line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003493 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3494 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003495
Chris Lattner59363a32008-02-19 04:36:25 +00003496 case 33:
Devang Patel087fe2b2008-02-23 00:38:56 +00003497#line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003498 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3499 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003500
Chris Lattner59363a32008-02-19 04:36:25 +00003501 case 34:
Devang Patel087fe2b2008-02-23 00:38:56 +00003502#line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003503 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3504 break;
3505
3506 case 35:
Devang Patel087fe2b2008-02-23 00:38:56 +00003507#line 1124 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003508 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3509 break;
3510
3511 case 36:
Devang Patel087fe2b2008-02-23 00:38:56 +00003512#line 1124 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003513 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3514 break;
3515
3516 case 37:
Devang Patel087fe2b2008-02-23 00:38:56 +00003517#line 1125 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003518 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3519 break;
3520
3521 case 38:
Devang Patel087fe2b2008-02-23 00:38:56 +00003522#line 1125 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003523 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3524 break;
3525
3526 case 39:
Devang Patel087fe2b2008-02-23 00:38:56 +00003527#line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003528 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3529 break;
3530
3531 case 40:
Devang Patel087fe2b2008-02-23 00:38:56 +00003532#line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003533 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3534 break;
3535
3536 case 41:
Devang Patel087fe2b2008-02-23 00:38:56 +00003537#line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003538 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3539 break;
3540
3541 case 42:
Devang Patel087fe2b2008-02-23 00:38:56 +00003542#line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003543 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3544 break;
3545
3546 case 43:
Devang Patel087fe2b2008-02-23 00:38:56 +00003547#line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003548 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3549 break;
3550
3551 case 44:
Devang Patel087fe2b2008-02-23 00:38:56 +00003552#line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003553 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3554 break;
3555
3556 case 45:
Devang Patel087fe2b2008-02-23 00:38:56 +00003557#line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003558 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3559 break;
3560
3561 case 46:
Devang Patel087fe2b2008-02-23 00:38:56 +00003562#line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003563 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3564 break;
3565
3566 case 47:
Devang Patel087fe2b2008-02-23 00:38:56 +00003567#line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003568 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3569 break;
3570
3571 case 48:
Devang Patel087fe2b2008-02-23 00:38:56 +00003572#line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003573 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3574 break;
3575
3576 case 49:
Devang Patel087fe2b2008-02-23 00:38:56 +00003577#line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003578 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3579 break;
3580
3581 case 50:
Devang Patel087fe2b2008-02-23 00:38:56 +00003582#line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003583 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3584 break;
3585
3586 case 51:
Devang Patel087fe2b2008-02-23 00:38:56 +00003587#line 1135 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003588 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3589 break;
3590
3591 case 52:
Devang Patel087fe2b2008-02-23 00:38:56 +00003592#line 1135 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003593 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3594 break;
3595
3596 case 53:
Devang Patel087fe2b2008-02-23 00:38:56 +00003597#line 1136 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003598 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3599 break;
3600
3601 case 54:
Devang Patel087fe2b2008-02-23 00:38:56 +00003602#line 1137 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003603 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3604 break;
3605
3606 case 65:
Devang Patel087fe2b2008-02-23 00:38:56 +00003607#line 1146 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003608 { (yyval.StrVal) = 0; ;}
3609 break;
3610
3611 case 66:
Devang Patel087fe2b2008-02-23 00:38:56 +00003612#line 1148 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003613 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3614 break;
3615
3616 case 67:
Devang Patel087fe2b2008-02-23 00:38:56 +00003617#line 1149 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003618 { (yyval.UIntVal)=0; ;}
3619 break;
3620
3621 case 68:
Devang Patel087fe2b2008-02-23 00:38:56 +00003622#line 1153 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003623 {
3624 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003625 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003626 ;}
3627 break;
3628
3629 case 69:
Devang Patel087fe2b2008-02-23 00:38:56 +00003630#line 1157 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003631 {
3632 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003633 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003634 ;}
3635 break;
3636
3637 case 73:
Devang Patel087fe2b2008-02-23 00:38:56 +00003638#line 1165 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003639 {
3640 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003641 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003642 ;}
3643 break;
3644
3645 case 74:
Devang Patel087fe2b2008-02-23 00:38:56 +00003646#line 1170 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003647 {
3648 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003649 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003650 ;}
3651 break;
3652
3653 case 75:
Devang Patel087fe2b2008-02-23 00:38:56 +00003654#line 1176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003655 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3656 break;
3657
3658 case 76:
Devang Patel087fe2b2008-02-23 00:38:56 +00003659#line 1177 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003660 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3661 break;
3662
3663 case 77:
Devang Patel087fe2b2008-02-23 00:38:56 +00003664#line 1178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003665 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3666 break;
3667
3668 case 78:
Devang Patel087fe2b2008-02-23 00:38:56 +00003669#line 1179 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003670 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3671 break;
3672
3673 case 79:
Devang Patel087fe2b2008-02-23 00:38:56 +00003674#line 1180 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003675 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3676 break;
3677
3678 case 80:
Devang Patel087fe2b2008-02-23 00:38:56 +00003679#line 1184 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003680 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3681 break;
3682
3683 case 81:
Devang Patel087fe2b2008-02-23 00:38:56 +00003684#line 1185 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003685 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3686 break;
3687
3688 case 82:
Devang Patel087fe2b2008-02-23 00:38:56 +00003689#line 1186 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003690 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3691 break;
3692
3693 case 83:
Devang Patel087fe2b2008-02-23 00:38:56 +00003694#line 1190 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003695 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3696 break;
3697
3698 case 84:
Devang Patel087fe2b2008-02-23 00:38:56 +00003699#line 1191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003700 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3701 break;
3702
3703 case 85:
Devang Patel087fe2b2008-02-23 00:38:56 +00003704#line 1192 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003705 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3706 break;
3707
3708 case 86:
Devang Patel087fe2b2008-02-23 00:38:56 +00003709#line 1193 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003710 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3711 break;
3712
3713 case 87:
Devang Patel087fe2b2008-02-23 00:38:56 +00003714#line 1197 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003715 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3716 break;
3717
3718 case 88:
Devang Patel087fe2b2008-02-23 00:38:56 +00003719#line 1198 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003720 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3721 break;
3722
3723 case 89:
Devang Patel087fe2b2008-02-23 00:38:56 +00003724#line 1199 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003725 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3726 break;
3727
3728 case 90:
Devang Patel087fe2b2008-02-23 00:38:56 +00003729#line 1203 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003730 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3731 break;
3732
3733 case 91:
Devang Patel087fe2b2008-02-23 00:38:56 +00003734#line 1204 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003735 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3736 break;
3737
3738 case 92:
Devang Patel087fe2b2008-02-23 00:38:56 +00003739#line 1205 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003740 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3741 break;
3742
3743 case 93:
Devang Patel087fe2b2008-02-23 00:38:56 +00003744#line 1206 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003745 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3746 break;
3747
3748 case 94:
Devang Patel087fe2b2008-02-23 00:38:56 +00003749#line 1207 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003750 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3751 break;
3752
3753 case 95:
Devang Patel087fe2b2008-02-23 00:38:56 +00003754#line 1211 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003755 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3756 break;
3757
3758 case 96:
Devang Patel087fe2b2008-02-23 00:38:56 +00003759#line 1212 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003760 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3761 break;
3762
3763 case 97:
Devang Patel087fe2b2008-02-23 00:38:56 +00003764#line 1213 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003765 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3766 break;
3767
3768 case 98:
Devang Patel087fe2b2008-02-23 00:38:56 +00003769#line 1216 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003770 { (yyval.UIntVal) = CallingConv::C; ;}
3771 break;
3772
3773 case 99:
Devang Patel087fe2b2008-02-23 00:38:56 +00003774#line 1217 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003775 { (yyval.UIntVal) = CallingConv::C; ;}
3776 break;
3777
3778 case 100:
Devang Patel087fe2b2008-02-23 00:38:56 +00003779#line 1218 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003780 { (yyval.UIntVal) = CallingConv::Fast; ;}
3781 break;
3782
3783 case 101:
Devang Patel087fe2b2008-02-23 00:38:56 +00003784#line 1219 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003785 { (yyval.UIntVal) = CallingConv::Cold; ;}
3786 break;
3787
3788 case 102:
Devang Patel087fe2b2008-02-23 00:38:56 +00003789#line 1220 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003790 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3791 break;
3792
3793 case 103:
Devang Patel087fe2b2008-02-23 00:38:56 +00003794#line 1221 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003795 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3796 break;
3797
3798 case 104:
Devang Patel087fe2b2008-02-23 00:38:56 +00003799#line 1222 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003800 {
3801 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003802 GEN_ERROR("Calling conv too large");
Chris Lattner59363a32008-02-19 04:36:25 +00003803 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003804 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003805 ;}
3806 break;
3807
3808 case 105:
Devang Patel087fe2b2008-02-23 00:38:56 +00003809#line 1229 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003810 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3811 break;
3812
3813 case 106:
Devang Patel087fe2b2008-02-23 00:38:56 +00003814#line 1230 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003815 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3816 break;
3817
3818 case 107:
Devang Patel087fe2b2008-02-23 00:38:56 +00003819#line 1231 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003820 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3821 break;
3822
3823 case 108:
Devang Patel087fe2b2008-02-23 00:38:56 +00003824#line 1232 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003825 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3826 break;
3827
3828 case 109:
Devang Patel087fe2b2008-02-23 00:38:56 +00003829#line 1233 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003830 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3831 break;
3832
3833 case 110:
Devang Patel087fe2b2008-02-23 00:38:56 +00003834#line 1234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003835 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3836 break;
3837
3838 case 111:
Devang Patel087fe2b2008-02-23 00:38:56 +00003839#line 1235 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003840 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3841 break;
3842
3843 case 112:
Devang Patel087fe2b2008-02-23 00:38:56 +00003844#line 1236 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003845 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3846 break;
3847
3848 case 113:
Devang Patel087fe2b2008-02-23 00:38:56 +00003849#line 1237 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003850 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3851 break;
3852
3853 case 114:
Devang Patel087fe2b2008-02-23 00:38:56 +00003854#line 1238 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf92f3162008-02-22 17:50:51 +00003855 { (yyval.ParamAttrs) =
3856 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Chris Lattner59363a32008-02-19 04:36:25 +00003857 break;
3858
3859 case 115:
Devang Patel087fe2b2008-02-23 00:38:56 +00003860#line 1242 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003861 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3862 break;
3863
Dale Johannesena79ecf32008-02-20 21:15:43 +00003864 case 116:
Devang Patel087fe2b2008-02-23 00:38:56 +00003865#line 1243 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003866 {
3867 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3868 ;}
3869 break;
3870
Dale Johannesena79ecf32008-02-20 21:15:43 +00003871 case 117:
Devang Patel087fe2b2008-02-23 00:38:56 +00003872#line 1248 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003873 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3874 break;
3875
3876 case 118:
Devang Patel087fe2b2008-02-23 00:38:56 +00003877#line 1249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003878 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3879 break;
3880
3881 case 119:
Devang Patel087fe2b2008-02-23 00:38:56 +00003882#line 1250 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003883 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3884 break;
3885
3886 case 120:
Devang Patel087fe2b2008-02-23 00:38:56 +00003887#line 1251 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003888 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3889 break;
3890
3891 case 121:
Devang Patel087fe2b2008-02-23 00:38:56 +00003892#line 1252 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003893 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3894 break;
3895
3896 case 122:
Devang Patel087fe2b2008-02-23 00:38:56 +00003897#line 1253 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003898 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3899 break;
3900
3901 case 123:
Devang Patel087fe2b2008-02-23 00:38:56 +00003902#line 1256 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003903 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3904 break;
3905
Chris Lattner59363a32008-02-19 04:36:25 +00003906 case 124:
Devang Patel087fe2b2008-02-23 00:38:56 +00003907#line 1257 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003908 {
3909 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3910 ;}
Chris Lattner59363a32008-02-19 04:36:25 +00003911 break;
3912
3913 case 125:
Devang Patel087fe2b2008-02-23 00:38:56 +00003914#line 1262 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003915 { (yyval.StrVal) = 0; ;}
3916 break;
3917
3918 case 126:
Devang Patel087fe2b2008-02-23 00:38:56 +00003919#line 1263 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003920 {
3921 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3922 ;}
3923 break;
3924
Dale Johannesena79ecf32008-02-20 21:15:43 +00003925 case 127:
Devang Patel087fe2b2008-02-23 00:38:56 +00003926#line 1270 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003927 { (yyval.UIntVal) = 0; ;}
3928 break;
3929
Dale Johannesena79ecf32008-02-20 21:15:43 +00003930 case 128:
Devang Patel087fe2b2008-02-23 00:38:56 +00003931#line 1271 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003932 {
3933 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3934 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003935 GEN_ERROR("Alignment must be a power of two");
3936 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003937;}
3938 break;
3939
Dale Johannesena79ecf32008-02-20 21:15:43 +00003940 case 129:
Devang Patel087fe2b2008-02-23 00:38:56 +00003941#line 1277 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003942 { (yyval.UIntVal) = 0; ;}
3943 break;
3944
Dale Johannesena79ecf32008-02-20 21:15:43 +00003945 case 130:
Devang Patel087fe2b2008-02-23 00:38:56 +00003946#line 1278 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003947 {
3948 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3949 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00003950 GEN_ERROR("Alignment must be a power of two");
3951 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003952;}
3953 break;
3954
Dale Johannesena79ecf32008-02-20 21:15:43 +00003955 case 131:
Devang Patel087fe2b2008-02-23 00:38:56 +00003956#line 1287 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003957 {
3958 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3959 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003960 GEN_ERROR("Invalid character in section name");
Chris Lattner59363a32008-02-19 04:36:25 +00003961 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003962 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003963;}
3964 break;
3965
Dale Johannesena79ecf32008-02-20 21:15:43 +00003966 case 132:
Devang Patel087fe2b2008-02-23 00:38:56 +00003967#line 1295 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003968 { (yyval.StrVal) = 0; ;}
3969 break;
3970
Dale Johannesena79ecf32008-02-20 21:15:43 +00003971 case 133:
Devang Patel087fe2b2008-02-23 00:38:56 +00003972#line 1296 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003973 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3974 break;
3975
Chris Lattner59363a32008-02-19 04:36:25 +00003976 case 134:
Devang Patel087fe2b2008-02-23 00:38:56 +00003977#line 1301 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003978 {;}
3979 break;
3980
3981 case 135:
Devang Patel087fe2b2008-02-23 00:38:56 +00003982#line 1302 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003983 {;}
3984 break;
3985
3986 case 136:
Devang Patel087fe2b2008-02-23 00:38:56 +00003987#line 1303 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003988 {
3989 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3990 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003991 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003992 ;}
3993 break;
3994
Dale Johannesena79ecf32008-02-20 21:15:43 +00003995 case 137:
Devang Patel087fe2b2008-02-23 00:38:56 +00003996#line 1308 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003997 {
3998 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003999 GEN_ERROR("Alignment must be a power of two");
Chris Lattner59363a32008-02-19 04:36:25 +00004000 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004001 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004002 ;}
4003 break;
4004
Dale Johannesena79ecf32008-02-20 21:15:43 +00004005 case 145:
Devang Patel087fe2b2008-02-23 00:38:56 +00004006#line 1324 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004007 {
4008 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004009 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004010 ;}
4011 break;
4012
Dale Johannesena79ecf32008-02-20 21:15:43 +00004013 case 146:
Devang Patel087fe2b2008-02-23 00:38:56 +00004014#line 1328 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004015 {
4016 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004017 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004018 ;}
4019 break;
4020
Dale Johannesena79ecf32008-02-20 21:15:43 +00004021 case 147:
Devang Patel087fe2b2008-02-23 00:38:56 +00004022#line 1332 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004023 { // Pointer type?
4024 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004025 GEN_ERROR("Cannot form a pointer to a basic block");
Chris Lattner59363a32008-02-19 04:36:25 +00004026 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4027 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004028 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004029 ;}
4030 break;
4031
Dale Johannesena79ecf32008-02-20 21:15:43 +00004032 case 148:
Devang Patel087fe2b2008-02-23 00:38:56 +00004033#line 1339 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004034 { // Named types are also simple types...
4035 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004036 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004037 (yyval.TypeVal) = new PATypeHolder(tmp);
4038 ;}
4039 break;
4040
Dale Johannesena79ecf32008-02-20 21:15:43 +00004041 case 149:
Devang Patel087fe2b2008-02-23 00:38:56 +00004042#line 1344 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004043 { // Type UpReference
4044 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004045 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Chris Lattner59363a32008-02-19 04:36:25 +00004046 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4047 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004048 UR_OUT("New Upreference!\n");
4049 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004050 ;}
4051 break;
4052
Dale Johannesena79ecf32008-02-20 21:15:43 +00004053 case 150:
Devang Patel087fe2b2008-02-23 00:38:56 +00004054#line 1352 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004055 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004056 // Allow but ignore attributes on function types; this permits auto-upgrade.
4057 // FIXME: remove in LLVM 3.0.
Chris Lattner59363a32008-02-19 04:36:25 +00004058 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004059 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4060 isa<OpaqueType>(RetTy)))
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004061 GEN_ERROR("LLVM Functions cannot return aggregates");
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004062
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004063 std::vector<const Type*> Params;
Chris Lattner59363a32008-02-19 04:36:25 +00004064 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004065 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004066 const Type *Ty = I->Ty->get();
4067 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004068 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004069
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004070 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4071 if (isVarArg) Params.pop_back();
4072
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004073 for (unsigned i = 0; i != Params.size(); ++i)
4074 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4075 GEN_ERROR("Function arguments must be value types!");
4076
4077 CHECK_FOR_ERROR
4078
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004079 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Chris Lattner59363a32008-02-19 04:36:25 +00004080 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4081 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4082 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004083 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004084 ;}
4085 break;
4086
Dale Johannesena79ecf32008-02-20 21:15:43 +00004087 case 151:
Devang Patel087fe2b2008-02-23 00:38:56 +00004088#line 1382 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004089 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004090 // Allow but ignore attributes on function types; this permits auto-upgrade.
4091 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004092 std::vector<const Type*> Params;
Chris Lattner59363a32008-02-19 04:36:25 +00004093 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004094 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004095 const Type* Ty = I->Ty->get();
4096 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004097 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004098
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004099 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4100 if (isVarArg) Params.pop_back();
4101
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004102 for (unsigned i = 0; i != Params.size(); ++i)
4103 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4104 GEN_ERROR("Function arguments must be value types!");
4105
4106 CHECK_FOR_ERROR
4107
Chris Lattner59363a32008-02-19 04:36:25 +00004108 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4109 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4110 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004111 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004112 ;}
4113 break;
4114
Dale Johannesena79ecf32008-02-20 21:15:43 +00004115 case 152:
Devang Patel087fe2b2008-02-23 00:38:56 +00004116#line 1407 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004117 { // Sized array type?
4118 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4119 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004120 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004121 ;}
4122 break;
4123
Dale Johannesena79ecf32008-02-20 21:15:43 +00004124 case 153:
Devang Patel087fe2b2008-02-23 00:38:56 +00004125#line 1412 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004126 { // Vector type?
4127 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4128 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004129 GEN_ERROR("Unsigned result not equal to signed result");
4130 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4131 GEN_ERROR("Element type of a VectorType must be primitive");
Chris Lattner59363a32008-02-19 04:36:25 +00004132 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4133 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004134 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004135 ;}
4136 break;
4137
Dale Johannesena79ecf32008-02-20 21:15:43 +00004138 case 154:
Devang Patel087fe2b2008-02-23 00:38:56 +00004139#line 1422 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004140 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004141 std::vector<const Type*> Elements;
Chris Lattner59363a32008-02-19 04:36:25 +00004142 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4143 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004144 Elements.push_back(*I);
4145
Chris Lattner59363a32008-02-19 04:36:25 +00004146 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4147 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004148 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004149 ;}
4150 break;
4151
Dale Johannesena79ecf32008-02-20 21:15:43 +00004152 case 155:
Devang Patel087fe2b2008-02-23 00:38:56 +00004153#line 1432 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004154 { // Empty structure type?
4155 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004156 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004157 ;}
4158 break;
4159
Dale Johannesena79ecf32008-02-20 21:15:43 +00004160 case 156:
Devang Patel087fe2b2008-02-23 00:38:56 +00004161#line 1436 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004162 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004163 std::vector<const Type*> Elements;
Chris Lattner59363a32008-02-19 04:36:25 +00004164 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4165 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004166 Elements.push_back(*I);
4167
Chris Lattner59363a32008-02-19 04:36:25 +00004168 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4169 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004170 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004171 ;}
4172 break;
4173
Dale Johannesena79ecf32008-02-20 21:15:43 +00004174 case 157:
Devang Patel087fe2b2008-02-23 00:38:56 +00004175#line 1446 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004176 { // Empty structure type?
4177 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004178 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004179 ;}
4180 break;
4181
Dale Johannesena79ecf32008-02-20 21:15:43 +00004182 case 158:
Devang Patel087fe2b2008-02-23 00:38:56 +00004183#line 1453 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004184 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004185 // Allow but ignore attributes on function types; this permits auto-upgrade.
4186 // FIXME: remove in LLVM 3.0.
Chris Lattner59363a32008-02-19 04:36:25 +00004187 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4188 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4189 ;}
4190 break;
4191
Dale Johannesena79ecf32008-02-20 21:15:43 +00004192 case 159:
Devang Patel087fe2b2008-02-23 00:38:56 +00004193#line 1462 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004194 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004195 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004196 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
Devang Patel3d5a1e862008-02-23 01:17:37 +00004197 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004198 GEN_ERROR("LLVM functions cannot return aggregate types");
Chris Lattner59363a32008-02-19 04:36:25 +00004199 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4200 ;}
4201 break;
4202
Dale Johannesena79ecf32008-02-20 21:15:43 +00004203 case 160:
Devang Patel087fe2b2008-02-23 00:38:56 +00004204#line 1469 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004205 {
4206 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4207 ;}
4208 break;
4209
Dale Johannesena79ecf32008-02-20 21:15:43 +00004210 case 161:
Devang Patel087fe2b2008-02-23 00:38:56 +00004211#line 1474 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004212 {
4213 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4214 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004215 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004216 ;}
4217 break;
4218
Dale Johannesena79ecf32008-02-20 21:15:43 +00004219 case 162:
Devang Patel087fe2b2008-02-23 00:38:56 +00004220#line 1479 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004221 {
4222 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004223 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004224 ;}
4225 break;
4226
Dale Johannesena79ecf32008-02-20 21:15:43 +00004227 case 164:
Devang Patel087fe2b2008-02-23 00:38:56 +00004228#line 1487 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004229 {
4230 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004231 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4232 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner59363a32008-02-19 04:36:25 +00004233 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004234 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004235 ;}
4236 break;
4237
Dale Johannesena79ecf32008-02-20 21:15:43 +00004238 case 165:
Devang Patel087fe2b2008-02-23 00:38:56 +00004239#line 1494 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004240 {
4241 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004242 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4243 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner59363a32008-02-19 04:36:25 +00004244 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004245 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004246 ;}
4247 break;
4248
Dale Johannesena79ecf32008-02-20 21:15:43 +00004249 case 166:
Devang Patel087fe2b2008-02-23 00:38:56 +00004250#line 1501 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004251 {
4252 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004253 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004254 ;}
4255 break;
4256
Dale Johannesena79ecf32008-02-20 21:15:43 +00004257 case 167:
Devang Patel087fe2b2008-02-23 00:38:56 +00004258#line 1509 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004259 {
4260 (yyval.TypeList) = new std::list<PATypeHolder>();
4261 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4262 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004263 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004264 ;}
4265 break;
4266
Dale Johannesena79ecf32008-02-20 21:15:43 +00004267 case 168:
Devang Patel087fe2b2008-02-23 00:38:56 +00004268#line 1515 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004269 {
4270 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4271 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004272 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004273 ;}
4274 break;
4275
Dale Johannesena79ecf32008-02-20 21:15:43 +00004276 case 169:
Devang Patel087fe2b2008-02-23 00:38:56 +00004277#line 1527 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004278 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004279 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004280 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4281 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004282 if (ATy == 0)
4283 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004284 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004285 const Type *ETy = ATy->getElementType();
4286 int NumElements = ATy->getNumElements();
4287
4288 // Verify that we have the correct size...
Chris Lattner59363a32008-02-19 04:36:25 +00004289 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004290 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Chris Lattner59363a32008-02-19 04:36:25 +00004291 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004292 itostr(NumElements) + "");
4293
4294 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00004295 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4296 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004297 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4298 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner59363a32008-02-19 04:36:25 +00004299 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004300 }
4301
Chris Lattner59363a32008-02-19 04:36:25 +00004302 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4303 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004304 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004305 ;}
4306 break;
4307
Dale Johannesena79ecf32008-02-20 21:15:43 +00004308 case 170:
Devang Patel087fe2b2008-02-23 00:38:56 +00004309#line 1555 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004310 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004311 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004312 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4313 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004314 if (ATy == 0)
4315 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004316 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004317
4318 int NumElements = ATy->getNumElements();
4319 if (NumElements != -1 && NumElements != 0)
4320 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4321 " arguments, but has size of " + itostr(NumElements) +"");
Chris Lattner59363a32008-02-19 04:36:25 +00004322 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4323 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004324 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004325 ;}
4326 break;
4327
Dale Johannesena79ecf32008-02-20 21:15:43 +00004328 case 171:
Devang Patel087fe2b2008-02-23 00:38:56 +00004329#line 1571 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004330 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004331 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004332 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4333 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004334 if (ATy == 0)
4335 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004336 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004337
4338 int NumElements = ATy->getNumElements();
4339 const Type *ETy = ATy->getElementType();
Chris Lattner59363a32008-02-19 04:36:25 +00004340 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004341 GEN_ERROR("Can't build string constant of size " +
Chris Lattner59363a32008-02-19 04:36:25 +00004342 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004343 " when array has size " + itostr(NumElements) + "");
4344 std::vector<Constant*> Vals;
4345 if (ETy == Type::Int8Ty) {
Chris Lattner59363a32008-02-19 04:36:25 +00004346 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4347 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004348 } else {
Chris Lattner59363a32008-02-19 04:36:25 +00004349 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004350 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4351 }
Chris Lattner59363a32008-02-19 04:36:25 +00004352 delete (yyvsp[(3) - (3)].StrVal);
4353 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4354 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004355 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004356 ;}
4357 break;
4358
Dale Johannesena79ecf32008-02-20 21:15:43 +00004359 case 172:
Devang Patel087fe2b2008-02-23 00:38:56 +00004360#line 1598 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004361 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004362 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004363 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4364 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004365 if (PTy == 0)
4366 GEN_ERROR("Cannot make packed constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004367 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004368 const Type *ETy = PTy->getElementType();
4369 int NumElements = PTy->getNumElements();
4370
4371 // Verify that we have the correct size...
Chris Lattner59363a32008-02-19 04:36:25 +00004372 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004373 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Chris Lattner59363a32008-02-19 04:36:25 +00004374 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004375 itostr(NumElements) + "");
4376
4377 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00004378 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4379 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004380 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4381 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner59363a32008-02-19 04:36:25 +00004382 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004383 }
4384
Chris Lattner59363a32008-02-19 04:36:25 +00004385 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4386 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004387 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004388 ;}
4389 break;
4390
Dale Johannesena79ecf32008-02-20 21:15:43 +00004391 case 173:
Devang Patel087fe2b2008-02-23 00:38:56 +00004392#line 1626 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004393 {
4394 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004395 if (STy == 0)
4396 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004397 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004398
Chris Lattner59363a32008-02-19 04:36:25 +00004399 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004400 GEN_ERROR("Illegal number of initializers for structure type");
4401
4402 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner59363a32008-02-19 04:36:25 +00004403 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4404 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004405 GEN_ERROR("Expected type '" +
4406 STy->getElementType(i)->getDescription() +
4407 "' for element #" + utostr(i) +
4408 " of structure initializer");
4409
4410 // Check to ensure that Type is not packed
4411 if (STy->isPacked())
4412 GEN_ERROR("Unpacked Initializer to vector type '" +
4413 STy->getDescription() + "'");
4414
Chris Lattner59363a32008-02-19 04:36:25 +00004415 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4416 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004417 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004418 ;}
4419 break;
4420
Dale Johannesena79ecf32008-02-20 21:15:43 +00004421 case 174:
Devang Patel087fe2b2008-02-23 00:38:56 +00004422#line 1652 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004423 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004424 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004425 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4426 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004427 if (STy == 0)
4428 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004429 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004430
4431 if (STy->getNumContainedTypes() != 0)
4432 GEN_ERROR("Illegal number of initializers for structure type");
4433
4434 // Check to ensure that Type is not packed
4435 if (STy->isPacked())
4436 GEN_ERROR("Unpacked Initializer to vector type '" +
4437 STy->getDescription() + "'");
4438
Chris Lattner59363a32008-02-19 04:36:25 +00004439 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4440 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004441 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004442 ;}
4443 break;
4444
Dale Johannesena79ecf32008-02-20 21:15:43 +00004445 case 175:
Devang Patel087fe2b2008-02-23 00:38:56 +00004446#line 1672 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004447 {
4448 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004449 if (STy == 0)
4450 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004451 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004452
Chris Lattner59363a32008-02-19 04:36:25 +00004453 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004454 GEN_ERROR("Illegal number of initializers for structure type");
4455
4456 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner59363a32008-02-19 04:36:25 +00004457 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4458 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004459 GEN_ERROR("Expected type '" +
4460 STy->getElementType(i)->getDescription() +
4461 "' for element #" + utostr(i) +
4462 " of structure initializer");
4463
4464 // Check to ensure that Type is packed
4465 if (!STy->isPacked())
4466 GEN_ERROR("Vector initializer to non-vector type '" +
4467 STy->getDescription() + "'");
4468
Chris Lattner59363a32008-02-19 04:36:25 +00004469 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4470 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004471 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004472 ;}
4473 break;
4474
Dale Johannesena79ecf32008-02-20 21:15:43 +00004475 case 176:
Devang Patel087fe2b2008-02-23 00:38:56 +00004476#line 1698 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004477 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004478 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004479 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4480 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004481 if (STy == 0)
4482 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004483 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004484
4485 if (STy->getNumContainedTypes() != 0)
4486 GEN_ERROR("Illegal number of initializers for structure type");
4487
4488 // Check to ensure that Type is packed
4489 if (!STy->isPacked())
4490 GEN_ERROR("Vector initializer to non-vector type '" +
4491 STy->getDescription() + "'");
4492
Chris Lattner59363a32008-02-19 04:36:25 +00004493 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4494 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004495 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004496 ;}
4497 break;
4498
Dale Johannesena79ecf32008-02-20 21:15:43 +00004499 case 177:
Devang Patel087fe2b2008-02-23 00:38:56 +00004500#line 1718 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004501 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004502 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004503 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4504 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004505 if (PTy == 0)
4506 GEN_ERROR("Cannot make null pointer constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004507 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004508
Chris Lattner59363a32008-02-19 04:36:25 +00004509 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4510 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004511 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004512 ;}
4513 break;
4514
Dale Johannesena79ecf32008-02-20 21:15:43 +00004515 case 178:
Devang Patel087fe2b2008-02-23 00:38:56 +00004516#line 1730 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004517 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004518 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004519 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4520 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4521 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004522 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004523 ;}
4524 break;
4525
Dale Johannesena79ecf32008-02-20 21:15:43 +00004526 case 179:
Devang Patel087fe2b2008-02-23 00:38:56 +00004527#line 1737 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004528 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004529 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4531 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004532 if (Ty == 0)
Devang Patel3b8849c2008-02-19 22:27:01 +00004533 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004534
4535 // ConstExprs can exist in the body of a function, thus creating
4536 // GlobalValues whenever they refer to a variable. Because we are in
4537 // the context of a function, getExistingVal will search the functions
4538 // symbol table instead of the module symbol table for the global symbol,
4539 // which throws things all off. To get around this, we just tell
4540 // getExistingVal that we are at global scope here.
4541 //
4542 Function *SavedCurFn = CurFun.CurrentFunction;
4543 CurFun.CurrentFunction = 0;
4544
Chris Lattner59363a32008-02-19 04:36:25 +00004545 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004546 CHECK_FOR_ERROR
4547
4548 CurFun.CurrentFunction = SavedCurFn;
4549
4550 // If this is an initializer for a constant pointer, which is referencing a
4551 // (currently) undefined variable, create a stub now that shall be replaced
4552 // in the future with the right type of variable.
4553 //
4554 if (V == 0) {
4555 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4556 const PointerType *PT = cast<PointerType>(Ty);
4557
4558 // First check to see if the forward references value is already created!
4559 PerModuleInfo::GlobalRefsType::iterator I =
Chris Lattner59363a32008-02-19 04:36:25 +00004560 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004561
4562 if (I != CurModule.GlobalRefs.end()) {
4563 V = I->second; // Placeholder already exists, use it...
Chris Lattner59363a32008-02-19 04:36:25 +00004564 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004565 } else {
4566 std::string Name;
Chris Lattner59363a32008-02-19 04:36:25 +00004567 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4568 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4569 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004570 GEN_ERROR("Invalid reference to global");
4571
4572 // Create the forward referenced global.
4573 GlobalValue *GV;
4574 if (const FunctionType *FTy =
4575 dyn_cast<FunctionType>(PT->getElementType())) {
4576 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4577 CurModule.CurrentModule);
4578 } else {
4579 GV = new GlobalVariable(PT->getElementType(), false,
4580 GlobalValue::ExternalWeakLinkage, 0,
4581 Name, CurModule.CurrentModule);
4582 }
4583
4584 // Keep track of the fact that we have a forward ref to recycle it
Chris Lattner59363a32008-02-19 04:36:25 +00004585 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004586 V = GV;
4587 }
4588 }
4589
Chris Lattner59363a32008-02-19 04:36:25 +00004590 (yyval.ConstVal) = cast<GlobalValue>(V);
4591 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004592 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004593 ;}
4594 break;
4595
Dale Johannesena79ecf32008-02-20 21:15:43 +00004596 case 180:
Devang Patel087fe2b2008-02-23 00:38:56 +00004597#line 1803 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004598 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004599 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004600 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4601 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004602 GEN_ERROR("Mismatched types for constant expression: " +
Chris Lattner59363a32008-02-19 04:36:25 +00004603 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4604 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4605 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004606 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004607 ;}
4608 break;
4609
Dale Johannesena79ecf32008-02-20 21:15:43 +00004610 case 181:
Devang Patel087fe2b2008-02-23 00:38:56 +00004611#line 1813 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004612 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004613 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004614 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4615 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004616 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4617 GEN_ERROR("Cannot create a null initialized value of this type");
Chris Lattner59363a32008-02-19 04:36:25 +00004618 (yyval.ConstVal) = Constant::getNullValue(Ty);
4619 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004620 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004621 ;}
4622 break;
4623
Dale Johannesena79ecf32008-02-20 21:15:43 +00004624 case 182:
Devang Patel087fe2b2008-02-23 00:38:56 +00004625#line 1823 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004626 { // integral constants
4627 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004628 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner59363a32008-02-19 04:36:25 +00004629 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004630 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004631 ;}
4632 break;
4633
Dale Johannesena79ecf32008-02-20 21:15:43 +00004634 case 183:
Devang Patel087fe2b2008-02-23 00:38:56 +00004635#line 1829 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004636 { // arbitrary precision integer constants
4637 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4638 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004639 GEN_ERROR("Constant value does not fit in type");
4640 }
Chris Lattner59363a32008-02-19 04:36:25 +00004641 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4642 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4643 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004644 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004645 ;}
4646 break;
4647
Dale Johannesena79ecf32008-02-20 21:15:43 +00004648 case 184:
Devang Patel087fe2b2008-02-23 00:38:56 +00004649#line 1839 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004650 { // integral constants
4651 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004652 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner59363a32008-02-19 04:36:25 +00004653 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004654 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004655 ;}
4656 break;
4657
Dale Johannesena79ecf32008-02-20 21:15:43 +00004658 case 185:
Devang Patel087fe2b2008-02-23 00:38:56 +00004659#line 1845 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004660 { // arbitrary precision integer constants
4661 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4662 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004663 GEN_ERROR("Constant value does not fit in type");
4664 }
Chris Lattner59363a32008-02-19 04:36:25 +00004665 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4666 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4667 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004668 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004669 ;}
4670 break;
4671
Dale Johannesena79ecf32008-02-20 21:15:43 +00004672 case 186:
Devang Patel087fe2b2008-02-23 00:38:56 +00004673#line 1855 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004674 { // Boolean constants
4675 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4676 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004677 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004678 ;}
4679 break;
4680
Dale Johannesena79ecf32008-02-20 21:15:43 +00004681 case 187:
Devang Patel087fe2b2008-02-23 00:38:56 +00004682#line 1860 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004683 { // Boolean constants
4684 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4685 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004686 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004687 ;}
4688 break;
4689
Dale Johannesena79ecf32008-02-20 21:15:43 +00004690 case 188:
Devang Patel087fe2b2008-02-23 00:38:56 +00004691#line 1865 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004692 { // Floating point constants
4693 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004694 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004695 // Lexer has no type info, so builds all float and double FP constants
4696 // as double. Fix this here. Long double is done right.
Chris Lattner59363a32008-02-19 04:36:25 +00004697 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4698 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4699 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4700 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004701 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004702 ;}
4703 break;
4704
Dale Johannesena79ecf32008-02-20 21:15:43 +00004705 case 189:
Devang Patel087fe2b2008-02-23 00:38:56 +00004706#line 1878 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004707 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004708 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004709 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4710 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4711 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4712 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004713 GEN_ERROR("invalid cast opcode for cast from '" +
4714 Val->getType()->getDescription() + "' to '" +
4715 DestTy->getDescription() + "'");
Chris Lattner59363a32008-02-19 04:36:25 +00004716 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4717 delete (yyvsp[(5) - (6)].TypeVal);
4718 ;}
4719 break;
4720
Dale Johannesena79ecf32008-02-20 21:15:43 +00004721 case 190:
Devang Patel087fe2b2008-02-23 00:38:56 +00004722#line 1890 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004723 {
4724 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004725 GEN_ERROR("GetElementPtr requires a pointer operand");
4726
4727 const Type *IdxTy =
Chris Lattner59363a32008-02-19 04:36:25 +00004728 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004729 true);
4730 if (!IdxTy)
4731 GEN_ERROR("Index list invalid for constant getelementptr");
4732
4733 SmallVector<Constant*, 8> IdxVec;
Chris Lattner59363a32008-02-19 04:36:25 +00004734 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4735 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004736 IdxVec.push_back(C);
4737 else
4738 GEN_ERROR("Indices to constant getelementptr must be constants");
4739
Chris Lattner59363a32008-02-19 04:36:25 +00004740 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741
Chris Lattner59363a32008-02-19 04:36:25 +00004742 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004743 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004744 ;}
4745 break;
4746
Dale Johannesena79ecf32008-02-20 21:15:43 +00004747 case 191:
Devang Patel087fe2b2008-02-23 00:38:56 +00004748#line 1912 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004749 {
4750 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004751 GEN_ERROR("Select condition must be of boolean type");
Chris Lattner59363a32008-02-19 04:36:25 +00004752 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004753 GEN_ERROR("Select operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004754 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004755 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004756 ;}
4757 break;
4758
Dale Johannesena79ecf32008-02-20 21:15:43 +00004759 case 192:
Devang Patel087fe2b2008-02-23 00:38:56 +00004760#line 1920 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004761 {
4762 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004763 GEN_ERROR("Binary operator types must match");
4764 CHECK_FOR_ERROR;
Chris Lattner59363a32008-02-19 04:36:25 +00004765 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4766 ;}
4767 break;
4768
Dale Johannesena79ecf32008-02-20 21:15:43 +00004769 case 193:
Devang Patel087fe2b2008-02-23 00:38:56 +00004770#line 1926 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004771 {
4772 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004773 GEN_ERROR("Logical operator types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004774 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4775 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4776 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004777 GEN_ERROR("Logical operator requires integral operands");
4778 }
Chris Lattner59363a32008-02-19 04:36:25 +00004779 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004780 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004781 ;}
4782 break;
4783
Dale Johannesena79ecf32008-02-20 21:15:43 +00004784 case 194:
Devang Patel087fe2b2008-02-23 00:38:56 +00004785#line 1937 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004786 {
4787 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004788 GEN_ERROR("icmp operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004789 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4790 ;}
4791 break;
4792
Dale Johannesena79ecf32008-02-20 21:15:43 +00004793 case 195:
Devang Patel087fe2b2008-02-23 00:38:56 +00004794#line 1942 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004795 {
4796 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004797 GEN_ERROR("fcmp operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004798 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4799 ;}
4800 break;
4801
Dale Johannesena79ecf32008-02-20 21:15:43 +00004802 case 196:
Devang Patel087fe2b2008-02-23 00:38:56 +00004803#line 1947 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004804 {
4805 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004806 GEN_ERROR("Invalid extractelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004807 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004808 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004809 ;}
4810 break;
4811
Dale Johannesena79ecf32008-02-20 21:15:43 +00004812 case 197:
Devang Patel087fe2b2008-02-23 00:38:56 +00004813#line 1953 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004814 {
4815 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004816 GEN_ERROR("Invalid insertelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004817 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004818 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004819 ;}
4820 break;
4821
Dale Johannesena79ecf32008-02-20 21:15:43 +00004822 case 198:
Devang Patel087fe2b2008-02-23 00:38:56 +00004823#line 1959 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004824 {
4825 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004826 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004827 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004828 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004829 ;}
4830 break;
4831
Dale Johannesena79ecf32008-02-20 21:15:43 +00004832 case 199:
Devang Patel087fe2b2008-02-23 00:38:56 +00004833#line 1968 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004834 {
4835 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004836 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004837 ;}
4838 break;
4839
Dale Johannesena79ecf32008-02-20 21:15:43 +00004840 case 200:
Devang Patel087fe2b2008-02-23 00:38:56 +00004841#line 1972 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004842 {
4843 (yyval.ConstVector) = new std::vector<Constant*>();
4844 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004845 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004846 ;}
4847 break;
4848
Dale Johannesena79ecf32008-02-20 21:15:43 +00004849 case 201:
Devang Patel087fe2b2008-02-23 00:38:56 +00004850#line 1980 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004851 { (yyval.BoolVal) = false; ;}
4852 break;
4853
Chris Lattner59363a32008-02-19 04:36:25 +00004854 case 202:
Devang Patel087fe2b2008-02-23 00:38:56 +00004855#line 1980 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004856 { (yyval.BoolVal) = true; ;}
4857 break;
4858
4859 case 203:
Devang Patel087fe2b2008-02-23 00:38:56 +00004860#line 1983 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004861 { (yyval.BoolVal) = true; ;}
Chris Lattner59363a32008-02-19 04:36:25 +00004862 break;
4863
4864 case 204:
Devang Patel087fe2b2008-02-23 00:38:56 +00004865#line 1983 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004866 { (yyval.BoolVal) = false; ;}
4867 break;
4868
4869 case 205:
Devang Patel087fe2b2008-02-23 00:38:56 +00004870#line 1986 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004871 {
4872 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4873 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00004874 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004875 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4876 if (!Aliasee)
4877 GEN_ERROR("Aliases can be created only to global values");
4878
Chris Lattner59363a32008-02-19 04:36:25 +00004879 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004880 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004881 delete (yyvsp[(1) - (2)].TypeVal);
4882 ;}
4883 break;
4884
Dale Johannesena79ecf32008-02-20 21:15:43 +00004885 case 206:
Devang Patel087fe2b2008-02-23 00:38:56 +00004886#line 1998 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004887 {
4888 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4889 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4890 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004891 GEN_ERROR("invalid cast opcode for cast from '" +
4892 Val->getType()->getDescription() + "' to '" +
4893 DestTy->getDescription() + "'");
4894
Chris Lattner59363a32008-02-19 04:36:25 +00004895 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004896 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004897 delete (yyvsp[(5) - (6)].TypeVal);
4898 ;}
4899 break;
4900
Chris Lattner59363a32008-02-19 04:36:25 +00004901 case 207:
Devang Patel087fe2b2008-02-23 00:38:56 +00004902#line 2019 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004903 {
4904 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Christopher Lamb668d9a02007-12-12 08:45:45 +00004905 CurModule.ModuleDone();
4906 CHECK_FOR_ERROR;
Chris Lattner59363a32008-02-19 04:36:25 +00004907 ;}
4908 break;
4909
Dale Johannesena79ecf32008-02-20 21:15:43 +00004910 case 208:
Devang Patel087fe2b2008-02-23 00:38:56 +00004911#line 2024 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004912 {
4913 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4914 CurModule.ModuleDone();
4915 CHECK_FOR_ERROR;
4916 ;}
Chris Lattner59363a32008-02-19 04:36:25 +00004917 break;
4918
4919 case 211:
Devang Patel087fe2b2008-02-23 00:38:56 +00004920#line 2037 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004921 { CurFun.isDeclare = false; ;}
4922 break;
4923
4924 case 212:
Devang Patel087fe2b2008-02-23 00:38:56 +00004925#line 2037 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004926 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004927 CurFun.FunctionDone();
4928 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004929 ;}
4930 break;
4931
Dale Johannesena79ecf32008-02-20 21:15:43 +00004932 case 213:
Devang Patel087fe2b2008-02-23 00:38:56 +00004933#line 2041 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004934 { CurFun.isDeclare = true; ;}
4935 break;
4936
Chris Lattner59363a32008-02-19 04:36:25 +00004937 case 214:
Devang Patel087fe2b2008-02-23 00:38:56 +00004938#line 2041 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004939 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00004940 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004941 ;}
4942 break;
4943
4944 case 215:
Devang Patel087fe2b2008-02-23 00:38:56 +00004945#line 2044 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004946 {
4947 CHECK_FOR_ERROR
4948 ;}
4949 break;
4950
4951 case 216:
Devang Patel087fe2b2008-02-23 00:38:56 +00004952#line 2047 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004953 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004954 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004955 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004956 // Eagerly resolve types. This is not an optimization, this is a
4957 // requirement that is due to the fact that we could have this:
4958 //
4959 // %list = type { %list * }
4960 // %list = type { %list * } ; repeated type decl
4961 //
4962 // If types are not resolved eagerly, then the two types will not be
4963 // determined to be the same type!
4964 //
Chris Lattner59363a32008-02-19 04:36:25 +00004965 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004966
Chris Lattner59363a32008-02-19 04:36:25 +00004967 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004968 CHECK_FOR_ERROR
4969 // If this is a named type that is not a redefinition, add it to the slot
4970 // table.
Chris Lattner59363a32008-02-19 04:36:25 +00004971 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004972 }
4973
Chris Lattner59363a32008-02-19 04:36:25 +00004974 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004975 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004976 ;}
4977 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004978
Dale Johannesena79ecf32008-02-20 21:15:43 +00004979 case 217:
Devang Patel087fe2b2008-02-23 00:38:56 +00004980#line 2071 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004981 {
4982 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4983
4984 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004985 CHECK_FOR_ERROR
4986 // If this is a named type that is not a redefinition, add it to the slot
4987 // table.
Chris Lattner59363a32008-02-19 04:36:25 +00004988 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004989 }
4990 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004991 ;}
4992 break;
4993
Dale Johannesena79ecf32008-02-20 21:15:43 +00004994 case 218:
Devang Patel087fe2b2008-02-23 00:38:56 +00004995#line 2083 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004996 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004997 /* "Externally Visible" Linkage */
Chris Lattner59363a32008-02-19 04:36:25 +00004998 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004999 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner59363a32008-02-19 04:36:25 +00005000 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5001 (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 +00005002 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005003 ;}
5004 break;
5005
Dale Johannesena79ecf32008-02-20 21:15:43 +00005006 case 219:
Devang Patel087fe2b2008-02-23 00:38:56 +00005007#line 2090 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005008 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005009 CurGV = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005010 ;}
5011 break;
5012
Dale Johannesena79ecf32008-02-20 21:15:43 +00005013 case 220:
Devang Patel087fe2b2008-02-23 00:38:56 +00005014#line 2094 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005015 {
5016 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005017 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner59363a32008-02-19 04:36:25 +00005018 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 +00005019 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005020 ;}
5021 break;
5022
Dale Johannesena79ecf32008-02-20 21:15:43 +00005023 case 221:
Devang Patel087fe2b2008-02-23 00:38:56 +00005024#line 2099 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005025 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005026 CurGV = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005027 ;}
5028 break;
5029
Dale Johannesena79ecf32008-02-20 21:15:43 +00005030 case 222:
Devang Patel087fe2b2008-02-23 00:38:56 +00005031#line 2103 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005032 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005033 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005034 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5035 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 +00005036 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005037 delete (yyvsp[(6) - (7)].TypeVal);
5038 ;}
5039 break;
5040
Dale Johannesena79ecf32008-02-20 21:15:43 +00005041 case 223:
Devang Patel087fe2b2008-02-23 00:38:56 +00005042#line 2109 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005043 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005044 CurGV = 0;
5045 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005046 ;}
5047 break;
5048
Dale Johannesena79ecf32008-02-20 21:15:43 +00005049 case 224:
Devang Patel087fe2b2008-02-23 00:38:56 +00005050#line 2113 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005051 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005052 std::string Name;
Chris Lattner59363a32008-02-19 04:36:25 +00005053 if ((yyvsp[(1) - (5)].StrVal)) {
5054 Name = *(yyvsp[(1) - (5)].StrVal);
5055 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005056 }
5057 if (Name.empty())
5058 GEN_ERROR("Alias name cannot be empty");
5059
Chris Lattner59363a32008-02-19 04:36:25 +00005060 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005061 if (Aliasee == 0)
5062 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5063
Chris Lattner59363a32008-02-19 04:36:25 +00005064 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005065 CurModule.CurrentModule);
Chris Lattner59363a32008-02-19 04:36:25 +00005066 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005067 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005068
5069
5070 // If there was a forward reference of this alias, resolve it now.
5071
5072 ValID ID;
5073 if (!Name.empty())
5074 ID = ValID::createGlobalName(Name);
5075 else
5076 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5077
5078 if (GlobalValue *FWGV =
5079 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5080 // Replace uses of the fwdref with the actual alias.
5081 FWGV->replaceAllUsesWith(GA);
5082 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5083 GV->eraseFromParent();
5084 else
5085 cast<Function>(FWGV)->eraseFromParent();
5086 }
5087 ID.destroy();
5088
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005089 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005090 ;}
5091 break;
5092
Dale Johannesena79ecf32008-02-20 21:15:43 +00005093 case 225:
Devang Patel087fe2b2008-02-23 00:38:56 +00005094#line 2153 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005095 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005096 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005097 ;}
5098 break;
5099
Dale Johannesena79ecf32008-02-20 21:15:43 +00005100 case 226:
Devang Patel087fe2b2008-02-23 00:38:56 +00005101#line 2156 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005102 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005103 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005104 ;}
5105 break;
5106
Dale Johannesena79ecf32008-02-20 21:15:43 +00005107 case 227:
Devang Patel087fe2b2008-02-23 00:38:56 +00005108#line 2162 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005109 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005110 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5111 if (AsmSoFar.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005112 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005113 else
Chris Lattner59363a32008-02-19 04:36:25 +00005114 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5115 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005116 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005117;}
5118 break;
5119
Dale Johannesena79ecf32008-02-20 21:15:43 +00005120 case 228:
Devang Patel087fe2b2008-02-23 00:38:56 +00005121#line 2172 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005122 {
5123 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5124 delete (yyvsp[(3) - (3)].StrVal);
5125 ;}
5126 break;
5127
Dale Johannesena79ecf32008-02-20 21:15:43 +00005128 case 229:
Devang Patel087fe2b2008-02-23 00:38:56 +00005129#line 2176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005130 {
5131 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5132 delete (yyvsp[(3) - (3)].StrVal);
5133 ;}
5134 break;
5135
Dale Johannesena79ecf32008-02-20 21:15:43 +00005136 case 231:
Devang Patel087fe2b2008-02-23 00:38:56 +00005137#line 2183 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005138 {
5139 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5140 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005141 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005142 ;}
5143 break;
5144
Dale Johannesena79ecf32008-02-20 21:15:43 +00005145 case 232:
Devang Patel087fe2b2008-02-23 00:38:56 +00005146#line 2188 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005147 {
5148 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5149 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005150 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005151 ;}
5152 break;
5153
Dale Johannesena79ecf32008-02-20 21:15:43 +00005154 case 233:
Devang Patel087fe2b2008-02-23 00:38:56 +00005155#line 2193 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005156 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005157 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005158 ;}
5159 break;
5160
Dale Johannesena79ecf32008-02-20 21:15:43 +00005161 case 234:
Devang Patel087fe2b2008-02-23 00:38:56 +00005162#line 2202 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005163 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005164 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005165 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5166 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005167 GEN_ERROR("void typed arguments are invalid");
Chris Lattner59363a32008-02-19 04:36:25 +00005168 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5169 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5170 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005171 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005172 ;}
5173 break;
5174
Dale Johannesena79ecf32008-02-20 21:15:43 +00005175 case 235:
Devang Patel087fe2b2008-02-23 00:38:56 +00005176#line 2212 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005177 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005178 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005179 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5180 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005181 GEN_ERROR("void typed arguments are invalid");
Chris Lattner59363a32008-02-19 04:36:25 +00005182 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5183 (yyval.ArgList) = new ArgListType;
5184 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005185 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005186 ;}
5187 break;
5188
Dale Johannesena79ecf32008-02-20 21:15:43 +00005189 case 236:
Devang Patel087fe2b2008-02-23 00:38:56 +00005190#line 2223 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005191 {
5192 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005193 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005194 ;}
5195 break;
5196
Dale Johannesena79ecf32008-02-20 21:15:43 +00005197 case 237:
Devang Patel087fe2b2008-02-23 00:38:56 +00005198#line 2227 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005199 {
5200 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005201 struct ArgListEntry E;
5202 E.Ty = new PATypeHolder(Type::VoidTy);
5203 E.Name = 0;
5204 E.Attrs = ParamAttr::None;
Chris Lattner59363a32008-02-19 04:36:25 +00005205 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005206 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005207 ;}
5208 break;
5209
Dale Johannesena79ecf32008-02-20 21:15:43 +00005210 case 238:
Devang Patel087fe2b2008-02-23 00:38:56 +00005211#line 2236 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005212 {
5213 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005214 struct ArgListEntry E;
5215 E.Ty = new PATypeHolder(Type::VoidTy);
5216 E.Name = 0;
5217 E.Attrs = ParamAttr::None;
Chris Lattner59363a32008-02-19 04:36:25 +00005218 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005219 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005220 ;}
5221 break;
5222
Dale Johannesena79ecf32008-02-20 21:15:43 +00005223 case 239:
Devang Patel087fe2b2008-02-23 00:38:56 +00005224#line 2245 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005225 {
5226 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005227 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005228 ;}
5229 break;
5230
Dale Johannesena79ecf32008-02-20 21:15:43 +00005231 case 240:
Devang Patel087fe2b2008-02-23 00:38:56 +00005232#line 2251 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005233 {
5234 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5235 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005236
5237 // Check the function result for abstractness if this is a define. We should
5238 // have no abstract types at this point
Chris Lattner59363a32008-02-19 04:36:25 +00005239 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5240 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005241
5242 std::vector<const Type*> ParamTypeList;
5243 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00005244 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005245 ParamAttrsWithIndex PAWI;
5246 PAWI.index = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005247 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005248 Attrs.push_back(PAWI);
5249 }
Chris Lattner59363a32008-02-19 04:36:25 +00005250 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005251 unsigned index = 1;
Chris Lattner59363a32008-02-19 04:36:25 +00005252 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005253 const Type* Ty = I->Ty->get();
5254 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5255 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5256 ParamTypeList.push_back(Ty);
5257 if (Ty != Type::VoidTy)
5258 if (I->Attrs != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005259 ParamAttrsWithIndex PAWI;
5260 PAWI.index = index;
5261 PAWI.attrs = I->Attrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005262 Attrs.push_back(PAWI);
5263 }
5264 }
5265 }
5266
5267 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5268 if (isVarArg) ParamTypeList.pop_back();
5269
Duncan Sands637ec552007-11-28 17:07:01 +00005270 const ParamAttrsList *PAL = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005271 if (!Attrs.empty())
5272 PAL = ParamAttrsList::get(Attrs);
5273
Chris Lattner59363a32008-02-19 04:36:25 +00005274 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005275 const PointerType *PFT = PointerType::getUnqual(FT);
Chris Lattner59363a32008-02-19 04:36:25 +00005276 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005277
5278 ValID ID;
5279 if (!FunctionName.empty()) {
5280 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5281 } else {
5282 ID = ValID::createGlobalID(CurModule.Values.size());
5283 }
5284
5285 Function *Fn = 0;
5286 // See if this function was forward referenced. If so, recycle the object.
5287 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5288 // Move the function to the end of the list, from whereever it was
5289 // previously inserted.
5290 Fn = cast<Function>(FWRef);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005291 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005292 CurModule.CurrentModule->getFunctionList().remove(Fn);
5293 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5294 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5295 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005296 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005297 // The existing function doesn't have the same type. This is an overload
5298 // error.
5299 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005300 } else if (Fn->getParamAttrs() != PAL) {
5301 // The existing function doesn't have the same parameter attributes.
5302 // This is an overload error.
5303 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005304 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5305 // Neither the existing or the current function is a declaration and they
5306 // have the same name and same type. Clearly this is a redefinition.
5307 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005308 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005309 // Make sure to strip off any argument names so we can't get conflicts.
5310 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5311 AI != AE; ++AI)
5312 AI->setName("");
5313 }
5314 } else { // Not already defined?
5315 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5316 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005317 InsertValue(Fn, CurModule.Values);
5318 }
5319
5320 CurFun.FunctionStart(Fn);
5321
5322 if (CurFun.isDeclare) {
5323 // If we have declaration, always overwrite linkage. This will allow us to
5324 // correctly handle cases, when pointer to function is passed as argument to
5325 // another function.
5326 Fn->setLinkage(CurFun.Linkage);
5327 Fn->setVisibility(CurFun.Visibility);
5328 }
Chris Lattner59363a32008-02-19 04:36:25 +00005329 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005330 Fn->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00005331 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5332 if ((yyvsp[(8) - (10)].StrVal)) {
5333 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5334 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005335 }
Chris Lattner59363a32008-02-19 04:36:25 +00005336 if ((yyvsp[(10) - (10)].StrVal)) {
5337 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5338 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005339 }
5340
5341 // Add all of the arguments we parsed to the function...
Chris Lattner59363a32008-02-19 04:36:25 +00005342 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005343 if (isVarArg) { // Nuke the last entry
Chris Lattner59363a32008-02-19 04:36:25 +00005344 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005345 "Not a varargs marker!");
Chris Lattner59363a32008-02-19 04:36:25 +00005346 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5347 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005348 }
5349 Function::arg_iterator ArgIt = Fn->arg_begin();
5350 Function::arg_iterator ArgEnd = Fn->arg_end();
5351 unsigned Idx = 1;
Chris Lattner59363a32008-02-19 04:36:25 +00005352 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5353 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005354 delete I->Ty; // Delete the typeholder...
5355 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5356 CHECK_FOR_ERROR
5357 InsertValue(ArgIt);
5358 Idx++;
5359 }
5360
Chris Lattner59363a32008-02-19 04:36:25 +00005361 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005362 }
5363 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005364;}
5365 break;
5366
Dale Johannesena79ecf32008-02-20 21:15:43 +00005367 case 243:
Devang Patel087fe2b2008-02-23 00:38:56 +00005368#line 2386 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005369 {
5370 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005371
5372 // Make sure that we keep track of the linkage type even if there was a
5373 // previous "declare".
Chris Lattner59363a32008-02-19 04:36:25 +00005374 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5375 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5376;}
5377 break;
5378
Dale Johannesena79ecf32008-02-20 21:15:43 +00005379 case 246:
Devang Patel087fe2b2008-02-23 00:38:56 +00005380#line 2397 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005381 {
5382 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005383 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005384;}
5385 break;
5386
Dale Johannesena79ecf32008-02-20 21:15:43 +00005387 case 247:
Devang Patel087fe2b2008-02-23 00:38:56 +00005388#line 2402 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005389 {
5390 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5391 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5392 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005393 CurFun.FunctionDone();
5394 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005395 ;}
5396 break;
5397
Dale Johannesena79ecf32008-02-20 21:15:43 +00005398 case 248:
Devang Patel087fe2b2008-02-23 00:38:56 +00005399#line 2414 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005400 {
5401 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005402 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005403 ;}
5404 break;
5405
Dale Johannesena79ecf32008-02-20 21:15:43 +00005406 case 249:
Devang Patel087fe2b2008-02-23 00:38:56 +00005407#line 2418 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005408 {
5409 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005410 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005411 ;}
5412 break;
5413
Dale Johannesena79ecf32008-02-20 21:15:43 +00005414 case 250:
Devang Patel087fe2b2008-02-23 00:38:56 +00005415#line 2423 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005416 { // A reference to a direct constant
5417 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005418 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005419 ;}
5420 break;
5421
Dale Johannesena79ecf32008-02-20 21:15:43 +00005422 case 251:
Devang Patel087fe2b2008-02-23 00:38:56 +00005423#line 2427 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005424 {
5425 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005426 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005427 ;}
5428 break;
5429
Dale Johannesena79ecf32008-02-20 21:15:43 +00005430 case 252:
Devang Patel087fe2b2008-02-23 00:38:56 +00005431#line 2431 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005432 { // Perhaps it's an FP constant?
5433 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005434 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005435 ;}
5436 break;
5437
Dale Johannesena79ecf32008-02-20 21:15:43 +00005438 case 253:
Devang Patel087fe2b2008-02-23 00:38:56 +00005439#line 2435 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005440 {
5441 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005442 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005443 ;}
5444 break;
5445
Dale Johannesena79ecf32008-02-20 21:15:43 +00005446 case 254:
Devang Patel087fe2b2008-02-23 00:38:56 +00005447#line 2439 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005448 {
5449 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005450 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005451 ;}
5452 break;
5453
Dale Johannesena79ecf32008-02-20 21:15:43 +00005454 case 255:
Devang Patel087fe2b2008-02-23 00:38:56 +00005455#line 2443 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005456 {
5457 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005458 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005459 ;}
5460 break;
5461
Dale Johannesena79ecf32008-02-20 21:15:43 +00005462 case 256:
Devang Patel087fe2b2008-02-23 00:38:56 +00005463#line 2447 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005464 {
5465 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005466 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005467 ;}
5468 break;
5469
Dale Johannesena79ecf32008-02-20 21:15:43 +00005470 case 257:
Devang Patel087fe2b2008-02-23 00:38:56 +00005471#line 2451 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005472 { // A vector zero constant.
5473 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005474 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005475 ;}
5476 break;
5477
Dale Johannesena79ecf32008-02-20 21:15:43 +00005478 case 258:
Devang Patel087fe2b2008-02-23 00:38:56 +00005479#line 2455 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005480 { // Nonempty unsized packed vector
5481 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5482 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005483
5484 VectorType* pt = VectorType::get(ETy, NumElements);
5485 PATypeHolder* PTy = new PATypeHolder(
5486 HandleUpRefs(
5487 VectorType::get(
5488 ETy,
5489 NumElements)
5490 )
5491 );
5492
5493 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00005494 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5495 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005496 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5497 ETy->getDescription() +"' as required!\nIt is of type '" +
Chris Lattner59363a32008-02-19 04:36:25 +00005498 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005499 }
5500
Chris Lattner59363a32008-02-19 04:36:25 +00005501 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5502 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005503 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005504 ;}
5505 break;
5506
Dale Johannesena79ecf32008-02-20 21:15:43 +00005507 case 259:
Devang Patel087fe2b2008-02-23 00:38:56 +00005508#line 2480 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005509 {
5510 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005511 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005512 ;}
5513 break;
5514
Dale Johannesena79ecf32008-02-20 21:15:43 +00005515 case 260:
Devang Patel087fe2b2008-02-23 00:38:56 +00005516#line 2484 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005517 {
5518 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5519 delete (yyvsp[(3) - (5)].StrVal);
5520 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005521 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005522 ;}
5523 break;
5524
Dale Johannesena79ecf32008-02-20 21:15:43 +00005525 case 261:
Devang Patel087fe2b2008-02-23 00:38:56 +00005526#line 2494 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005527 { // Is it an integer reference...?
5528 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005529 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005530 ;}
5531 break;
5532
Dale Johannesena79ecf32008-02-20 21:15:43 +00005533 case 262:
Devang Patel087fe2b2008-02-23 00:38:56 +00005534#line 2498 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005535 {
5536 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005537 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005538 ;}
5539 break;
5540
Dale Johannesena79ecf32008-02-20 21:15:43 +00005541 case 263:
Devang Patel087fe2b2008-02-23 00:38:56 +00005542#line 2502 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005543 { // Is it a named reference...?
5544 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5545 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005546 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005547 ;}
5548 break;
5549
Dale Johannesena79ecf32008-02-20 21:15:43 +00005550 case 264:
Devang Patel087fe2b2008-02-23 00:38:56 +00005551#line 2507 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005552 { // Is it a named reference...?
5553 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5554 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005555 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005556 ;}
5557 break;
5558
Dale Johannesena79ecf32008-02-20 21:15:43 +00005559 case 267:
Devang Patel087fe2b2008-02-23 00:38:56 +00005560#line 2520 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005561 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005562 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5564 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5565 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005566 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005567 ;}
5568 break;
5569
Dale Johannesena79ecf32008-02-20 21:15:43 +00005570 case 268:
Devang Patel087fe2b2008-02-23 00:38:56 +00005571#line 2529 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelbf507402008-02-20 22:40:23 +00005572 {
5573 (yyval.ValueList) = new std::vector<Value *>();
5574 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5575 CHECK_FOR_ERROR
5576 ;}
5577 break;
5578
5579 case 269:
Devang Patel087fe2b2008-02-23 00:38:56 +00005580#line 2534 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelbf507402008-02-20 22:40:23 +00005581 {
Devang Patel087fe2b2008-02-23 00:38:56 +00005582 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005583 CHECK_FOR_ERROR
5584 ;}
5585 break;
5586
5587 case 270:
Devang Patel087fe2b2008-02-23 00:38:56 +00005588#line 2539 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005589 {
5590 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005591 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005592 ;}
5593 break;
5594
Devang Patelbf507402008-02-20 22:40:23 +00005595 case 271:
Devang Patel087fe2b2008-02-23 00:38:56 +00005596#line 2543 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005597 { // Do not allow functions with 0 basic blocks
5598 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005599 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005600 ;}
5601 break;
5602
Devang Patelbf507402008-02-20 22:40:23 +00005603 case 272:
Devang Patel087fe2b2008-02-23 00:38:56 +00005604#line 2552 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005605 {
5606 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005607 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005608 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5609 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5610 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005611 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005612 ;}
5613 break;
5614
Devang Patelbf507402008-02-20 22:40:23 +00005615 case 273:
Devang Patel087fe2b2008-02-23 00:38:56 +00005616#line 2561 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005617 {
5618 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005619 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5620 if (CI2->getParent() == 0)
Chris Lattner59363a32008-02-19 04:36:25 +00005621 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5622 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5623 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005624 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005625 ;}
5626 break;
5627
Devang Patelbf507402008-02-20 22:40:23 +00005628 case 274:
Devang Patel087fe2b2008-02-23 00:38:56 +00005629#line 2570 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005630 { // Empty space between instruction lists
5631 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005632 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005633 ;}
5634 break;
5635
Devang Patelbf507402008-02-20 22:40:23 +00005636 case 275:
Devang Patel087fe2b2008-02-23 00:38:56 +00005637#line 2574 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005638 { // Labelled (named) basic block
5639 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5640 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005641 CHECK_FOR_ERROR
5642
Chris Lattner59363a32008-02-19 04:36:25 +00005643 ;}
5644 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005645
Devang Patelbf507402008-02-20 22:40:23 +00005646 case 276:
Devang Patel087fe2b2008-02-23 00:38:56 +00005647#line 2582 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelbf507402008-02-20 22:40:23 +00005648 { // Return with a result...
Devang Patel087fe2b2008-02-23 00:38:56 +00005649 (yyval.TermInstVal) = new ReturnInst(*(yyvsp[(2) - (2)].ValueList));
Devang Patelbf507402008-02-20 22:40:23 +00005650 delete (yyvsp[(2) - (2)].ValueList);
Chris Lattner59363a32008-02-19 04:36:25 +00005651 CHECK_FOR_ERROR
5652 ;}
5653 break;
5654
Devang Patelbf507402008-02-20 22:40:23 +00005655 case 277:
Devang Patel087fe2b2008-02-23 00:38:56 +00005656#line 2587 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005657 { // Return with no result...
5658 (yyval.TermInstVal) = new ReturnInst();
5659 CHECK_FOR_ERROR
5660 ;}
5661 break;
5662
Devang Patelbf507402008-02-20 22:40:23 +00005663 case 278:
Devang Patel087fe2b2008-02-23 00:38:56 +00005664#line 2591 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005665 { // Unconditional Branch...
5666 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5667 CHECK_FOR_ERROR
5668 (yyval.TermInstVal) = new BranchInst(tmpBB);
5669 ;}
5670 break;
5671
Devang Patelbf507402008-02-20 22:40:23 +00005672 case 279:
Devang Patel087fe2b2008-02-23 00:38:56 +00005673#line 2596 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005674 {
5675 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5676 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5677 CHECK_FOR_ERROR
5678 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5679 CHECK_FOR_ERROR
5680 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5681 CHECK_FOR_ERROR
5682 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5683 ;}
5684 break;
5685
Devang Patelbf507402008-02-20 22:40:23 +00005686 case 280:
Devang Patel087fe2b2008-02-23 00:38:56 +00005687#line 2606 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005688 {
5689 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5690 CHECK_FOR_ERROR
5691 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5692 CHECK_FOR_ERROR
5693 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5694 (yyval.TermInstVal) = S;
5695
5696 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5697 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005698 for (; I != E; ++I) {
5699 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5700 S->addCase(CI, I->second);
5701 else
5702 GEN_ERROR("Switch case is constant, but not a simple integer");
5703 }
Chris Lattner59363a32008-02-19 04:36:25 +00005704 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005705 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005706 ;}
5707 break;
5708
Devang Patelbf507402008-02-20 22:40:23 +00005709 case 281:
Devang Patel087fe2b2008-02-23 00:38:56 +00005710#line 2625 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005711 {
5712 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005713 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005714 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005715 CHECK_FOR_ERROR
5716 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Chris Lattner59363a32008-02-19 04:36:25 +00005717 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005718 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005719 ;}
5720 break;
5721
Devang Patelbf507402008-02-20 22:40:23 +00005722 case 282:
Devang Patel087fe2b2008-02-23 00:38:56 +00005723#line 2635 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005724 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005725
5726 // Handle the short syntax
5727 const PointerType *PFTy = 0;
5728 const FunctionType *Ty = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005729 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005730 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5731 // Pull out the types of all of the arguments...
5732 std::vector<const Type*> ParamTypes;
Chris Lattner59363a32008-02-19 04:36:25 +00005733 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005734 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005735 const Type *Ty = I->Val->getType();
5736 if (Ty == Type::VoidTy)
5737 GEN_ERROR("Short call syntax cannot be used with varargs");
5738 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005739 }
Chris Lattner59363a32008-02-19 04:36:25 +00005740 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00005741 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005742 }
5743
Chris Lattner59363a32008-02-19 04:36:25 +00005744 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005745
Chris Lattner59363a32008-02-19 04:36:25 +00005746 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005747 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005748 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005749 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005750 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005751 CHECK_FOR_ERROR
5752
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005753 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00005754 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5755 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005756 Attrs.push_back(PAWI);
5757 }
5758
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005759 // Check the arguments
5760 ValueList Args;
Chris Lattner59363a32008-02-19 04:36:25 +00005761 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005762 // Make sure no arguments is a good thing!
5763 if (Ty->getNumParams() != 0)
5764 GEN_ERROR("No arguments passed to a function that "
5765 "expects arguments");
5766 } else { // Has arguments?
5767 // Loop through FunctionType's arguments and ensure they are specified
5768 // correctly!
5769 FunctionType::param_iterator I = Ty->param_begin();
5770 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner59363a32008-02-19 04:36:25 +00005771 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005772 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005773
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005774 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005775 if (ArgI->Val->getType() != *I)
5776 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5777 (*I)->getDescription() + "'");
5778 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005779 if (ArgI->Attrs != ParamAttr::None) {
5780 ParamAttrsWithIndex PAWI;
5781 PAWI.index = index;
5782 PAWI.attrs = ArgI->Attrs;
5783 Attrs.push_back(PAWI);
5784 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005785 }
5786
5787 if (Ty->isVarArg()) {
5788 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00005789 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005790 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner59363a32008-02-19 04:36:25 +00005791 if (ArgI->Attrs != ParamAttr::None) {
5792 ParamAttrsWithIndex PAWI;
5793 PAWI.index = index;
5794 PAWI.attrs = ArgI->Attrs;
5795 Attrs.push_back(PAWI);
5796 }
5797 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005798 } else if (I != E || ArgI != ArgE)
5799 GEN_ERROR("Invalid number of parameters detected");
5800 }
5801
Duncan Sands637ec552007-11-28 17:07:01 +00005802 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005803 if (!Attrs.empty())
5804 PAL = ParamAttrsList::get(Attrs);
5805
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005806 // Create the InvokeInst
Chris Lattnerd140ada2007-08-29 16:15:23 +00005807 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Chris Lattner59363a32008-02-19 04:36:25 +00005808 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005809 II->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00005810 (yyval.TermInstVal) = II;
5811 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005812 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005813 ;}
5814 break;
5815
Devang Patelbf507402008-02-20 22:40:23 +00005816 case 283:
Devang Patel087fe2b2008-02-23 00:38:56 +00005817#line 2725 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005818 {
5819 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005820 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005821 ;}
5822 break;
5823
Devang Patelbf507402008-02-20 22:40:23 +00005824 case 284:
Devang Patel087fe2b2008-02-23 00:38:56 +00005825#line 2729 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005826 {
5827 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005828 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005829 ;}
5830 break;
5831
Devang Patelbf507402008-02-20 22:40:23 +00005832 case 285:
Devang Patel087fe2b2008-02-23 00:38:56 +00005833#line 2736 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005834 {
5835 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5836 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005837 CHECK_FOR_ERROR
5838 if (V == 0)
5839 GEN_ERROR("May only switch on a constant pool value");
5840
Chris Lattner59363a32008-02-19 04:36:25 +00005841 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005842 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005843 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5844 ;}
5845 break;
5846
Devang Patelbf507402008-02-20 22:40:23 +00005847 case 286:
Devang Patel087fe2b2008-02-23 00:38:56 +00005848#line 2747 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005849 {
5850 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5851 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005852 CHECK_FOR_ERROR
5853
5854 if (V == 0)
5855 GEN_ERROR("May only switch on a constant pool value");
5856
Chris Lattner59363a32008-02-19 04:36:25 +00005857 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005858 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005859 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5860 ;}
5861 break;
5862
Devang Patelbf507402008-02-20 22:40:23 +00005863 case 287:
Devang Patel087fe2b2008-02-23 00:38:56 +00005864#line 2760 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005865 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005866 // Is this definition named?? if so, assign the name...
Chris Lattner59363a32008-02-19 04:36:25 +00005867 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005868 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005869 InsertValue((yyvsp[(2) - (2)].InstVal));
5870 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005871 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005872 ;}
5873 break;
5874
Devang Patelbf507402008-02-20 22:40:23 +00005875 case 288:
Devang Patel087fe2b2008-02-23 00:38:56 +00005876#line 2770 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005877 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005878 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005879 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5880 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5881 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005882 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005883 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005884 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005885 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5886 delete (yyvsp[(1) - (6)].TypeVal);
5887 ;}
5888 break;
5889
Devang Patelbf507402008-02-20 22:40:23 +00005890 case 289:
Devang Patel087fe2b2008-02-23 00:38:56 +00005891#line 2781 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005892 {
5893 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5894 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005895 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005896 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005897 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005898 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5899 ;}
5900 break;
5901
Devang Patelbf507402008-02-20 22:40:23 +00005902 case 290:
Devang Patel087fe2b2008-02-23 00:38:56 +00005903#line 2791 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005904 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005905 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005906 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005907 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005908 // Used for call and invoke instructions
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 = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5911 (yyval.ParamList)->push_back(E);
5912 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005913 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005914 ;}
5915 break;
5916
Devang Patelbf507402008-02-20 22:40:23 +00005917 case 291:
Devang Patel087fe2b2008-02-23 00:38:56 +00005918#line 2802 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005919 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005920 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00005921 // Labels are only valid in ASMs
Chris Lattner59363a32008-02-19 04:36:25 +00005922 (yyval.ParamList) = new ParamList();
5923 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5924 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005925 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005926 ;}
5927 break;
5928
Devang Patelbf507402008-02-20 22:40:23 +00005929 case 292:
Devang Patel087fe2b2008-02-23 00:38:56 +00005930#line 2810 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005931 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005932 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005933 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005934 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5935 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5936 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5937 (yyval.ParamList)->push_back(E);
5938 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005939 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005940 ;}
5941 break;
5942
Devang Patelbf507402008-02-20 22:40:23 +00005943 case 293:
Devang Patel087fe2b2008-02-23 00:38:56 +00005944#line 2820 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005945 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005946 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Chris Lattner59363a32008-02-19 04:36:25 +00005947 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5948 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5949 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00005950 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005951 ;}
5952 break;
5953
Devang Patelbf507402008-02-20 22:40:23 +00005954 case 294:
Devang Patel087fe2b2008-02-23 00:38:56 +00005955#line 2827 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005956 { (yyval.ParamList) = new ParamList(); ;}
5957 break;
5958
Devang Patelbf507402008-02-20 22:40:23 +00005959 case 295:
Devang Patel087fe2b2008-02-23 00:38:56 +00005960#line 2830 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005961 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5962 break;
5963
Devang Patelbf507402008-02-20 22:40:23 +00005964 case 296:
Devang Patel087fe2b2008-02-23 00:38:56 +00005965#line 2831 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005966 {
5967 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5968 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005969 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005970 ;}
5971 break;
5972
Devang Patelbf507402008-02-20 22:40:23 +00005973 case 297:
Devang Patel087fe2b2008-02-23 00:38:56 +00005974#line 2838 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005975 {
5976 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005977 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005978 ;}
5979 break;
5980
Devang Patelbf507402008-02-20 22:40:23 +00005981 case 298:
Devang Patel087fe2b2008-02-23 00:38:56 +00005982#line 2842 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005983 {
5984 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005985 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005986 ;}
5987 break;
5988
Devang Patelbf507402008-02-20 22:40:23 +00005989 case 299:
Devang Patel087fe2b2008-02-23 00:38:56 +00005990#line 2847 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005991 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005992 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005993 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5994 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5995 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005996 GEN_ERROR(
5997 "Arithmetic operator requires integer, FP, or packed operands");
Chris Lattner59363a32008-02-19 04:36:25 +00005998 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005999 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006000 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006001 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006002 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6003 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006004 GEN_ERROR("binary operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006005 delete (yyvsp[(2) - (5)].TypeVal);
6006 ;}
6007 break;
6008
Devang Patelbf507402008-02-20 22:40:23 +00006009 case 300:
Devang Patel087fe2b2008-02-23 00:38:56 +00006010#line 2863 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006011 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006012 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006013 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6014 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6015 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6016 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006017 GEN_ERROR("Logical operator requires integral operands");
6018 }
Chris Lattner59363a32008-02-19 04:36:25 +00006019 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006020 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006021 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006022 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006023 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6024 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006025 GEN_ERROR("binary operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006026 delete (yyvsp[(2) - (5)].TypeVal);
6027 ;}
6028 break;
6029
Devang Patelbf507402008-02-20 22:40:23 +00006030 case 301:
Devang Patel087fe2b2008-02-23 00:38:56 +00006031#line 2880 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006032 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006033 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006034 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6035 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006036 GEN_ERROR("Vector types not supported by icmp instruction");
Chris Lattner59363a32008-02-19 04:36:25 +00006037 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006038 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006039 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006040 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006041 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6042 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006043 GEN_ERROR("icmp operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006044 delete (yyvsp[(3) - (6)].TypeVal);
6045 ;}
6046 break;
6047
Devang Patelbf507402008-02-20 22:40:23 +00006048 case 302:
Devang Patel087fe2b2008-02-23 00:38:56 +00006049#line 2894 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006050 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006051 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006052 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6053 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006054 GEN_ERROR("Vector types not supported by fcmp instruction");
Chris Lattner59363a32008-02-19 04:36:25 +00006055 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006056 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006057 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006058 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006059 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6060 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006061 GEN_ERROR("fcmp operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006062 delete (yyvsp[(3) - (6)].TypeVal);
6063 ;}
6064 break;
6065
Devang Patelbf507402008-02-20 22:40:23 +00006066 case 303:
Devang Patel087fe2b2008-02-23 00:38:56 +00006067#line 2908 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006068 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006069 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006070 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6071 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6072 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6073 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006074 GEN_ERROR("invalid cast opcode for cast from '" +
6075 Val->getType()->getDescription() + "' to '" +
6076 DestTy->getDescription() + "'");
Chris Lattner59363a32008-02-19 04:36:25 +00006077 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6078 delete (yyvsp[(4) - (4)].TypeVal);
6079 ;}
6080 break;
6081
Devang Patelbf507402008-02-20 22:40:23 +00006082 case 304:
Devang Patel087fe2b2008-02-23 00:38:56 +00006083#line 2920 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006084 {
6085 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006086 GEN_ERROR("select condition must be boolean");
Chris Lattner59363a32008-02-19 04:36:25 +00006087 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006088 GEN_ERROR("select value types should match");
Chris Lattner59363a32008-02-19 04:36:25 +00006089 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006090 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006091 ;}
6092 break;
6093
Devang Patelbf507402008-02-20 22:40:23 +00006094 case 305:
Devang Patel087fe2b2008-02-23 00:38:56 +00006095#line 2928 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006096 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006097 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006098 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6099 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6100 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006101 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006102 ;}
6103 break;
6104
Devang Patelbf507402008-02-20 22:40:23 +00006105 case 306:
Devang Patel087fe2b2008-02-23 00:38:56 +00006106#line 2935 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006107 {
6108 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006109 GEN_ERROR("Invalid extractelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006110 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006111 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006112 ;}
6113 break;
6114
Devang Patelbf507402008-02-20 22:40:23 +00006115 case 307:
Devang Patel087fe2b2008-02-23 00:38:56 +00006116#line 2941 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006117 {
6118 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006119 GEN_ERROR("Invalid insertelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006120 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006121 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006122 ;}
6123 break;
6124
Devang Patelbf507402008-02-20 22:40:23 +00006125 case 308:
Devang Patel087fe2b2008-02-23 00:38:56 +00006126#line 2947 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006127 {
6128 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006129 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006130 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006131 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006132 ;}
6133 break;
6134
Devang Patelbf507402008-02-20 22:40:23 +00006135 case 309:
Devang Patel087fe2b2008-02-23 00:38:56 +00006136#line 2953 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006137 {
6138 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006139 if (!Ty->isFirstClassType())
6140 GEN_ERROR("PHI node operands must be of first class type");
Chris Lattner59363a32008-02-19 04:36:25 +00006141 (yyval.InstVal) = new PHINode(Ty);
6142 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6143 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6144 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006145 GEN_ERROR("All elements of a PHI node must be of the same type");
Chris Lattner59363a32008-02-19 04:36:25 +00006146 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6147 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006148 }
Chris Lattner59363a32008-02-19 04:36:25 +00006149 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006150 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006151 ;}
6152 break;
6153
Devang Patelbf507402008-02-20 22:40:23 +00006154 case 310:
Devang Patel087fe2b2008-02-23 00:38:56 +00006155#line 2969 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006156 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006157
6158 // Handle the short syntax
6159 const PointerType *PFTy = 0;
6160 const FunctionType *Ty = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00006161 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006162 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6163 // Pull out the types of all of the arguments...
6164 std::vector<const Type*> ParamTypes;
Chris Lattner59363a32008-02-19 04:36:25 +00006165 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006166 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006167 const Type *Ty = I->Val->getType();
6168 if (Ty == Type::VoidTy)
6169 GEN_ERROR("Short call syntax cannot be used with varargs");
6170 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006171 }
Chris Lattner59363a32008-02-19 04:36:25 +00006172 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006173 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006174 }
6175
Chris Lattner59363a32008-02-19 04:36:25 +00006176 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006177 CHECK_FOR_ERROR
6178
6179 // Check for call to invalid intrinsic to avoid crashing later.
6180 if (Function *theF = dyn_cast<Function>(V)) {
6181 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6182 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6183 !theF->getIntrinsicID(true))
6184 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6185 theF->getName() + "'");
6186 }
6187
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006188 // Set up the ParamAttrs for the function
6189 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00006190 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006191 ParamAttrsWithIndex PAWI;
6192 PAWI.index = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00006193 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006194 Attrs.push_back(PAWI);
6195 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006196 // Check the arguments
6197 ValueList Args;
Chris Lattner59363a32008-02-19 04:36:25 +00006198 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006199 // Make sure no arguments is a good thing!
6200 if (Ty->getNumParams() != 0)
6201 GEN_ERROR("No arguments passed to a function that "
6202 "expects arguments");
6203 } else { // Has arguments?
6204 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006205 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006206 FunctionType::param_iterator I = Ty->param_begin();
6207 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner59363a32008-02-19 04:36:25 +00006208 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006209 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006210
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006211 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006212 if (ArgI->Val->getType() != *I)
6213 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6214 (*I)->getDescription() + "'");
6215 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006216 if (ArgI->Attrs != ParamAttr::None) {
6217 ParamAttrsWithIndex PAWI;
6218 PAWI.index = index;
6219 PAWI.attrs = ArgI->Attrs;
6220 Attrs.push_back(PAWI);
6221 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006222 }
6223 if (Ty->isVarArg()) {
6224 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006225 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006226 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner59363a32008-02-19 04:36:25 +00006227 if (ArgI->Attrs != ParamAttr::None) {
6228 ParamAttrsWithIndex PAWI;
6229 PAWI.index = index;
6230 PAWI.attrs = ArgI->Attrs;
6231 Attrs.push_back(PAWI);
6232 }
6233 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006234 } else if (I != E || ArgI != ArgE)
6235 GEN_ERROR("Invalid number of parameters detected");
6236 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006237
6238 // Finish off the ParamAttrs and check them
Duncan Sands637ec552007-11-28 17:07:01 +00006239 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006240 if (!Attrs.empty())
6241 PAL = ParamAttrsList::get(Attrs);
6242
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006243 // Create the call node
David Greene9145dd22007-08-01 03:59:32 +00006244 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Chris Lattner59363a32008-02-19 04:36:25 +00006245 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6246 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006247 CI->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00006248 (yyval.InstVal) = CI;
6249 delete (yyvsp[(6) - (8)].ParamList);
6250 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006251 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006252 ;}
6253 break;
6254
Devang Patelbf507402008-02-20 22:40:23 +00006255 case 311:
Devang Patel087fe2b2008-02-23 00:38:56 +00006256#line 3066 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006257 {
6258 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006259 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006260 ;}
6261 break;
6262
Devang Patelbf507402008-02-20 22:40:23 +00006263 case 312:
Devang Patel087fe2b2008-02-23 00:38:56 +00006264#line 3071 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006265 {
6266 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006267 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006268 ;}
6269 break;
6270
Devang Patelbf507402008-02-20 22:40:23 +00006271 case 313:
Devang Patel087fe2b2008-02-23 00:38:56 +00006272#line 3075 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006273 {
6274 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006275 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006276 ;}
6277 break;
6278
Devang Patelbf507402008-02-20 22:40:23 +00006279 case 314:
Devang Patel087fe2b2008-02-23 00:38:56 +00006280#line 3082 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006281 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006282 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006283 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6284 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6285 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006286 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006287 ;}
6288 break;
6289
Devang Patelbf507402008-02-20 22:40:23 +00006290 case 315:
Devang Patel087fe2b2008-02-23 00:38:56 +00006291#line 3089 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006292 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006293 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006294 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6295 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006296 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006297 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6298 delete (yyvsp[(2) - (6)].TypeVal);
6299 ;}
6300 break;
6301
Devang Patelbf507402008-02-20 22:40:23 +00006302 case 316:
Devang Patel087fe2b2008-02-23 00:38:56 +00006303#line 3097 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006304 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006305 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006306 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6307 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6308 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006309 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006310 ;}
6311 break;
6312
Devang Patelbf507402008-02-20 22:40:23 +00006313 case 317:
Devang Patel087fe2b2008-02-23 00:38:56 +00006314#line 3104 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006315 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006316 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006317 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6318 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006319 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006320 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6321 delete (yyvsp[(2) - (6)].TypeVal);
6322 ;}
6323 break;
6324
Devang Patelbf507402008-02-20 22:40:23 +00006325 case 318:
Devang Patel087fe2b2008-02-23 00:38:56 +00006326#line 3112 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006327 {
6328 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 GEN_ERROR("Trying to free nonpointer type " +
Chris Lattner59363a32008-02-19 04:36:25 +00006330 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6331 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006332 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006333 ;}
6334 break;
6335
Devang Patelbf507402008-02-20 22:40:23 +00006336 case 319:
Devang Patel087fe2b2008-02-23 00:38:56 +00006337#line 3120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006338 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006339 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006340 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6341 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006342 GEN_ERROR("Can't load from nonpointer type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006343 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6344 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006345 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006346 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6347 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006348 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006349 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6350 delete (yyvsp[(3) - (5)].TypeVal);
6351 ;}
6352 break;
6353
Devang Patelbf507402008-02-20 22:40:23 +00006354 case 320:
Devang Patel087fe2b2008-02-23 00:38:56 +00006355#line 3134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006356 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006357 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006358 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6359 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006360 if (!PT)
6361 GEN_ERROR("Can't store to a nonpointer type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006362 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006363 const Type *ElTy = PT->getElementType();
Chris Lattner59363a32008-02-19 04:36:25 +00006364 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6365 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006366 "' into space of type '" + ElTy->getDescription() + "'");
6367
Chris Lattner59363a32008-02-19 04:36:25 +00006368 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006369 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006370 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6371 delete (yyvsp[(5) - (7)].TypeVal);
6372 ;}
6373 break;
6374
Devang Patelbf507402008-02-20 22:40:23 +00006375 case 321:
Devang Patel087fe2b2008-02-23 00:38:56 +00006376#line 3151 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel3b8849c2008-02-19 22:27:01 +00006377 {
Devang Patelb52f9e72008-02-22 19:31:30 +00006378 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
Devang Pateleb293342008-02-20 19:13:10 +00006379 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel3b8849c2008-02-19 22:27:01 +00006380 GEN_ERROR("Invalid getresult operands");
Devang Pateleb293342008-02-20 19:13:10 +00006381 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
Devang Patel087fe2b2008-02-23 00:38:56 +00006382 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel3b8849c2008-02-19 22:27:01 +00006383 CHECK_FOR_ERROR
6384 ;}
6385 break;
6386
Devang Patelbf507402008-02-20 22:40:23 +00006387 case 322:
Devang Patel087fe2b2008-02-23 00:38:56 +00006388#line 3159 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006389 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006390 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006391 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6392 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006393 GEN_ERROR("getelementptr insn requires pointer operand");
6394
Chris Lattner59363a32008-02-19 04:36:25 +00006395 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 +00006396 GEN_ERROR("Invalid getelementptr indices for type '" +
Chris Lattner59363a32008-02-19 04:36:25 +00006397 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6398 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006399 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006400 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6401 delete (yyvsp[(2) - (4)].TypeVal);
6402 delete (yyvsp[(4) - (4)].ValueList);
6403 ;}
6404 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006405
Chris Lattner59363a32008-02-19 04:36:25 +00006406
6407/* Line 1267 of yacc.c. */
Devang Patel087fe2b2008-02-23 00:38:56 +00006408#line 6409 "llvmAsmParser.tab.c"
Chris Lattner59363a32008-02-19 04:36:25 +00006409 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006410 }
Chris Lattner59363a32008-02-19 04:36:25 +00006411 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6412
6413 YYPOPSTACK (yylen);
6414 yylen = 0;
6415 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006416
6417 *++yyvsp = yyval;
6418
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006419
Chris Lattner59363a32008-02-19 04:36:25 +00006420 /* Now `shift' the result of the reduction. Determine what state
6421 that goes to, based on the state we popped back to and the rule
6422 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006423
6424 yyn = yyr1[yyn];
6425
Chris Lattner59363a32008-02-19 04:36:25 +00006426 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6427 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006428 yystate = yytable[yystate];
6429 else
Chris Lattner59363a32008-02-19 04:36:25 +00006430 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006431
6432 goto yynewstate;
6433
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006434
Chris Lattner59363a32008-02-19 04:36:25 +00006435/*------------------------------------.
6436| yyerrlab -- here on detecting error |
6437`------------------------------------*/
6438yyerrlab:
6439 /* If not already recovering from an error, report this error. */
6440 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006441 {
6442 ++yynerrs;
Chris Lattner59363a32008-02-19 04:36:25 +00006443#if ! YYERROR_VERBOSE
6444 yyerror (YY_("syntax error"));
6445#else
6446 {
6447 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6448 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6449 {
6450 YYSIZE_T yyalloc = 2 * yysize;
6451 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6452 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6453 if (yymsg != yymsgbuf)
6454 YYSTACK_FREE (yymsg);
6455 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6456 if (yymsg)
6457 yymsg_alloc = yyalloc;
6458 else
6459 {
6460 yymsg = yymsgbuf;
6461 yymsg_alloc = sizeof yymsgbuf;
6462 }
6463 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006464
Chris Lattner59363a32008-02-19 04:36:25 +00006465 if (0 < yysize && yysize <= yymsg_alloc)
6466 {
6467 (void) yysyntax_error (yymsg, yystate, yychar);
6468 yyerror (yymsg);
6469 }
6470 else
6471 {
6472 yyerror (YY_("syntax error"));
6473 if (yysize != 0)
6474 goto yyexhaustedlab;
6475 }
6476 }
6477#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006478 }
6479
Chris Lattner59363a32008-02-19 04:36:25 +00006480
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006481
6482 if (yyerrstatus == 3)
6483 {
Chris Lattner59363a32008-02-19 04:36:25 +00006484 /* If just tried and failed to reuse look-ahead token after an
6485 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006486
Chris Lattner59363a32008-02-19 04:36:25 +00006487 if (yychar <= YYEOF)
6488 {
6489 /* Return failure if at end of input. */
6490 if (yychar == YYEOF)
6491 YYABORT;
6492 }
6493 else
6494 {
6495 yydestruct ("Error: discarding",
6496 yytoken, &yylval);
6497 yychar = YYEMPTY;
6498 }
6499 }
6500
6501 /* Else will try to reuse look-ahead token after shifting the error
6502 token. */
6503 goto yyerrlab1;
6504
6505
6506/*---------------------------------------------------.
6507| yyerrorlab -- error raised explicitly by YYERROR. |
6508`---------------------------------------------------*/
6509yyerrorlab:
6510
6511 /* Pacify compilers like GCC when the user code never invokes
6512 YYERROR and the label yyerrorlab therefore never appears in user
6513 code. */
6514 if (/*CONSTCOND*/ 0)
6515 goto yyerrorlab;
6516
6517 /* Do not reclaim the symbols of the rule which action triggered
6518 this YYERROR. */
6519 YYPOPSTACK (yylen);
6520 yylen = 0;
6521 YY_STACK_PRINT (yyss, yyssp);
6522 yystate = *yyssp;
6523 goto yyerrlab1;
6524
6525
6526/*-------------------------------------------------------------.
6527| yyerrlab1 -- common code for both syntax error and YYERROR. |
6528`-------------------------------------------------------------*/
6529yyerrlab1:
6530 yyerrstatus = 3; /* Each real token shifted decrements this. */
6531
6532 for (;;)
6533 {
6534 yyn = yypact[yystate];
6535 if (yyn != YYPACT_NINF)
6536 {
6537 yyn += YYTERROR;
6538 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6539 {
6540 yyn = yytable[yyn];
6541 if (0 < yyn)
6542 break;
6543 }
6544 }
6545
6546 /* Pop the current state because it cannot handle the error token. */
6547 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006548 YYABORT;
6549
Dale Johannesen3afee192007-09-07 21:07:57 +00006550
Chris Lattner59363a32008-02-19 04:36:25 +00006551 yydestruct ("Error: popping",
6552 yystos[yystate], yyvsp);
6553 YYPOPSTACK (1);
6554 yystate = *yyssp;
6555 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006556 }
6557
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006558 if (yyn == YYFINAL)
6559 YYACCEPT;
6560
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006561 *++yyvsp = yylval;
Chris Lattner59363a32008-02-19 04:36:25 +00006562
6563
6564 /* Shift the error token. */
6565 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006566
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006567 yystate = yyn;
6568 goto yynewstate;
6569
Scott Michel6d1aba82008-01-30 03:10:00 +00006570
Chris Lattner59363a32008-02-19 04:36:25 +00006571/*-------------------------------------.
6572| yyacceptlab -- YYACCEPT comes here. |
6573`-------------------------------------*/
6574yyacceptlab:
6575 yyresult = 0;
6576 goto yyreturn;
6577
6578/*-----------------------------------.
6579| yyabortlab -- YYABORT comes here. |
6580`-----------------------------------*/
6581yyabortlab:
6582 yyresult = 1;
6583 goto yyreturn;
6584
6585#ifndef yyoverflow
6586/*-------------------------------------------------.
6587| yyexhaustedlab -- memory exhaustion comes here. |
6588`-------------------------------------------------*/
6589yyexhaustedlab:
6590 yyerror (YY_("memory exhausted"));
6591 yyresult = 2;
6592 /* Fall through. */
Scott Michel5a6f17b2008-01-30 02:55:46 +00006593#endif
Chris Lattner59363a32008-02-19 04:36:25 +00006594
6595yyreturn:
6596 if (yychar != YYEOF && yychar != YYEMPTY)
6597 yydestruct ("Cleanup: discarding lookahead",
6598 yytoken, &yylval);
6599 /* Do not reclaim the symbols of the rule which action triggered
6600 this YYABORT or YYACCEPT. */
6601 YYPOPSTACK (yylen);
6602 YY_STACK_PRINT (yyss, yyssp);
6603 while (yyssp != yyss)
6604 {
6605 yydestruct ("Cleanup: popping",
6606 yystos[*yyssp], yyvsp);
6607 YYPOPSTACK (1);
Scott Michel6d1aba82008-01-30 03:10:00 +00006608 }
Chris Lattner59363a32008-02-19 04:36:25 +00006609#ifndef yyoverflow
6610 if (yyss != yyssa)
6611 YYSTACK_FREE (yyss);
6612#endif
6613#if YYERROR_VERBOSE
6614 if (yymsg != yymsgbuf)
6615 YYSTACK_FREE (yymsg);
6616#endif
6617 /* Make sure YYID is used. */
6618 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006619}
Chris Lattner59363a32008-02-19 04:36:25 +00006620
6621
Devang Patel087fe2b2008-02-23 00:38:56 +00006622#line 3176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006623
6624
6625// common code from the two 'RunVMAsmParser' functions
6626static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006627 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006628 // Check to make sure the parser succeeded
6629 if (yyparse()) {
6630 if (ParserResult)
6631 delete ParserResult;
6632 return 0;
6633 }
6634
6635 // Emit an error if there are any unresolved types left.
6636 if (!CurModule.LateResolveTypes.empty()) {
6637 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6638 if (DID.Type == ValID::LocalName) {
6639 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6640 } else {
6641 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6642 }
6643 if (ParserResult)
6644 delete ParserResult;
6645 return 0;
6646 }
6647
6648 // Emit an error if there are any unresolved values left.
6649 if (!CurModule.LateResolveValues.empty()) {
6650 Value *V = CurModule.LateResolveValues.back();
6651 std::map<Value*, std::pair<ValID, int> >::iterator I =
6652 CurModule.PlaceHolderInfo.find(V);
6653
6654 if (I != CurModule.PlaceHolderInfo.end()) {
6655 ValID &DID = I->second.first;
6656 if (DID.Type == ValID::LocalName) {
6657 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6658 } else {
6659 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6660 }
6661 if (ParserResult)
6662 delete ParserResult;
6663 return 0;
6664 }
6665 }
6666
6667 // Check to make sure that parsing produced a result
6668 if (!ParserResult)
6669 return 0;
6670
6671 // Reset ParserResult variable while saving its value for the result.
6672 Module *Result = ParserResult;
6673 ParserResult = 0;
6674
6675 return Result;
6676}
6677
6678void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006679 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006680 // TODO: column number in exception
6681 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006682 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006683 TriggerError = 1;
6684}
6685
6686int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006687 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006688 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006689 if (yychar != YYEMPTY && yychar != 0) {
6690 errMsg += " while reading token: '";
6691 errMsg += std::string(LLLgetTokenStart(),
6692 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6693 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006694 GenerateError(errMsg);
6695 return 0;
6696}
Chris Lattner59363a32008-02-19 04:36:25 +00006697