blob: ba221d7dfc3f71109ada59a56a0f2a43cdd60843 [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 Patelbf507402008-02-20 22:40:23 +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"
396#include <algorithm>
397#include <list>
398#include <map>
399#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000400
401// The following is a gross hack. In order to rid the libAsmParser library of
402// exceptions, we have to have a way of getting the yyparse function to go into
403// an error situation. So, whenever we want an error to occur, the GenerateError
404// function (see bottom of file) sets TriggerError. Then, at the end of each
405// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
406// (a goto) to put YACC in error state. Furthermore, several calls to
407// GenerateError are made from inside productions and they must simulate the
408// previous exception behavior by exiting the production immediately. We have
409// replaced these with the GEN_ERROR macro which calls GeneratError and then
410// immediately invokes YYERROR. This would be so much cleaner if it was a
411// recursive descent parser.
412static bool TriggerError = false;
413#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
414#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
415
416int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
417int yylex(); // declaration" of xxx warnings.
418int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000419using namespace llvm;
420
421static Module *ParserResult;
422
423// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
424// relating to upreferences in the input stream.
425//
426//#define DEBUG_UPREFS 1
427#ifdef DEBUG_UPREFS
428#define UR_OUT(X) cerr << X
429#else
430#define UR_OUT(X)
431#endif
432
433#define YYERROR_VERBOSE 1
434
435static GlobalVariable *CurGV;
436
437
438// This contains info used when building the body of a function. It is
439// destroyed when the function is completed.
440//
441typedef std::vector<Value *> ValueList; // Numbered defs
442
443static void
444ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
445
446static struct PerModuleInfo {
447 Module *CurrentModule;
448 ValueList Values; // Module level numbered definitions
449 ValueList LateResolveValues;
450 std::vector<PATypeHolder> Types;
451 std::map<ValID, PATypeHolder> LateResolveTypes;
452
453 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
454 /// how they were referenced and on which line of the input they came from so
455 /// that we can resolve them later and print error messages as appropriate.
456 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
457
458 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
459 // references to global values. Global values may be referenced before they
460 // are defined, and if so, the temporary object that they represent is held
461 // here. This is used for forward references of GlobalValues.
462 //
463 typedef std::map<std::pair<const PointerType *,
464 ValID>, GlobalValue*> GlobalRefsType;
465 GlobalRefsType GlobalRefs;
466
467 void ModuleDone() {
468 // If we could not resolve some functions at function compilation time
469 // (calls to functions before they are defined), resolve them now... Types
470 // are resolved when the constant pool has been completely parsed.
471 //
472 ResolveDefinitions(LateResolveValues);
473 if (TriggerError)
474 return;
475
476 // Check to make sure that all global value forward references have been
477 // resolved!
478 //
479 if (!GlobalRefs.empty()) {
480 std::string UndefinedReferences = "Unresolved global references exist:\n";
481
482 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
483 I != E; ++I) {
484 UndefinedReferences += " " + I->first.first->getDescription() + " " +
485 I->first.second.getName() + "\n";
486 }
487 GenerateError(UndefinedReferences);
488 return;
489 }
490
Chandler Carruth563d4a42007-08-04 01:56:21 +0000491 // Look for intrinsic functions and CallInst that need to be upgraded
492 for (Module::iterator FI = CurrentModule->begin(),
493 FE = CurrentModule->end(); FI != FE; )
494 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
495
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000496 Values.clear(); // Clear out function local definitions
497 Types.clear();
498 CurrentModule = 0;
499 }
500
501 // GetForwardRefForGlobal - Check to see if there is a forward reference
502 // for this global. If so, remove it from the GlobalRefs map and return it.
503 // If not, just return null.
504 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
505 // Check to see if there is a forward reference to this global variable...
506 // if there is, eliminate it and patch the reference to use the new def'n.
507 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
508 GlobalValue *Ret = 0;
509 if (I != GlobalRefs.end()) {
510 Ret = I->second;
511 GlobalRefs.erase(I);
512 }
513 return Ret;
514 }
515
516 bool TypeIsUnresolved(PATypeHolder* PATy) {
517 // If it isn't abstract, its resolved
518 const Type* Ty = PATy->get();
519 if (!Ty->isAbstract())
520 return false;
521 // Traverse the type looking for abstract types. If it isn't abstract then
522 // we don't need to traverse that leg of the type.
523 std::vector<const Type*> WorkList, SeenList;
524 WorkList.push_back(Ty);
525 while (!WorkList.empty()) {
526 const Type* Ty = WorkList.back();
527 SeenList.push_back(Ty);
528 WorkList.pop_back();
529 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
530 // Check to see if this is an unresolved type
531 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
532 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
533 for ( ; I != E; ++I) {
534 if (I->second.get() == OpTy)
535 return true;
536 }
537 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
538 const Type* TheTy = SeqTy->getElementType();
539 if (TheTy->isAbstract() && TheTy != Ty) {
540 std::vector<const Type*>::iterator I = SeenList.begin(),
541 E = SeenList.end();
542 for ( ; I != E; ++I)
543 if (*I == TheTy)
544 break;
545 if (I == E)
546 WorkList.push_back(TheTy);
547 }
548 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
549 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
550 const Type* TheTy = StrTy->getElementType(i);
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
553 E = SeenList.end();
554 for ( ; I != E; ++I)
555 if (*I == TheTy)
556 break;
557 if (I == E)
558 WorkList.push_back(TheTy);
559 }
560 }
561 }
562 }
563 return false;
564 }
565} CurModule;
566
567static struct PerFunctionInfo {
568 Function *CurrentFunction; // Pointer to current function being created
569
570 ValueList Values; // Keep track of #'d definitions
571 unsigned NextValNum;
572 ValueList LateResolveValues;
573 bool isDeclare; // Is this function a forward declararation?
574 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
575 GlobalValue::VisibilityTypes Visibility;
576
577 /// BBForwardRefs - When we see forward references to basic blocks, keep
578 /// track of them here.
579 std::map<ValID, BasicBlock*> BBForwardRefs;
580
581 inline PerFunctionInfo() {
582 CurrentFunction = 0;
583 isDeclare = false;
584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
586 }
587
588 inline void FunctionStart(Function *M) {
589 CurrentFunction = M;
590 NextValNum = 0;
591 }
592
593 void FunctionDone() {
594 // Any forward referenced blocks left?
595 if (!BBForwardRefs.empty()) {
596 GenerateError("Undefined reference to label " +
597 BBForwardRefs.begin()->second->getName());
598 return;
599 }
600
601 // Resolve all forward references now.
602 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
603
604 Values.clear(); // Clear out function local definitions
605 BBForwardRefs.clear();
606 CurrentFunction = 0;
607 isDeclare = false;
608 Linkage = GlobalValue::ExternalLinkage;
609 Visibility = GlobalValue::DefaultVisibility;
610 }
611} CurFun; // Info for the current function...
612
613static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
614
615
616//===----------------------------------------------------------------------===//
617// Code to handle definitions of all the types
618//===----------------------------------------------------------------------===//
619
620static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
621 // Things that have names or are void typed don't get slot numbers
622 if (V->hasName() || (V->getType() == Type::VoidTy))
623 return;
624
625 // In the case of function values, we have to allow for the forward reference
626 // of basic blocks, which are included in the numbering. Consequently, we keep
627 // track of the next insertion location with NextValNum. When a BB gets
628 // inserted, it could change the size of the CurFun.Values vector.
629 if (&ValueTab == &CurFun.Values) {
630 if (ValueTab.size() <= CurFun.NextValNum)
631 ValueTab.resize(CurFun.NextValNum+1);
632 ValueTab[CurFun.NextValNum++] = V;
633 return;
634 }
635 // For all other lists, its okay to just tack it on the back of the vector.
636 ValueTab.push_back(V);
637}
638
639static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
640 switch (D.Type) {
641 case ValID::LocalID: // Is it a numbered definition?
642 // Module constants occupy the lowest numbered slots...
643 if (D.Num < CurModule.Types.size())
644 return CurModule.Types[D.Num];
645 break;
646 case ValID::LocalName: // Is it a named definition?
647 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
648 D.destroy(); // Free old strdup'd memory...
649 return N;
650 }
651 break;
652 default:
653 GenerateError("Internal parser error: Invalid symbol type reference");
654 return 0;
655 }
656
657 // If we reached here, we referenced either a symbol that we don't know about
658 // or an id number that hasn't been read yet. We may be referencing something
659 // forward, so just create an entry to be resolved later and get to it...
660 //
661 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
662
663
664 if (inFunctionScope()) {
665 if (D.Type == ValID::LocalName) {
666 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
667 return 0;
668 } else {
669 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
670 return 0;
671 }
672 }
673
674 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
675 if (I != CurModule.LateResolveTypes.end())
676 return I->second;
677
678 Type *Typ = OpaqueType::get();
679 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
680 return Typ;
681 }
682
683// getExistingVal - Look up the value specified by the provided type and
684// the provided ValID. If the value exists and has already been defined, return
685// it. Otherwise return null.
686//
687static Value *getExistingVal(const Type *Ty, const ValID &D) {
688 if (isa<FunctionType>(Ty)) {
689 GenerateError("Functions are not values and "
690 "must be referenced as pointers");
691 return 0;
692 }
693
694 switch (D.Type) {
695 case ValID::LocalID: { // Is it a numbered definition?
696 // Check that the number is within bounds.
697 if (D.Num >= CurFun.Values.size())
698 return 0;
699 Value *Result = CurFun.Values[D.Num];
700 if (Ty != Result->getType()) {
701 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
702 Result->getType()->getDescription() + "' does not match "
703 "expected type, '" + Ty->getDescription() + "'");
704 return 0;
705 }
706 return Result;
707 }
708 case ValID::GlobalID: { // Is it a numbered definition?
709 if (D.Num >= CurModule.Values.size())
710 return 0;
711 Value *Result = CurModule.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
716 return 0;
717 }
718 return Result;
719 }
720
721 case ValID::LocalName: { // Is it a named definition?
722 if (!inFunctionScope())
723 return 0;
724 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
725 Value *N = SymTab.lookup(D.getName());
726 if (N == 0)
727 return 0;
728 if (N->getType() != Ty)
729 return 0;
730
731 D.destroy(); // Free old strdup'd memory...
732 return N;
733 }
734 case ValID::GlobalName: { // Is it a named definition?
735 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
736 Value *N = SymTab.lookup(D.getName());
737 if (N == 0)
738 return 0;
739 if (N->getType() != Ty)
740 return 0;
741
742 D.destroy(); // Free old strdup'd memory...
743 return N;
744 }
745
746 // Check to make sure that "Ty" is an integral type, and that our
747 // value will fit into the specified type...
748 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000749 if (!isa<IntegerType>(Ty) ||
750 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000751 GenerateError("Signed integral constant '" +
752 itostr(D.ConstPool64) + "' is invalid for type '" +
753 Ty->getDescription() + "'");
754 return 0;
755 }
756 return ConstantInt::get(Ty, D.ConstPool64, true);
757
758 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000759 if (isa<IntegerType>(Ty) &&
760 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000761 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000762
763 if (!isa<IntegerType>(Ty) ||
764 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
765 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
766 "' is invalid or out of range for type '" +
767 Ty->getDescription() + "'");
768 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000769 }
Chris Lattner59363a32008-02-19 04:36:25 +0000770 // This is really a signed reference. Transmogrify.
771 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000772
773 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000774 if (!Ty->isFloatingPoint() ||
775 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000776 GenerateError("FP constant invalid for type");
777 return 0;
778 }
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000779 // Lexer has no type info, so builds all float and double FP constants
780 // as double. Fix this here. Long double does not need this.
781 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
782 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000783 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
784 return ConstantFP::get(Ty, *D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000785
786 case ValID::ConstNullVal: // Is it a null value?
787 if (!isa<PointerType>(Ty)) {
788 GenerateError("Cannot create a a non pointer null");
789 return 0;
790 }
791 return ConstantPointerNull::get(cast<PointerType>(Ty));
792
793 case ValID::ConstUndefVal: // Is it an undef value?
794 return UndefValue::get(Ty);
795
796 case ValID::ConstZeroVal: // Is it a zero value?
797 return Constant::getNullValue(Ty);
798
799 case ValID::ConstantVal: // Fully resolved constant?
800 if (D.ConstantValue->getType() != Ty) {
801 GenerateError("Constant expression type different from required type");
802 return 0;
803 }
804 return D.ConstantValue;
805
806 case ValID::InlineAsmVal: { // Inline asm expression
807 const PointerType *PTy = dyn_cast<PointerType>(Ty);
808 const FunctionType *FTy =
809 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
810 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
811 GenerateError("Invalid type for asm constraint string");
812 return 0;
813 }
814 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
815 D.IAD->HasSideEffects);
816 D.destroy(); // Free InlineAsmDescriptor.
817 return IA;
818 }
819 default:
820 assert(0 && "Unhandled case!");
821 return 0;
822 } // End of switch
823
824 assert(0 && "Unhandled case!");
825 return 0;
826}
827
828// getVal - This function is identical to getExistingVal, except that if a
829// value is not already defined, it "improvises" by creating a placeholder var
830// that looks and acts just like the requested variable. When the value is
831// defined later, all uses of the placeholder variable are replaced with the
832// real thing.
833//
834static Value *getVal(const Type *Ty, const ValID &ID) {
835 if (Ty == Type::LabelTy) {
836 GenerateError("Cannot use a basic block here");
837 return 0;
838 }
839
840 // See if the value has already been defined.
841 Value *V = getExistingVal(Ty, ID);
842 if (V) return V;
843 if (TriggerError) return 0;
844
845 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
846 GenerateError("Invalid use of a composite type");
847 return 0;
848 }
849
850 // If we reached here, we referenced either a symbol that we don't know about
851 // or an id number that hasn't been read yet. We may be referencing something
852 // forward, so just create an entry to be resolved later and get to it...
853 //
854 switch (ID.Type) {
855 case ValID::GlobalName:
856 case ValID::GlobalID: {
857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
858 if (!PTy) {
859 GenerateError("Invalid type for reference to global" );
860 return 0;
861 }
862 const Type* ElTy = PTy->getElementType();
863 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
864 V = new Function(FTy, GlobalValue::ExternalLinkage);
865 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000866 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
867 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000868 break;
869 }
870 default:
871 V = new Argument(Ty);
872 }
873
874 // Remember where this forward reference came from. FIXME, shouldn't we try
875 // to recycle these things??
876 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000877 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000878
879 if (inFunctionScope())
880 InsertValue(V, CurFun.LateResolveValues);
881 else
882 InsertValue(V, CurModule.LateResolveValues);
883 return V;
884}
885
886/// defineBBVal - This is a definition of a new basic block with the specified
887/// identifier which must be the same as CurFun.NextValNum, if its numeric.
888static BasicBlock *defineBBVal(const ValID &ID) {
889 assert(inFunctionScope() && "Can't get basic block at global scope!");
890
891 BasicBlock *BB = 0;
892
893 // First, see if this was forward referenced
894
895 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
896 if (BBI != CurFun.BBForwardRefs.end()) {
897 BB = BBI->second;
898 // The forward declaration could have been inserted anywhere in the
899 // function: insert it into the correct place now.
900 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
901 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
902
903 // We're about to erase the entry, save the key so we can clean it up.
904 ValID Tmp = BBI->first;
905
906 // Erase the forward ref from the map as its no longer "forward"
907 CurFun.BBForwardRefs.erase(ID);
908
909 // The key has been removed from the map but so we don't want to leave
910 // strdup'd memory around so destroy it too.
911 Tmp.destroy();
912
913 // If its a numbered definition, bump the number and set the BB value.
914 if (ID.Type == ValID::LocalID) {
915 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
916 InsertValue(BB);
917 }
918
919 ID.destroy();
920 return BB;
921 }
922
923 // We haven't seen this BB before and its first mention is a definition.
924 // Just create it and return it.
925 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
926 BB = new BasicBlock(Name, CurFun.CurrentFunction);
927 if (ID.Type == ValID::LocalID) {
928 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
929 InsertValue(BB);
930 }
931
932 ID.destroy(); // Free strdup'd memory
933 return BB;
934}
935
936/// getBBVal - get an existing BB value or create a forward reference for it.
937///
938static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
940
941 BasicBlock *BB = 0;
942
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
945 BB = BBI->second;
946 } if (ID.Type == ValID::LocalName) {
947 std::string Name = ID.getName();
948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000949 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
952 else
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000955 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
960 else
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
964 }
965 } else {
966 GenerateError("Illegal label reference " + ID.getName());
967 return 0;
968 }
969
970 // If its already been defined, return it now.
971 if (BB) {
972 ID.destroy(); // Free strdup'd memory.
973 return BB;
974 }
975
976 // Otherwise, this block has not been seen before, create it.
977 std::string Name;
978 if (ID.Type == ValID::LocalName)
979 Name = ID.getName();
980 BB = new BasicBlock(Name, CurFun.CurrentFunction);
981
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
984
985 return BB;
986}
987
988
989//===----------------------------------------------------------------------===//
990// Code to handle forward references in instructions
991//===----------------------------------------------------------------------===//
992//
993// This code handles the late binding needed with statements that reference
994// values not defined yet... for example, a forward branch, or the PHI node for
995// a loop body.
996//
997// This keeps a table (CurFun.LateResolveValues) of all such forward references
998// and back patchs after we are done.
999//
1000
1001// ResolveDefinitions - If we could not resolve some defs at parsing
1002// time (forward branches, phi functions for loops, etc...) resolve the
1003// defs now...
1004//
1005static void
1006ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
1011
1012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1015
1016 ValID &DID = PHI->second.first;
1017
1018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1019 if (TriggerError)
1020 return;
1021 if (TheRealValue) {
1022 V->replaceAllUsesWith(TheRealValue);
1023 delete V;
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1027 // resolver table
1028 InsertValue(V, *FutureLateResolvers);
1029 } else {
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
1034 return;
1035 } else {
1036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1040 return;
1041 }
1042 }
1043 }
1044 LateResolvers.clear();
1045}
1046
1047// ResolveTypeTo - A brand new type was just declared. This means that (if
1048// name is not null) things referencing Name can be resolved. Otherwise, things
1049// refering to the number can be resolved. Do this now.
1050//
1051static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1052 ValID D;
1053 if (Name)
1054 D = ValID::createLocalName(*Name);
1055 else
1056 D = ValID::createLocalID(CurModule.Types.size());
1057
1058 std::map<ValID, PATypeHolder>::iterator I =
1059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
1061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1062 CurModule.LateResolveTypes.erase(I);
1063 }
1064}
1065
1066// setValueName - Set the specified value to the name given. The name may be
1067// null potentially, in which case this is a noop. The string passed in is
1068// assumed to be a malloc'd string buffer, and is free'd by this function.
1069//
1070static void setValueName(Value *V, std::string *NameStr) {
1071 if (!NameStr) return;
1072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
1074
1075 if (V->getType() == Type::VoidTy) {
1076 GenerateError("Can't assign name '" + Name+"' to value with void type");
1077 return;
1078 }
1079
1080 assert(inFunctionScope() && "Must be in function scope!");
1081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
1083 GenerateError("Redefinition of value '" + Name + "' of type '" +
1084 V->getType()->getDescription() + "'");
1085 return;
1086 }
1087
1088 // Set the name.
1089 V->setName(Name);
1090}
1091
1092/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093/// this is a declaration, otherwise it is a definition.
1094static GlobalVariable *
1095ParseGlobalVariable(std::string *NameStr,
1096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
1098 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001101 if (isa<FunctionType>(Ty)) {
1102 GenerateError("Cannot declare global vars of function type");
1103 return 0;
1104 }
1105
Christopher Lamb0a243582007-12-11 09:02:08 +00001106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001107
1108 std::string Name;
1109 if (NameStr) {
1110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
1112 }
1113
1114 // See if this global value was forward referenced. If so, recycle the
1115 // object.
1116 ValID ID;
1117 if (!Name.empty()) {
1118 ID = ValID::createGlobalName(Name);
1119 } else {
1120 ID = ValID::createGlobalID(CurModule.Values.size());
1121 }
1122
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
1131 GV->setVisibility(Visibility);
1132 GV->setConstant(isConstantGlobal);
1133 GV->setThreadLocal(IsThreadLocal);
1134 InsertValue(GV, CurModule.Values);
1135 return GV;
1136 }
1137
1138 // If this global has a name
1139 if (!Name.empty()) {
1140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1151 return 0;
1152 }
1153 }
1154
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001159 GV->setVisibility(Visibility);
1160 InsertValue(GV, CurModule.Values);
1161 return GV;
1162}
1163
1164// setTypeName - Set the specified type to the name given. The name may be
1165// null potentially, in which case this is a noop. The string passed in is
1166// assumed to be a malloc'd string buffer, and is freed by this function.
1167//
1168// This function returns true if the type has already been defined, but is
1169// allowed to be redefined in the specified context. If the name is a new name
1170// for the type plane, it is inserted and false is returned.
1171static bool setTypeName(const Type *T, std::string *NameStr) {
1172 assert(!inFunctionScope() && "Can't give types function-local names!");
1173 if (NameStr == 0) return false;
1174
1175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
1177
1178 // We don't allow assigning names to void type
1179 if (T == Type::VoidTy) {
1180 GenerateError("Can't assign name '" + Name + "' to the void type");
1181 return false;
1182 }
1183
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1186
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1189 assert(Existing && "Conflict but no matching type?!");
1190
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1196 return true;
1197 }
1198
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1204
1205 // Any other kind of (non-equivalent) redefinition is an error.
1206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1207 T->getDescription() + "'");
1208 }
1209
1210 return false;
1211}
1212
1213//===----------------------------------------------------------------------===//
1214// Code for handling upreferences in type names...
1215//
1216
1217// TypeContains - Returns true if Ty directly contains E in it.
1218//
1219static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1222}
1223
1224namespace {
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1229
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1233
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1237
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1240 };
1241}
1242
1243// UpRefs - A list of the outstanding upreferences that need to be resolved.
1244static std::vector<UpRefRecord> UpRefs;
1245
1246/// HandleUpRefs - Every time we finish a new layer of types, this function is
1247/// called. It loops through the UpRefs vector, which is a list of the
1248/// currently active types. For each type, if the up reference is contained in
1249/// the newly completed type, we decrement the level count. When the level
1250/// count reaches zero, the upreferenced type is the type that is passed in:
1251/// thus we can complete the cycle.
1252///
1253static PATypeHolder HandleUpRefs(const Type *ty) {
1254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1257
1258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1262
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1266 // this variable.
1267 OpaqueType *TypeToResolve = 0;
1268
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1281 } else {
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1288 }
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1291 }
1292 }
1293 }
1294
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1300 }
1301
1302 return Ty;
1303}
1304
1305//===----------------------------------------------------------------------===//
1306// RunVMAsmParser - Define an interface to this parser
1307//===----------------------------------------------------------------------===//
1308//
1309static Module* RunParser(Module * M);
1310
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001311Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1312 InitLLLexer(MB);
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1314 FreeLexer();
1315 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001316}
1317
1318
Chris Lattner59363a32008-02-19 04:36:25 +00001319
1320/* Enabling traces. */
1321#ifndef YYDEBUG
1322# define YYDEBUG 0
1323#endif
1324
1325/* Enabling verbose error messages. */
1326#ifdef YYERROR_VERBOSE
1327# undef YYERROR_VERBOSE
1328# define YYERROR_VERBOSE 1
1329#else
1330# define YYERROR_VERBOSE 0
1331#endif
1332
1333/* Enabling the token table. */
1334#ifndef YYTOKEN_TABLE
1335# define YYTOKEN_TABLE 0
1336#endif
1337
1338#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339typedef union YYSTYPE
Devang Patelbf507402008-02-20 22:40:23 +00001340#line 952 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00001341{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
1344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
1347 llvm::Constant *ConstVal;
1348
1349 const llvm::Type *PrimType;
1350 std::list<llvm::PATypeHolder> *TypeList;
1351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
1353 std::vector<llvm::Value*> *ValueList;
1354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001357 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001358
1359 // Represent the RHS of PHI node
1360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
1362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1363 std::vector<llvm::Constant*> *ConstVector;
1364
1365 llvm::GlobalValue::LinkageTypes Linkage;
1366 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesend915ee52008-02-19 21:40:51 +00001367 llvm::ParameterAttributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001368 llvm::APInt *APIntVal;
1369 int64_t SInt64Val;
1370 uint64_t UInt64Val;
1371 int SIntVal;
1372 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001373 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001374 bool BoolVal;
1375
1376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
1378
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
Chris Lattner59363a32008-02-19 04:36:25 +00001386}
Devang Pateleb293342008-02-20 19:13:10 +00001387/* Line 193 of yacc.c. */
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +00001388#line 1389 "llvmAsmParser.tab.c"
Chris Lattner59363a32008-02-19 04:36:25 +00001389 YYSTYPE;
1390# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391# define YYSTYPE_IS_DECLARED 1
1392# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001393#endif
1394
1395
1396
Chris Lattner59363a32008-02-19 04:36:25 +00001397/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001398
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001399
Chris Lattner59363a32008-02-19 04:36:25 +00001400/* Line 216 of yacc.c. */
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +00001401#line 1402 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001402
Chris Lattner59363a32008-02-19 04:36:25 +00001403#ifdef short
1404# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405#endif
1406
Chris Lattner59363a32008-02-19 04:36:25 +00001407#ifdef YYTYPE_UINT8
1408typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409#else
Chris Lattner59363a32008-02-19 04:36:25 +00001410typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411#endif
1412
Chris Lattner59363a32008-02-19 04:36:25 +00001413#ifdef YYTYPE_INT8
1414typedef YYTYPE_INT8 yytype_int8;
1415#elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417typedef signed char yytype_int8;
1418#else
1419typedef short int yytype_int8;
1420#endif
1421
1422#ifdef YYTYPE_UINT16
1423typedef YYTYPE_UINT16 yytype_uint16;
1424#else
1425typedef unsigned short int yytype_uint16;
1426#endif
1427
1428#ifdef YYTYPE_INT16
1429typedef YYTYPE_INT16 yytype_int16;
1430#else
1431typedef short int yytype_int16;
1432#endif
1433
1434#ifndef YYSIZE_T
1435# ifdef __SIZE_TYPE__
1436# define YYSIZE_T __SIZE_TYPE__
1437# elif defined size_t
1438# define YYSIZE_T size_t
1439# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442# define YYSIZE_T size_t
1443# else
1444# define YYSIZE_T unsigned int
1445# endif
1446#endif
1447
1448#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1449
1450#ifndef YY_
Devang Pateleb293342008-02-20 19:13:10 +00001451# if defined YYENABLE_NLS && YYENABLE_NLS
Chris Lattner59363a32008-02-19 04:36:25 +00001452# if ENABLE_NLS
1453# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454# define YY_(msgid) dgettext ("bison-runtime", msgid)
1455# endif
1456# endif
1457# ifndef YY_
1458# define YY_(msgid) msgid
1459# endif
1460#endif
1461
1462/* Suppress unused-variable warnings by "using" E. */
1463#if ! defined lint || defined __GNUC__
1464# define YYUSE(e) ((void) (e))
1465#else
1466# define YYUSE(e) /* empty */
1467#endif
1468
1469/* Identity function, used to suppress warnings about constant conditions. */
1470#ifndef lint
1471# define YYID(n) (n)
1472#else
1473#if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1475static int
1476YYID (int i)
1477#else
1478static int
1479YYID (i)
1480 int i;
1481#endif
1482{
1483 return i;
1484}
1485#endif
1486
1487#if ! defined yyoverflow || YYERROR_VERBOSE
1488
1489/* The parser invokes alloca or malloc; define the necessary symbols. */
1490
1491# ifdef YYSTACK_USE_ALLOCA
1492# if YYSTACK_USE_ALLOCA
1493# ifdef __GNUC__
1494# define YYSTACK_ALLOC __builtin_alloca
1495# elif defined __BUILTIN_VA_ARG_INCR
1496# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1497# elif defined _AIX
1498# define YYSTACK_ALLOC __alloca
1499# elif defined _MSC_VER
1500# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501# define alloca _alloca
1502# else
1503# define YYSTACK_ALLOC alloca
1504# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1507# ifndef _STDLIB_H
1508# define _STDLIB_H 1
1509# endif
1510# endif
1511# endif
1512# endif
1513# endif
1514
1515# ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518# ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1524# endif
1525# else
1526# define YYSTACK_ALLOC YYMALLOC
1527# define YYSTACK_FREE YYFREE
1528# ifndef YYSTACK_ALLOC_MAXIMUM
1529# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1530# endif
1531# if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1535# ifndef _STDLIB_H
1536# define _STDLIB_H 1
1537# endif
1538# endif
1539# ifndef YYMALLOC
1540# define YYMALLOC malloc
1541# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1544# endif
1545# endif
1546# ifndef YYFREE
1547# define YYFREE free
1548# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550void free (void *); /* INFRINGES ON USER NAME SPACE */
1551# endif
1552# endif
1553# endif
1554#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1555
1556
1557#if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1560
1561/* A type that is properly aligned for any stack member. */
1562union yyalloc
1563{
1564 yytype_int16 yyss;
1565 YYSTYPE yyvs;
1566 };
1567
1568/* The size of the maximum gap between one aligned stack and the next. */
1569# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1570
1571/* The size of an array large to enough to hold all stacks, each with
1572 N elements. */
1573# define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1576
1577/* Copy COUNT objects from FROM to TO. The source and destination do
1578 not overlap. */
1579# ifndef YYCOPY
1580# if defined __GNUC__ && 1 < __GNUC__
1581# define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1583# else
1584# define YYCOPY(To, From, Count) \
1585 do \
1586 { \
1587 YYSIZE_T yyi; \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1590 } \
1591 while (YYID (0))
1592# endif
1593# endif
1594
1595/* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1599 stack. */
1600# define YYSTACK_RELOCATE(Stack) \
1601 do \
1602 { \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1608 } \
1609 while (YYID (0))
1610
1611#endif
1612
1613/* YYFINAL -- State number of the termination state. */
1614#define YYFINAL 43
1615/* YYLAST -- Last index in YYTABLE. */
Devang Patelbf507402008-02-20 22:40:23 +00001616#define YYLAST 1978
Chris Lattner59363a32008-02-19 04:36:25 +00001617
1618/* YYNTOKENS -- Number of terminals. */
Devang Patel3b8849c2008-02-19 22:27:01 +00001619#define YYNTOKENS 165
Chris Lattner59363a32008-02-19 04:36:25 +00001620/* YYNNTS -- Number of nonterminals. */
Devang Patelbf507402008-02-20 22:40:23 +00001621#define YYNNTS 85
Chris Lattner59363a32008-02-19 04:36:25 +00001622/* YYNRULES -- Number of rules. */
Devang Patelbf507402008-02-20 22:40:23 +00001623#define YYNRULES 322
Chris Lattner59363a32008-02-19 04:36:25 +00001624/* YYNRULES -- Number of states. */
Devang Patelbf507402008-02-20 22:40:23 +00001625#define YYNSTATES 629
Chris Lattner59363a32008-02-19 04:36:25 +00001626
1627/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628#define YYUNDEFTOK 2
Devang Patel3b8849c2008-02-19 22:27:01 +00001629#define YYMAXUTOK 405
Chris Lattner59363a32008-02-19 04:36:25 +00001630
1631#define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1633
1634/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635static const yytype_uint8 yytranslate[] =
1636{
1637 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001641 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001643 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001646 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
Chris Lattner59363a32008-02-19 04:36:25 +00001647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel3b8849c2008-02-19 22:27:01 +00001649 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00001650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Devang Patel3b8849c2008-02-19 22:27:01 +00001677 145, 146, 147, 148, 149, 150
Chris Lattner59363a32008-02-19 04:36:25 +00001678};
1679
1680#if YYDEBUG
1681/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1682 YYRHS. */
1683static const yytype_uint16 yyprhs[] =
1684{
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001696 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1697 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1698 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1699 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1700 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1701 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1702 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1704 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1705 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1706 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1707 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1708 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1709 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1710 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
Devang Patelbf507402008-02-20 22:40:23 +00001711 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1712 747, 750, 753, 757, 760, 761, 763, 766, 769, 773,
1713 783, 793, 802, 817, 819, 821, 828, 834, 837, 844,
1714 852, 857, 862, 869, 876, 877, 878, 882, 885, 887,
1715 893, 899, 906, 913, 918, 925, 930, 935, 942, 949,
1716 952, 961, 963, 965, 966, 970, 977, 981, 988, 991,
1717 997, 1005, 1011
Chris Lattner59363a32008-02-19 04:36:25 +00001718};
1719
1720/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1721static const yytype_int16 yyrhs[] =
1722{
Devang Patel3b8849c2008-02-19 22:27:01 +00001723 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
Chris Lattner59363a32008-02-19 04:36:25 +00001724 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1725 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1726 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1727 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1728 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1729 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1730 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1731 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1732 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1733 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1734 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patel3b8849c2008-02-19 22:27:01 +00001735 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1736 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1737 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
Chris Lattner59363a32008-02-19 04:36:25 +00001738 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00001739 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1740 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
Chris Lattner59363a32008-02-19 04:36:25 +00001741 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1742 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
Devang Patel3b8849c2008-02-19 22:27:01 +00001743 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1744 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001745 143, -1, 144, -1, 53, 4, -1, -1, 188, 187,
1746 -1, 138, -1, 141, -1, 137, -1, 136, -1, 145,
1747 -1, 146, -1, -1, 190, 189, -1, -1, 147, 22,
1748 -1, -1, 53, 4, -1, -1, 154, 53, 4, -1,
1749 34, 22, -1, -1, 194, -1, -1, 154, 197, 196,
1750 -1, 194, -1, 53, 4, -1, 11, -1, 12, -1,
1751 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1752 49, -1, 198, -1, 199, 175, 155, -1, 233, -1,
1753 156, 4, -1, 199, 151, 203, 152, 190, -1, 10,
1754 151, 203, 152, 190, -1, 157, 4, 158, 199, 159,
1755 -1, 160, 4, 158, 199, 161, -1, 162, 204, 163,
1756 -1, 162, 163, -1, 160, 162, 204, 163, 161, -1,
1757 160, 162, 163, 161, -1, 199, 188, -1, 199, -1,
1758 10, -1, 200, -1, 202, 154, 200, -1, 202, -1,
1759 202, 154, 39, -1, 39, -1, -1, 199, -1, 204,
1760 154, 199, -1, 199, 157, 207, 159, -1, 199, 157,
1761 159, -1, 199, 164, 22, -1, 199, 160, 207, 161,
1762 -1, 199, 162, 207, 163, -1, 199, 162, 163, -1,
1763 199, 160, 162, 207, 163, 161, -1, 199, 160, 162,
1764 163, 161, -1, 199, 40, -1, 199, 41, -1, 199,
1765 233, -1, 199, 206, -1, 199, 25, -1, 171, 3,
1766 -1, 171, 5, -1, 171, 4, -1, 171, 6, -1,
1767 11, 26, -1, 11, 27, -1, 172, 9, -1, 168,
Devang Patelbf507402008-02-20 22:40:23 +00001768 151, 205, 38, 199, 152, -1, 116, 151, 205, 245,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001769 152, -1, 130, 151, 205, 154, 205, 154, 205, 152,
1770 -1, 166, 151, 205, 154, 205, 152, -1, 167, 151,
1771 205, 154, 205, 152, -1, 89, 169, 151, 205, 154,
1772 205, 152, -1, 90, 170, 151, 205, 154, 205, 152,
1773 -1, 132, 151, 205, 154, 205, 152, -1, 133, 151,
1774 205, 154, 205, 154, 205, 152, -1, 134, 151, 205,
1775 154, 205, 154, 205, 152, -1, 207, 154, 205, -1,
1776 205, -1, 32, -1, 33, -1, 37, -1, -1, 201,
1777 233, -1, 122, 151, 210, 38, 199, 152, -1, 212,
1778 -1, -1, 213, -1, 212, 213, -1, -1, 31, 214,
1779 229, -1, -1, 30, 215, 230, -1, 59, 58, 219,
1780 -1, 176, 18, 199, -1, 176, 18, 10, -1, -1,
1781 178, 182, 209, 208, 205, 175, 216, 196, -1, -1,
1782 178, 180, 182, 209, 208, 205, 175, 217, 196, -1,
1783 -1, 178, 181, 182, 209, 208, 199, 175, 218, 196,
1784 -1, 178, 182, 35, 185, 210, -1, 51, 220, -1,
1785 55, 153, 221, -1, 22, -1, 52, 153, 22, -1,
1786 67, 153, 22, -1, 157, 222, 159, -1, 222, 154,
1787 22, -1, 22, -1, -1, 223, 154, 199, 188, 174,
1788 -1, 199, 188, 174, -1, 223, -1, 223, 154, 39,
1789 -1, 39, -1, -1, 186, 201, 177, 151, 224, 152,
1790 190, 195, 192, 191, -1, 28, -1, 162, -1, 184,
Devang Patelbf507402008-02-20 22:40:23 +00001791 182, 225, 226, -1, 29, -1, 163, -1, 237, 228,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001792 -1, 183, 182, 225, -1, -1, 60, -1, 3, -1,
1793 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1794 41, -1, 25, -1, 160, 207, 161, -1, 206, -1,
1795 58, 231, 22, 154, 22, -1, 7, -1, 8, -1,
1796 173, -1, 177, -1, 233, -1, 232, -1, 199, 234,
Devang Patelbf507402008-02-20 22:40:23 +00001797 -1, 235, -1, 236, 154, 205, -1, 237, 238, -1,
1798 227, 238, -1, 239, 176, 240, -1, 239, 242, -1,
1799 -1, 21, -1, 68, 236, -1, 68, 10, -1, 69,
1800 17, 234, -1, 69, 11, 234, 154, 17, 234, 154,
1801 17, 234, -1, 70, 171, 234, 154, 17, 234, 157,
1802 241, 159, -1, 70, 171, 234, 154, 17, 234, 157,
1803 159, -1, 71, 186, 201, 234, 151, 244, 152, 190,
1804 38, 17, 234, 72, 17, 234, -1, 72, -1, 73,
1805 -1, 241, 171, 232, 154, 17, 234, -1, 171, 232,
1806 154, 17, 234, -1, 176, 247, -1, 199, 157, 234,
1807 154, 234, 159, -1, 243, 154, 157, 234, 154, 234,
1808 159, -1, 199, 188, 234, 188, -1, 17, 188, 234,
1809 188, -1, 244, 154, 199, 188, 234, 188, -1, 244,
1810 154, 17, 188, 234, 188, -1, -1, -1, 245, 154,
1811 235, -1, 57, 56, -1, 56, -1, 166, 199, 234,
1812 154, 234, -1, 167, 199, 234, 154, 234, -1, 89,
1813 169, 199, 234, 154, 234, -1, 90, 170, 199, 234,
1814 154, 234, -1, 168, 235, 38, 199, -1, 130, 235,
1815 154, 235, 154, 235, -1, 131, 235, 154, 199, -1,
1816 132, 235, 154, 235, -1, 133, 235, 154, 235, 154,
1817 235, -1, 134, 235, 154, 235, 154, 235, -1, 129,
1818 243, -1, 246, 186, 201, 234, 151, 244, 152, 190,
1819 -1, 249, -1, 36, -1, -1, 111, 199, 193, -1,
1820 111, 199, 154, 11, 234, 193, -1, 112, 199, 193,
1821 -1, 112, 199, 154, 11, 234, 193, -1, 113, 235,
1822 -1, 248, 114, 199, 234, 193, -1, 248, 115, 235,
1823 154, 199, 234, 193, -1, 135, 199, 173, 154, 4,
1824 -1, 116, 199, 234, 245, -1
Chris Lattner59363a32008-02-19 04:36:25 +00001825};
1826
1827/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1828static const yytype_uint16 yyrline[] =
1829{
Devang Patelbf507402008-02-20 22:40:23 +00001830 0, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114,
1831 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1116, 1116, 1116,
1832 1116, 1116, 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1120,
1833 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1124, 1124, 1128,
1834 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132, 1132, 1133,
1835 1133, 1134, 1134, 1135, 1136, 1141, 1142, 1142, 1142, 1142,
1836 1142, 1144, 1144, 1144, 1145, 1145, 1147, 1148, 1152, 1156,
1837 1161, 1161, 1163, 1164, 1169, 1175, 1176, 1177, 1178, 1179,
1838 1183, 1184, 1185, 1189, 1190, 1191, 1192, 1196, 1197, 1198,
1839 1202, 1203, 1204, 1205, 1206, 1210, 1211, 1212, 1215, 1216,
1840 1217, 1218, 1219, 1220, 1221, 1228, 1229, 1230, 1231, 1232,
1841 1233, 1234, 1235, 1236, 1237, 1240, 1241, 1246, 1247, 1248,
1842 1249, 1250, 1251, 1254, 1255, 1260, 1261, 1268, 1269, 1275,
1843 1276, 1285, 1293, 1294, 1299, 1300, 1301, 1306, 1319, 1319,
1844 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337, 1342,
1845 1350, 1380, 1405, 1410, 1420, 1430, 1434, 1444, 1451, 1460,
1846 1467, 1472, 1477, 1484, 1485, 1492, 1499, 1507, 1513, 1525,
1847 1553, 1569, 1596, 1624, 1650, 1670, 1696, 1716, 1728, 1735,
1848 1801, 1811, 1821, 1827, 1837, 1843, 1853, 1858, 1863, 1876,
1849 1888, 1910, 1918, 1924, 1935, 1940, 1945, 1951, 1957, 1966,
1850 1970, 1978, 1978, 1981, 1981, 1984, 1996, 2017, 2022, 2030,
1851 2031, 2035, 2035, 2039, 2039, 2042, 2045, 2069, 2081, 2080,
1852 2092, 2091, 2101, 2100, 2111, 2151, 2154, 2160, 2170, 2174,
1853 2179, 2181, 2186, 2191, 2200, 2210, 2221, 2225, 2234, 2243,
1854 2248, 2382, 2382, 2384, 2393, 2393, 2395, 2400, 2412, 2416,
1855 2421, 2425, 2429, 2433, 2437, 2441, 2445, 2449, 2453, 2478,
1856 2482, 2492, 2496, 2500, 2505, 2512, 2512, 2518, 2527, 2532,
1857 2537, 2541, 2550, 2559, 2568, 2572, 2580, 2606, 2610, 2615,
1858 2625, 2644, 2653, 2744, 2748, 2755, 2766, 2779, 2789, 2800,
1859 2810, 2821, 2829, 2839, 2846, 2849, 2850, 2857, 2861, 2866,
1860 2882, 2899, 2913, 2927, 2939, 2947, 2954, 2960, 2966, 2972,
1861 2987, 3085, 3090, 3094, 3101, 3108, 3116, 3123, 3131, 3139,
1862 3153, 3170, 3178
Chris Lattner59363a32008-02-19 04:36:25 +00001863};
1864#endif
1865
1866#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1867/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1868 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1869static const char *const yytname[] =
1870{
1871 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1872 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1873 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1874 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1875 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1876 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1877 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1878 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1879 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1880 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1881 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1882 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1883 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1884 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1885 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1886 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1887 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1888 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1889 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1890 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
Devang Patel3b8849c2008-02-19 22:27:01 +00001891 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1892 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1893 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1894 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1895 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1896 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1897 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1898 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Chris Lattner59363a32008-02-19 04:36:25 +00001899 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1900 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1901 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1902 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1903 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1904 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1905 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1906 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1907 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1908 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1909 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
Devang Patelbf507402008-02-20 22:40:23 +00001910 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1911 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1912 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1913 "InstVal", "OptVolatile", "MemoryInst", 0
Chris Lattner59363a32008-02-19 04:36:25 +00001914};
1915#endif
1916
1917# ifdef YYPRINT
1918/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1919 token YYLEX-NUM. */
1920static const yytype_uint16 yytoknum[] =
1921{
1922 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1923 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1924 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1925 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1926 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1927 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1928 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1929 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1930 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1931 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1932 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1933 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1934 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1935 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1936 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel3b8849c2008-02-19 22:27:01 +00001937 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1938 60, 62, 123, 125, 99
Chris Lattner59363a32008-02-19 04:36:25 +00001939};
1940# endif
1941
1942/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1943static const yytype_uint8 yyr1[] =
1944{
Devang Patel3b8849c2008-02-19 22:27:01 +00001945 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1946 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
Chris Lattner59363a32008-02-19 04:36:25 +00001947 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
Devang Patel3b8849c2008-02-19 22:27:01 +00001948 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1949 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1950 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1951 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1952 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1953 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1954 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1955 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001956 187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
1957 189, 189, 189, 190, 190, 191, 191, 192, 192, 193,
1958 193, 194, 195, 195, 196, 196, 197, 197, 198, 198,
1959 198, 198, 198, 198, 198, 199, 199, 199, 199, 199,
1960 199, 199, 199, 199, 199, 199, 199, 199, 200, 201,
1961 201, 202, 202, 203, 203, 203, 203, 204, 204, 205,
Devang Patel3b8849c2008-02-19 22:27:01 +00001962 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001963 205, 205, 205, 205, 205, 205, 205, 205, 205, 206,
1964 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1965 207, 208, 208, 209, 209, 210, 210, 211, 211, 212,
1966 212, 214, 213, 215, 213, 213, 213, 213, 216, 213,
1967 217, 213, 218, 213, 213, 213, 213, 219, 220, 220,
1968 221, 222, 222, 222, 223, 223, 224, 224, 224, 224,
1969 225, 226, 226, 227, 228, 228, 229, 230, 231, 231,
Devang Patel3b8849c2008-02-19 22:27:01 +00001970 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001971 232, 233, 233, 233, 233, 234, 234, 235, 236, 236,
Devang Patelbf507402008-02-20 22:40:23 +00001972 237, 237, 238, 239, 239, 239, 240, 240, 240, 240,
1973 240, 240, 240, 240, 240, 241, 241, 242, 243, 243,
1974 244, 244, 244, 244, 244, 245, 245, 246, 246, 247,
1975 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
1976 247, 247, 248, 248, 249, 249, 249, 249, 249, 249,
1977 249, 249, 249
Chris Lattner59363a32008-02-19 04:36:25 +00001978};
1979
1980/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1981static const yytype_uint8 yyr2[] =
1982{
1983 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1986 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1987 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1988 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1990 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1991 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1992 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1993 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00001994 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1995 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1996 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1997 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
1998 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
1999 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2000 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2001 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2002 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2003 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2004 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2005 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2006 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2007 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2008 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
Devang Patelbf507402008-02-20 22:40:23 +00002009 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2010 2, 2, 3, 2, 0, 1, 2, 2, 3, 9,
2011 9, 8, 14, 1, 1, 6, 5, 2, 6, 7,
2012 4, 4, 6, 6, 0, 0, 3, 2, 1, 5,
2013 5, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2014 8, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2015 7, 5, 4
Chris Lattner59363a32008-02-19 04:36:25 +00002016};
2017
2018/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2019 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2020 means the default is an error. */
2021static const yytype_uint16 yydefact[] =
2022{
Dale Johannesena79ecf32008-02-20 21:15:43 +00002023 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2024 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2025 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
Chris Lattner59363a32008-02-19 04:36:25 +00002026 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002027 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
Devang Patelbf507402008-02-20 22:40:23 +00002028 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002029 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2030 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2031 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
Devang Patelbf507402008-02-20 22:40:23 +00002032 275, 271, 69, 244, 245, 246, 270, 228, 229, 232,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002033 0, 166, 149, 0, 0, 0, 0, 155, 167, 0,
2034 0, 166, 0, 0, 0, 97, 96, 0, 201, 202,
2035 0, 0, 99, 100, 101, 102, 103, 0, 247, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002036 313, 273, 0, 230, 165, 115, 161, 163, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002037 0, 0, 0, 0, 154, 0, 0, 147, 0, 0,
2038 160, 0, 159, 0, 224, 138, 139, 140, 143, 142,
2039 141, 0, 0, 67, 67, 104, 0, 241, 242, 243,
Devang Patelbf507402008-02-20 22:40:23 +00002040 312, 298, 0, 0, 0, 0, 98, 283, 284, 2,
Chris Lattner59363a32008-02-19 04:36:25 +00002041 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2042 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2043 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2044 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002045 0, 0, 272, 98, 287, 0, 311, 231, 158, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002046 123, 67, 67, 157, 0, 168, 0, 123, 67, 67,
2047 0, 205, 186, 187, 182, 184, 183, 185, 188, 181,
2048 177, 178, 0, 0, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 180, 179, 218, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002050 297, 277, 67, 268, 276, 0, 0, 55, 0, 0,
2051 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2052 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2053 42, 43, 44, 45, 46, 47, 48, 0, 129, 129,
2054 318, 67, 67, 309, 0, 0, 0, 0, 0, 67,
2055 67, 67, 0, 0, 0, 0, 0, 106, 108, 107,
2056 105, 109, 110, 111, 112, 113, 116, 164, 162, 151,
2057 152, 153, 156, 66, 150, 220, 222, 0, 0, 0,
2058 0, 0, 0, 0, 0, 170, 200, 0, 0, 0,
2059 174, 0, 171, 0, 0, 0, 134, 239, 250, 251,
2060 252, 257, 253, 254, 255, 256, 248, 0, 259, 266,
2061 265, 267, 0, 0, 278, 0, 0, 67, 67, 0,
2062 314, 0, 316, 295, 0, 0, 0, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 67, 0, 114, 120,
2064 119, 117, 118, 121, 122, 124, 134, 134, 0, 0,
2065 0, 295, 0, 0, 0, 0, 0, 169, 155, 167,
2066 0, 172, 173, 0, 0, 0, 0, 219, 238, 115,
2067 236, 0, 249, 0, 0, 269, 0, 0, 0, 0,
2068 0, 0, 0, 0, 322, 0, 0, 0, 305, 306,
2069 0, 0, 0, 0, 0, 303, 0, 129, 0, 221,
2070 223, 67, 0, 0, 0, 0, 0, 0, 0, 199,
2071 176, 0, 0, 0, 0, 0, 0, 136, 134, 65,
2072 0, 123, 0, 258, 0, 0, 294, 0, 0, 129,
2073 130, 129, 0, 0, 0, 0, 0, 0, 321, 299,
2074 300, 294, 0, 319, 67, 206, 0, 0, 190, 0,
2075 0, 0, 0, 175, 0, 0, 67, 131, 137, 135,
2076 64, 235, 237, 115, 132, 0, 0, 0, 115, 115,
2077 0, 301, 302, 315, 317, 296, 0, 0, 304, 307,
2078 308, 0, 129, 0, 0, 0, 196, 0, 0, 192,
2079 193, 189, 65, 133, 127, 260, 0, 0, 0, 0,
2080 123, 0, 288, 0, 123, 320, 194, 195, 0, 0,
2081 0, 234, 0, 125, 0, 281, 0, 0, 106, 108,
2082 115, 115, 0, 115, 115, 289, 310, 191, 197, 198,
2083 128, 0, 240, 279, 0, 280, 0, 291, 290, 0,
2084 0, 0, 126, 0, 0, 0, 115, 115, 0, 0,
2085 0, 293, 292, 286, 0, 0, 285, 0, 282
Chris Lattner59363a32008-02-19 04:36:25 +00002086};
2087
2088/* YYDEFGOTO[NTERM-NUM]. */
2089static const yytype_int16 yydefgoto[] =
2090{
Devang Patelbf507402008-02-20 22:40:23 +00002091 -1, 263, 264, 265, 290, 307, 161, 162, 78, 531,
Chris Lattner59363a32008-02-19 04:36:25 +00002092 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
Devang Patelbf507402008-02-20 22:40:23 +00002093 117, 127, 336, 228, 415, 339, 602, 583, 390, 487,
2094 564, 437, 488, 80, 163, 136, 153, 137, 138, 109,
2095 356, 378, 357, 120, 87, 154, 16, 17, 18, 20,
2096 19, 366, 416, 417, 62, 23, 60, 100, 440, 441,
2097 128, 169, 54, 95, 55, 48, 443, 379, 82, 381,
2098 273, 274, 56, 91, 92, 222, 587, 131, 313, 540,
2099 454, 223, 224, 225, 226
Chris Lattner59363a32008-02-19 04:36:25 +00002100};
2101
2102/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2103 STATE-NUM. */
Devang Patelbf507402008-02-20 22:40:23 +00002104#define YYPACT_NINF -571
Chris Lattner59363a32008-02-19 04:36:25 +00002105static const yytype_int16 yypact[] =
2106{
Devang Patelbf507402008-02-20 22:40:23 +00002107 39, -571, -571, -571, -571, -571, -571, -571, -12, -138,
2108 -25, -108, 49, -75, 258, -571, 83, 883, -571, 54,
2109 187, -54, -50, -571, -38, 105, -571, 1464, -571, -571,
2110 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2111 106, 106, 178, -571, -571, -571, -571, 106, -571, -571,
2112 -571, -571, -571, 106, 110, -571, -10, 158, 176, 184,
2113 -571, -571, -571, -571, -571, 58, -571, -571, -571, -571,
2114 -571, -571, -571, -571, 239, 242, 2, 126, -571, -571,
2115 -571, 12, -571, 232, 232, 234, -571, 127, 175, 175,
2116 -571, -571, 255, -571, -571, -571, -571, -571, -571, -571,
2117 62, 1059, -571, 117, 122, 506, 58, -571, 12, -111,
2118 141, 1059, 129, 127, 127, -571, -571, 1014, -571, -571,
2119 1504, 292, -571, -571, -571, -571, -571, 1562, -571, -6,
2120 1843, -571, 291, -571, -571, 12, -571, 166, 174, 1620,
2121 1620, 170, -110, 1620, -571, 329, 183, -571, 1504, 1620,
2122 58, 188, 12, 336, -571, 311, 333, 337, 338, 339,
2123 340, 262, 341, 1115, 297, -571, 26, -571, -571, -571,
2124 -571, -571, 289, 1660, 194, 343, 175, -571, -571, -571,
2125 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2126 -571, -571, -571, -571, 511, 787, 1620, 1620, 1620, 1620,
2127 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2128 -571, -571, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620,
2129 1620, 1620, -571, 175, -571, 135, -571, -571, 434, 1345,
2130 -571, -7, -33, -571, 191, 12, 209, -571, 297, -19,
2131 1014, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2132 -571, -571, 511, 787, 211, 212, 213, 214, 217, 1385,
2133 1678, 609, 347, 225, 228, 230, -571, -571, -571, 231,
2134 -571, 58, 702, -571, 235, 841, 841, -571, 841, 1562,
2135 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2136 1620, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2137 -571, -571, -571, -571, -571, -571, -571, 1620, 11, 97,
2138 -571, 702, -31, 241, 244, 245, 249, 250, 251, 10,
2139 702, 702, 355, 1562, 1620, 1620, 392, -571, -571, -571,
2140 -571, -571, -571, -571, -571, -571, -571, -571, -571, -65,
2141 -571, -571, -571, -571, -65, -571, 129, 371, 259, 260,
2142 1504, 1504, 1504, 1504, 1504, -571, -571, 88, 788, -57,
2143 -571, -68, -571, 1504, 1504, 1504, 261, 1406, -571, -571,
2144 -571, -571, -571, -571, -571, -571, 352, 1504, -571, -571,
2145 -571, -571, 1504, 263, -571, 266, 841, 702, 702, 7,
2146 -571, 15, -571, -571, 841, 256, 1620, 1620, 1620, 1620,
2147 1620, 269, 272, 274, 1620, 841, 702, 275, -571, -571,
2148 -571, -571, -571, -571, -571, -571, 261, 261, 1620, 1504,
2149 1504, -571, 276, 277, 281, 282, 1504, -571, 278, 969,
2150 -58, -571, -571, 283, 287, 378, -3, -571, -571, 12,
2151 290, 293, -571, 421, 43, -571, 429, 430, 298, 294,
2152 296, 841, 449, 841, 300, 301, 841, 302, 12, -571,
2153 303, 305, 456, 841, 841, 12, 310, 308, 1620, -571,
2154 -571, -45, 313, 314, 133, 1504, 1504, 1504, 1504, -571,
2155 -571, 312, 1504, 1504, 1620, 447, 468, -571, 261, 1746,
2156 1446, -571, 320, -571, 841, 841, 1718, 841, 841, 308,
2157 -571, 308, 1620, 841, 321, 1620, 1620, 1620, -571, -571,
2158 -571, 1718, 424, -571, 702, -571, 1504, 1504, -571, 324,
2159 330, 332, 334, -571, 331, 342, -30, -571, -571, -571,
2160 -571, -571, -571, 12, 81, 462, 344, 346, 28, 12,
2161 155, -571, -571, -571, -571, -571, 345, 841, -571, -571,
2162 -571, 171, 308, 348, 349, 1504, -571, 1504, 1504, -571,
2163 -571, -571, 1746, -571, 437, -571, 474, -4, 560, 560,
2164 -571, 1736, -571, 353, -571, -571, -571, -571, 354, 359,
2165 363, -571, 491, 358, 841, -571, 1255, -1, 356, 373,
2166 -571, -571, 87, 28, 12, -571, -65, -571, -571, -571,
2167 -571, 505, -571, -571, 377, -571, 1255, 434, 434, 479,
2168 560, 560, -571, 515, 379, 841, -571, -571, 841, 519,
2169 465, 434, 434, -571, 841, 521, -571, 841, -571
Chris Lattner59363a32008-02-19 04:36:25 +00002170};
2171
2172/* YYPGOTO[NTERM-NUM]. */
2173static const yytype_int16 yypgoto[] =
2174{
Devang Patelbf507402008-02-20 22:40:23 +00002175 -571, 416, 417, 420, 304, 306, -173, -571, 0, -8,
2176 -150, 466, 8, -571, -571, -571, -571, 1, -571, -571,
2177 -571, -149, -571, -409, -571, -234, -571, -571, -289, 23,
2178 -571, -404, -571, -571, -26, 360, -122, -571, 450, 460,
2179 -92, -159, -223, 55, 93, 326, -571, -571, 555, -571,
2180 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2181 486, -571, -571, -571, -571, -571, -571, -570, -76, 46,
2182 -105, -571, -571, 525, -571, -571, -571, -571, -571, 77,
2183 169, -571, -571, -571, -571
Chris Lattner59363a32008-02-19 04:36:25 +00002184};
2185
2186/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2187 positive, shift that token. If negative, reduce the rule which
2188 number is the opposite. If zero, do what YYDEFACT says.
2189 If YYTABLE_NINF, syntax error. */
Dale Johannesena79ecf32008-02-20 21:15:43 +00002190#define YYTABLE_NINF -209
Chris Lattner59363a32008-02-19 04:36:25 +00002191static const yytype_int16 yytable[] =
2192{
Devang Patelbf507402008-02-20 22:40:23 +00002193 11, 81, 278, 344, 266, 166, 104, 277, 13, 110,
2194 277, 90, 469, 470, 268, 24, 604, 11, 451, 93,
2195 392, 110, 167, 110, 110, 13, 453, 279, 164, 1,
2196 489, 485, 3, 25, 5, 110, 614, 359, 361, -208,
2197 21, 83, 84, 143, 143, 26, 2, 110, 88, 4,
2198 486, 108, 144, 234, 89, 22, 238, -69, 1, 2,
2199 452, 3, 4, 5, 110, 110, 110, 27, 452, 6,
2200 7, 409, 410, 411, 323, 135, 412, 241, 28, 108,
2201 413, 414, -144, 43, 529, 135, 426, 267, 345, 346,
2202 8, 152, 11, 310, 9, 432, 426, 426, 10, 57,
2203 45, 152, 46, 58, 431, 481, 111, 515, 314, 315,
2204 316, 317, 318, 231, 232, 485, 322, 235, 111, 59,
2205 111, 111, 561, 239, 562, 609, 394, 61, 341, 568,
2206 569, 90, 111, 63, 64, 430, 106, 66, 67, 68,
2207 69, 70, 71, 72, 111, 1, 2, 272, 3, 4,
2208 5, 110, 340, 94, 444, 585, 168, 386, 605, 118,
2209 119, 111, 111, 111, 105, 389, -67, -67, 148, 149,
2210 308, 309, 272, 311, 269, 73, 113, 114, 513, -144,
2211 97, 607, 608, -144, 610, 611, 312, 272, 272, 272,
2212 272, 272, 319, 320, 321, 272, 380, 426, 98, 380,
2213 380, 405, 380, 135, 493, 275, 99, 621, 622, 101,
2214 543, 276, 544, 85, 152, 86, 132, 409, 410, 411,
2215 407, 133, 412, 409, 410, 411, 413, 414, 412, 49,
2216 50, 51, 413, 414, 52, 380, 121, 122, 123, 124,
2217 125, 126, 426, 102, 380, 380, 103, 427, 111, 324,
2218 325, 391, -67, 152, 37, 38, 39, 534, 421, 422,
2219 423, 424, 425, 575, 387, 244, 245, 246, 247, 86,
2220 266, 433, 434, 435, 1, 139, 115, 3, 116, 5,
2221 140, 388, 74, 75, 147, 518, 76, 502, 77, 107,
2222 445, 457, 145, 459, 460, 461, 165, 152, 406, 272,
2223 29, 30, 31, 32, 33, 34, 35, 570, 36, 571,
2224 380, 380, 380, 227, -55, -55, -55, -55, 380, 401,
2225 229, 383, 384, 574, 385, 571, 230, 472, 473, 380,
2226 380, 233, 429, 236, 479, 237, 592, 242, 243, 240,
2227 596, 439, -56, 63, 64, 270, -57, -60, -59, -58,
2228 248, 110, 342, 267, 277, 1, 2, 393, 3, 4,
2229 5, 343, 350, 351, 352, 353, 402, 403, 354, 362,
2230 272, 458, 272, 272, 272, 380, 363, 380, 465, 364,
2231 380, 365, 367, 519, 520, 521, 522, 380, 380, 382,
2232 524, 525, 471, 404, 586, 395, 408, 545, 396, 397,
2233 548, 549, 550, 398, 399, 400, 37, 38, 39, 418,
2234 419, 420, 442, 456, 606, 436, 484, 446, 380, 380,
2235 447, 380, 380, 462, 553, 554, 463, 380, 464, 468,
2236 475, 476, 448, 449, 450, 477, 478, 482, 380, 480,
2237 455, 483, 514, 492, 490, 491, 494, 495, 497, 496,
2238 498, 466, 467, 500, 502, 503, 505, 506, 526, 507,
2239 508, 511, 512, 578, 533, 579, 580, 516, 517, 527,
2240 539, 380, 528, 523, 535, 547, 272, 452, 555, 272,
2241 272, 272, 556, 559, 565, 539, 557, 326, 558, 530,
2242 582, 584, 380, 380, 560, 600, 615, 499, 566, 501,
2243 576, 577, 504, 567, 572, 601, 597, -18, 380, 509,
2244 510, 598, 595, 63, 64, 599, 106, 66, 67, 68,
2245 69, 70, 71, 72, -19, 1, 2, 612, 3, 4,
2246 5, 613, 618, 619, 380, 380, 624, 625, 627, 380,
2247 536, 537, 380, 541, 542, 594, 219, 220, 380, 546,
2248 221, 380, 327, 328, 581, 73, 348, 563, 130, 349,
2249 552, 146, 530, 368, 369, 142, 347, 63, 64, 370,
2250 329, 330, 44, 331, 332, 129, 333, 334, 335, 1,
2251 2, 96, 3, 4, 5, 371, 372, 373, 551, 338,
2252 474, 0, 0, 573, 0, 0, 0, 0, 0, 0,
2253 374, 375, 280, 281, 282, 283, 284, 285, 286, 287,
2254 288, 289, 0, 326, 590, 591, 63, 64, 376, 106,
2255 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2256 603, 3, 4, 5, 179, 180, 181, 182, 183, 184,
2257 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2258 253, 0, 0, 0, 0, 0, 616, 617, 73, 0,
2259 0, 620, 74, 75, 623, 0, 76, 0, 77, 141,
2260 626, 0, 0, 628, 0, 0, 254, 200, 588, 589,
2261 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
2262 255, 0, 256, 257, 258, 0, 329, 330, 0, 331,
2263 332, 0, 333, 334, 335, 368, 369, 0, 0, 63,
2264 64, 370, 0, 0, 0, 0, 0, 0, 0, 0,
2265 377, 1, 2, 0, 3, 4, 5, 371, 372, 373,
2266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2267 0, 0, 374, 375, 0, 0, 0, 0, 0, 0,
2268 0, 0, 0, 0, 0, 0, 110, 0, 0, 0,
2269 376, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2270 0, 77, 360, 0, 0, 0, 179, 180, 181, 182,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002271 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
Devang Patelbf507402008-02-20 22:40:23 +00002272 193, 252, 253, 0, 0, 63, 64, 0, 106, 155,
2273 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
2274 3, 4, 5, 291, 292, 0, 0, 0, 254, 200,
2275 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2276 211, 0, 255, 0, 256, 257, 258, 73, 0, 0,
2277 0, 0, 0, 0, 368, 369, 0, 0, 63, 64,
2278 370, 0, 0, 111, 0, 0, 0, 0, 0, 0,
2279 1, 2, 377, 3, 4, 5, 371, 372, 373, 0,
Chris Lattner59363a32008-02-19 04:36:25 +00002280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002281 0, 374, 375, -207, 293, 294, 295, 296, 297, 298,
2282 299, 300, 301, 302, 303, 304, 305, 306, 0, 376,
2283 0, -69, 1, 2, 0, 3, 4, 5, 0, 0,
2284 0, 0, 0, 6, 7, 179, 180, 181, 182, 183,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002285 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
Devang Patelbf507402008-02-20 22:40:23 +00002286 252, 253, 0, 0, 8, 0, 0, 0, 9, 0,
2287 0, 0, 10, 0, 74, 75, 0, 0, 76, 0,
2288 77, 428, 0, 0, 0, 0, 0, 254, 200, 201,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002289 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
Devang Patelbf507402008-02-20 22:40:23 +00002290 0, 255, 0, 256, 257, 258, 63, 64, 0, 0,
2291 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2292 0, 3, 4, 5, 249, 0, 0, 0, 0, 0,
2293 0, 377, 0, 0, 0, 0, 0, 0, 0, 250,
2294 251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2295 0, 63, 64, 110, 150, 66, 67, 68, 69, 70,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002296 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002297 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2298 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2299 0, 0, 0, 73, 0, 0, 63, 64, 0, 106,
2300 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2301 0, 3, 4, 5, 0, 254, 200, 201, 202, 203,
2302 204, 205, 206, 207, 208, 209, 210, 211, 134, 255,
2303 0, 256, 257, 258, 0, 0, 0, 0, 73, 0,
Devang Patel3b8849c2008-02-19 22:27:01 +00002304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002305 111, 0, 63, 64, -67, 0, 259, 0, 0, 260,
2306 0, 261, 0, 262, 1, 2, 151, 3, 4, 5,
2307 249, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2308 0, 0, 0, 0, 0, 250, 251, 0, 0, 0,
2309 0, 0, 0, 0, 0, 0, 0, 0, 0, 110,
2310 74, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2311 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2312 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2313 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2314 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2315 0, 77, 0, 0, 0, 0, 0, 0, 0, 0,
2316 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2317 208, 209, 210, 211, 0, 255, 0, 256, 257, 258,
2318 0, 0, 0, 0, 0, 0, 0, 0, 368, 369,
2319 0, 0, 0, 0, 370, 0, 111, 0, 0, 0,
2320 0, 0, 259, 0, 0, 260, 0, 261, 0, 262,
2321 371, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 374, 375, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2324 0, 0, 0, 376, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2326 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2327 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2328 0, 0, 63, 64, 0, 106, 66, 67, 68, 69,
2329 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2330 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2331 208, 209, 210, 211, 337, 255, 0, 256, 257, 258,
2332 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2333 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2334 0, 0, 0, 63, 64, 377, 106, 66, 67, 68,
2335 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2336 5, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2337 0, 0, 0, 0, 0, 438, 0, 0, 0, 0,
2338 0, 0, 0, 63, 64, 73, 106, 66, 67, 68,
2339 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2340 5, 63, 64, 0, 65, 66, 67, 68, 69, 70,
2341 71, 72, 0, 1, 2, 532, 3, 4, 5, 0,
2342 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2343 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2344 0, 63, 64, 73, 106, 155, 156, 157, 158, 159,
2345 160, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2346 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2347 0, 74, 75, 0, 355, 76, 0, 77, 0, 0,
2348 0, 0, 0, 73, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002349 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
Devang Patelbf507402008-02-20 22:40:23 +00002350 64, 0, 150, 66, 67, 68, 69, 70, 71, 72,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002351 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002353 0, 0, 74, 75, 0, 0, 76, 0, 77, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002354 0, 73, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002355 74, 75, 0, 0, 76, 0, 77, 63, 64, 0,
2356 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2357 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2358 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002359 74, 75, 0, 0, 76, 0, 77, 63, 64, 73,
Devang Patelbf507402008-02-20 22:40:23 +00002360 271, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2361 2, 0, 3, 4, 5, 63, 64, 0, 106, 155,
2362 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002363 3, 4, 5, 0, 0, 0, 0, 0, 0, 73,
2364 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
Devang Patelbf507402008-02-20 22:40:23 +00002365 0, 0, 76, 0, 77, 63, 64, 73, 106, 66,
2366 67, 68, 69, 70, 71, 538, 0, 1, 2, 0,
2367 3, 4, 5, 63, 64, 0, 106, 66, 67, 68,
2368 69, 70, 71, 593, 0, 1, 2, 0, 3, 4,
2369 5, 0, 0, 0, 0, 1, 0, 73, 3, 0,
2370 5, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2371 76, 0, 77, 0, 0, 73, 0, 0, 0, 0,
2372 0, 0, 0, 0, 0, 0, 0, 0, 0, 326,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002374 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002375 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2377 358, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002378 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelbf507402008-02-20 22:40:23 +00002379 0, 0, 0, 0, 327, 328, 0, 0, 0, 0,
2380 0, 0, 0, 0, 74, 75, 0, 0, 76, 170,
2381 77, 0, 329, 330, 0, 331, 332, 0, 333, 334,
2382 335, 0, 74, 75, 0, 0, 76, 0, 77, 171,
2383 172, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2384 0, 173, 174, 175, 176, 177, 178, 179, 180, 181,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002385 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2386 192, 193, 194, 195, 0, 0, 0, 0, 0, 0,
2387 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2388 0, 0, 0, 0, 196, 197, 198, 0, 0, 199,
2389 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2390 210, 211, 212, 213, 214, 215, 216, 217, 218
Chris Lattner59363a32008-02-19 04:36:25 +00002391};
2392
2393static const yytype_int16 yycheck[] =
2394{
Devang Patelbf507402008-02-20 22:40:23 +00002395 0, 27, 175, 237, 163, 127, 4, 11, 0, 54,
2396 11, 21, 416, 417, 164, 153, 586, 17, 11, 29,
2397 309, 54, 28, 54, 54, 17, 11, 176, 120, 19,
2398 439, 34, 22, 58, 24, 54, 606, 260, 261, 0,
2399 52, 40, 41, 154, 154, 153, 20, 54, 47, 23,
2400 53, 77, 163, 163, 53, 67, 148, 18, 19, 20,
2401 53, 22, 23, 24, 54, 54, 54, 18, 53, 30,
2402 31, 136, 137, 138, 223, 101, 141, 153, 153, 105,
2403 145, 146, 54, 0, 488, 111, 154, 163, 238, 239,
2404 51, 117, 92, 198, 55, 163, 154, 154, 59, 153,
2405 46, 127, 48, 153, 161, 163, 151, 152, 213, 214,
2406 215, 216, 217, 139, 140, 34, 221, 143, 151, 157,
2407 151, 151, 152, 149, 533, 38, 157, 22, 161, 538,
2408 539, 21, 151, 7, 8, 358, 10, 11, 12, 13,
2409 14, 15, 16, 17, 151, 19, 20, 173, 22, 23,
2410 24, 54, 159, 163, 377, 159, 162, 279, 159, 32,
2411 33, 151, 151, 151, 162, 154, 155, 155, 113, 114,
2412 196, 197, 198, 199, 166, 49, 83, 84, 467, 151,
2413 22, 590, 591, 155, 593, 594, 212, 213, 214, 215,
2414 216, 217, 218, 219, 220, 221, 272, 154, 22, 275,
2415 276, 323, 278, 229, 161, 11, 22, 616, 617, 151,
2416 499, 17, 501, 35, 240, 37, 154, 136, 137, 138,
2417 325, 159, 141, 136, 137, 138, 145, 146, 141, 42,
2418 43, 44, 145, 146, 47, 311, 61, 62, 63, 64,
2419 65, 66, 154, 4, 320, 321, 4, 159, 151, 114,
2420 115, 154, 155, 279, 148, 149, 150, 491, 350, 351,
2421 352, 353, 354, 552, 290, 3, 4, 5, 6, 37,
2422 429, 363, 364, 365, 19, 158, 42, 22, 44, 24,
2423 158, 307, 156, 157, 155, 152, 160, 154, 162, 163,
2424 382, 396, 151, 398, 399, 400, 4, 323, 324, 325,
2425 42, 43, 44, 45, 46, 47, 48, 152, 50, 154,
2426 386, 387, 388, 22, 3, 4, 5, 6, 394, 319,
2427 154, 275, 276, 152, 278, 154, 152, 419, 420, 405,
2428 406, 161, 358, 4, 426, 152, 570, 26, 27, 151,
2429 574, 367, 9, 7, 8, 56, 9, 9, 9, 9,
2430 9, 54, 161, 429, 11, 19, 20, 311, 22, 23,
2431 24, 152, 151, 151, 151, 151, 320, 321, 151, 22,
2432 396, 397, 398, 399, 400, 451, 151, 453, 404, 151,
2433 456, 151, 151, 475, 476, 477, 478, 463, 464, 154,
2434 482, 483, 418, 38, 567, 154, 4, 502, 154, 154,
2435 505, 506, 507, 154, 154, 154, 148, 149, 150, 38,
2436 151, 151, 60, 157, 587, 154, 38, 154, 494, 495,
2437 154, 497, 498, 154, 516, 517, 154, 503, 154, 154,
2438 154, 154, 386, 387, 388, 154, 154, 154, 514, 161,
2439 394, 154, 468, 22, 154, 152, 17, 17, 154, 151,
2440 154, 405, 406, 4, 154, 154, 154, 154, 484, 154,
2441 4, 151, 154, 555, 490, 557, 558, 154, 154, 22,
2442 496, 547, 4, 161, 154, 154, 502, 53, 154, 505,
2443 506, 507, 152, 152, 22, 511, 154, 53, 154, 489,
2444 53, 17, 568, 569, 152, 4, 17, 451, 154, 453,
2445 152, 152, 456, 157, 159, 147, 152, 151, 584, 463,
2446 464, 152, 159, 7, 8, 152, 10, 11, 12, 13,
2447 14, 15, 16, 17, 151, 19, 20, 22, 22, 23,
2448 24, 154, 17, 154, 610, 611, 17, 72, 17, 615,
2449 494, 495, 618, 497, 498, 571, 130, 130, 624, 503,
2450 130, 627, 118, 119, 562, 49, 252, 534, 92, 253,
2451 514, 111, 562, 3, 4, 105, 240, 7, 8, 9,
2452 136, 137, 17, 139, 140, 89, 142, 143, 144, 19,
2453 20, 56, 22, 23, 24, 25, 26, 27, 511, 229,
2454 421, -1, -1, 547, -1, -1, -1, -1, -1, -1,
2455 40, 41, 91, 92, 93, 94, 95, 96, 97, 98,
2456 99, 100, -1, 53, 568, 569, 7, 8, 58, 10,
2457 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2458 584, 22, 23, 24, 74, 75, 76, 77, 78, 79,
2459 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2460 90, -1, -1, -1, -1, -1, 610, 611, 49, -1,
2461 -1, 615, 156, 157, 618, -1, 160, -1, 162, 163,
2462 624, -1, -1, 627, -1, -1, 116, 117, 118, 119,
2463 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
2464 130, -1, 132, 133, 134, -1, 136, 137, -1, 139,
2465 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
2466 8, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2467 160, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2468 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2469 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2470 -1, -1, -1, -1, -1, -1, 54, -1, -1, -1,
2471 58, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2472 -1, 162, 163, -1, -1, -1, 74, 75, 76, 77,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002473 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
Devang Patelbf507402008-02-20 22:40:23 +00002474 88, 89, 90, -1, -1, 7, 8, -1, 10, 11,
2475 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2476 22, 23, 24, 26, 27, -1, -1, -1, 116, 117,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002477 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
Devang Patelbf507402008-02-20 22:40:23 +00002478 128, -1, 130, -1, 132, 133, 134, 49, -1, -1,
2479 -1, -1, -1, -1, 3, 4, -1, -1, 7, 8,
2480 9, -1, -1, 151, -1, -1, -1, -1, -1, -1,
2481 19, 20, 160, 22, 23, 24, 25, 26, 27, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002482 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002483 -1, 40, 41, 0, 97, 98, 99, 100, 101, 102,
2484 103, 104, 105, 106, 107, 108, 109, 110, -1, 58,
2485 -1, 18, 19, 20, -1, 22, 23, 24, -1, -1,
2486 -1, -1, -1, 30, 31, 74, 75, 76, 77, 78,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002487 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
Devang Patelbf507402008-02-20 22:40:23 +00002488 89, 90, -1, -1, 51, -1, -1, -1, 55, -1,
2489 -1, -1, 59, -1, 156, 157, -1, -1, 160, -1,
2490 162, 163, -1, -1, -1, -1, -1, 116, 117, 118,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002491 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
Devang Patelbf507402008-02-20 22:40:23 +00002492 -1, 130, -1, 132, 133, 134, 7, 8, -1, -1,
2493 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2494 -1, 22, 23, 24, 25, -1, -1, -1, -1, -1,
2495 -1, 160, -1, -1, -1, -1, -1, -1, -1, 40,
2496 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2497 -1, 7, 8, 54, 10, 11, 12, 13, 14, 15,
2498 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2499 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2500 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2501 -1, -1, -1, 49, -1, -1, 7, 8, -1, 10,
2502 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2503 -1, 22, 23, 24, -1, 116, 117, 118, 119, 120,
2504 121, 122, 123, 124, 125, 126, 127, 128, 39, 130,
2505 -1, 132, 133, 134, -1, -1, -1, -1, 49, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002506 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002507 151, -1, 7, 8, 155, -1, 157, -1, -1, 160,
2508 -1, 162, -1, 164, 19, 20, 122, 22, 23, 24,
2509 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2510 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2511 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2512 156, 157, -1, -1, 160, -1, 162, -1, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2514 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2515 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2516 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2517 -1, 162, -1, -1, -1, -1, -1, -1, -1, -1,
2518 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2519 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
2520 -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2521 -1, -1, -1, -1, 9, -1, 151, -1, -1, -1,
2522 -1, -1, 157, -1, -1, 160, -1, 162, -1, 164,
2523 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2524 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002525 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002526 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1,
2527 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2528 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2529 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2530 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2531 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2532 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2533 125, 126, 127, 128, 39, 130, -1, 132, 133, 134,
2534 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2535 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2536 -1, -1, -1, 7, 8, 160, 10, 11, 12, 13,
2537 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2538 24, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2539 -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002540 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
2541 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
Devang Patelbf507402008-02-20 22:40:23 +00002542 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2543 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002544 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002545 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2546 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002547 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Devang Patel3b8849c2008-02-19 22:27:01 +00002548 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002549 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2550 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002551 -1, -1, 156, 157, -1, -1, 160, -1, 162, 7,
2552 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2553 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2554 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002555 -1, -1, 156, 157, -1, -1, 160, -1, 162, -1,
2556 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
2557 156, 157, -1, -1, 160, -1, 162, 7, 8, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002558 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2559 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002560 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002561 156, 157, -1, -1, 160, -1, 162, 7, 8, 49,
2562 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2563 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2564 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2565 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2566 -1, -1, -1, -1, -1, -1, -1, -1, 156, 157,
Devang Patelbf507402008-02-20 22:40:23 +00002567 -1, -1, 160, -1, 162, 7, 8, 49, 10, 11,
2568 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2569 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
2570 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2571 24, -1, -1, -1, -1, 19, -1, 49, 22, -1,
2572 24, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2573 160, -1, 162, -1, -1, 49, -1, -1, -1, -1,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002575 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002576 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2577 160, -1, 162, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002578 -1, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2579 162, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelbf507402008-02-20 22:40:23 +00002581 -1, -1, -1, -1, 118, 119, -1, -1, -1, -1,
2582 -1, -1, -1, -1, 156, 157, -1, -1, 160, 36,
2583 162, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2584 144, -1, 156, 157, -1, -1, 160, -1, 162, 56,
2585 57, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2586 -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
Dale Johannesena79ecf32008-02-20 21:15:43 +00002587 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2588 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
2589 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2590 -1, -1, -1, -1, 111, 112, 113, -1, -1, 116,
2591 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2592 127, 128, 129, 130, 131, 132, 133, 134, 135
Chris Lattner59363a32008-02-19 04:36:25 +00002593};
2594
2595/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2596 symbol of state STATE-NUM. */
2597static const yytype_uint8 yystos[] =
2598{
2599 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
Devang Patel3b8849c2008-02-19 22:27:01 +00002600 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2601 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2602 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2603 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
Devang Patelbf507402008-02-20 22:40:23 +00002604 43, 44, 47, 184, 227, 229, 237, 153, 153, 157,
Devang Patel3b8849c2008-02-19 22:27:01 +00002605 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2606 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2607 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
Devang Patelbf507402008-02-20 22:40:23 +00002608 21, 238, 239, 29, 163, 228, 238, 22, 22, 22,
Devang Patel3b8849c2008-02-19 22:27:01 +00002609 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2610 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2611 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
Devang Patelbf507402008-02-20 22:40:23 +00002612 176, 242, 154, 159, 39, 199, 200, 202, 203, 158,
Devang Patel3b8849c2008-02-19 22:27:01 +00002613 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2614 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2615 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
Chris Lattner59363a32008-02-19 04:36:25 +00002616 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2617 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2618 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2619 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
Devang Patel3b8849c2008-02-19 22:27:01 +00002620 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
Devang Patelbf507402008-02-20 22:40:23 +00002621 167, 168, 240, 246, 247, 248, 249, 22, 188, 154,
Devang Patel3b8849c2008-02-19 22:27:01 +00002622 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2623 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2624 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2625 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
Devang Patelbf507402008-02-20 22:40:23 +00002626 56, 10, 199, 235, 236, 11, 17, 11, 171, 186,
2627 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2628 169, 26, 27, 97, 98, 99, 100, 101, 102, 103,
2629 104, 105, 106, 107, 108, 109, 110, 170, 199, 199,
2630 235, 199, 199, 243, 235, 235, 235, 235, 235, 199,
2631 199, 199, 235, 186, 114, 115, 53, 118, 119, 136,
2632 137, 139, 140, 142, 143, 144, 187, 39, 200, 190,
2633 159, 161, 161, 152, 190, 175, 175, 210, 169, 170,
2634 151, 151, 151, 151, 151, 159, 205, 207, 162, 207,
2635 163, 207, 22, 151, 151, 151, 216, 151, 3, 4,
2636 9, 25, 26, 27, 40, 41, 58, 160, 206, 232,
2637 233, 234, 154, 234, 234, 234, 201, 199, 199, 154,
2638 193, 154, 193, 234, 157, 154, 154, 154, 154, 154,
2639 154, 173, 234, 234, 38, 201, 199, 235, 4, 136,
2640 137, 138, 141, 145, 146, 189, 217, 218, 38, 151,
2641 151, 205, 205, 205, 205, 205, 154, 159, 163, 199,
2642 207, 161, 163, 205, 205, 205, 154, 196, 39, 199,
2643 223, 224, 60, 231, 207, 205, 154, 154, 234, 234,
2644 234, 11, 53, 11, 245, 234, 157, 235, 199, 235,
2645 235, 235, 154, 154, 154, 199, 234, 234, 154, 196,
2646 196, 199, 205, 205, 245, 154, 154, 154, 154, 205,
2647 161, 163, 154, 154, 38, 34, 53, 194, 197, 188,
2648 154, 152, 22, 161, 17, 17, 151, 154, 154, 234,
2649 4, 234, 154, 154, 234, 154, 154, 154, 4, 234,
2650 234, 151, 154, 193, 199, 152, 154, 154, 152, 205,
2651 205, 205, 205, 161, 205, 205, 199, 22, 4, 196,
2652 173, 174, 39, 199, 190, 154, 234, 234, 17, 199,
2653 244, 234, 234, 193, 193, 235, 234, 154, 235, 235,
2654 235, 244, 234, 205, 205, 154, 152, 154, 154, 152,
2655 152, 152, 188, 194, 195, 22, 154, 157, 188, 188,
2656 152, 154, 159, 234, 152, 193, 152, 152, 205, 205,
2657 205, 174, 53, 192, 17, 159, 171, 241, 118, 119,
2658 234, 234, 190, 17, 199, 159, 190, 152, 152, 152,
2659 4, 147, 191, 234, 232, 159, 171, 188, 188, 38,
2660 188, 188, 22, 154, 232, 17, 234, 234, 17, 154,
2661 234, 188, 188, 234, 17, 72, 234, 17, 234
Chris Lattner59363a32008-02-19 04:36:25 +00002662};
David Greene9145dd22007-08-01 03:59:32 +00002663
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002664#define yyerrok (yyerrstatus = 0)
2665#define yyclearin (yychar = YYEMPTY)
Chris Lattner59363a32008-02-19 04:36:25 +00002666#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002667#define YYEOF 0
Chris Lattner59363a32008-02-19 04:36:25 +00002668
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002669#define YYACCEPT goto yyacceptlab
Chris Lattner59363a32008-02-19 04:36:25 +00002670#define YYABORT goto yyabortlab
2671#define YYERROR goto yyerrorlab
2672
2673
2674/* Like YYERROR except do call yyerror. This remains here temporarily
2675 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002676 Once GCC version 2 has supplanted version 1, this can go. */
Chris Lattner59363a32008-02-19 04:36:25 +00002677
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002678#define YYFAIL goto yyerrlab
Chris Lattner59363a32008-02-19 04:36:25 +00002679
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002680#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner59363a32008-02-19 04:36:25 +00002681
2682#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002683do \
2684 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner59363a32008-02-19 04:36:25 +00002685 { \
2686 yychar = (Token); \
2687 yylval = (Value); \
2688 yytoken = YYTRANSLATE (yychar); \
2689 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002690 goto yybackup; \
2691 } \
2692 else \
Chris Lattner59363a32008-02-19 04:36:25 +00002693 { \
2694 yyerror (YY_("syntax error: cannot back up")); \
2695 YYERROR; \
2696 } \
2697while (YYID (0))
2698
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002699
2700#define YYTERROR 1
2701#define YYERRCODE 256
2702
Chris Lattner59363a32008-02-19 04:36:25 +00002703
2704/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2705 If N is 0, then set CURRENT to the empty location which ends
2706 the previous symbol: RHS[0] (always defined). */
2707
2708#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2709#ifndef YYLLOC_DEFAULT
2710# define YYLLOC_DEFAULT(Current, Rhs, N) \
2711 do \
2712 if (YYID (N)) \
2713 { \
2714 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2715 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2716 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2717 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2718 } \
2719 else \
2720 { \
2721 (Current).first_line = (Current).last_line = \
2722 YYRHSLOC (Rhs, 0).last_line; \
2723 (Current).first_column = (Current).last_column = \
2724 YYRHSLOC (Rhs, 0).last_column; \
2725 } \
2726 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002727#endif
2728
Chris Lattner59363a32008-02-19 04:36:25 +00002729
2730/* YY_LOCATION_PRINT -- Print the location on the stream.
2731 This macro was not mandated originally: define only if we know
2732 we won't break user code: when these are the locations we know. */
2733
2734#ifndef YY_LOCATION_PRINT
Devang Pateleb293342008-02-20 19:13:10 +00002735# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Chris Lattner59363a32008-02-19 04:36:25 +00002736# define YY_LOCATION_PRINT(File, Loc) \
2737 fprintf (File, "%d.%d-%d.%d", \
2738 (Loc).first_line, (Loc).first_column, \
2739 (Loc).last_line, (Loc).last_column)
2740# else
2741# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2742# endif
2743#endif
2744
2745
2746/* YYLEX -- calling `yylex' with the right arguments. */
2747
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002748#ifdef YYLEX_PARAM
Chris Lattner59363a32008-02-19 04:36:25 +00002749# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002750#else
Chris Lattner59363a32008-02-19 04:36:25 +00002751# define YYLEX yylex ()
Scott Michel6d1aba82008-01-30 03:10:00 +00002752#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002753
2754/* Enable debugging if requested. */
2755#if YYDEBUG
2756
2757# ifndef YYFPRINTF
2758# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2759# define YYFPRINTF fprintf
2760# endif
2761
2762# define YYDPRINTF(Args) \
2763do { \
2764 if (yydebug) \
2765 YYFPRINTF Args; \
2766} while (YYID (0))
2767
2768# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2769do { \
2770 if (yydebug) \
2771 { \
2772 YYFPRINTF (stderr, "%s ", Title); \
2773 yy_symbol_print (stderr, \
2774 Type, Value); \
2775 YYFPRINTF (stderr, "\n"); \
2776 } \
2777} while (YYID (0))
2778
2779
2780/*--------------------------------.
2781| Print this symbol on YYOUTPUT. |
2782`--------------------------------*/
2783
2784/*ARGSUSED*/
2785#if (defined __STDC__ || defined __C99__FUNC__ \
2786 || defined __cplusplus || defined _MSC_VER)
2787static void
2788yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Scott Michel6d1aba82008-01-30 03:10:00 +00002789#else
Chris Lattner59363a32008-02-19 04:36:25 +00002790static void
2791yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2792 FILE *yyoutput;
2793 int yytype;
2794 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002795#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002796{
2797 if (!yyvaluep)
2798 return;
2799# ifdef YYPRINT
2800 if (yytype < YYNTOKENS)
2801 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2802# else
2803 YYUSE (yyoutput);
2804# endif
2805 switch (yytype)
2806 {
2807 default:
2808 break;
2809 }
2810}
2811
2812
2813/*--------------------------------.
2814| Print this symbol on YYOUTPUT. |
2815`--------------------------------*/
2816
2817#if (defined __STDC__ || defined __C99__FUNC__ \
2818 || defined __cplusplus || defined _MSC_VER)
2819static void
2820yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2821#else
2822static void
2823yy_symbol_print (yyoutput, yytype, yyvaluep)
2824 FILE *yyoutput;
2825 int yytype;
2826 YYSTYPE const * const yyvaluep;
Christopher Lamb0a243582007-12-11 09:02:08 +00002827#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002828{
2829 if (yytype < YYNTOKENS)
2830 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2831 else
2832 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Scott Michel5a6f17b2008-01-30 02:55:46 +00002833
Chris Lattner59363a32008-02-19 04:36:25 +00002834 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2835 YYFPRINTF (yyoutput, ")");
2836}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002837
Chris Lattner59363a32008-02-19 04:36:25 +00002838/*------------------------------------------------------------------.
2839| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2840| TOP (included). |
2841`------------------------------------------------------------------*/
Scott Michel5a6f17b2008-01-30 02:55:46 +00002842
Chris Lattner59363a32008-02-19 04:36:25 +00002843#if (defined __STDC__ || defined __C99__FUNC__ \
2844 || defined __cplusplus || defined _MSC_VER)
2845static void
2846yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2847#else
2848static void
2849yy_stack_print (bottom, top)
2850 yytype_int16 *bottom;
2851 yytype_int16 *top;
Christopher Lamb0a243582007-12-11 09:02:08 +00002852#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002853{
2854 YYFPRINTF (stderr, "Stack now");
2855 for (; bottom <= top; ++bottom)
2856 YYFPRINTF (stderr, " %d", *bottom);
2857 YYFPRINTF (stderr, "\n");
2858}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002859
Chris Lattner59363a32008-02-19 04:36:25 +00002860# define YY_STACK_PRINT(Bottom, Top) \
2861do { \
2862 if (yydebug) \
2863 yy_stack_print ((Bottom), (Top)); \
2864} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00002865
Chris Lattner59363a32008-02-19 04:36:25 +00002866
2867/*------------------------------------------------.
2868| Report that the YYRULE is going to be reduced. |
2869`------------------------------------------------*/
2870
2871#if (defined __STDC__ || defined __C99__FUNC__ \
2872 || defined __cplusplus || defined _MSC_VER)
2873static void
2874yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2875#else
2876static void
2877yy_reduce_print (yyvsp, yyrule)
2878 YYSTYPE *yyvsp;
2879 int yyrule;
Dale Johannesen3afee192007-09-07 21:07:57 +00002880#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002881{
2882 int yynrhs = yyr2[yyrule];
2883 int yyi;
2884 unsigned long int yylno = yyrline[yyrule];
2885 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2886 yyrule - 1, yylno);
2887 /* The symbols being reduced. */
2888 for (yyi = 0; yyi < yynrhs; yyi++)
2889 {
2890 fprintf (stderr, " $%d = ", yyi + 1);
2891 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2892 &(yyvsp[(yyi + 1) - (yynrhs)])
2893 );
2894 fprintf (stderr, "\n");
2895 }
2896}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002897
Chris Lattner59363a32008-02-19 04:36:25 +00002898# define YY_REDUCE_PRINT(Rule) \
2899do { \
2900 if (yydebug) \
2901 yy_reduce_print (yyvsp, Rule); \
2902} while (YYID (0))
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002903
Chris Lattner59363a32008-02-19 04:36:25 +00002904/* Nonzero means print parse trace. It is left uninitialized so that
2905 multiple parsers can coexist. */
2906int yydebug;
2907#else /* !YYDEBUG */
2908# define YYDPRINTF(Args)
2909# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2910# define YY_STACK_PRINT(Bottom, Top)
2911# define YY_REDUCE_PRINT(Rule)
2912#endif /* !YYDEBUG */
2913
2914
2915/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002916#ifndef YYINITDEPTH
Chris Lattner59363a32008-02-19 04:36:25 +00002917# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002918#endif
2919
Chris Lattner59363a32008-02-19 04:36:25 +00002920/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2921 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002922
Chris Lattner59363a32008-02-19 04:36:25 +00002923 Do not make this value too large; the results are undefined if
2924 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2925 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00002926
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002927#ifndef YYMAXDEPTH
Chris Lattner59363a32008-02-19 04:36:25 +00002928# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002929#endif
Chris Lattner59363a32008-02-19 04:36:25 +00002930
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002931
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002932
Chris Lattner59363a32008-02-19 04:36:25 +00002933#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002934
Chris Lattner59363a32008-02-19 04:36:25 +00002935# ifndef yystrlen
2936# if defined __GLIBC__ && defined _STRING_H
2937# define yystrlen strlen
2938# else
2939/* Return the length of YYSTR. */
2940#if (defined __STDC__ || defined __C99__FUNC__ \
2941 || defined __cplusplus || defined _MSC_VER)
2942static YYSIZE_T
2943yystrlen (const char *yystr)
Scott Michel5a6f17b2008-01-30 02:55:46 +00002944#else
Chris Lattner59363a32008-02-19 04:36:25 +00002945static YYSIZE_T
2946yystrlen (yystr)
2947 const char *yystr;
2948#endif
2949{
2950 YYSIZE_T yylen;
2951 for (yylen = 0; yystr[yylen]; yylen++)
2952 continue;
2953 return yylen;
2954}
2955# endif
2956# endif
2957
2958# ifndef yystpcpy
2959# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2960# define yystpcpy stpcpy
2961# else
2962/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2963 YYDEST. */
2964#if (defined __STDC__ || defined __C99__FUNC__ \
2965 || defined __cplusplus || defined _MSC_VER)
2966static char *
2967yystpcpy (char *yydest, const char *yysrc)
2968#else
2969static char *
2970yystpcpy (yydest, yysrc)
2971 char *yydest;
2972 const char *yysrc;
2973#endif
2974{
2975 char *yyd = yydest;
2976 const char *yys = yysrc;
2977
2978 while ((*yyd++ = *yys++) != '\0')
2979 continue;
2980
2981 return yyd - 1;
2982}
2983# endif
2984# endif
2985
2986# ifndef yytnamerr
2987/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2988 quotes and backslashes, so that it's suitable for yyerror. The
2989 heuristic is that double-quoting is unnecessary unless the string
2990 contains an apostrophe, a comma, or backslash (other than
2991 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2992 null, do not copy; instead, return the length of what the result
2993 would have been. */
2994static YYSIZE_T
2995yytnamerr (char *yyres, const char *yystr)
2996{
2997 if (*yystr == '"')
2998 {
2999 YYSIZE_T yyn = 0;
3000 char const *yyp = yystr;
3001
3002 for (;;)
3003 switch (*++yyp)
3004 {
3005 case '\'':
3006 case ',':
3007 goto do_not_strip_quotes;
3008
3009 case '\\':
3010 if (*++yyp != '\\')
3011 goto do_not_strip_quotes;
3012 /* Fall through. */
3013 default:
3014 if (yyres)
3015 yyres[yyn] = *yyp;
3016 yyn++;
3017 break;
3018
3019 case '"':
3020 if (yyres)
3021 yyres[yyn] = '\0';
3022 return yyn;
3023 }
3024 do_not_strip_quotes: ;
3025 }
3026
3027 if (! yyres)
3028 return yystrlen (yystr);
3029
3030 return yystpcpy (yyres, yystr) - yyres;
3031}
3032# endif
3033
3034/* Copy into YYRESULT an error message about the unexpected token
3035 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3036 including the terminating null byte. If YYRESULT is null, do not
3037 copy anything; just return the number of bytes that would be
3038 copied. As a special case, return 0 if an ordinary "syntax error"
3039 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3040 size calculation. */
3041static YYSIZE_T
3042yysyntax_error (char *yyresult, int yystate, int yychar)
3043{
3044 int yyn = yypact[yystate];
3045
3046 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3047 return 0;
3048 else
3049 {
3050 int yytype = YYTRANSLATE (yychar);
3051 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3052 YYSIZE_T yysize = yysize0;
3053 YYSIZE_T yysize1;
3054 int yysize_overflow = 0;
3055 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3056 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3057 int yyx;
3058
3059# if 0
3060 /* This is so xgettext sees the translatable formats that are
3061 constructed on the fly. */
3062 YY_("syntax error, unexpected %s");
3063 YY_("syntax error, unexpected %s, expecting %s");
3064 YY_("syntax error, unexpected %s, expecting %s or %s");
3065 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3066 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3067# endif
3068 char *yyfmt;
3069 char const *yyf;
3070 static char const yyunexpected[] = "syntax error, unexpected %s";
3071 static char const yyexpecting[] = ", expecting %s";
3072 static char const yyor[] = " or %s";
3073 char yyformat[sizeof yyunexpected
3074 + sizeof yyexpecting - 1
3075 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3076 * (sizeof yyor - 1))];
3077 char const *yyprefix = yyexpecting;
3078
3079 /* Start YYX at -YYN if negative to avoid negative indexes in
3080 YYCHECK. */
3081 int yyxbegin = yyn < 0 ? -yyn : 0;
3082
3083 /* Stay within bounds of both yycheck and yytname. */
3084 int yychecklim = YYLAST - yyn + 1;
3085 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3086 int yycount = 1;
3087
3088 yyarg[0] = yytname[yytype];
3089 yyfmt = yystpcpy (yyformat, yyunexpected);
3090
3091 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3092 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3093 {
3094 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3095 {
3096 yycount = 1;
3097 yysize = yysize0;
3098 yyformat[sizeof yyunexpected - 1] = '\0';
3099 break;
3100 }
3101 yyarg[yycount++] = yytname[yyx];
3102 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3103 yysize_overflow |= (yysize1 < yysize);
3104 yysize = yysize1;
3105 yyfmt = yystpcpy (yyfmt, yyprefix);
3106 yyprefix = yyor;
3107 }
3108
3109 yyf = YY_(yyformat);
3110 yysize1 = yysize + yystrlen (yyf);
3111 yysize_overflow |= (yysize1 < yysize);
3112 yysize = yysize1;
3113
3114 if (yysize_overflow)
3115 return YYSIZE_MAXIMUM;
3116
3117 if (yyresult)
3118 {
3119 /* Avoid sprintf, as that infringes on the user's name space.
3120 Don't have undefined behavior even if the translation
3121 produced a string with the wrong number of "%s"s. */
3122 char *yyp = yyresult;
3123 int yyi = 0;
3124 while ((*yyp = *yyf) != '\0')
3125 {
3126 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3127 {
3128 yyp += yytnamerr (yyp, yyarg[yyi++]);
3129 yyf += 2;
3130 }
3131 else
3132 {
3133 yyp++;
3134 yyf++;
3135 }
3136 }
3137 }
3138 return yysize;
3139 }
3140}
3141#endif /* YYERROR_VERBOSE */
3142
3143
3144/*-----------------------------------------------.
3145| Release the memory associated to this symbol. |
3146`-----------------------------------------------*/
3147
3148/*ARGSUSED*/
3149#if (defined __STDC__ || defined __C99__FUNC__ \
3150 || defined __cplusplus || defined _MSC_VER)
3151static void
3152yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3153#else
3154static void
3155yydestruct (yymsg, yytype, yyvaluep)
3156 const char *yymsg;
3157 int yytype;
3158 YYSTYPE *yyvaluep;
3159#endif
3160{
3161 YYUSE (yyvaluep);
3162
3163 if (!yymsg)
3164 yymsg = "Deleting";
3165 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3166
3167 switch (yytype)
3168 {
3169
3170 default:
3171 break;
3172 }
3173}
3174
3175
3176/* Prevent warnings from -Wmissing-prototypes. */
3177
3178#ifdef YYPARSE_PARAM
3179#if defined __STDC__ || defined __cplusplus
3180int yyparse (void *YYPARSE_PARAM);
3181#else
3182int yyparse ();
3183#endif
3184#else /* ! YYPARSE_PARAM */
3185#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003186int yyparse (void);
Scott Michel6d1aba82008-01-30 03:10:00 +00003187#else
Chris Lattner59363a32008-02-19 04:36:25 +00003188int yyparse ();
Christopher Lamb0a243582007-12-11 09:02:08 +00003189#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003190#endif /* ! YYPARSE_PARAM */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003191
Scott Michel5a6f17b2008-01-30 02:55:46 +00003192
Chris Lattner59363a32008-02-19 04:36:25 +00003193
3194/* The look-ahead symbol. */
3195int yychar;
3196
3197/* The semantic value of the look-ahead symbol. */
3198YYSTYPE yylval;
3199
3200/* Number of syntax errors so far. */
3201int yynerrs;
3202
3203
3204
3205/*----------.
3206| yyparse. |
3207`----------*/
3208
3209#ifdef YYPARSE_PARAM
3210#if (defined __STDC__ || defined __C99__FUNC__ \
3211 || defined __cplusplus || defined _MSC_VER)
3212int
3213yyparse (void *YYPARSE_PARAM)
3214#else
3215int
3216yyparse (YYPARSE_PARAM)
3217 void *YYPARSE_PARAM;
3218#endif
3219#else /* ! YYPARSE_PARAM */
3220#if (defined __STDC__ || defined __C99__FUNC__ \
3221 || defined __cplusplus || defined _MSC_VER)
3222int
3223yyparse (void)
3224#else
3225int
3226yyparse ()
3227
Scott Michel6d1aba82008-01-30 03:10:00 +00003228#endif
3229#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003230{
3231
3232 int yystate;
3233 int yyn;
3234 int yyresult;
3235 /* Number of tokens to shift before error messages enabled. */
3236 int yyerrstatus;
3237 /* Look-ahead token as an internal (translated) token number. */
3238 int yytoken = 0;
3239#if YYERROR_VERBOSE
3240 /* Buffer for error messages, and its allocated size. */
3241 char yymsgbuf[128];
3242 char *yymsg = yymsgbuf;
3243 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Scott Michel6d1aba82008-01-30 03:10:00 +00003244#endif
Scott Michel5a6f17b2008-01-30 02:55:46 +00003245
Chris Lattner59363a32008-02-19 04:36:25 +00003246 /* Three stacks and their tools:
3247 `yyss': related to states,
3248 `yyvs': related to semantic values,
3249 `yyls': related to locations.
3250
3251 Refer to the stacks thru separate pointers, to allow yyoverflow
3252 to reallocate them elsewhere. */
3253
3254 /* The state stack. */
3255 yytype_int16 yyssa[YYINITDEPTH];
3256 yytype_int16 *yyss = yyssa;
3257 yytype_int16 *yyssp;
3258
3259 /* The semantic value stack. */
3260 YYSTYPE yyvsa[YYINITDEPTH];
3261 YYSTYPE *yyvs = yyvsa;
3262 YYSTYPE *yyvsp;
3263
3264
3265
3266#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3267
3268 YYSIZE_T yystacksize = YYINITDEPTH;
3269
3270 /* The variables used to return semantic value and location from the
3271 action routines. */
3272 YYSTYPE yyval;
3273
3274
3275 /* The number of symbols on the RHS of the reduced rule.
3276 Keep to zero when no symbol should be popped. */
3277 int yylen = 0;
3278
3279 YYDPRINTF ((stderr, "Starting parse\n"));
3280
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003281 yystate = 0;
3282 yyerrstatus = 0;
3283 yynerrs = 0;
3284 yychar = YYEMPTY; /* Cause a token to be read. */
3285
3286 /* Initialize stack pointers.
3287 Waste one element of value and location stack
3288 so that they stay on the same level as the state stack.
3289 The wasted elements are never initialized. */
3290
Chris Lattner59363a32008-02-19 04:36:25 +00003291 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003292 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003293
Chris Lattner59363a32008-02-19 04:36:25 +00003294 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003295
Chris Lattner59363a32008-02-19 04:36:25 +00003296/*------------------------------------------------------------.
3297| yynewstate -- Push a new state, which is found in yystate. |
3298`------------------------------------------------------------*/
3299 yynewstate:
3300 /* In all cases, when you get here, the value and location stacks
3301 have just been pushed. So pushing a state here evens the stacks. */
3302 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003303
Chris Lattner59363a32008-02-19 04:36:25 +00003304 yysetstate:
3305 *yyssp = yystate;
3306
3307 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003308 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003309 /* Get the current used size of the three stacks, in elements. */
Chris Lattner59363a32008-02-19 04:36:25 +00003310 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003311
3312#ifdef yyoverflow
Chris Lattner59363a32008-02-19 04:36:25 +00003313 {
3314 /* Give user a chance to reallocate the stack. Use copies of
3315 these so that the &'s don't force the real ones into
3316 memory. */
3317 YYSTYPE *yyvs1 = yyvs;
3318 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003319
Chris Lattner59363a32008-02-19 04:36:25 +00003320
3321 /* Each stack pointer address is followed by the size of the
3322 data in use in that stack, in bytes. This used to be a
3323 conditional around just the two extra args, but that might
3324 be undefined if yyoverflow is a macro. */
3325 yyoverflow (YY_("memory exhausted"),
3326 &yyss1, yysize * sizeof (*yyssp),
3327 &yyvs1, yysize * sizeof (*yyvsp),
3328
3329 &yystacksize);
3330
3331 yyss = yyss1;
3332 yyvs = yyvs1;
3333 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003334#else /* no yyoverflow */
Chris Lattner59363a32008-02-19 04:36:25 +00003335# ifndef YYSTACK_RELOCATE
3336 goto yyexhaustedlab;
3337# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003338 /* Extend the stack our own way. */
Chris Lattner59363a32008-02-19 04:36:25 +00003339 if (YYMAXDEPTH <= yystacksize)
3340 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003341 yystacksize *= 2;
Chris Lattner59363a32008-02-19 04:36:25 +00003342 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003343 yystacksize = YYMAXDEPTH;
Chris Lattner59363a32008-02-19 04:36:25 +00003344
3345 {
3346 yytype_int16 *yyss1 = yyss;
3347 union yyalloc *yyptr =
3348 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3349 if (! yyptr)
3350 goto yyexhaustedlab;
3351 YYSTACK_RELOCATE (yyss);
3352 YYSTACK_RELOCATE (yyvs);
3353
3354# undef YYSTACK_RELOCATE
3355 if (yyss1 != yyssa)
3356 YYSTACK_FREE (yyss1);
3357 }
3358# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003359#endif /* no yyoverflow */
3360
Chris Lattner59363a32008-02-19 04:36:25 +00003361 yyssp = yyss + yysize - 1;
3362 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003363
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003364
Chris Lattner59363a32008-02-19 04:36:25 +00003365 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3366 (unsigned long int) yystacksize));
3367
3368 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003369 YYABORT;
3370 }
3371
Chris Lattner59363a32008-02-19 04:36:25 +00003372 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003373
3374 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003375
Chris Lattner59363a32008-02-19 04:36:25 +00003376/*-----------.
3377| yybackup. |
3378`-----------*/
3379yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003380
Chris Lattner59363a32008-02-19 04:36:25 +00003381 /* Do appropriate processing given the current state. Read a
3382 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003383
Chris Lattner59363a32008-02-19 04:36:25 +00003384 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003385 yyn = yypact[yystate];
Chris Lattner59363a32008-02-19 04:36:25 +00003386 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003387 goto yydefault;
3388
Chris Lattner59363a32008-02-19 04:36:25 +00003389 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003390
Chris Lattner59363a32008-02-19 04:36:25 +00003391 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003392 if (yychar == YYEMPTY)
3393 {
Chris Lattner59363a32008-02-19 04:36:25 +00003394 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003395 yychar = YYLEX;
3396 }
3397
Chris Lattner59363a32008-02-19 04:36:25 +00003398 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003399 {
Chris Lattner59363a32008-02-19 04:36:25 +00003400 yychar = yytoken = YYEOF;
3401 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003402 }
3403 else
3404 {
Chris Lattner59363a32008-02-19 04:36:25 +00003405 yytoken = YYTRANSLATE (yychar);
3406 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003407 }
3408
Chris Lattner59363a32008-02-19 04:36:25 +00003409 /* If the proper action on seeing token YYTOKEN is to reduce or to
3410 detect an error, take that action. */
3411 yyn += yytoken;
3412 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003413 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003414 yyn = yytable[yyn];
Chris Lattner59363a32008-02-19 04:36:25 +00003415 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003416 {
Chris Lattner59363a32008-02-19 04:36:25 +00003417 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003418 goto yyerrlab;
3419 yyn = -yyn;
3420 goto yyreduce;
3421 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003422
3423 if (yyn == YYFINAL)
3424 YYACCEPT;
3425
Chris Lattner59363a32008-02-19 04:36:25 +00003426 /* Count tokens shifted since error; after three, turn off error
3427 status. */
3428 if (yyerrstatus)
3429 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003430
Chris Lattner59363a32008-02-19 04:36:25 +00003431 /* Shift the look-ahead token. */
3432 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003433
Chris Lattner59363a32008-02-19 04:36:25 +00003434 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003435 if (yychar != YYEOF)
3436 yychar = YYEMPTY;
3437
Scott Michel6d1aba82008-01-30 03:10:00 +00003438 yystate = yyn;
Chris Lattner59363a32008-02-19 04:36:25 +00003439 *++yyvsp = yylval;
3440
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003441 goto yynewstate;
3442
Scott Michel6d1aba82008-01-30 03:10:00 +00003443
Chris Lattner59363a32008-02-19 04:36:25 +00003444/*-----------------------------------------------------------.
3445| yydefault -- do the default action for the current state. |
3446`-----------------------------------------------------------*/
3447yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003448 yyn = yydefact[yystate];
3449 if (yyn == 0)
3450 goto yyerrlab;
Chris Lattner59363a32008-02-19 04:36:25 +00003451 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003452
Chris Lattner59363a32008-02-19 04:36:25 +00003453
3454/*-----------------------------.
3455| yyreduce -- Do a reduction. |
3456`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003457yyreduce:
Chris Lattner59363a32008-02-19 04:36:25 +00003458 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003459 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003460
Chris Lattner59363a32008-02-19 04:36:25 +00003461 /* If YYLEN is nonzero, implement the default value of the action:
3462 `$$ = $1'.
3463
3464 Otherwise, the following line sets YYVAL to garbage.
3465 This behavior is undocumented and Bison
3466 users should not rely upon it. Assigning to YYVAL
3467 unconditionally makes the parser a bit smaller, and it avoids a
3468 GCC warning that YYVAL may be used uninitialized. */
3469 yyval = yyvsp[1-yylen];
3470
3471
3472 YY_REDUCE_PRINT (yyn);
3473 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003474 {
Chris Lattner59363a32008-02-19 04:36:25 +00003475 case 29:
Devang Patelbf507402008-02-20 22:40:23 +00003476#line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003477 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3478 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003479
Chris Lattner59363a32008-02-19 04:36:25 +00003480 case 30:
Devang Patelbf507402008-02-20 22:40:23 +00003481#line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003482 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3483 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003484
Chris Lattner59363a32008-02-19 04:36:25 +00003485 case 31:
Devang Patelbf507402008-02-20 22:40:23 +00003486#line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003487 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3488 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003489
Chris Lattner59363a32008-02-19 04:36:25 +00003490 case 32:
Devang Patelbf507402008-02-20 22:40:23 +00003491#line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003492 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3493 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003494
Chris Lattner59363a32008-02-19 04:36:25 +00003495 case 33:
Devang Patelbf507402008-02-20 22:40:23 +00003496#line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003497 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3498 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003499
Chris Lattner59363a32008-02-19 04:36:25 +00003500 case 34:
Devang Patelbf507402008-02-20 22:40:23 +00003501#line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003502 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3503 break;
3504
3505 case 35:
Devang Patelbf507402008-02-20 22:40:23 +00003506#line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003507 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3508 break;
3509
3510 case 36:
Devang Patelbf507402008-02-20 22:40:23 +00003511#line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003512 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3513 break;
3514
3515 case 37:
Devang Patelbf507402008-02-20 22:40:23 +00003516#line 1124 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003517 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3518 break;
3519
3520 case 38:
Devang Patelbf507402008-02-20 22:40:23 +00003521#line 1124 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003522 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3523 break;
3524
3525 case 39:
Devang Patelbf507402008-02-20 22:40:23 +00003526#line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003527 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3528 break;
3529
3530 case 40:
Devang Patelbf507402008-02-20 22:40:23 +00003531#line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003532 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3533 break;
3534
3535 case 41:
Devang Patelbf507402008-02-20 22:40:23 +00003536#line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003537 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3538 break;
3539
3540 case 42:
Devang Patelbf507402008-02-20 22:40:23 +00003541#line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003542 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3543 break;
3544
3545 case 43:
Devang Patelbf507402008-02-20 22:40:23 +00003546#line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003547 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3548 break;
3549
3550 case 44:
Devang Patelbf507402008-02-20 22:40:23 +00003551#line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003552 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3553 break;
3554
3555 case 45:
Devang Patelbf507402008-02-20 22:40:23 +00003556#line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003557 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3558 break;
3559
3560 case 46:
Devang Patelbf507402008-02-20 22:40:23 +00003561#line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003562 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3563 break;
3564
3565 case 47:
Devang Patelbf507402008-02-20 22:40:23 +00003566#line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003567 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3568 break;
3569
3570 case 48:
Devang Patelbf507402008-02-20 22:40:23 +00003571#line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003572 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3573 break;
3574
3575 case 49:
Devang Patelbf507402008-02-20 22:40:23 +00003576#line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003577 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3578 break;
3579
3580 case 50:
Devang Patelbf507402008-02-20 22:40:23 +00003581#line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003582 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3583 break;
3584
3585 case 51:
Devang Patelbf507402008-02-20 22:40:23 +00003586#line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003587 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3588 break;
3589
3590 case 52:
Devang Patelbf507402008-02-20 22:40:23 +00003591#line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003592 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3593 break;
3594
3595 case 53:
Devang Patelbf507402008-02-20 22:40:23 +00003596#line 1135 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003597 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3598 break;
3599
3600 case 54:
Devang Patelbf507402008-02-20 22:40:23 +00003601#line 1136 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003602 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3603 break;
3604
3605 case 65:
Devang Patelbf507402008-02-20 22:40:23 +00003606#line 1145 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003607 { (yyval.StrVal) = 0; ;}
3608 break;
3609
3610 case 66:
Devang Patelbf507402008-02-20 22:40:23 +00003611#line 1147 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003612 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3613 break;
3614
3615 case 67:
Devang Patelbf507402008-02-20 22:40:23 +00003616#line 1148 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003617 { (yyval.UIntVal)=0; ;}
3618 break;
3619
3620 case 68:
Devang Patelbf507402008-02-20 22:40:23 +00003621#line 1152 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003622 {
3623 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003624 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003625 ;}
3626 break;
3627
3628 case 69:
Devang Patelbf507402008-02-20 22:40:23 +00003629#line 1156 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003630 {
3631 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003632 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003633 ;}
3634 break;
3635
3636 case 73:
Devang Patelbf507402008-02-20 22:40:23 +00003637#line 1164 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003638 {
3639 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003640 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003641 ;}
3642 break;
3643
3644 case 74:
Devang Patelbf507402008-02-20 22:40:23 +00003645#line 1169 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003646 {
3647 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003648 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003649 ;}
3650 break;
3651
3652 case 75:
Devang Patelbf507402008-02-20 22:40:23 +00003653#line 1175 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003654 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3655 break;
3656
3657 case 76:
Devang Patelbf507402008-02-20 22:40:23 +00003658#line 1176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003659 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3660 break;
3661
3662 case 77:
Devang Patelbf507402008-02-20 22:40:23 +00003663#line 1177 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003664 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3665 break;
3666
3667 case 78:
Devang Patelbf507402008-02-20 22:40:23 +00003668#line 1178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003669 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3670 break;
3671
3672 case 79:
Devang Patelbf507402008-02-20 22:40:23 +00003673#line 1179 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003674 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3675 break;
3676
3677 case 80:
Devang Patelbf507402008-02-20 22:40:23 +00003678#line 1183 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003679 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3680 break;
3681
3682 case 81:
Devang Patelbf507402008-02-20 22:40:23 +00003683#line 1184 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003684 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3685 break;
3686
3687 case 82:
Devang Patelbf507402008-02-20 22:40:23 +00003688#line 1185 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003689 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3690 break;
3691
3692 case 83:
Devang Patelbf507402008-02-20 22:40:23 +00003693#line 1189 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003694 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3695 break;
3696
3697 case 84:
Devang Patelbf507402008-02-20 22:40:23 +00003698#line 1190 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003699 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3700 break;
3701
3702 case 85:
Devang Patelbf507402008-02-20 22:40:23 +00003703#line 1191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003704 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3705 break;
3706
3707 case 86:
Devang Patelbf507402008-02-20 22:40:23 +00003708#line 1192 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003709 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3710 break;
3711
3712 case 87:
Devang Patelbf507402008-02-20 22:40:23 +00003713#line 1196 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003714 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3715 break;
3716
3717 case 88:
Devang Patelbf507402008-02-20 22:40:23 +00003718#line 1197 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003719 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3720 break;
3721
3722 case 89:
Devang Patelbf507402008-02-20 22:40:23 +00003723#line 1198 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003724 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3725 break;
3726
3727 case 90:
Devang Patelbf507402008-02-20 22:40:23 +00003728#line 1202 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003729 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3730 break;
3731
3732 case 91:
Devang Patelbf507402008-02-20 22:40:23 +00003733#line 1203 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003734 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3735 break;
3736
3737 case 92:
Devang Patelbf507402008-02-20 22:40:23 +00003738#line 1204 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003739 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3740 break;
3741
3742 case 93:
Devang Patelbf507402008-02-20 22:40:23 +00003743#line 1205 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003744 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3745 break;
3746
3747 case 94:
Devang Patelbf507402008-02-20 22:40:23 +00003748#line 1206 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003749 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3750 break;
3751
3752 case 95:
Devang Patelbf507402008-02-20 22:40:23 +00003753#line 1210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003754 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3755 break;
3756
3757 case 96:
Devang Patelbf507402008-02-20 22:40:23 +00003758#line 1211 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003759 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3760 break;
3761
3762 case 97:
Devang Patelbf507402008-02-20 22:40:23 +00003763#line 1212 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003764 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3765 break;
3766
3767 case 98:
Devang Patelbf507402008-02-20 22:40:23 +00003768#line 1215 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003769 { (yyval.UIntVal) = CallingConv::C; ;}
3770 break;
3771
3772 case 99:
Devang Patelbf507402008-02-20 22:40:23 +00003773#line 1216 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003774 { (yyval.UIntVal) = CallingConv::C; ;}
3775 break;
3776
3777 case 100:
Devang Patelbf507402008-02-20 22:40:23 +00003778#line 1217 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003779 { (yyval.UIntVal) = CallingConv::Fast; ;}
3780 break;
3781
3782 case 101:
Devang Patelbf507402008-02-20 22:40:23 +00003783#line 1218 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003784 { (yyval.UIntVal) = CallingConv::Cold; ;}
3785 break;
3786
3787 case 102:
Devang Patelbf507402008-02-20 22:40:23 +00003788#line 1219 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003789 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3790 break;
3791
3792 case 103:
Devang Patelbf507402008-02-20 22:40:23 +00003793#line 1220 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003794 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3795 break;
3796
3797 case 104:
Devang Patelbf507402008-02-20 22:40:23 +00003798#line 1221 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003799 {
3800 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003801 GEN_ERROR("Calling conv too large");
Chris Lattner59363a32008-02-19 04:36:25 +00003802 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003803 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003804 ;}
3805 break;
3806
3807 case 105:
Devang Patelbf507402008-02-20 22:40:23 +00003808#line 1228 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003809 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3810 break;
3811
3812 case 106:
Devang Patelbf507402008-02-20 22:40:23 +00003813#line 1229 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003814 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3815 break;
3816
3817 case 107:
Devang Patelbf507402008-02-20 22:40:23 +00003818#line 1230 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003819 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3820 break;
3821
3822 case 108:
Devang Patelbf507402008-02-20 22:40:23 +00003823#line 1231 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003824 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3825 break;
3826
3827 case 109:
Devang Patelbf507402008-02-20 22:40:23 +00003828#line 1232 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003829 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3830 break;
3831
3832 case 110:
Devang Patelbf507402008-02-20 22:40:23 +00003833#line 1233 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003834 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3835 break;
3836
3837 case 111:
Devang Patelbf507402008-02-20 22:40:23 +00003838#line 1234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003839 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3840 break;
3841
3842 case 112:
Devang Patelbf507402008-02-20 22:40:23 +00003843#line 1235 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003844 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3845 break;
3846
3847 case 113:
Devang Patelbf507402008-02-20 22:40:23 +00003848#line 1236 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003849 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3850 break;
3851
3852 case 114:
Devang Patelbf507402008-02-20 22:40:23 +00003853#line 1237 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003854 { (yyval.ParamAttrs) = (yyvsp[(2) - (2)].UInt64Val) << 16; ;}
Chris Lattner59363a32008-02-19 04:36:25 +00003855 break;
3856
3857 case 115:
Devang Patelbf507402008-02-20 22:40:23 +00003858#line 1240 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003859 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3860 break;
3861
Dale Johannesena79ecf32008-02-20 21:15:43 +00003862 case 116:
Devang Patelbf507402008-02-20 22:40:23 +00003863#line 1241 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003864 {
3865 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3866 ;}
3867 break;
3868
Dale Johannesena79ecf32008-02-20 21:15:43 +00003869 case 117:
Devang Patelbf507402008-02-20 22:40:23 +00003870#line 1246 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003871 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3872 break;
3873
3874 case 118:
Devang Patelbf507402008-02-20 22:40:23 +00003875#line 1247 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003876 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3877 break;
3878
3879 case 119:
Devang Patelbf507402008-02-20 22:40:23 +00003880#line 1248 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003881 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3882 break;
3883
3884 case 120:
Devang Patelbf507402008-02-20 22:40:23 +00003885#line 1249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003886 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3887 break;
3888
3889 case 121:
Devang Patelbf507402008-02-20 22:40:23 +00003890#line 1250 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003891 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3892 break;
3893
3894 case 122:
Devang Patelbf507402008-02-20 22:40:23 +00003895#line 1251 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003896 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3897 break;
3898
3899 case 123:
Devang Patelbf507402008-02-20 22:40:23 +00003900#line 1254 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003901 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3902 break;
3903
Chris Lattner59363a32008-02-19 04:36:25 +00003904 case 124:
Devang Patelbf507402008-02-20 22:40:23 +00003905#line 1255 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003906 {
3907 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3908 ;}
Chris Lattner59363a32008-02-19 04:36:25 +00003909 break;
3910
3911 case 125:
Devang Patelbf507402008-02-20 22:40:23 +00003912#line 1260 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003913 { (yyval.StrVal) = 0; ;}
3914 break;
3915
3916 case 126:
Devang Patelbf507402008-02-20 22:40:23 +00003917#line 1261 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003918 {
3919 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3920 ;}
3921 break;
3922
Dale Johannesena79ecf32008-02-20 21:15:43 +00003923 case 127:
Devang Patelbf507402008-02-20 22:40:23 +00003924#line 1268 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003925 { (yyval.UIntVal) = 0; ;}
3926 break;
3927
Dale Johannesena79ecf32008-02-20 21:15:43 +00003928 case 128:
Devang Patelbf507402008-02-20 22:40:23 +00003929#line 1269 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003930 {
3931 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3932 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003933 GEN_ERROR("Alignment must be a power of two");
3934 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003935;}
3936 break;
3937
Dale Johannesena79ecf32008-02-20 21:15:43 +00003938 case 129:
Devang Patelbf507402008-02-20 22:40:23 +00003939#line 1275 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003940 { (yyval.UIntVal) = 0; ;}
3941 break;
3942
Dale Johannesena79ecf32008-02-20 21:15:43 +00003943 case 130:
Devang Patelbf507402008-02-20 22:40:23 +00003944#line 1276 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003945 {
3946 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3947 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00003948 GEN_ERROR("Alignment must be a power of two");
3949 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003950;}
3951 break;
3952
Dale Johannesena79ecf32008-02-20 21:15:43 +00003953 case 131:
Devang Patelbf507402008-02-20 22:40:23 +00003954#line 1285 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003955 {
3956 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3957 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003958 GEN_ERROR("Invalid character in section name");
Chris Lattner59363a32008-02-19 04:36:25 +00003959 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003960 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003961;}
3962 break;
3963
Dale Johannesena79ecf32008-02-20 21:15:43 +00003964 case 132:
Devang Patelbf507402008-02-20 22:40:23 +00003965#line 1293 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003966 { (yyval.StrVal) = 0; ;}
3967 break;
3968
Dale Johannesena79ecf32008-02-20 21:15:43 +00003969 case 133:
Devang Patelbf507402008-02-20 22:40:23 +00003970#line 1294 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003971 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3972 break;
3973
Chris Lattner59363a32008-02-19 04:36:25 +00003974 case 134:
Devang Patelbf507402008-02-20 22:40:23 +00003975#line 1299 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003976 {;}
3977 break;
3978
3979 case 135:
Devang Patelbf507402008-02-20 22:40:23 +00003980#line 1300 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00003981 {;}
3982 break;
3983
3984 case 136:
Devang Patelbf507402008-02-20 22:40:23 +00003985#line 1301 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003986 {
3987 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3988 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003989 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00003990 ;}
3991 break;
3992
Dale Johannesena79ecf32008-02-20 21:15:43 +00003993 case 137:
Devang Patelbf507402008-02-20 22:40:23 +00003994#line 1306 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00003995 {
3996 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003997 GEN_ERROR("Alignment must be a power of two");
Chris Lattner59363a32008-02-19 04:36:25 +00003998 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003999 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004000 ;}
4001 break;
4002
Dale Johannesena79ecf32008-02-20 21:15:43 +00004003 case 145:
Devang Patelbf507402008-02-20 22:40:23 +00004004#line 1322 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004005 {
4006 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004007 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004008 ;}
4009 break;
4010
Dale Johannesena79ecf32008-02-20 21:15:43 +00004011 case 146:
Devang Patelbf507402008-02-20 22:40:23 +00004012#line 1326 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004013 {
4014 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004015 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004016 ;}
4017 break;
4018
Dale Johannesena79ecf32008-02-20 21:15:43 +00004019 case 147:
Devang Patelbf507402008-02-20 22:40:23 +00004020#line 1330 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004021 { // Pointer type?
4022 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004023 GEN_ERROR("Cannot form a pointer to a basic block");
Chris Lattner59363a32008-02-19 04:36:25 +00004024 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4025 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004026 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004027 ;}
4028 break;
4029
Dale Johannesena79ecf32008-02-20 21:15:43 +00004030 case 148:
Devang Patelbf507402008-02-20 22:40:23 +00004031#line 1337 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004032 { // Named types are also simple types...
4033 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004034 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004035 (yyval.TypeVal) = new PATypeHolder(tmp);
4036 ;}
4037 break;
4038
Dale Johannesena79ecf32008-02-20 21:15:43 +00004039 case 149:
Devang Patelbf507402008-02-20 22:40:23 +00004040#line 1342 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004041 { // Type UpReference
4042 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004043 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Chris Lattner59363a32008-02-19 04:36:25 +00004044 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4045 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004046 UR_OUT("New Upreference!\n");
4047 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004048 ;}
4049 break;
4050
Dale Johannesena79ecf32008-02-20 21:15:43 +00004051 case 150:
Devang Patelbf507402008-02-20 22:40:23 +00004052#line 1350 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004053 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004054 // Allow but ignore attributes on function types; this permits auto-upgrade.
4055 // FIXME: remove in LLVM 3.0.
Chris Lattner59363a32008-02-19 04:36:25 +00004056 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004057 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4058 isa<OpaqueType>(RetTy)))
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004059 GEN_ERROR("LLVM Functions cannot return aggregates");
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004060
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004061 std::vector<const Type*> Params;
Chris Lattner59363a32008-02-19 04:36:25 +00004062 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004063 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004064 const Type *Ty = I->Ty->get();
4065 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004066 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004067
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004068 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4069 if (isVarArg) Params.pop_back();
4070
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004071 for (unsigned i = 0; i != Params.size(); ++i)
4072 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4073 GEN_ERROR("Function arguments must be value types!");
4074
4075 CHECK_FOR_ERROR
4076
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004077 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Chris Lattner59363a32008-02-19 04:36:25 +00004078 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4079 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4080 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004081 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004082 ;}
4083 break;
4084
Dale Johannesena79ecf32008-02-20 21:15:43 +00004085 case 151:
Devang Patelbf507402008-02-20 22:40:23 +00004086#line 1380 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004087 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004088 // Allow but ignore attributes on function types; this permits auto-upgrade.
4089 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004090 std::vector<const Type*> Params;
Chris Lattner59363a32008-02-19 04:36:25 +00004091 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004092 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004093 const Type* Ty = I->Ty->get();
4094 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004095 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004096
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004097 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4098 if (isVarArg) Params.pop_back();
4099
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004100 for (unsigned i = 0; i != Params.size(); ++i)
4101 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4102 GEN_ERROR("Function arguments must be value types!");
4103
4104 CHECK_FOR_ERROR
4105
Chris Lattner59363a32008-02-19 04:36:25 +00004106 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4107 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4108 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004109 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004110 ;}
4111 break;
4112
Dale Johannesena79ecf32008-02-20 21:15:43 +00004113 case 152:
Devang Patelbf507402008-02-20 22:40:23 +00004114#line 1405 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004115 { // Sized array type?
4116 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4117 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004118 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004119 ;}
4120 break;
4121
Dale Johannesena79ecf32008-02-20 21:15:43 +00004122 case 153:
Devang Patelbf507402008-02-20 22:40:23 +00004123#line 1410 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004124 { // Vector type?
4125 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4126 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004127 GEN_ERROR("Unsigned result not equal to signed result");
4128 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4129 GEN_ERROR("Element type of a VectorType must be primitive");
Chris Lattner59363a32008-02-19 04:36:25 +00004130 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4131 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004132 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004133 ;}
4134 break;
4135
Dale Johannesena79ecf32008-02-20 21:15:43 +00004136 case 154:
Devang Patelbf507402008-02-20 22:40:23 +00004137#line 1420 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004138 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004139 std::vector<const Type*> Elements;
Chris Lattner59363a32008-02-19 04:36:25 +00004140 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4141 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004142 Elements.push_back(*I);
4143
Chris Lattner59363a32008-02-19 04:36:25 +00004144 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4145 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004146 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004147 ;}
4148 break;
4149
Dale Johannesena79ecf32008-02-20 21:15:43 +00004150 case 155:
Devang Patelbf507402008-02-20 22:40:23 +00004151#line 1430 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004152 { // Empty structure type?
4153 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004154 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004155 ;}
4156 break;
4157
Dale Johannesena79ecf32008-02-20 21:15:43 +00004158 case 156:
Devang Patelbf507402008-02-20 22:40:23 +00004159#line 1434 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004160 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004161 std::vector<const Type*> Elements;
Chris Lattner59363a32008-02-19 04:36:25 +00004162 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4163 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004164 Elements.push_back(*I);
4165
Chris Lattner59363a32008-02-19 04:36:25 +00004166 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4167 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004168 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004169 ;}
4170 break;
4171
Dale Johannesena79ecf32008-02-20 21:15:43 +00004172 case 157:
Devang Patelbf507402008-02-20 22:40:23 +00004173#line 1444 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004174 { // Empty structure type?
4175 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004176 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004177 ;}
4178 break;
4179
Dale Johannesena79ecf32008-02-20 21:15:43 +00004180 case 158:
Devang Patelbf507402008-02-20 22:40:23 +00004181#line 1451 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004182 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004183 // Allow but ignore attributes on function types; this permits auto-upgrade.
4184 // FIXME: remove in LLVM 3.0.
Chris Lattner59363a32008-02-19 04:36:25 +00004185 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4186 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4187 ;}
4188 break;
4189
Dale Johannesena79ecf32008-02-20 21:15:43 +00004190 case 159:
Devang Patelbf507402008-02-20 22:40:23 +00004191#line 1460 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004192 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004193 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004194 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
Devang Patelbf507402008-02-20 22:40:23 +00004195 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && (*(yyvsp[(1) - (1)].TypeVal))->getTypeID() != Type::StructTyID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004196 GEN_ERROR("LLVM functions cannot return aggregate types");
Chris Lattner59363a32008-02-19 04:36:25 +00004197 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4198 ;}
4199 break;
4200
Dale Johannesena79ecf32008-02-20 21:15:43 +00004201 case 160:
Devang Patelbf507402008-02-20 22:40:23 +00004202#line 1467 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004203 {
4204 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4205 ;}
4206 break;
4207
Dale Johannesena79ecf32008-02-20 21:15:43 +00004208 case 161:
Devang Patelbf507402008-02-20 22:40:23 +00004209#line 1472 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004210 {
4211 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4212 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004213 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004214 ;}
4215 break;
4216
Dale Johannesena79ecf32008-02-20 21:15:43 +00004217 case 162:
Devang Patelbf507402008-02-20 22:40:23 +00004218#line 1477 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004219 {
4220 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004221 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004222 ;}
4223 break;
4224
Dale Johannesena79ecf32008-02-20 21:15:43 +00004225 case 164:
Devang Patelbf507402008-02-20 22:40:23 +00004226#line 1485 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004227 {
4228 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004229 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4230 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner59363a32008-02-19 04:36:25 +00004231 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004232 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004233 ;}
4234 break;
4235
Dale Johannesena79ecf32008-02-20 21:15:43 +00004236 case 165:
Devang Patelbf507402008-02-20 22:40:23 +00004237#line 1492 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004238 {
4239 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004240 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4241 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner59363a32008-02-19 04:36:25 +00004242 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004243 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004244 ;}
4245 break;
4246
Dale Johannesena79ecf32008-02-20 21:15:43 +00004247 case 166:
Devang Patelbf507402008-02-20 22:40:23 +00004248#line 1499 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004249 {
4250 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004251 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004252 ;}
4253 break;
4254
Dale Johannesena79ecf32008-02-20 21:15:43 +00004255 case 167:
Devang Patelbf507402008-02-20 22:40:23 +00004256#line 1507 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004257 {
4258 (yyval.TypeList) = new std::list<PATypeHolder>();
4259 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4260 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004261 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004262 ;}
4263 break;
4264
Dale Johannesena79ecf32008-02-20 21:15:43 +00004265 case 168:
Devang Patelbf507402008-02-20 22:40:23 +00004266#line 1513 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004267 {
4268 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4269 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004270 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004271 ;}
4272 break;
4273
Dale Johannesena79ecf32008-02-20 21:15:43 +00004274 case 169:
Devang Patelbf507402008-02-20 22:40:23 +00004275#line 1525 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004276 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004277 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004278 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4279 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004280 if (ATy == 0)
4281 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004282 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004283 const Type *ETy = ATy->getElementType();
4284 int NumElements = ATy->getNumElements();
4285
4286 // Verify that we have the correct size...
Chris Lattner59363a32008-02-19 04:36:25 +00004287 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004288 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Chris Lattner59363a32008-02-19 04:36:25 +00004289 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004290 itostr(NumElements) + "");
4291
4292 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00004293 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4294 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004295 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4296 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner59363a32008-02-19 04:36:25 +00004297 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004298 }
4299
Chris Lattner59363a32008-02-19 04:36:25 +00004300 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4301 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004302 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004303 ;}
4304 break;
4305
Dale Johannesena79ecf32008-02-20 21:15:43 +00004306 case 170:
Devang Patelbf507402008-02-20 22:40:23 +00004307#line 1553 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004308 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004309 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004310 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4311 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004312 if (ATy == 0)
4313 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004314 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004315
4316 int NumElements = ATy->getNumElements();
4317 if (NumElements != -1 && NumElements != 0)
4318 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4319 " arguments, but has size of " + itostr(NumElements) +"");
Chris Lattner59363a32008-02-19 04:36:25 +00004320 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4321 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004323 ;}
4324 break;
4325
Dale Johannesena79ecf32008-02-20 21:15:43 +00004326 case 171:
Devang Patelbf507402008-02-20 22:40:23 +00004327#line 1569 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004328 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004329 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004330 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4331 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004332 if (ATy == 0)
4333 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004334 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004335
4336 int NumElements = ATy->getNumElements();
4337 const Type *ETy = ATy->getElementType();
Chris Lattner59363a32008-02-19 04:36:25 +00004338 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004339 GEN_ERROR("Can't build string constant of size " +
Chris Lattner59363a32008-02-19 04:36:25 +00004340 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004341 " when array has size " + itostr(NumElements) + "");
4342 std::vector<Constant*> Vals;
4343 if (ETy == Type::Int8Ty) {
Chris Lattner59363a32008-02-19 04:36:25 +00004344 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4345 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004346 } else {
Chris Lattner59363a32008-02-19 04:36:25 +00004347 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004348 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4349 }
Chris Lattner59363a32008-02-19 04:36:25 +00004350 delete (yyvsp[(3) - (3)].StrVal);
4351 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4352 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004353 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004354 ;}
4355 break;
4356
Dale Johannesena79ecf32008-02-20 21:15:43 +00004357 case 172:
Devang Patelbf507402008-02-20 22:40:23 +00004358#line 1596 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004359 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004360 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004361 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4362 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004363 if (PTy == 0)
4364 GEN_ERROR("Cannot make packed constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004365 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004366 const Type *ETy = PTy->getElementType();
4367 int NumElements = PTy->getNumElements();
4368
4369 // Verify that we have the correct size...
Chris Lattner59363a32008-02-19 04:36:25 +00004370 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004371 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Chris Lattner59363a32008-02-19 04:36:25 +00004372 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004373 itostr(NumElements) + "");
4374
4375 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00004376 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4377 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004378 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4379 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner59363a32008-02-19 04:36:25 +00004380 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004381 }
4382
Chris Lattner59363a32008-02-19 04:36:25 +00004383 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4384 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004385 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004386 ;}
4387 break;
4388
Dale Johannesena79ecf32008-02-20 21:15:43 +00004389 case 173:
Devang Patelbf507402008-02-20 22:40:23 +00004390#line 1624 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004391 {
4392 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004393 if (STy == 0)
4394 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004395 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004396
Chris Lattner59363a32008-02-19 04:36:25 +00004397 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004398 GEN_ERROR("Illegal number of initializers for structure type");
4399
4400 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner59363a32008-02-19 04:36:25 +00004401 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4402 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004403 GEN_ERROR("Expected type '" +
4404 STy->getElementType(i)->getDescription() +
4405 "' for element #" + utostr(i) +
4406 " of structure initializer");
4407
4408 // Check to ensure that Type is not packed
4409 if (STy->isPacked())
4410 GEN_ERROR("Unpacked Initializer to vector type '" +
4411 STy->getDescription() + "'");
4412
Chris Lattner59363a32008-02-19 04:36:25 +00004413 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4414 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004415 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004416 ;}
4417 break;
4418
Dale Johannesena79ecf32008-02-20 21:15:43 +00004419 case 174:
Devang Patelbf507402008-02-20 22:40:23 +00004420#line 1650 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004421 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004422 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004423 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4424 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004425 if (STy == 0)
4426 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004427 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004428
4429 if (STy->getNumContainedTypes() != 0)
4430 GEN_ERROR("Illegal number of initializers for structure type");
4431
4432 // Check to ensure that Type is not packed
4433 if (STy->isPacked())
4434 GEN_ERROR("Unpacked Initializer to vector type '" +
4435 STy->getDescription() + "'");
4436
Chris Lattner59363a32008-02-19 04:36:25 +00004437 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4438 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004439 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004440 ;}
4441 break;
4442
Dale Johannesena79ecf32008-02-20 21:15:43 +00004443 case 175:
Devang Patelbf507402008-02-20 22:40:23 +00004444#line 1670 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004445 {
4446 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004447 if (STy == 0)
4448 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004449 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004450
Chris Lattner59363a32008-02-19 04:36:25 +00004451 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004452 GEN_ERROR("Illegal number of initializers for structure type");
4453
4454 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner59363a32008-02-19 04:36:25 +00004455 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4456 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004457 GEN_ERROR("Expected type '" +
4458 STy->getElementType(i)->getDescription() +
4459 "' for element #" + utostr(i) +
4460 " of structure initializer");
4461
4462 // Check to ensure that Type is packed
4463 if (!STy->isPacked())
4464 GEN_ERROR("Vector initializer to non-vector type '" +
4465 STy->getDescription() + "'");
4466
Chris Lattner59363a32008-02-19 04:36:25 +00004467 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4468 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004469 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004470 ;}
4471 break;
4472
Dale Johannesena79ecf32008-02-20 21:15:43 +00004473 case 176:
Devang Patelbf507402008-02-20 22:40:23 +00004474#line 1696 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004475 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004476 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004477 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4478 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004479 if (STy == 0)
4480 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004481 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004482
4483 if (STy->getNumContainedTypes() != 0)
4484 GEN_ERROR("Illegal number of initializers for structure type");
4485
4486 // Check to ensure that Type is packed
4487 if (!STy->isPacked())
4488 GEN_ERROR("Vector initializer to non-vector type '" +
4489 STy->getDescription() + "'");
4490
Chris Lattner59363a32008-02-19 04:36:25 +00004491 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4492 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004493 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004494 ;}
4495 break;
4496
Dale Johannesena79ecf32008-02-20 21:15:43 +00004497 case 177:
Devang Patelbf507402008-02-20 22:40:23 +00004498#line 1716 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004499 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004500 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004501 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4502 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004503 if (PTy == 0)
4504 GEN_ERROR("Cannot make null pointer constant with type: '" +
Chris Lattner59363a32008-02-19 04:36:25 +00004505 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004506
Chris Lattner59363a32008-02-19 04:36:25 +00004507 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4508 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004509 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004510 ;}
4511 break;
4512
Dale Johannesena79ecf32008-02-20 21:15:43 +00004513 case 178:
Devang Patelbf507402008-02-20 22:40:23 +00004514#line 1728 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004515 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004516 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004517 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4518 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4519 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004520 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004521 ;}
4522 break;
4523
Dale Johannesena79ecf32008-02-20 21:15:43 +00004524 case 179:
Devang Patelbf507402008-02-20 22:40:23 +00004525#line 1735 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004526 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004527 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004528 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4529 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004530 if (Ty == 0)
Devang Patel3b8849c2008-02-19 22:27:01 +00004531 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004532
4533 // ConstExprs can exist in the body of a function, thus creating
4534 // GlobalValues whenever they refer to a variable. Because we are in
4535 // the context of a function, getExistingVal will search the functions
4536 // symbol table instead of the module symbol table for the global symbol,
4537 // which throws things all off. To get around this, we just tell
4538 // getExistingVal that we are at global scope here.
4539 //
4540 Function *SavedCurFn = CurFun.CurrentFunction;
4541 CurFun.CurrentFunction = 0;
4542
Chris Lattner59363a32008-02-19 04:36:25 +00004543 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004544 CHECK_FOR_ERROR
4545
4546 CurFun.CurrentFunction = SavedCurFn;
4547
4548 // If this is an initializer for a constant pointer, which is referencing a
4549 // (currently) undefined variable, create a stub now that shall be replaced
4550 // in the future with the right type of variable.
4551 //
4552 if (V == 0) {
4553 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4554 const PointerType *PT = cast<PointerType>(Ty);
4555
4556 // First check to see if the forward references value is already created!
4557 PerModuleInfo::GlobalRefsType::iterator I =
Chris Lattner59363a32008-02-19 04:36:25 +00004558 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004559
4560 if (I != CurModule.GlobalRefs.end()) {
4561 V = I->second; // Placeholder already exists, use it...
Chris Lattner59363a32008-02-19 04:36:25 +00004562 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004563 } else {
4564 std::string Name;
Chris Lattner59363a32008-02-19 04:36:25 +00004565 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4566 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4567 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004568 GEN_ERROR("Invalid reference to global");
4569
4570 // Create the forward referenced global.
4571 GlobalValue *GV;
4572 if (const FunctionType *FTy =
4573 dyn_cast<FunctionType>(PT->getElementType())) {
4574 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4575 CurModule.CurrentModule);
4576 } else {
4577 GV = new GlobalVariable(PT->getElementType(), false,
4578 GlobalValue::ExternalWeakLinkage, 0,
4579 Name, CurModule.CurrentModule);
4580 }
4581
4582 // Keep track of the fact that we have a forward ref to recycle it
Chris Lattner59363a32008-02-19 04:36:25 +00004583 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004584 V = GV;
4585 }
4586 }
4587
Chris Lattner59363a32008-02-19 04:36:25 +00004588 (yyval.ConstVal) = cast<GlobalValue>(V);
4589 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004590 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004591 ;}
4592 break;
4593
Dale Johannesena79ecf32008-02-20 21:15:43 +00004594 case 180:
Devang Patelbf507402008-02-20 22:40:23 +00004595#line 1801 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004596 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004597 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004598 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4599 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004600 GEN_ERROR("Mismatched types for constant expression: " +
Chris Lattner59363a32008-02-19 04:36:25 +00004601 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4602 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4603 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004604 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004605 ;}
4606 break;
4607
Dale Johannesena79ecf32008-02-20 21:15:43 +00004608 case 181:
Devang Patelbf507402008-02-20 22:40:23 +00004609#line 1811 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004610 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004611 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004612 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4613 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004614 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4615 GEN_ERROR("Cannot create a null initialized value of this type");
Chris Lattner59363a32008-02-19 04:36:25 +00004616 (yyval.ConstVal) = Constant::getNullValue(Ty);
4617 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004618 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004619 ;}
4620 break;
4621
Dale Johannesena79ecf32008-02-20 21:15:43 +00004622 case 182:
Devang Patelbf507402008-02-20 22:40:23 +00004623#line 1821 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004624 { // integral constants
4625 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004626 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner59363a32008-02-19 04:36:25 +00004627 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004628 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004629 ;}
4630 break;
4631
Dale Johannesena79ecf32008-02-20 21:15:43 +00004632 case 183:
Devang Patelbf507402008-02-20 22:40:23 +00004633#line 1827 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004634 { // arbitrary precision integer constants
4635 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4636 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004637 GEN_ERROR("Constant value does not fit in type");
4638 }
Chris Lattner59363a32008-02-19 04:36:25 +00004639 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4640 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4641 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004642 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004643 ;}
4644 break;
4645
Dale Johannesena79ecf32008-02-20 21:15:43 +00004646 case 184:
Devang Patelbf507402008-02-20 22:40:23 +00004647#line 1837 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004648 { // integral constants
4649 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner59363a32008-02-19 04:36:25 +00004651 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004652 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004653 ;}
4654 break;
4655
Dale Johannesena79ecf32008-02-20 21:15:43 +00004656 case 185:
Devang Patelbf507402008-02-20 22:40:23 +00004657#line 1843 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004658 { // arbitrary precision integer constants
4659 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4660 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004661 GEN_ERROR("Constant value does not fit in type");
4662 }
Chris Lattner59363a32008-02-19 04:36:25 +00004663 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4664 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4665 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004666 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004667 ;}
4668 break;
4669
Dale Johannesena79ecf32008-02-20 21:15:43 +00004670 case 186:
Devang Patelbf507402008-02-20 22:40:23 +00004671#line 1853 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004672 { // Boolean constants
4673 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4674 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004675 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004676 ;}
4677 break;
4678
Dale Johannesena79ecf32008-02-20 21:15:43 +00004679 case 187:
Devang Patelbf507402008-02-20 22:40:23 +00004680#line 1858 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004681 { // Boolean constants
4682 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4683 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004684 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004685 ;}
4686 break;
4687
Dale Johannesena79ecf32008-02-20 21:15:43 +00004688 case 188:
Devang Patelbf507402008-02-20 22:40:23 +00004689#line 1863 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004690 { // Floating point constants
4691 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004692 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004693 // Lexer has no type info, so builds all float and double FP constants
4694 // as double. Fix this here. Long double is done right.
Chris Lattner59363a32008-02-19 04:36:25 +00004695 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4696 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4697 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4698 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004699 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004700 ;}
4701 break;
4702
Dale Johannesena79ecf32008-02-20 21:15:43 +00004703 case 189:
Devang Patelbf507402008-02-20 22:40:23 +00004704#line 1876 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004705 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004706 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004707 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4708 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4709 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4710 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004711 GEN_ERROR("invalid cast opcode for cast from '" +
4712 Val->getType()->getDescription() + "' to '" +
4713 DestTy->getDescription() + "'");
Chris Lattner59363a32008-02-19 04:36:25 +00004714 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4715 delete (yyvsp[(5) - (6)].TypeVal);
4716 ;}
4717 break;
4718
Dale Johannesena79ecf32008-02-20 21:15:43 +00004719 case 190:
Devang Patelbf507402008-02-20 22:40:23 +00004720#line 1888 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004721 {
4722 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004723 GEN_ERROR("GetElementPtr requires a pointer operand");
4724
4725 const Type *IdxTy =
Chris Lattner59363a32008-02-19 04:36:25 +00004726 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004727 true);
4728 if (!IdxTy)
4729 GEN_ERROR("Index list invalid for constant getelementptr");
4730
4731 SmallVector<Constant*, 8> IdxVec;
Chris Lattner59363a32008-02-19 04:36:25 +00004732 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4733 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004734 IdxVec.push_back(C);
4735 else
4736 GEN_ERROR("Indices to constant getelementptr must be constants");
4737
Chris Lattner59363a32008-02-19 04:36:25 +00004738 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004739
Chris Lattner59363a32008-02-19 04:36:25 +00004740 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004742 ;}
4743 break;
4744
Dale Johannesena79ecf32008-02-20 21:15:43 +00004745 case 191:
Devang Patelbf507402008-02-20 22:40:23 +00004746#line 1910 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004747 {
4748 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004749 GEN_ERROR("Select condition must be of boolean type");
Chris Lattner59363a32008-02-19 04:36:25 +00004750 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004751 GEN_ERROR("Select operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004752 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004753 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004754 ;}
4755 break;
4756
Dale Johannesena79ecf32008-02-20 21:15:43 +00004757 case 192:
Devang Patelbf507402008-02-20 22:40:23 +00004758#line 1918 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004759 {
4760 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004761 GEN_ERROR("Binary operator types must match");
4762 CHECK_FOR_ERROR;
Chris Lattner59363a32008-02-19 04:36:25 +00004763 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4764 ;}
4765 break;
4766
Dale Johannesena79ecf32008-02-20 21:15:43 +00004767 case 193:
Devang Patelbf507402008-02-20 22:40:23 +00004768#line 1924 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004769 {
4770 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004771 GEN_ERROR("Logical operator types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004772 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4773 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4774 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004775 GEN_ERROR("Logical operator requires integral operands");
4776 }
Chris Lattner59363a32008-02-19 04:36:25 +00004777 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004778 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004779 ;}
4780 break;
4781
Dale Johannesena79ecf32008-02-20 21:15:43 +00004782 case 194:
Devang Patelbf507402008-02-20 22:40:23 +00004783#line 1935 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004784 {
4785 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004786 GEN_ERROR("icmp operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004787 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4788 ;}
4789 break;
4790
Dale Johannesena79ecf32008-02-20 21:15:43 +00004791 case 195:
Devang Patelbf507402008-02-20 22:40:23 +00004792#line 1940 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004793 {
4794 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004795 GEN_ERROR("fcmp operand types must match");
Chris Lattner59363a32008-02-19 04:36:25 +00004796 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4797 ;}
4798 break;
4799
Dale Johannesena79ecf32008-02-20 21:15:43 +00004800 case 196:
Devang Patelbf507402008-02-20 22:40:23 +00004801#line 1945 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004802 {
4803 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004804 GEN_ERROR("Invalid extractelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004805 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004806 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004807 ;}
4808 break;
4809
Dale Johannesena79ecf32008-02-20 21:15:43 +00004810 case 197:
Devang Patelbf507402008-02-20 22:40:23 +00004811#line 1951 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004812 {
4813 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004814 GEN_ERROR("Invalid insertelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004815 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004816 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004817 ;}
4818 break;
4819
Dale Johannesena79ecf32008-02-20 21:15:43 +00004820 case 198:
Devang Patelbf507402008-02-20 22:40:23 +00004821#line 1957 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004822 {
4823 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004824 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner59363a32008-02-19 04:36:25 +00004825 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004826 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004827 ;}
4828 break;
4829
Dale Johannesena79ecf32008-02-20 21:15:43 +00004830 case 199:
Devang Patelbf507402008-02-20 22:40:23 +00004831#line 1966 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004832 {
4833 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004834 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004835 ;}
4836 break;
4837
Dale Johannesena79ecf32008-02-20 21:15:43 +00004838 case 200:
Devang Patelbf507402008-02-20 22:40:23 +00004839#line 1970 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004840 {
4841 (yyval.ConstVector) = new std::vector<Constant*>();
4842 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004843 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004844 ;}
4845 break;
4846
Dale Johannesena79ecf32008-02-20 21:15:43 +00004847 case 201:
Devang Patelbf507402008-02-20 22:40:23 +00004848#line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004849 { (yyval.BoolVal) = false; ;}
4850 break;
4851
Chris Lattner59363a32008-02-19 04:36:25 +00004852 case 202:
Devang Patelbf507402008-02-20 22:40:23 +00004853#line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004854 { (yyval.BoolVal) = true; ;}
4855 break;
4856
4857 case 203:
Devang Patelbf507402008-02-20 22:40:23 +00004858#line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004859 { (yyval.BoolVal) = true; ;}
Chris Lattner59363a32008-02-19 04:36:25 +00004860 break;
4861
4862 case 204:
Devang Patelbf507402008-02-20 22:40:23 +00004863#line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004864 { (yyval.BoolVal) = false; ;}
4865 break;
4866
4867 case 205:
Devang Patelbf507402008-02-20 22:40:23 +00004868#line 1984 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004869 {
4870 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4871 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00004872 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004873 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4874 if (!Aliasee)
4875 GEN_ERROR("Aliases can be created only to global values");
4876
Chris Lattner59363a32008-02-19 04:36:25 +00004877 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004878 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004879 delete (yyvsp[(1) - (2)].TypeVal);
4880 ;}
4881 break;
4882
Dale Johannesena79ecf32008-02-20 21:15:43 +00004883 case 206:
Devang Patelbf507402008-02-20 22:40:23 +00004884#line 1996 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004885 {
4886 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4887 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4888 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004889 GEN_ERROR("invalid cast opcode for cast from '" +
4890 Val->getType()->getDescription() + "' to '" +
4891 DestTy->getDescription() + "'");
4892
Chris Lattner59363a32008-02-19 04:36:25 +00004893 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004894 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004895 delete (yyvsp[(5) - (6)].TypeVal);
4896 ;}
4897 break;
4898
Chris Lattner59363a32008-02-19 04:36:25 +00004899 case 207:
Devang Patelbf507402008-02-20 22:40:23 +00004900#line 2017 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004901 {
4902 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Christopher Lamb668d9a02007-12-12 08:45:45 +00004903 CurModule.ModuleDone();
4904 CHECK_FOR_ERROR;
Chris Lattner59363a32008-02-19 04:36:25 +00004905 ;}
4906 break;
4907
Dale Johannesena79ecf32008-02-20 21:15:43 +00004908 case 208:
Devang Patelbf507402008-02-20 22:40:23 +00004909#line 2022 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004910 {
4911 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4912 CurModule.ModuleDone();
4913 CHECK_FOR_ERROR;
4914 ;}
Chris Lattner59363a32008-02-19 04:36:25 +00004915 break;
4916
4917 case 211:
Devang Patelbf507402008-02-20 22:40:23 +00004918#line 2035 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004919 { CurFun.isDeclare = false; ;}
4920 break;
4921
4922 case 212:
Devang Patelbf507402008-02-20 22:40:23 +00004923#line 2035 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004924 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004925 CurFun.FunctionDone();
4926 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004927 ;}
4928 break;
4929
Dale Johannesena79ecf32008-02-20 21:15:43 +00004930 case 213:
Devang Patelbf507402008-02-20 22:40:23 +00004931#line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004932 { CurFun.isDeclare = true; ;}
4933 break;
4934
Chris Lattner59363a32008-02-19 04:36:25 +00004935 case 214:
Devang Patelbf507402008-02-20 22:40:23 +00004936#line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004937 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00004938 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004939 ;}
4940 break;
4941
4942 case 215:
Devang Patelbf507402008-02-20 22:40:23 +00004943#line 2042 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesena79ecf32008-02-20 21:15:43 +00004944 {
4945 CHECK_FOR_ERROR
4946 ;}
4947 break;
4948
4949 case 216:
Devang Patelbf507402008-02-20 22:40:23 +00004950#line 2045 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004951 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004952 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00004953 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004954 // Eagerly resolve types. This is not an optimization, this is a
4955 // requirement that is due to the fact that we could have this:
4956 //
4957 // %list = type { %list * }
4958 // %list = type { %list * } ; repeated type decl
4959 //
4960 // If types are not resolved eagerly, then the two types will not be
4961 // determined to be the same type!
4962 //
Chris Lattner59363a32008-02-19 04:36:25 +00004963 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004964
Chris Lattner59363a32008-02-19 04:36:25 +00004965 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004966 CHECK_FOR_ERROR
4967 // If this is a named type that is not a redefinition, add it to the slot
4968 // table.
Chris Lattner59363a32008-02-19 04:36:25 +00004969 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004970 }
4971
Chris Lattner59363a32008-02-19 04:36:25 +00004972 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004973 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004974 ;}
4975 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004976
Dale Johannesena79ecf32008-02-20 21:15:43 +00004977 case 217:
Devang Patelbf507402008-02-20 22:40:23 +00004978#line 2069 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004979 {
4980 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4981
4982 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004983 CHECK_FOR_ERROR
4984 // If this is a named type that is not a redefinition, add it to the slot
4985 // table.
Chris Lattner59363a32008-02-19 04:36:25 +00004986 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004987 }
4988 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00004989 ;}
4990 break;
4991
Dale Johannesena79ecf32008-02-20 21:15:43 +00004992 case 218:
Devang Patelbf507402008-02-20 22:40:23 +00004993#line 2081 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00004994 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004995 /* "Externally Visible" Linkage */
Chris Lattner59363a32008-02-19 04:36:25 +00004996 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004997 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner59363a32008-02-19 04:36:25 +00004998 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
4999 (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 +00005000 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005001 ;}
5002 break;
5003
Dale Johannesena79ecf32008-02-20 21:15:43 +00005004 case 219:
Devang Patelbf507402008-02-20 22:40:23 +00005005#line 2088 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005006 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005007 CurGV = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005008 ;}
5009 break;
5010
Dale Johannesena79ecf32008-02-20 21:15:43 +00005011 case 220:
Devang Patelbf507402008-02-20 22:40:23 +00005012#line 2092 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005013 {
5014 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005015 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner59363a32008-02-19 04:36:25 +00005016 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 +00005017 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005018 ;}
5019 break;
5020
Dale Johannesena79ecf32008-02-20 21:15:43 +00005021 case 221:
Devang Patelbf507402008-02-20 22:40:23 +00005022#line 2097 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005023 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005024 CurGV = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005025 ;}
5026 break;
5027
Dale Johannesena79ecf32008-02-20 21:15:43 +00005028 case 222:
Devang Patelbf507402008-02-20 22:40:23 +00005029#line 2101 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005030 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005031 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005032 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5033 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 +00005034 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005035 delete (yyvsp[(6) - (7)].TypeVal);
5036 ;}
5037 break;
5038
Dale Johannesena79ecf32008-02-20 21:15:43 +00005039 case 223:
Devang Patelbf507402008-02-20 22:40:23 +00005040#line 2107 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005041 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005042 CurGV = 0;
5043 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005044 ;}
5045 break;
5046
Dale Johannesena79ecf32008-02-20 21:15:43 +00005047 case 224:
Devang Patelbf507402008-02-20 22:40:23 +00005048#line 2111 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005049 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005050 std::string Name;
Chris Lattner59363a32008-02-19 04:36:25 +00005051 if ((yyvsp[(1) - (5)].StrVal)) {
5052 Name = *(yyvsp[(1) - (5)].StrVal);
5053 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005054 }
5055 if (Name.empty())
5056 GEN_ERROR("Alias name cannot be empty");
5057
Chris Lattner59363a32008-02-19 04:36:25 +00005058 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005059 if (Aliasee == 0)
5060 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5061
Chris Lattner59363a32008-02-19 04:36:25 +00005062 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005063 CurModule.CurrentModule);
Chris Lattner59363a32008-02-19 04:36:25 +00005064 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005065 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005066
5067
5068 // If there was a forward reference of this alias, resolve it now.
5069
5070 ValID ID;
5071 if (!Name.empty())
5072 ID = ValID::createGlobalName(Name);
5073 else
5074 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5075
5076 if (GlobalValue *FWGV =
5077 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5078 // Replace uses of the fwdref with the actual alias.
5079 FWGV->replaceAllUsesWith(GA);
5080 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5081 GV->eraseFromParent();
5082 else
5083 cast<Function>(FWGV)->eraseFromParent();
5084 }
5085 ID.destroy();
5086
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005087 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005088 ;}
5089 break;
5090
Dale Johannesena79ecf32008-02-20 21:15:43 +00005091 case 225:
Devang Patelbf507402008-02-20 22:40:23 +00005092#line 2151 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005093 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005094 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005095 ;}
5096 break;
5097
Dale Johannesena79ecf32008-02-20 21:15:43 +00005098 case 226:
Devang Patelbf507402008-02-20 22:40:23 +00005099#line 2154 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005100 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005101 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005102 ;}
5103 break;
5104
Dale Johannesena79ecf32008-02-20 21:15:43 +00005105 case 227:
Devang Patelbf507402008-02-20 22:40:23 +00005106#line 2160 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005107 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005108 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5109 if (AsmSoFar.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005110 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005111 else
Chris Lattner59363a32008-02-19 04:36:25 +00005112 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5113 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005114 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005115;}
5116 break;
5117
Dale Johannesena79ecf32008-02-20 21:15:43 +00005118 case 228:
Devang Patelbf507402008-02-20 22:40:23 +00005119#line 2170 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005120 {
5121 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5122 delete (yyvsp[(3) - (3)].StrVal);
5123 ;}
5124 break;
5125
Dale Johannesena79ecf32008-02-20 21:15:43 +00005126 case 229:
Devang Patelbf507402008-02-20 22:40:23 +00005127#line 2174 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005128 {
5129 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5130 delete (yyvsp[(3) - (3)].StrVal);
5131 ;}
5132 break;
5133
Dale Johannesena79ecf32008-02-20 21:15:43 +00005134 case 231:
Devang Patelbf507402008-02-20 22:40:23 +00005135#line 2181 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005136 {
5137 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5138 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005139 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005140 ;}
5141 break;
5142
Dale Johannesena79ecf32008-02-20 21:15:43 +00005143 case 232:
Devang Patelbf507402008-02-20 22:40:23 +00005144#line 2186 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005145 {
5146 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5147 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005148 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005149 ;}
5150 break;
5151
Dale Johannesena79ecf32008-02-20 21:15:43 +00005152 case 233:
Devang Patelbf507402008-02-20 22:40:23 +00005153#line 2191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005154 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005155 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005156 ;}
5157 break;
5158
Dale Johannesena79ecf32008-02-20 21:15:43 +00005159 case 234:
Devang Patelbf507402008-02-20 22:40:23 +00005160#line 2200 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005161 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005162 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005163 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5164 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005165 GEN_ERROR("void typed arguments are invalid");
Chris Lattner59363a32008-02-19 04:36:25 +00005166 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5167 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5168 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005169 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005170 ;}
5171 break;
5172
Dale Johannesena79ecf32008-02-20 21:15:43 +00005173 case 235:
Devang Patelbf507402008-02-20 22:40:23 +00005174#line 2210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005175 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005176 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005177 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5178 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005179 GEN_ERROR("void typed arguments are invalid");
Chris Lattner59363a32008-02-19 04:36:25 +00005180 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5181 (yyval.ArgList) = new ArgListType;
5182 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005183 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005184 ;}
5185 break;
5186
Dale Johannesena79ecf32008-02-20 21:15:43 +00005187 case 236:
Devang Patelbf507402008-02-20 22:40:23 +00005188#line 2221 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005189 {
5190 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005191 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005192 ;}
5193 break;
5194
Dale Johannesena79ecf32008-02-20 21:15:43 +00005195 case 237:
Devang Patelbf507402008-02-20 22:40:23 +00005196#line 2225 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005197 {
5198 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005199 struct ArgListEntry E;
5200 E.Ty = new PATypeHolder(Type::VoidTy);
5201 E.Name = 0;
5202 E.Attrs = ParamAttr::None;
Chris Lattner59363a32008-02-19 04:36:25 +00005203 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005204 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005205 ;}
5206 break;
5207
Dale Johannesena79ecf32008-02-20 21:15:43 +00005208 case 238:
Devang Patelbf507402008-02-20 22:40:23 +00005209#line 2234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005210 {
5211 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005212 struct ArgListEntry E;
5213 E.Ty = new PATypeHolder(Type::VoidTy);
5214 E.Name = 0;
5215 E.Attrs = ParamAttr::None;
Chris Lattner59363a32008-02-19 04:36:25 +00005216 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005217 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005218 ;}
5219 break;
5220
Dale Johannesena79ecf32008-02-20 21:15:43 +00005221 case 239:
Devang Patelbf507402008-02-20 22:40:23 +00005222#line 2243 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005223 {
5224 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005225 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005226 ;}
5227 break;
5228
Dale Johannesena79ecf32008-02-20 21:15:43 +00005229 case 240:
Devang Patelbf507402008-02-20 22:40:23 +00005230#line 2249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005231 {
5232 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5233 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005234
5235 // Check the function result for abstractness if this is a define. We should
5236 // have no abstract types at this point
Chris Lattner59363a32008-02-19 04:36:25 +00005237 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5238 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005239
5240 std::vector<const Type*> ParamTypeList;
5241 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00005242 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005243 ParamAttrsWithIndex PAWI;
5244 PAWI.index = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005245 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005246 Attrs.push_back(PAWI);
5247 }
Chris Lattner59363a32008-02-19 04:36:25 +00005248 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005249 unsigned index = 1;
Chris Lattner59363a32008-02-19 04:36:25 +00005250 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005251 const Type* Ty = I->Ty->get();
5252 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5253 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5254 ParamTypeList.push_back(Ty);
5255 if (Ty != Type::VoidTy)
5256 if (I->Attrs != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005257 ParamAttrsWithIndex PAWI;
5258 PAWI.index = index;
5259 PAWI.attrs = I->Attrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005260 Attrs.push_back(PAWI);
5261 }
5262 }
5263 }
5264
5265 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5266 if (isVarArg) ParamTypeList.pop_back();
5267
Duncan Sands637ec552007-11-28 17:07:01 +00005268 const ParamAttrsList *PAL = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005269 if (!Attrs.empty())
5270 PAL = ParamAttrsList::get(Attrs);
5271
Chris Lattner59363a32008-02-19 04:36:25 +00005272 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005273 const PointerType *PFT = PointerType::getUnqual(FT);
Chris Lattner59363a32008-02-19 04:36:25 +00005274 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005275
5276 ValID ID;
5277 if (!FunctionName.empty()) {
5278 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5279 } else {
5280 ID = ValID::createGlobalID(CurModule.Values.size());
5281 }
5282
5283 Function *Fn = 0;
5284 // See if this function was forward referenced. If so, recycle the object.
5285 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5286 // Move the function to the end of the list, from whereever it was
5287 // previously inserted.
5288 Fn = cast<Function>(FWRef);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005289 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005290 CurModule.CurrentModule->getFunctionList().remove(Fn);
5291 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5292 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5293 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005294 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005295 // The existing function doesn't have the same type. This is an overload
5296 // error.
5297 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005298 } else if (Fn->getParamAttrs() != PAL) {
5299 // The existing function doesn't have the same parameter attributes.
5300 // This is an overload error.
5301 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005302 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5303 // Neither the existing or the current function is a declaration and they
5304 // have the same name and same type. Clearly this is a redefinition.
5305 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005306 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005307 // Make sure to strip off any argument names so we can't get conflicts.
5308 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5309 AI != AE; ++AI)
5310 AI->setName("");
5311 }
5312 } else { // Not already defined?
5313 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5314 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005315 InsertValue(Fn, CurModule.Values);
5316 }
5317
5318 CurFun.FunctionStart(Fn);
5319
5320 if (CurFun.isDeclare) {
5321 // If we have declaration, always overwrite linkage. This will allow us to
5322 // correctly handle cases, when pointer to function is passed as argument to
5323 // another function.
5324 Fn->setLinkage(CurFun.Linkage);
5325 Fn->setVisibility(CurFun.Visibility);
5326 }
Chris Lattner59363a32008-02-19 04:36:25 +00005327 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005328 Fn->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00005329 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5330 if ((yyvsp[(8) - (10)].StrVal)) {
5331 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5332 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005333 }
Chris Lattner59363a32008-02-19 04:36:25 +00005334 if ((yyvsp[(10) - (10)].StrVal)) {
5335 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5336 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005337 }
5338
5339 // Add all of the arguments we parsed to the function...
Chris Lattner59363a32008-02-19 04:36:25 +00005340 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005341 if (isVarArg) { // Nuke the last entry
Chris Lattner59363a32008-02-19 04:36:25 +00005342 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005343 "Not a varargs marker!");
Chris Lattner59363a32008-02-19 04:36:25 +00005344 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5345 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005346 }
5347 Function::arg_iterator ArgIt = Fn->arg_begin();
5348 Function::arg_iterator ArgEnd = Fn->arg_end();
5349 unsigned Idx = 1;
Chris Lattner59363a32008-02-19 04:36:25 +00005350 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5351 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005352 delete I->Ty; // Delete the typeholder...
5353 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5354 CHECK_FOR_ERROR
5355 InsertValue(ArgIt);
5356 Idx++;
5357 }
5358
Chris Lattner59363a32008-02-19 04:36:25 +00005359 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005360 }
5361 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005362;}
5363 break;
5364
Dale Johannesena79ecf32008-02-20 21:15:43 +00005365 case 243:
Devang Patelbf507402008-02-20 22:40:23 +00005366#line 2384 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005367 {
5368 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005369
5370 // Make sure that we keep track of the linkage type even if there was a
5371 // previous "declare".
Chris Lattner59363a32008-02-19 04:36:25 +00005372 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5373 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5374;}
5375 break;
5376
Dale Johannesena79ecf32008-02-20 21:15:43 +00005377 case 246:
Devang Patelbf507402008-02-20 22:40:23 +00005378#line 2395 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005379 {
5380 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005381 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005382;}
5383 break;
5384
Dale Johannesena79ecf32008-02-20 21:15:43 +00005385 case 247:
Devang Patelbf507402008-02-20 22:40:23 +00005386#line 2400 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005387 {
5388 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5389 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5390 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005391 CurFun.FunctionDone();
5392 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005393 ;}
5394 break;
5395
Dale Johannesena79ecf32008-02-20 21:15:43 +00005396 case 248:
Devang Patelbf507402008-02-20 22:40:23 +00005397#line 2412 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005398 {
5399 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005400 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005401 ;}
5402 break;
5403
Dale Johannesena79ecf32008-02-20 21:15:43 +00005404 case 249:
Devang Patelbf507402008-02-20 22:40:23 +00005405#line 2416 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005406 {
5407 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005408 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005409 ;}
5410 break;
5411
Dale Johannesena79ecf32008-02-20 21:15:43 +00005412 case 250:
Devang Patelbf507402008-02-20 22:40:23 +00005413#line 2421 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005414 { // A reference to a direct constant
5415 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005416 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005417 ;}
5418 break;
5419
Dale Johannesena79ecf32008-02-20 21:15:43 +00005420 case 251:
Devang Patelbf507402008-02-20 22:40:23 +00005421#line 2425 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005422 {
5423 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005424 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005425 ;}
5426 break;
5427
Dale Johannesena79ecf32008-02-20 21:15:43 +00005428 case 252:
Devang Patelbf507402008-02-20 22:40:23 +00005429#line 2429 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005430 { // Perhaps it's an FP constant?
5431 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005432 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005433 ;}
5434 break;
5435
Dale Johannesena79ecf32008-02-20 21:15:43 +00005436 case 253:
Devang Patelbf507402008-02-20 22:40:23 +00005437#line 2433 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005438 {
5439 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005440 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005441 ;}
5442 break;
5443
Dale Johannesena79ecf32008-02-20 21:15:43 +00005444 case 254:
Devang Patelbf507402008-02-20 22:40:23 +00005445#line 2437 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005446 {
5447 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005448 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005449 ;}
5450 break;
5451
Dale Johannesena79ecf32008-02-20 21:15:43 +00005452 case 255:
Devang Patelbf507402008-02-20 22:40:23 +00005453#line 2441 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005454 {
5455 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005456 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005457 ;}
5458 break;
5459
Dale Johannesena79ecf32008-02-20 21:15:43 +00005460 case 256:
Devang Patelbf507402008-02-20 22:40:23 +00005461#line 2445 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005462 {
5463 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005464 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005465 ;}
5466 break;
5467
Dale Johannesena79ecf32008-02-20 21:15:43 +00005468 case 257:
Devang Patelbf507402008-02-20 22:40:23 +00005469#line 2449 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005470 { // A vector zero constant.
5471 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005472 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005473 ;}
5474 break;
5475
Dale Johannesena79ecf32008-02-20 21:15:43 +00005476 case 258:
Devang Patelbf507402008-02-20 22:40:23 +00005477#line 2453 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005478 { // Nonempty unsized packed vector
5479 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5480 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005481
5482 VectorType* pt = VectorType::get(ETy, NumElements);
5483 PATypeHolder* PTy = new PATypeHolder(
5484 HandleUpRefs(
5485 VectorType::get(
5486 ETy,
5487 NumElements)
5488 )
5489 );
5490
5491 // Verify all elements are correct type!
Chris Lattner59363a32008-02-19 04:36:25 +00005492 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5493 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005494 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5495 ETy->getDescription() +"' as required!\nIt is of type '" +
Chris Lattner59363a32008-02-19 04:36:25 +00005496 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005497 }
5498
Chris Lattner59363a32008-02-19 04:36:25 +00005499 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5500 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005501 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005502 ;}
5503 break;
5504
Dale Johannesena79ecf32008-02-20 21:15:43 +00005505 case 259:
Devang Patelbf507402008-02-20 22:40:23 +00005506#line 2478 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005507 {
5508 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005509 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005510 ;}
5511 break;
5512
Dale Johannesena79ecf32008-02-20 21:15:43 +00005513 case 260:
Devang Patelbf507402008-02-20 22:40:23 +00005514#line 2482 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005515 {
5516 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5517 delete (yyvsp[(3) - (5)].StrVal);
5518 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005519 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005520 ;}
5521 break;
5522
Dale Johannesena79ecf32008-02-20 21:15:43 +00005523 case 261:
Devang Patelbf507402008-02-20 22:40:23 +00005524#line 2492 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005525 { // Is it an integer reference...?
5526 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005527 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005528 ;}
5529 break;
5530
Dale Johannesena79ecf32008-02-20 21:15:43 +00005531 case 262:
Devang Patelbf507402008-02-20 22:40:23 +00005532#line 2496 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005533 {
5534 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005535 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005536 ;}
5537 break;
5538
Dale Johannesena79ecf32008-02-20 21:15:43 +00005539 case 263:
Devang Patelbf507402008-02-20 22:40:23 +00005540#line 2500 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005541 { // Is it a named reference...?
5542 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5543 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005544 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005545 ;}
5546 break;
5547
Dale Johannesena79ecf32008-02-20 21:15:43 +00005548 case 264:
Devang Patelbf507402008-02-20 22:40:23 +00005549#line 2505 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005550 { // Is it a named reference...?
5551 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5552 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005553 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005554 ;}
5555 break;
5556
Dale Johannesena79ecf32008-02-20 21:15:43 +00005557 case 267:
Devang Patelbf507402008-02-20 22:40:23 +00005558#line 2518 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005559 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005560 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005561 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5562 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5563 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005564 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005565 ;}
5566 break;
5567
Dale Johannesena79ecf32008-02-20 21:15:43 +00005568 case 268:
Devang Patelbf507402008-02-20 22:40:23 +00005569#line 2527 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5570 {
5571 (yyval.ValueList) = new std::vector<Value *>();
5572 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5573 CHECK_FOR_ERROR
5574 ;}
5575 break;
5576
5577 case 269:
5578#line 2532 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5579 {
5580 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ConstVal));
5581 CHECK_FOR_ERROR
5582 ;}
5583 break;
5584
5585 case 270:
5586#line 2537 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005587 {
5588 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005589 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005590 ;}
5591 break;
5592
Devang Patelbf507402008-02-20 22:40:23 +00005593 case 271:
5594#line 2541 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005595 { // Do not allow functions with 0 basic blocks
5596 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005597 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005598 ;}
5599 break;
5600
Devang Patelbf507402008-02-20 22:40:23 +00005601 case 272:
5602#line 2550 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005603 {
5604 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005605 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005606 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5607 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5608 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005609 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005610 ;}
5611 break;
5612
Devang Patelbf507402008-02-20 22:40:23 +00005613 case 273:
5614#line 2559 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005615 {
5616 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005617 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5618 if (CI2->getParent() == 0)
Chris Lattner59363a32008-02-19 04:36:25 +00005619 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5620 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5621 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005622 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005623 ;}
5624 break;
5625
Devang Patelbf507402008-02-20 22:40:23 +00005626 case 274:
5627#line 2568 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005628 { // Empty space between instruction lists
5629 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005630 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005631 ;}
5632 break;
5633
Devang Patelbf507402008-02-20 22:40:23 +00005634 case 275:
5635#line 2572 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005636 { // Labelled (named) basic block
5637 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5638 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005639 CHECK_FOR_ERROR
5640
Chris Lattner59363a32008-02-19 04:36:25 +00005641 ;}
5642 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005643
Devang Patelbf507402008-02-20 22:40:23 +00005644 case 276:
5645#line 2580 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5646 { // Return with a result...
5647 if((yyvsp[(2) - (2)].ValueList)->size() == 1)
5648 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueList)->back());
5649 else {
5650
5651 std::vector<const Type*> Elements;
5652 std::vector<Constant*> Vals;
5653 for (std::vector<Value *>::iterator I = (yyvsp[(2) - (2)].ValueList)->begin(),
5654 E = (yyvsp[(2) - (2)].ValueList)->end(); I != E; ++I) {
5655 Value *V = *I;
5656 Constant *C = cast<Constant>(V);
5657 Elements.push_back(V->getType());
5658 Vals.push_back(C);
5659 }
5660
5661 const StructType *STy = StructType::get(Elements);
5662 PATypeHolder *PTy =
5663 new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
5664
5665 Constant *CS = ConstantStruct::get(STy, Vals); // *$2);
5666 (yyval.TermInstVal) = new ReturnInst(CS);
5667 delete PTy;
5668 }
5669 delete (yyvsp[(2) - (2)].ValueList);
Chris Lattner59363a32008-02-19 04:36:25 +00005670 CHECK_FOR_ERROR
5671 ;}
5672 break;
5673
Devang Patelbf507402008-02-20 22:40:23 +00005674 case 277:
5675#line 2606 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005676 { // Return with no result...
5677 (yyval.TermInstVal) = new ReturnInst();
5678 CHECK_FOR_ERROR
5679 ;}
5680 break;
5681
Devang Patelbf507402008-02-20 22:40:23 +00005682 case 278:
5683#line 2610 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005684 { // Unconditional Branch...
5685 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5686 CHECK_FOR_ERROR
5687 (yyval.TermInstVal) = new BranchInst(tmpBB);
5688 ;}
5689 break;
5690
Devang Patelbf507402008-02-20 22:40:23 +00005691 case 279:
5692#line 2615 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005693 {
5694 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5695 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5696 CHECK_FOR_ERROR
5697 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5698 CHECK_FOR_ERROR
5699 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5700 CHECK_FOR_ERROR
5701 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5702 ;}
5703 break;
5704
Devang Patelbf507402008-02-20 22:40:23 +00005705 case 280:
5706#line 2625 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005707 {
5708 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5709 CHECK_FOR_ERROR
5710 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5711 CHECK_FOR_ERROR
5712 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5713 (yyval.TermInstVal) = S;
5714
5715 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5716 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005717 for (; I != E; ++I) {
5718 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5719 S->addCase(CI, I->second);
5720 else
5721 GEN_ERROR("Switch case is constant, but not a simple integer");
5722 }
Chris Lattner59363a32008-02-19 04:36:25 +00005723 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005724 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005725 ;}
5726 break;
5727
Devang Patelbf507402008-02-20 22:40:23 +00005728 case 281:
5729#line 2644 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005730 {
5731 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005732 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005733 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005734 CHECK_FOR_ERROR
5735 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Chris Lattner59363a32008-02-19 04:36:25 +00005736 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005737 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005738 ;}
5739 break;
5740
Devang Patelbf507402008-02-20 22:40:23 +00005741 case 282:
5742#line 2654 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005743 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005744
5745 // Handle the short syntax
5746 const PointerType *PFTy = 0;
5747 const FunctionType *Ty = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00005748 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005749 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5750 // Pull out the types of all of the arguments...
5751 std::vector<const Type*> ParamTypes;
Chris Lattner59363a32008-02-19 04:36:25 +00005752 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005753 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005754 const Type *Ty = I->Val->getType();
5755 if (Ty == Type::VoidTy)
5756 GEN_ERROR("Short call syntax cannot be used with varargs");
5757 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005758 }
Chris Lattner59363a32008-02-19 04:36:25 +00005759 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00005760 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005761 }
5762
Chris Lattner59363a32008-02-19 04:36:25 +00005763 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005764
Chris Lattner59363a32008-02-19 04:36:25 +00005765 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005766 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005767 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005768 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005769 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005770 CHECK_FOR_ERROR
5771
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005772 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00005773 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5774 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005775 Attrs.push_back(PAWI);
5776 }
5777
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005778 // Check the arguments
5779 ValueList Args;
Chris Lattner59363a32008-02-19 04:36:25 +00005780 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005781 // Make sure no arguments is a good thing!
5782 if (Ty->getNumParams() != 0)
5783 GEN_ERROR("No arguments passed to a function that "
5784 "expects arguments");
5785 } else { // Has arguments?
5786 // Loop through FunctionType's arguments and ensure they are specified
5787 // correctly!
5788 FunctionType::param_iterator I = Ty->param_begin();
5789 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner59363a32008-02-19 04:36:25 +00005790 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005791 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005792
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005793 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005794 if (ArgI->Val->getType() != *I)
5795 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5796 (*I)->getDescription() + "'");
5797 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005798 if (ArgI->Attrs != ParamAttr::None) {
5799 ParamAttrsWithIndex PAWI;
5800 PAWI.index = index;
5801 PAWI.attrs = ArgI->Attrs;
5802 Attrs.push_back(PAWI);
5803 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005804 }
5805
5806 if (Ty->isVarArg()) {
5807 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00005808 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005809 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner59363a32008-02-19 04:36:25 +00005810 if (ArgI->Attrs != ParamAttr::None) {
5811 ParamAttrsWithIndex PAWI;
5812 PAWI.index = index;
5813 PAWI.attrs = ArgI->Attrs;
5814 Attrs.push_back(PAWI);
5815 }
5816 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005817 } else if (I != E || ArgI != ArgE)
5818 GEN_ERROR("Invalid number of parameters detected");
5819 }
5820
Duncan Sands637ec552007-11-28 17:07:01 +00005821 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005822 if (!Attrs.empty())
5823 PAL = ParamAttrsList::get(Attrs);
5824
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005825 // Create the InvokeInst
Chris Lattnerd140ada2007-08-29 16:15:23 +00005826 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Chris Lattner59363a32008-02-19 04:36:25 +00005827 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005828 II->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00005829 (yyval.TermInstVal) = II;
5830 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005831 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005832 ;}
5833 break;
5834
Devang Patelbf507402008-02-20 22:40:23 +00005835 case 283:
5836#line 2744 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005837 {
5838 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005839 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005840 ;}
5841 break;
5842
Devang Patelbf507402008-02-20 22:40:23 +00005843 case 284:
5844#line 2748 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005845 {
5846 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005847 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005848 ;}
5849 break;
5850
Devang Patelbf507402008-02-20 22:40:23 +00005851 case 285:
5852#line 2755 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005853 {
5854 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5855 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005856 CHECK_FOR_ERROR
5857 if (V == 0)
5858 GEN_ERROR("May only switch on a constant pool value");
5859
Chris Lattner59363a32008-02-19 04:36:25 +00005860 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005861 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005862 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5863 ;}
5864 break;
5865
Devang Patelbf507402008-02-20 22:40:23 +00005866 case 286:
5867#line 2766 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005868 {
5869 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5870 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005871 CHECK_FOR_ERROR
5872
5873 if (V == 0)
5874 GEN_ERROR("May only switch on a constant pool value");
5875
Chris Lattner59363a32008-02-19 04:36:25 +00005876 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005877 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005878 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5879 ;}
5880 break;
5881
Devang Patelbf507402008-02-20 22:40:23 +00005882 case 287:
5883#line 2779 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005884 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005885 // Is this definition named?? if so, assign the name...
Chris Lattner59363a32008-02-19 04:36:25 +00005886 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005887 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005888 InsertValue((yyvsp[(2) - (2)].InstVal));
5889 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005890 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005891 ;}
5892 break;
5893
Devang Patelbf507402008-02-20 22:40:23 +00005894 case 288:
5895#line 2789 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005896 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005897 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005898 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5899 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5900 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005901 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005902 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005903 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005904 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5905 delete (yyvsp[(1) - (6)].TypeVal);
5906 ;}
5907 break;
5908
Devang Patelbf507402008-02-20 22:40:23 +00005909 case 289:
5910#line 2800 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005911 {
5912 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5913 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005914 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005915 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005916 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005917 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5918 ;}
5919 break;
5920
Devang Patelbf507402008-02-20 22:40:23 +00005921 case 290:
5922#line 2810 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005923 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005924 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005925 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005926 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005927 // Used for call and invoke instructions
Chris Lattner59363a32008-02-19 04:36:25 +00005928 (yyval.ParamList) = new ParamList();
5929 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5930 (yyval.ParamList)->push_back(E);
5931 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005932 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005933 ;}
5934 break;
5935
Devang Patelbf507402008-02-20 22:40:23 +00005936 case 291:
5937#line 2821 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005938 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005939 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00005940 // Labels are only valid in ASMs
Chris Lattner59363a32008-02-19 04:36:25 +00005941 (yyval.ParamList) = new ParamList();
5942 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5943 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005944 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005945 ;}
5946 break;
5947
Devang Patelbf507402008-02-20 22:40:23 +00005948 case 292:
5949#line 2829 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005950 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005951 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005952 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00005953 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5954 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5955 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5956 (yyval.ParamList)->push_back(E);
5957 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005958 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005959 ;}
5960 break;
5961
Devang Patelbf507402008-02-20 22:40:23 +00005962 case 293:
5963#line 2839 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005964 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005965 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Chris Lattner59363a32008-02-19 04:36:25 +00005966 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5967 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5968 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00005969 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005970 ;}
5971 break;
5972
Devang Patelbf507402008-02-20 22:40:23 +00005973 case 294:
5974#line 2846 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005975 { (yyval.ParamList) = new ParamList(); ;}
5976 break;
5977
Devang Patelbf507402008-02-20 22:40:23 +00005978 case 295:
5979#line 2849 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005980 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5981 break;
5982
Devang Patelbf507402008-02-20 22:40:23 +00005983 case 296:
5984#line 2850 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005985 {
5986 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5987 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005988 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005989 ;}
5990 break;
5991
Devang Patelbf507402008-02-20 22:40:23 +00005992 case 297:
5993#line 2857 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00005994 {
5995 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005996 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00005997 ;}
5998 break;
5999
Devang Patelbf507402008-02-20 22:40:23 +00006000 case 298:
6001#line 2861 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006002 {
6003 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006004 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006005 ;}
6006 break;
6007
Devang Patelbf507402008-02-20 22:40:23 +00006008 case 299:
6009#line 2866 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006010 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006011 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006012 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6013 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6014 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006015 GEN_ERROR(
6016 "Arithmetic operator requires integer, FP, or packed operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006017 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006018 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006019 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006020 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006021 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6022 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006023 GEN_ERROR("binary operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006024 delete (yyvsp[(2) - (5)].TypeVal);
6025 ;}
6026 break;
6027
Devang Patelbf507402008-02-20 22:40:23 +00006028 case 300:
6029#line 2882 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006030 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006031 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006032 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6033 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6034 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6035 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006036 GEN_ERROR("Logical operator requires integral operands");
6037 }
Chris Lattner59363a32008-02-19 04:36:25 +00006038 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006039 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006040 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006041 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006042 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6043 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006044 GEN_ERROR("binary operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006045 delete (yyvsp[(2) - (5)].TypeVal);
6046 ;}
6047 break;
6048
Devang Patelbf507402008-02-20 22:40:23 +00006049 case 301:
6050#line 2899 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006051 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006052 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006053 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6054 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006055 GEN_ERROR("Vector types not supported by icmp instruction");
Chris Lattner59363a32008-02-19 04:36:25 +00006056 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006057 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006058 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006059 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006060 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6061 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006062 GEN_ERROR("icmp operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006063 delete (yyvsp[(3) - (6)].TypeVal);
6064 ;}
6065 break;
6066
Devang Patelbf507402008-02-20 22:40:23 +00006067 case 302:
6068#line 2913 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006069 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006070 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006071 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6072 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006073 GEN_ERROR("Vector types not supported by fcmp instruction");
Chris Lattner59363a32008-02-19 04:36:25 +00006074 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006075 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006076 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006077 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006078 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6079 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006080 GEN_ERROR("fcmp operator returned null");
Chris Lattner59363a32008-02-19 04:36:25 +00006081 delete (yyvsp[(3) - (6)].TypeVal);
6082 ;}
6083 break;
6084
Devang Patelbf507402008-02-20 22:40:23 +00006085 case 303:
6086#line 2927 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006087 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006088 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006089 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6090 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6091 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6092 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006093 GEN_ERROR("invalid cast opcode for cast from '" +
6094 Val->getType()->getDescription() + "' to '" +
6095 DestTy->getDescription() + "'");
Chris Lattner59363a32008-02-19 04:36:25 +00006096 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6097 delete (yyvsp[(4) - (4)].TypeVal);
6098 ;}
6099 break;
6100
Devang Patelbf507402008-02-20 22:40:23 +00006101 case 304:
6102#line 2939 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006103 {
6104 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006105 GEN_ERROR("select condition must be boolean");
Chris Lattner59363a32008-02-19 04:36:25 +00006106 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006107 GEN_ERROR("select value types should match");
Chris Lattner59363a32008-02-19 04:36:25 +00006108 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006109 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006110 ;}
6111 break;
6112
Devang Patelbf507402008-02-20 22:40:23 +00006113 case 305:
6114#line 2947 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006115 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006116 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006117 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6118 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6119 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006120 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006121 ;}
6122 break;
6123
Devang Patelbf507402008-02-20 22:40:23 +00006124 case 306:
6125#line 2954 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006126 {
6127 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006128 GEN_ERROR("Invalid extractelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006129 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006130 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006131 ;}
6132 break;
6133
Devang Patelbf507402008-02-20 22:40:23 +00006134 case 307:
6135#line 2960 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006136 {
6137 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006138 GEN_ERROR("Invalid insertelement operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006139 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006140 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006141 ;}
6142 break;
6143
Devang Patelbf507402008-02-20 22:40:23 +00006144 case 308:
6145#line 2966 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006146 {
6147 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006148 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner59363a32008-02-19 04:36:25 +00006149 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
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 309:
6155#line 2972 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006156 {
6157 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006158 if (!Ty->isFirstClassType())
6159 GEN_ERROR("PHI node operands must be of first class type");
Chris Lattner59363a32008-02-19 04:36:25 +00006160 (yyval.InstVal) = new PHINode(Ty);
6161 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6162 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6163 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006164 GEN_ERROR("All elements of a PHI node must be of the same type");
Chris Lattner59363a32008-02-19 04:36:25 +00006165 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6166 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006167 }
Chris Lattner59363a32008-02-19 04:36:25 +00006168 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006169 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006170 ;}
6171 break;
6172
Devang Patelbf507402008-02-20 22:40:23 +00006173 case 310:
6174#line 2988 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006175 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006176
6177 // Handle the short syntax
6178 const PointerType *PFTy = 0;
6179 const FunctionType *Ty = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00006180 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006181 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6182 // Pull out the types of all of the arguments...
6183 std::vector<const Type*> ParamTypes;
Chris Lattner59363a32008-02-19 04:36:25 +00006184 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006185 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006186 const Type *Ty = I->Val->getType();
6187 if (Ty == Type::VoidTy)
6188 GEN_ERROR("Short call syntax cannot be used with varargs");
6189 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006190 }
Chris Lattner59363a32008-02-19 04:36:25 +00006191 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006192 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006193 }
6194
Chris Lattner59363a32008-02-19 04:36:25 +00006195 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006196 CHECK_FOR_ERROR
6197
6198 // Check for call to invalid intrinsic to avoid crashing later.
6199 if (Function *theF = dyn_cast<Function>(V)) {
6200 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6201 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6202 !theF->getIntrinsicID(true))
6203 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6204 theF->getName() + "'");
6205 }
6206
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006207 // Set up the ParamAttrs for the function
6208 ParamAttrsVector Attrs;
Chris Lattner59363a32008-02-19 04:36:25 +00006209 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006210 ParamAttrsWithIndex PAWI;
6211 PAWI.index = 0;
Chris Lattner59363a32008-02-19 04:36:25 +00006212 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006213 Attrs.push_back(PAWI);
6214 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006215 // Check the arguments
6216 ValueList Args;
Chris Lattner59363a32008-02-19 04:36:25 +00006217 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006218 // Make sure no arguments is a good thing!
6219 if (Ty->getNumParams() != 0)
6220 GEN_ERROR("No arguments passed to a function that "
6221 "expects arguments");
6222 } else { // Has arguments?
6223 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006224 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006225 FunctionType::param_iterator I = Ty->param_begin();
6226 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner59363a32008-02-19 04:36:25 +00006227 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006228 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006229
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006230 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006231 if (ArgI->Val->getType() != *I)
6232 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6233 (*I)->getDescription() + "'");
6234 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006235 if (ArgI->Attrs != ParamAttr::None) {
6236 ParamAttrsWithIndex PAWI;
6237 PAWI.index = index;
6238 PAWI.attrs = ArgI->Attrs;
6239 Attrs.push_back(PAWI);
6240 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006241 }
6242 if (Ty->isVarArg()) {
6243 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006244 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006245 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner59363a32008-02-19 04:36:25 +00006246 if (ArgI->Attrs != ParamAttr::None) {
6247 ParamAttrsWithIndex PAWI;
6248 PAWI.index = index;
6249 PAWI.attrs = ArgI->Attrs;
6250 Attrs.push_back(PAWI);
6251 }
6252 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006253 } else if (I != E || ArgI != ArgE)
6254 GEN_ERROR("Invalid number of parameters detected");
6255 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006256
6257 // Finish off the ParamAttrs and check them
Duncan Sands637ec552007-11-28 17:07:01 +00006258 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006259 if (!Attrs.empty())
6260 PAL = ParamAttrsList::get(Attrs);
6261
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006262 // Create the call node
David Greene9145dd22007-08-01 03:59:32 +00006263 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Chris Lattner59363a32008-02-19 04:36:25 +00006264 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6265 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006266 CI->setParamAttrs(PAL);
Chris Lattner59363a32008-02-19 04:36:25 +00006267 (yyval.InstVal) = CI;
6268 delete (yyvsp[(6) - (8)].ParamList);
6269 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006270 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006271 ;}
6272 break;
6273
Devang Patelbf507402008-02-20 22:40:23 +00006274 case 311:
6275#line 3085 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006276 {
6277 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006278 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006279 ;}
6280 break;
6281
Devang Patelbf507402008-02-20 22:40:23 +00006282 case 312:
6283#line 3090 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006284 {
6285 (yyval.BoolVal) = true;
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 313:
6291#line 3094 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006292 {
6293 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006294 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006295 ;}
6296 break;
6297
Devang Patelbf507402008-02-20 22:40:23 +00006298 case 314:
6299#line 3101 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006300 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006301 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006302 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6303 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6304 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006305 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006306 ;}
6307 break;
6308
Devang Patelbf507402008-02-20 22:40:23 +00006309 case 315:
6310#line 3108 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006311 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006312 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6314 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006315 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006316 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6317 delete (yyvsp[(2) - (6)].TypeVal);
6318 ;}
6319 break;
6320
Devang Patelbf507402008-02-20 22:40:23 +00006321 case 316:
6322#line 3116 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006323 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006324 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006325 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6326 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6327 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006328 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006329 ;}
6330 break;
6331
Devang Patelbf507402008-02-20 22:40:23 +00006332 case 317:
6333#line 3123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006334 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006335 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6337 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006338 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006339 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6340 delete (yyvsp[(2) - (6)].TypeVal);
6341 ;}
6342 break;
6343
Devang Patelbf507402008-02-20 22:40:23 +00006344 case 318:
6345#line 3131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006346 {
6347 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006348 GEN_ERROR("Trying to free nonpointer type " +
Chris Lattner59363a32008-02-19 04:36:25 +00006349 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6350 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006351 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006352 ;}
6353 break;
6354
Devang Patelbf507402008-02-20 22:40:23 +00006355 case 319:
6356#line 3139 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006357 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006358 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006359 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6360 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006361 GEN_ERROR("Can't load from nonpointer type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006362 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6363 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006364 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006365 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6366 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006367 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006368 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6369 delete (yyvsp[(3) - (5)].TypeVal);
6370 ;}
6371 break;
6372
Devang Patelbf507402008-02-20 22:40:23 +00006373 case 320:
6374#line 3153 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006375 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006376 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006377 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6378 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006379 if (!PT)
6380 GEN_ERROR("Can't store to a nonpointer type: " +
Chris Lattner59363a32008-02-19 04:36:25 +00006381 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006382 const Type *ElTy = PT->getElementType();
Chris Lattner59363a32008-02-19 04:36:25 +00006383 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6384 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006385 "' into space of type '" + ElTy->getDescription() + "'");
6386
Chris Lattner59363a32008-02-19 04:36:25 +00006387 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006388 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006389 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6390 delete (yyvsp[(5) - (7)].TypeVal);
6391 ;}
6392 break;
6393
Devang Patelbf507402008-02-20 22:40:23 +00006394 case 321:
6395#line 3170 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel3b8849c2008-02-19 22:27:01 +00006396 {
6397 ValID TmpVID = ValID::createLocalName(*(yyvsp[(3) - (5)].StrVal));
6398 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), TmpVID);
Devang Pateleb293342008-02-20 19:13:10 +00006399 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel3b8849c2008-02-19 22:27:01 +00006400 GEN_ERROR("Invalid getresult operands");
Devang Pateleb293342008-02-20 19:13:10 +00006401 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
Devang Patel3b8849c2008-02-19 22:27:01 +00006402 CHECK_FOR_ERROR
6403 ;}
6404 break;
6405
Devang Patelbf507402008-02-20 22:40:23 +00006406 case 322:
6407#line 3178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner59363a32008-02-19 04:36:25 +00006408 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006409 if (!UpRefs.empty())
Chris Lattner59363a32008-02-19 04:36:25 +00006410 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6411 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006412 GEN_ERROR("getelementptr insn requires pointer operand");
6413
Chris Lattner59363a32008-02-19 04:36:25 +00006414 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 +00006415 GEN_ERROR("Invalid getelementptr indices for type '" +
Chris Lattner59363a32008-02-19 04:36:25 +00006416 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6417 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006418 CHECK_FOR_ERROR
Chris Lattner59363a32008-02-19 04:36:25 +00006419 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6420 delete (yyvsp[(2) - (4)].TypeVal);
6421 delete (yyvsp[(4) - (4)].ValueList);
6422 ;}
6423 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006424
Chris Lattner59363a32008-02-19 04:36:25 +00006425
6426/* Line 1267 of yacc.c. */
Devang Patelbf507402008-02-20 22:40:23 +00006427#line 6428 "llvmAsmParser.tab.c"
Chris Lattner59363a32008-02-19 04:36:25 +00006428 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006429 }
Chris Lattner59363a32008-02-19 04:36:25 +00006430 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6431
6432 YYPOPSTACK (yylen);
6433 yylen = 0;
6434 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006435
6436 *++yyvsp = yyval;
6437
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006438
Chris Lattner59363a32008-02-19 04:36:25 +00006439 /* Now `shift' the result of the reduction. Determine what state
6440 that goes to, based on the state we popped back to and the rule
6441 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006442
6443 yyn = yyr1[yyn];
6444
Chris Lattner59363a32008-02-19 04:36:25 +00006445 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6446 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006447 yystate = yytable[yystate];
6448 else
Chris Lattner59363a32008-02-19 04:36:25 +00006449 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006450
6451 goto yynewstate;
6452
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006453
Chris Lattner59363a32008-02-19 04:36:25 +00006454/*------------------------------------.
6455| yyerrlab -- here on detecting error |
6456`------------------------------------*/
6457yyerrlab:
6458 /* If not already recovering from an error, report this error. */
6459 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006460 {
6461 ++yynerrs;
Chris Lattner59363a32008-02-19 04:36:25 +00006462#if ! YYERROR_VERBOSE
6463 yyerror (YY_("syntax error"));
6464#else
6465 {
6466 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6467 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6468 {
6469 YYSIZE_T yyalloc = 2 * yysize;
6470 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6471 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6472 if (yymsg != yymsgbuf)
6473 YYSTACK_FREE (yymsg);
6474 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6475 if (yymsg)
6476 yymsg_alloc = yyalloc;
6477 else
6478 {
6479 yymsg = yymsgbuf;
6480 yymsg_alloc = sizeof yymsgbuf;
6481 }
6482 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006483
Chris Lattner59363a32008-02-19 04:36:25 +00006484 if (0 < yysize && yysize <= yymsg_alloc)
6485 {
6486 (void) yysyntax_error (yymsg, yystate, yychar);
6487 yyerror (yymsg);
6488 }
6489 else
6490 {
6491 yyerror (YY_("syntax error"));
6492 if (yysize != 0)
6493 goto yyexhaustedlab;
6494 }
6495 }
6496#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006497 }
6498
Chris Lattner59363a32008-02-19 04:36:25 +00006499
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006500
6501 if (yyerrstatus == 3)
6502 {
Chris Lattner59363a32008-02-19 04:36:25 +00006503 /* If just tried and failed to reuse look-ahead token after an
6504 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006505
Chris Lattner59363a32008-02-19 04:36:25 +00006506 if (yychar <= YYEOF)
6507 {
6508 /* Return failure if at end of input. */
6509 if (yychar == YYEOF)
6510 YYABORT;
6511 }
6512 else
6513 {
6514 yydestruct ("Error: discarding",
6515 yytoken, &yylval);
6516 yychar = YYEMPTY;
6517 }
6518 }
6519
6520 /* Else will try to reuse look-ahead token after shifting the error
6521 token. */
6522 goto yyerrlab1;
6523
6524
6525/*---------------------------------------------------.
6526| yyerrorlab -- error raised explicitly by YYERROR. |
6527`---------------------------------------------------*/
6528yyerrorlab:
6529
6530 /* Pacify compilers like GCC when the user code never invokes
6531 YYERROR and the label yyerrorlab therefore never appears in user
6532 code. */
6533 if (/*CONSTCOND*/ 0)
6534 goto yyerrorlab;
6535
6536 /* Do not reclaim the symbols of the rule which action triggered
6537 this YYERROR. */
6538 YYPOPSTACK (yylen);
6539 yylen = 0;
6540 YY_STACK_PRINT (yyss, yyssp);
6541 yystate = *yyssp;
6542 goto yyerrlab1;
6543
6544
6545/*-------------------------------------------------------------.
6546| yyerrlab1 -- common code for both syntax error and YYERROR. |
6547`-------------------------------------------------------------*/
6548yyerrlab1:
6549 yyerrstatus = 3; /* Each real token shifted decrements this. */
6550
6551 for (;;)
6552 {
6553 yyn = yypact[yystate];
6554 if (yyn != YYPACT_NINF)
6555 {
6556 yyn += YYTERROR;
6557 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6558 {
6559 yyn = yytable[yyn];
6560 if (0 < yyn)
6561 break;
6562 }
6563 }
6564
6565 /* Pop the current state because it cannot handle the error token. */
6566 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006567 YYABORT;
6568
Dale Johannesen3afee192007-09-07 21:07:57 +00006569
Chris Lattner59363a32008-02-19 04:36:25 +00006570 yydestruct ("Error: popping",
6571 yystos[yystate], yyvsp);
6572 YYPOPSTACK (1);
6573 yystate = *yyssp;
6574 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006575 }
6576
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006577 if (yyn == YYFINAL)
6578 YYACCEPT;
6579
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006580 *++yyvsp = yylval;
Chris Lattner59363a32008-02-19 04:36:25 +00006581
6582
6583 /* Shift the error token. */
6584 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006585
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006586 yystate = yyn;
6587 goto yynewstate;
6588
Scott Michel6d1aba82008-01-30 03:10:00 +00006589
Chris Lattner59363a32008-02-19 04:36:25 +00006590/*-------------------------------------.
6591| yyacceptlab -- YYACCEPT comes here. |
6592`-------------------------------------*/
6593yyacceptlab:
6594 yyresult = 0;
6595 goto yyreturn;
6596
6597/*-----------------------------------.
6598| yyabortlab -- YYABORT comes here. |
6599`-----------------------------------*/
6600yyabortlab:
6601 yyresult = 1;
6602 goto yyreturn;
6603
6604#ifndef yyoverflow
6605/*-------------------------------------------------.
6606| yyexhaustedlab -- memory exhaustion comes here. |
6607`-------------------------------------------------*/
6608yyexhaustedlab:
6609 yyerror (YY_("memory exhausted"));
6610 yyresult = 2;
6611 /* Fall through. */
Scott Michel5a6f17b2008-01-30 02:55:46 +00006612#endif
Chris Lattner59363a32008-02-19 04:36:25 +00006613
6614yyreturn:
6615 if (yychar != YYEOF && yychar != YYEMPTY)
6616 yydestruct ("Cleanup: discarding lookahead",
6617 yytoken, &yylval);
6618 /* Do not reclaim the symbols of the rule which action triggered
6619 this YYABORT or YYACCEPT. */
6620 YYPOPSTACK (yylen);
6621 YY_STACK_PRINT (yyss, yyssp);
6622 while (yyssp != yyss)
6623 {
6624 yydestruct ("Cleanup: popping",
6625 yystos[*yyssp], yyvsp);
6626 YYPOPSTACK (1);
Scott Michel6d1aba82008-01-30 03:10:00 +00006627 }
Chris Lattner59363a32008-02-19 04:36:25 +00006628#ifndef yyoverflow
6629 if (yyss != yyssa)
6630 YYSTACK_FREE (yyss);
6631#endif
6632#if YYERROR_VERBOSE
6633 if (yymsg != yymsgbuf)
6634 YYSTACK_FREE (yymsg);
6635#endif
6636 /* Make sure YYID is used. */
6637 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006638}
Chris Lattner59363a32008-02-19 04:36:25 +00006639
6640
Devang Patelbf507402008-02-20 22:40:23 +00006641#line 3195 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006642
6643
6644// common code from the two 'RunVMAsmParser' functions
6645static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006646 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006647 // Check to make sure the parser succeeded
6648 if (yyparse()) {
6649 if (ParserResult)
6650 delete ParserResult;
6651 return 0;
6652 }
6653
6654 // Emit an error if there are any unresolved types left.
6655 if (!CurModule.LateResolveTypes.empty()) {
6656 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6657 if (DID.Type == ValID::LocalName) {
6658 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6659 } else {
6660 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6661 }
6662 if (ParserResult)
6663 delete ParserResult;
6664 return 0;
6665 }
6666
6667 // Emit an error if there are any unresolved values left.
6668 if (!CurModule.LateResolveValues.empty()) {
6669 Value *V = CurModule.LateResolveValues.back();
6670 std::map<Value*, std::pair<ValID, int> >::iterator I =
6671 CurModule.PlaceHolderInfo.find(V);
6672
6673 if (I != CurModule.PlaceHolderInfo.end()) {
6674 ValID &DID = I->second.first;
6675 if (DID.Type == ValID::LocalName) {
6676 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6677 } else {
6678 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6679 }
6680 if (ParserResult)
6681 delete ParserResult;
6682 return 0;
6683 }
6684 }
6685
6686 // Check to make sure that parsing produced a result
6687 if (!ParserResult)
6688 return 0;
6689
6690 // Reset ParserResult variable while saving its value for the result.
6691 Module *Result = ParserResult;
6692 ParserResult = 0;
6693
6694 return Result;
6695}
6696
6697void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006698 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006699 // TODO: column number in exception
6700 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006701 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006702 TriggerError = 1;
6703}
6704
6705int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006706 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006707 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006708 if (yychar != YYEMPTY && yychar != 0) {
6709 errMsg += " while reading token: '";
6710 errMsg += std::string(LLLgetTokenStart(),
6711 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6712 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006713 GenerateError(errMsg);
6714 return 0;
6715}
Chris Lattner59363a32008-02-19 04:36:25 +00006716