blob: 9fb6134ee28bd8d7c46dcac84628ee6ebfb9cdd3 [file] [log] [blame]
Dan Gohman54392c12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Dan Gohman54392c12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Dan Gohman54392c12008-04-19 00:24:39 +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
Dan Gohman54392c12008-04-19 00:24:39 +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
Dan Gohman54392c12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +000064#define yyerror llvmAsmerror
Dan Gohman54392c12008-04-19 00:24:39 +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
Dan Gohman54392c12008-04-19 00:24:39 +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,
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
Dale Johannesen9cdf0652008-08-13 18:41:46 +0000142 X86_SSECALLCC_TOK = 323,
143 DATALAYOUT = 324,
144 RET = 325,
145 BR = 326,
146 SWITCH = 327,
147 INVOKE = 328,
148 UNWIND = 329,
149 UNREACHABLE = 330,
150 ADD = 331,
151 SUB = 332,
152 MUL = 333,
153 UDIV = 334,
154 SDIV = 335,
155 FDIV = 336,
156 UREM = 337,
157 SREM = 338,
158 FREM = 339,
159 AND = 340,
160 OR = 341,
161 XOR = 342,
162 SHL = 343,
163 LSHR = 344,
164 ASHR = 345,
165 ICMP = 346,
166 FCMP = 347,
167 VICMP = 348,
168 VFCMP = 349,
169 EQ = 350,
170 NE = 351,
171 SLT = 352,
172 SGT = 353,
173 SLE = 354,
174 SGE = 355,
175 ULT = 356,
176 UGT = 357,
177 ULE = 358,
178 UGE = 359,
179 OEQ = 360,
180 ONE = 361,
181 OLT = 362,
182 OGT = 363,
183 OLE = 364,
184 OGE = 365,
185 ORD = 366,
186 UNO = 367,
187 UEQ = 368,
188 UNE = 369,
189 MALLOC = 370,
190 ALLOCA = 371,
191 FREE = 372,
192 LOAD = 373,
193 STORE = 374,
194 GETELEMENTPTR = 375,
195 TRUNC = 376,
196 ZEXT = 377,
197 SEXT = 378,
198 FPTRUNC = 379,
199 FPEXT = 380,
200 BITCAST = 381,
201 UITOFP = 382,
202 SITOFP = 383,
203 FPTOUI = 384,
204 FPTOSI = 385,
205 INTTOPTR = 386,
206 PTRTOINT = 387,
207 PHI_TOK = 388,
208 SELECT = 389,
209 VAARG = 390,
210 EXTRACTELEMENT = 391,
211 INSERTELEMENT = 392,
212 SHUFFLEVECTOR = 393,
213 GETRESULT = 394,
214 EXTRACTVALUE = 395,
215 INSERTVALUE = 396,
216 SIGNEXT = 397,
217 ZEROEXT = 398,
218 NORETURN = 399,
219 INREG = 400,
220 SRET = 401,
221 NOUNWIND = 402,
222 NOALIAS = 403,
223 BYVAL = 404,
224 NEST = 405,
225 READNONE = 406,
226 READONLY = 407,
227 GC = 408,
Devang Patel5df692d2008-09-02 20:52:40 +0000228 FNNOTE = 409,
229 INLINE = 410,
230 ALWAYS = 411,
231 NEVER = 412,
232 OPTIMIZEFORSIZE = 413,
233 DEFAULT = 414,
234 HIDDEN = 415,
235 PROTECTED = 416
Dan Gohman54392c12008-04-19 00:24:39 +0000236 };
237#endif
238/* Tokens. */
239#define ESINT64VAL 258
240#define EUINT64VAL 259
241#define ESAPINTVAL 260
242#define EUAPINTVAL 261
243#define LOCALVAL_ID 262
244#define GLOBALVAL_ID 263
245#define FPVAL 264
246#define VOID 265
247#define INTTYPE 266
248#define FLOAT 267
249#define DOUBLE 268
250#define X86_FP80 269
251#define FP128 270
252#define PPC_FP128 271
253#define LABEL 272
254#define TYPE 273
255#define LOCALVAR 274
256#define GLOBALVAR 275
257#define LABELSTR 276
258#define STRINGCONSTANT 277
259#define ATSTRINGCONSTANT 278
260#define PCTSTRINGCONSTANT 279
261#define ZEROINITIALIZER 280
262#define TRUETOK 281
263#define FALSETOK 282
264#define BEGINTOK 283
265#define ENDTOK 284
266#define DECLARE 285
267#define DEFINE 286
268#define GLOBAL 287
269#define CONSTANT 288
270#define SECTION 289
271#define ALIAS 290
272#define VOLATILE 291
273#define THREAD_LOCAL 292
274#define TO 293
275#define DOTDOTDOT 294
276#define NULL_TOK 295
277#define UNDEF 296
278#define INTERNAL 297
279#define LINKONCE 298
280#define WEAK 299
281#define APPENDING 300
282#define DLLIMPORT 301
283#define DLLEXPORT 302
284#define EXTERN_WEAK 303
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000285#define COMMON 304
286#define OPAQUE 305
287#define EXTERNAL 306
288#define TARGET 307
289#define TRIPLE 308
290#define ALIGN 309
291#define ADDRSPACE 310
292#define DEPLIBS 311
293#define CALL 312
294#define TAIL 313
295#define ASM_TOK 314
296#define MODULE 315
297#define SIDEEFFECT 316
298#define CC_TOK 317
299#define CCC_TOK 318
300#define FASTCC_TOK 319
301#define COLDCC_TOK 320
302#define X86_STDCALLCC_TOK 321
303#define X86_FASTCALLCC_TOK 322
Dale Johannesen9cdf0652008-08-13 18:41:46 +0000304#define X86_SSECALLCC_TOK 323
305#define DATALAYOUT 324
306#define RET 325
307#define BR 326
308#define SWITCH 327
309#define INVOKE 328
310#define UNWIND 329
311#define UNREACHABLE 330
312#define ADD 331
313#define SUB 332
314#define MUL 333
315#define UDIV 334
316#define SDIV 335
317#define FDIV 336
318#define UREM 337
319#define SREM 338
320#define FREM 339
321#define AND 340
322#define OR 341
323#define XOR 342
324#define SHL 343
325#define LSHR 344
326#define ASHR 345
327#define ICMP 346
328#define FCMP 347
329#define VICMP 348
330#define VFCMP 349
331#define EQ 350
332#define NE 351
333#define SLT 352
334#define SGT 353
335#define SLE 354
336#define SGE 355
337#define ULT 356
338#define UGT 357
339#define ULE 358
340#define UGE 359
341#define OEQ 360
342#define ONE 361
343#define OLT 362
344#define OGT 363
345#define OLE 364
346#define OGE 365
347#define ORD 366
348#define UNO 367
349#define UEQ 368
350#define UNE 369
351#define MALLOC 370
352#define ALLOCA 371
353#define FREE 372
354#define LOAD 373
355#define STORE 374
356#define GETELEMENTPTR 375
357#define TRUNC 376
358#define ZEXT 377
359#define SEXT 378
360#define FPTRUNC 379
361#define FPEXT 380
362#define BITCAST 381
363#define UITOFP 382
364#define SITOFP 383
365#define FPTOUI 384
366#define FPTOSI 385
367#define INTTOPTR 386
368#define PTRTOINT 387
369#define PHI_TOK 388
370#define SELECT 389
371#define VAARG 390
372#define EXTRACTELEMENT 391
373#define INSERTELEMENT 392
374#define SHUFFLEVECTOR 393
375#define GETRESULT 394
376#define EXTRACTVALUE 395
377#define INSERTVALUE 396
378#define SIGNEXT 397
379#define ZEROEXT 398
380#define NORETURN 399
381#define INREG 400
382#define SRET 401
383#define NOUNWIND 402
384#define NOALIAS 403
385#define BYVAL 404
386#define NEST 405
387#define READNONE 406
388#define READONLY 407
389#define GC 408
Devang Patel5df692d2008-09-02 20:52:40 +0000390#define FNNOTE 409
391#define INLINE 410
392#define ALWAYS 411
393#define NEVER 412
394#define OPTIMIZEFORSIZE 413
395#define DEFAULT 414
396#define HIDDEN 415
397#define PROTECTED 416
Dan Gohman54392c12008-04-19 00:24:39 +0000398
399
400
401
402/* Copy the first part of user declarations. */
Devang Patele01c06b2008-09-23 23:25:44 +0000403#line 14 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000404
405#include "ParserInternals.h"
406#include "llvm/CallingConv.h"
407#include "llvm/InlineAsm.h"
408#include "llvm/Instructions.h"
409#include "llvm/Module.h"
410#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000411#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000412#include "llvm/Support/GetElementPtrTypeIterator.h"
413#include "llvm/Support/CommandLine.h"
414#include "llvm/ADT/SmallVector.h"
415#include "llvm/ADT/STLExtras.h"
416#include "llvm/Support/MathExtras.h"
417#include "llvm/Support/Streams.h"
418#include <algorithm>
419#include <list>
420#include <map>
421#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000422
423// The following is a gross hack. In order to rid the libAsmParser library of
424// exceptions, we have to have a way of getting the yyparse function to go into
425// an error situation. So, whenever we want an error to occur, the GenerateError
426// function (see bottom of file) sets TriggerError. Then, at the end of each
427// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
428// (a goto) to put YACC in error state. Furthermore, several calls to
429// GenerateError are made from inside productions and they must simulate the
430// previous exception behavior by exiting the production immediately. We have
431// replaced these with the GEN_ERROR macro which calls GeneratError and then
432// immediately invokes YYERROR. This would be so much cleaner if it was a
433// recursive descent parser.
434static bool TriggerError = false;
435#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
436#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
437
438int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
439int yylex(); // declaration" of xxx warnings.
440int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000441using namespace llvm;
442
443static Module *ParserResult;
444
445// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
446// relating to upreferences in the input stream.
447//
448//#define DEBUG_UPREFS 1
449#ifdef DEBUG_UPREFS
450#define UR_OUT(X) cerr << X
451#else
452#define UR_OUT(X)
453#endif
454
455#define YYERROR_VERBOSE 1
456
457static GlobalVariable *CurGV;
458
459
460// This contains info used when building the body of a function. It is
461// destroyed when the function is completed.
462//
463typedef std::vector<Value *> ValueList; // Numbered defs
464
465static void
466ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
467
468static struct PerModuleInfo {
469 Module *CurrentModule;
470 ValueList Values; // Module level numbered definitions
471 ValueList LateResolveValues;
472 std::vector<PATypeHolder> Types;
473 std::map<ValID, PATypeHolder> LateResolveTypes;
474
475 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
476 /// how they were referenced and on which line of the input they came from so
477 /// that we can resolve them later and print error messages as appropriate.
478 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
479
480 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
481 // references to global values. Global values may be referenced before they
482 // are defined, and if so, the temporary object that they represent is held
483 // here. This is used for forward references of GlobalValues.
484 //
485 typedef std::map<std::pair<const PointerType *,
486 ValID>, GlobalValue*> GlobalRefsType;
487 GlobalRefsType GlobalRefs;
488
489 void ModuleDone() {
490 // If we could not resolve some functions at function compilation time
491 // (calls to functions before they are defined), resolve them now... Types
492 // are resolved when the constant pool has been completely parsed.
493 //
494 ResolveDefinitions(LateResolveValues);
495 if (TriggerError)
496 return;
497
498 // Check to make sure that all global value forward references have been
499 // resolved!
500 //
501 if (!GlobalRefs.empty()) {
502 std::string UndefinedReferences = "Unresolved global references exist:\n";
503
504 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
505 I != E; ++I) {
506 UndefinedReferences += " " + I->first.first->getDescription() + " " +
507 I->first.second.getName() + "\n";
508 }
509 GenerateError(UndefinedReferences);
510 return;
511 }
512
Chandler Carruth563d4a42007-08-04 01:56:21 +0000513 // Look for intrinsic functions and CallInst that need to be upgraded
514 for (Module::iterator FI = CurrentModule->begin(),
515 FE = CurrentModule->end(); FI != FE; )
516 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
517
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000518 Values.clear(); // Clear out function local definitions
519 Types.clear();
520 CurrentModule = 0;
521 }
522
523 // GetForwardRefForGlobal - Check to see if there is a forward reference
524 // for this global. If so, remove it from the GlobalRefs map and return it.
525 // If not, just return null.
526 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
527 // Check to see if there is a forward reference to this global variable...
528 // if there is, eliminate it and patch the reference to use the new def'n.
529 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
530 GlobalValue *Ret = 0;
531 if (I != GlobalRefs.end()) {
532 Ret = I->second;
533 GlobalRefs.erase(I);
534 }
535 return Ret;
536 }
537
538 bool TypeIsUnresolved(PATypeHolder* PATy) {
539 // If it isn't abstract, its resolved
540 const Type* Ty = PATy->get();
541 if (!Ty->isAbstract())
542 return false;
543 // Traverse the type looking for abstract types. If it isn't abstract then
544 // we don't need to traverse that leg of the type.
545 std::vector<const Type*> WorkList, SeenList;
546 WorkList.push_back(Ty);
547 while (!WorkList.empty()) {
548 const Type* Ty = WorkList.back();
549 SeenList.push_back(Ty);
550 WorkList.pop_back();
551 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
552 // Check to see if this is an unresolved type
553 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
554 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
555 for ( ; I != E; ++I) {
556 if (I->second.get() == OpTy)
557 return true;
558 }
559 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
560 const Type* TheTy = SeqTy->getElementType();
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
563 E = SeenList.end();
564 for ( ; I != E; ++I)
565 if (*I == TheTy)
566 break;
567 if (I == E)
568 WorkList.push_back(TheTy);
569 }
570 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
571 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
572 const Type* TheTy = StrTy->getElementType(i);
573 if (TheTy->isAbstract() && TheTy != Ty) {
574 std::vector<const Type*>::iterator I = SeenList.begin(),
575 E = SeenList.end();
576 for ( ; I != E; ++I)
577 if (*I == TheTy)
578 break;
579 if (I == E)
580 WorkList.push_back(TheTy);
581 }
582 }
583 }
584 }
585 return false;
586 }
587} CurModule;
588
589static struct PerFunctionInfo {
590 Function *CurrentFunction; // Pointer to current function being created
591
592 ValueList Values; // Keep track of #'d definitions
593 unsigned NextValNum;
594 ValueList LateResolveValues;
595 bool isDeclare; // Is this function a forward declararation?
596 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
597 GlobalValue::VisibilityTypes Visibility;
598
599 /// BBForwardRefs - When we see forward references to basic blocks, keep
600 /// track of them here.
601 std::map<ValID, BasicBlock*> BBForwardRefs;
602
603 inline PerFunctionInfo() {
604 CurrentFunction = 0;
605 isDeclare = false;
606 Linkage = GlobalValue::ExternalLinkage;
607 Visibility = GlobalValue::DefaultVisibility;
608 }
609
610 inline void FunctionStart(Function *M) {
611 CurrentFunction = M;
612 NextValNum = 0;
613 }
614
615 void FunctionDone() {
616 // Any forward referenced blocks left?
617 if (!BBForwardRefs.empty()) {
618 GenerateError("Undefined reference to label " +
619 BBForwardRefs.begin()->second->getName());
620 return;
621 }
622
623 // Resolve all forward references now.
624 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
625
626 Values.clear(); // Clear out function local definitions
627 BBForwardRefs.clear();
628 CurrentFunction = 0;
629 isDeclare = false;
630 Linkage = GlobalValue::ExternalLinkage;
631 Visibility = GlobalValue::DefaultVisibility;
632 }
633} CurFun; // Info for the current function...
634
635static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
636
637
638//===----------------------------------------------------------------------===//
639// Code to handle definitions of all the types
640//===----------------------------------------------------------------------===//
641
Chris Lattner906773a2008-08-29 17:20:18 +0000642/// InsertValue - Insert a value into the value table. If it is named, this
643/// returns -1, otherwise it returns the slot number for the value.
644static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000645 // Things that have names or are void typed don't get slot numbers
646 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner906773a2008-08-29 17:20:18 +0000647 return -1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000648
649 // In the case of function values, we have to allow for the forward reference
650 // of basic blocks, which are included in the numbering. Consequently, we keep
651 // track of the next insertion location with NextValNum. When a BB gets
652 // inserted, it could change the size of the CurFun.Values vector.
653 if (&ValueTab == &CurFun.Values) {
654 if (ValueTab.size() <= CurFun.NextValNum)
655 ValueTab.resize(CurFun.NextValNum+1);
656 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner906773a2008-08-29 17:20:18 +0000657 return CurFun.NextValNum-1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000658 }
659 // For all other lists, its okay to just tack it on the back of the vector.
660 ValueTab.push_back(V);
Chris Lattner906773a2008-08-29 17:20:18 +0000661 return ValueTab.size()-1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000662}
663
664static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
665 switch (D.Type) {
666 case ValID::LocalID: // Is it a numbered definition?
667 // Module constants occupy the lowest numbered slots...
668 if (D.Num < CurModule.Types.size())
669 return CurModule.Types[D.Num];
670 break;
671 case ValID::LocalName: // Is it a named definition?
672 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
673 D.destroy(); // Free old strdup'd memory...
674 return N;
675 }
676 break;
677 default:
678 GenerateError("Internal parser error: Invalid symbol type reference");
679 return 0;
680 }
681
682 // If we reached here, we referenced either a symbol that we don't know about
683 // or an id number that hasn't been read yet. We may be referencing something
684 // forward, so just create an entry to be resolved later and get to it...
685 //
686 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
687
688
689 if (inFunctionScope()) {
690 if (D.Type == ValID::LocalName) {
691 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
692 return 0;
693 } else {
694 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
695 return 0;
696 }
697 }
698
699 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
700 if (I != CurModule.LateResolveTypes.end())
701 return I->second;
702
703 Type *Typ = OpaqueType::get();
704 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
705 return Typ;
706 }
707
708// getExistingVal - Look up the value specified by the provided type and
709// the provided ValID. If the value exists and has already been defined, return
710// it. Otherwise return null.
711//
712static Value *getExistingVal(const Type *Ty, const ValID &D) {
713 if (isa<FunctionType>(Ty)) {
714 GenerateError("Functions are not values and "
715 "must be referenced as pointers");
716 return 0;
717 }
718
719 switch (D.Type) {
720 case ValID::LocalID: { // Is it a numbered definition?
721 // Check that the number is within bounds.
722 if (D.Num >= CurFun.Values.size())
723 return 0;
724 Value *Result = CurFun.Values[D.Num];
725 if (Ty != Result->getType()) {
726 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
727 Result->getType()->getDescription() + "' does not match "
728 "expected type, '" + Ty->getDescription() + "'");
729 return 0;
730 }
731 return Result;
732 }
733 case ValID::GlobalID: { // Is it a numbered definition?
734 if (D.Num >= CurModule.Values.size())
735 return 0;
736 Value *Result = CurModule.Values[D.Num];
737 if (Ty != Result->getType()) {
738 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
739 Result->getType()->getDescription() + "' does not match "
740 "expected type, '" + Ty->getDescription() + "'");
741 return 0;
742 }
743 return Result;
744 }
745
746 case ValID::LocalName: { // Is it a named definition?
747 if (!inFunctionScope())
748 return 0;
749 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
750 Value *N = SymTab.lookup(D.getName());
751 if (N == 0)
752 return 0;
753 if (N->getType() != Ty)
754 return 0;
755
756 D.destroy(); // Free old strdup'd memory...
757 return N;
758 }
759 case ValID::GlobalName: { // Is it a named definition?
760 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
761 Value *N = SymTab.lookup(D.getName());
762 if (N == 0)
763 return 0;
764 if (N->getType() != Ty)
765 return 0;
766
767 D.destroy(); // Free old strdup'd memory...
768 return N;
769 }
770
771 // Check to make sure that "Ty" is an integral type, and that our
772 // value will fit into the specified type...
773 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000774 if (!isa<IntegerType>(Ty) ||
775 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000776 GenerateError("Signed integral constant '" +
777 itostr(D.ConstPool64) + "' is invalid for type '" +
778 Ty->getDescription() + "'");
779 return 0;
780 }
781 return ConstantInt::get(Ty, D.ConstPool64, true);
782
783 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000784 if (isa<IntegerType>(Ty) &&
785 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000786 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000787
788 if (!isa<IntegerType>(Ty) ||
789 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
790 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
791 "' is invalid or out of range for type '" +
792 Ty->getDescription() + "'");
793 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000794 }
Chris Lattner59363a32008-02-19 04:36:25 +0000795 // This is really a signed reference. Transmogrify.
796 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000797
Chris Lattnerf3d40022008-07-11 00:30:39 +0000798 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
799 if (!isa<IntegerType>(Ty)) {
800 GenerateError("Integral constant '" + D.getName() +
801 "' is invalid or out of range for type '" +
802 Ty->getDescription() + "'");
803 return 0;
804 }
805
806 {
807 APSInt Tmp = *D.ConstPoolInt;
808 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
809 return ConstantInt::get(Tmp);
810 }
811
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000812 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000813 if (!Ty->isFloatingPoint() ||
814 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000815 GenerateError("FP constant invalid for type");
816 return 0;
817 }
Chris Lattner05ba86e2008-04-20 00:41:19 +0000818 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000819 // as double. Fix this here. Long double does not need this.
820 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
821 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000822 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +0000823 return ConstantFP::get(*D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000824
825 case ValID::ConstNullVal: // Is it a null value?
826 if (!isa<PointerType>(Ty)) {
827 GenerateError("Cannot create a a non pointer null");
828 return 0;
829 }
830 return ConstantPointerNull::get(cast<PointerType>(Ty));
831
832 case ValID::ConstUndefVal: // Is it an undef value?
833 return UndefValue::get(Ty);
834
835 case ValID::ConstZeroVal: // Is it a zero value?
836 return Constant::getNullValue(Ty);
837
838 case ValID::ConstantVal: // Fully resolved constant?
839 if (D.ConstantValue->getType() != Ty) {
840 GenerateError("Constant expression type different from required type");
841 return 0;
842 }
843 return D.ConstantValue;
844
845 case ValID::InlineAsmVal: { // Inline asm expression
846 const PointerType *PTy = dyn_cast<PointerType>(Ty);
847 const FunctionType *FTy =
848 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
849 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
850 GenerateError("Invalid type for asm constraint string");
851 return 0;
852 }
853 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
854 D.IAD->HasSideEffects);
855 D.destroy(); // Free InlineAsmDescriptor.
856 return IA;
857 }
858 default:
859 assert(0 && "Unhandled case!");
860 return 0;
861 } // End of switch
862
863 assert(0 && "Unhandled case!");
864 return 0;
865}
866
867// getVal - This function is identical to getExistingVal, except that if a
868// value is not already defined, it "improvises" by creating a placeholder var
869// that looks and acts just like the requested variable. When the value is
870// defined later, all uses of the placeholder variable are replaced with the
871// real thing.
872//
873static Value *getVal(const Type *Ty, const ValID &ID) {
874 if (Ty == Type::LabelTy) {
875 GenerateError("Cannot use a basic block here");
876 return 0;
877 }
878
879 // See if the value has already been defined.
880 Value *V = getExistingVal(Ty, ID);
881 if (V) return V;
882 if (TriggerError) return 0;
883
884 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000885 GenerateError("Invalid use of a non-first-class type");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000886 return 0;
887 }
888
889 // If we reached here, we referenced either a symbol that we don't know about
890 // or an id number that hasn't been read yet. We may be referencing something
891 // forward, so just create an entry to be resolved later and get to it...
892 //
893 switch (ID.Type) {
894 case ValID::GlobalName:
895 case ValID::GlobalID: {
896 const PointerType *PTy = dyn_cast<PointerType>(Ty);
897 if (!PTy) {
898 GenerateError("Invalid type for reference to global" );
899 return 0;
900 }
901 const Type* ElTy = PTy->getElementType();
902 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000903 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000904 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000905 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
906 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000907 break;
908 }
909 default:
910 V = new Argument(Ty);
911 }
912
913 // Remember where this forward reference came from. FIXME, shouldn't we try
914 // to recycle these things??
915 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000916 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000917
918 if (inFunctionScope())
919 InsertValue(V, CurFun.LateResolveValues);
920 else
921 InsertValue(V, CurModule.LateResolveValues);
922 return V;
923}
924
925/// defineBBVal - This is a definition of a new basic block with the specified
926/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000927static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000928 assert(inFunctionScope() && "Can't get basic block at global scope!");
929
930 BasicBlock *BB = 0;
931
932 // First, see if this was forward referenced
933
934 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
935 if (BBI != CurFun.BBForwardRefs.end()) {
936 BB = BBI->second;
937 // The forward declaration could have been inserted anywhere in the
938 // function: insert it into the correct place now.
939 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
940 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
941
942 // We're about to erase the entry, save the key so we can clean it up.
943 ValID Tmp = BBI->first;
944
945 // Erase the forward ref from the map as its no longer "forward"
946 CurFun.BBForwardRefs.erase(ID);
947
948 // The key has been removed from the map but so we don't want to leave
949 // strdup'd memory around so destroy it too.
950 Tmp.destroy();
951
952 // If its a numbered definition, bump the number and set the BB value.
953 if (ID.Type == ValID::LocalID) {
954 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
955 InsertValue(BB);
956 }
Devang Patel890cc572008-03-03 18:58:47 +0000957 } else {
958 // We haven't seen this BB before and its first mention is a definition.
959 // Just create it and return it.
960 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000961 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000962 if (ID.Type == ValID::LocalID) {
963 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
964 InsertValue(BB);
965 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000966 }
967
Devang Patel890cc572008-03-03 18:58:47 +0000968 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000969 return BB;
970}
971
972/// getBBVal - get an existing BB value or create a forward reference for it.
973///
974static BasicBlock *getBBVal(const ValID &ID) {
975 assert(inFunctionScope() && "Can't get basic block at global scope!");
976
977 BasicBlock *BB = 0;
978
979 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
980 if (BBI != CurFun.BBForwardRefs.end()) {
981 BB = BBI->second;
982 } if (ID.Type == ValID::LocalName) {
983 std::string Name = ID.getName();
984 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000985 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000986 if (N->getType()->getTypeID() == Type::LabelTyID)
987 BB = cast<BasicBlock>(N);
988 else
989 GenerateError("Reference to label '" + Name + "' is actually of type '"+
990 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000991 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000992 } else if (ID.Type == ValID::LocalID) {
993 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
994 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
995 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
996 else
997 GenerateError("Reference to label '%" + utostr(ID.Num) +
998 "' is actually of type '"+
999 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1000 }
1001 } else {
1002 GenerateError("Illegal label reference " + ID.getName());
1003 return 0;
1004 }
1005
1006 // If its already been defined, return it now.
1007 if (BB) {
1008 ID.destroy(); // Free strdup'd memory.
1009 return BB;
1010 }
1011
1012 // Otherwise, this block has not been seen before, create it.
1013 std::string Name;
1014 if (ID.Type == ValID::LocalName)
1015 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +00001016 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001017
1018 // Insert it in the forward refs map.
1019 CurFun.BBForwardRefs[ID] = BB;
1020
1021 return BB;
1022}
1023
1024
1025//===----------------------------------------------------------------------===//
1026// Code to handle forward references in instructions
1027//===----------------------------------------------------------------------===//
1028//
1029// This code handles the late binding needed with statements that reference
1030// values not defined yet... for example, a forward branch, or the PHI node for
1031// a loop body.
1032//
1033// This keeps a table (CurFun.LateResolveValues) of all such forward references
1034// and back patchs after we are done.
1035//
1036
1037// ResolveDefinitions - If we could not resolve some defs at parsing
1038// time (forward branches, phi functions for loops, etc...) resolve the
1039// defs now...
1040//
1041static void
1042ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1043 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1044 while (!LateResolvers.empty()) {
1045 Value *V = LateResolvers.back();
1046 LateResolvers.pop_back();
1047
1048 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1049 CurModule.PlaceHolderInfo.find(V);
1050 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1051
1052 ValID &DID = PHI->second.first;
1053
1054 Value *TheRealValue = getExistingVal(V->getType(), DID);
1055 if (TriggerError)
1056 return;
1057 if (TheRealValue) {
1058 V->replaceAllUsesWith(TheRealValue);
1059 delete V;
1060 CurModule.PlaceHolderInfo.erase(PHI);
1061 } else if (FutureLateResolvers) {
1062 // Functions have their unresolved items forwarded to the module late
1063 // resolver table
1064 InsertValue(V, *FutureLateResolvers);
1065 } else {
1066 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1067 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1068 "' of type '" + V->getType()->getDescription() + "'",
1069 PHI->second.second);
1070 return;
1071 } else {
1072 GenerateError("Reference to an invalid definition: #" +
1073 itostr(DID.Num) + " of type '" +
1074 V->getType()->getDescription() + "'",
1075 PHI->second.second);
1076 return;
1077 }
1078 }
1079 }
1080 LateResolvers.clear();
1081}
1082
1083// ResolveTypeTo - A brand new type was just declared. This means that (if
1084// name is not null) things referencing Name can be resolved. Otherwise, things
1085// refering to the number can be resolved. Do this now.
1086//
1087static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1088 ValID D;
1089 if (Name)
1090 D = ValID::createLocalName(*Name);
1091 else
1092 D = ValID::createLocalID(CurModule.Types.size());
1093
1094 std::map<ValID, PATypeHolder>::iterator I =
1095 CurModule.LateResolveTypes.find(D);
1096 if (I != CurModule.LateResolveTypes.end()) {
1097 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1098 CurModule.LateResolveTypes.erase(I);
1099 }
1100}
1101
1102// setValueName - Set the specified value to the name given. The name may be
1103// null potentially, in which case this is a noop. The string passed in is
1104// assumed to be a malloc'd string buffer, and is free'd by this function.
1105//
1106static void setValueName(Value *V, std::string *NameStr) {
1107 if (!NameStr) return;
1108 std::string Name(*NameStr); // Copy string
1109 delete NameStr; // Free old string
1110
1111 if (V->getType() == Type::VoidTy) {
1112 GenerateError("Can't assign name '" + Name+"' to value with void type");
1113 return;
1114 }
1115
1116 assert(inFunctionScope() && "Must be in function scope!");
1117 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1118 if (ST.lookup(Name)) {
1119 GenerateError("Redefinition of value '" + Name + "' of type '" +
1120 V->getType()->getDescription() + "'");
1121 return;
1122 }
1123
1124 // Set the name.
1125 V->setName(Name);
1126}
1127
1128/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1129/// this is a declaration, otherwise it is a definition.
1130static GlobalVariable *
1131ParseGlobalVariable(std::string *NameStr,
1132 GlobalValue::LinkageTypes Linkage,
1133 GlobalValue::VisibilityTypes Visibility,
1134 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001135 Constant *Initializer, bool IsThreadLocal,
1136 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001137 if (isa<FunctionType>(Ty)) {
1138 GenerateError("Cannot declare global vars of function type");
1139 return 0;
1140 }
Dan Gohmane5febe42008-05-31 00:58:22 +00001141 if (Ty == Type::LabelTy) {
1142 GenerateError("Cannot declare global vars of label type");
1143 return 0;
1144 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001145
Christopher Lamb0a243582007-12-11 09:02:08 +00001146 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001147
1148 std::string Name;
1149 if (NameStr) {
1150 Name = *NameStr; // Copy string
1151 delete NameStr; // Free old string
1152 }
1153
1154 // See if this global value was forward referenced. If so, recycle the
1155 // object.
1156 ValID ID;
1157 if (!Name.empty()) {
1158 ID = ValID::createGlobalName(Name);
1159 } else {
1160 ID = ValID::createGlobalID(CurModule.Values.size());
1161 }
1162
1163 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1164 // Move the global to the end of the list, from whereever it was
1165 // previously inserted.
1166 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1167 CurModule.CurrentModule->getGlobalList().remove(GV);
1168 CurModule.CurrentModule->getGlobalList().push_back(GV);
1169 GV->setInitializer(Initializer);
1170 GV->setLinkage(Linkage);
1171 GV->setVisibility(Visibility);
1172 GV->setConstant(isConstantGlobal);
1173 GV->setThreadLocal(IsThreadLocal);
1174 InsertValue(GV, CurModule.Values);
1175 return GV;
1176 }
1177
1178 // If this global has a name
1179 if (!Name.empty()) {
1180 // if the global we're parsing has an initializer (is a definition) and
1181 // has external linkage.
1182 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1183 // If there is already a global with external linkage with this name
1184 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1185 // If we allow this GVar to get created, it will be renamed in the
1186 // symbol table because it conflicts with an existing GVar. We can't
1187 // allow redefinition of GVars whose linking indicates that their name
1188 // must stay the same. Issue the error.
1189 GenerateError("Redefinition of global variable named '" + Name +
1190 "' of type '" + Ty->getDescription() + "'");
1191 return 0;
1192 }
1193 }
1194
1195 // Otherwise there is no existing GV to use, create one now.
1196 GlobalVariable *GV =
1197 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001198 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001199 GV->setVisibility(Visibility);
1200 InsertValue(GV, CurModule.Values);
1201 return GV;
1202}
1203
1204// setTypeName - Set the specified type to the name given. The name may be
1205// null potentially, in which case this is a noop. The string passed in is
1206// assumed to be a malloc'd string buffer, and is freed by this function.
1207//
1208// This function returns true if the type has already been defined, but is
1209// allowed to be redefined in the specified context. If the name is a new name
1210// for the type plane, it is inserted and false is returned.
1211static bool setTypeName(const Type *T, std::string *NameStr) {
1212 assert(!inFunctionScope() && "Can't give types function-local names!");
1213 if (NameStr == 0) return false;
1214
1215 std::string Name(*NameStr); // Copy string
1216 delete NameStr; // Free old string
1217
1218 // We don't allow assigning names to void type
1219 if (T == Type::VoidTy) {
1220 GenerateError("Can't assign name '" + Name + "' to the void type");
1221 return false;
1222 }
1223
1224 // Set the type name, checking for conflicts as we do so.
1225 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1226
1227 if (AlreadyExists) { // Inserting a name that is already defined???
1228 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1229 assert(Existing && "Conflict but no matching type?!");
1230
1231 // There is only one case where this is allowed: when we are refining an
1232 // opaque type. In this case, Existing will be an opaque type.
1233 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1234 // We ARE replacing an opaque type!
1235 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1236 return true;
1237 }
1238
1239 // Otherwise, this is an attempt to redefine a type. That's okay if
1240 // the redefinition is identical to the original. This will be so if
1241 // Existing and T point to the same Type object. In this one case we
1242 // allow the equivalent redefinition.
1243 if (Existing == T) return true; // Yes, it's equal.
1244
1245 // Any other kind of (non-equivalent) redefinition is an error.
1246 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1247 T->getDescription() + "'");
1248 }
1249
1250 return false;
1251}
1252
1253//===----------------------------------------------------------------------===//
1254// Code for handling upreferences in type names...
1255//
1256
1257// TypeContains - Returns true if Ty directly contains E in it.
1258//
1259static bool TypeContains(const Type *Ty, const Type *E) {
1260 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1261 E) != Ty->subtype_end();
1262}
1263
1264namespace {
1265 struct UpRefRecord {
1266 // NestingLevel - The number of nesting levels that need to be popped before
1267 // this type is resolved.
1268 unsigned NestingLevel;
1269
1270 // LastContainedTy - This is the type at the current binding level for the
1271 // type. Every time we reduce the nesting level, this gets updated.
1272 const Type *LastContainedTy;
1273
1274 // UpRefTy - This is the actual opaque type that the upreference is
1275 // represented with.
1276 OpaqueType *UpRefTy;
1277
1278 UpRefRecord(unsigned NL, OpaqueType *URTy)
1279 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1280 };
1281}
1282
1283// UpRefs - A list of the outstanding upreferences that need to be resolved.
1284static std::vector<UpRefRecord> UpRefs;
1285
1286/// HandleUpRefs - Every time we finish a new layer of types, this function is
1287/// called. It loops through the UpRefs vector, which is a list of the
1288/// currently active types. For each type, if the up reference is contained in
1289/// the newly completed type, we decrement the level count. When the level
1290/// count reaches zero, the upreferenced type is the type that is passed in:
1291/// thus we can complete the cycle.
1292///
1293static PATypeHolder HandleUpRefs(const Type *ty) {
1294 // If Ty isn't abstract, or if there are no up-references in it, then there is
1295 // nothing to resolve here.
1296 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1297
1298 PATypeHolder Ty(ty);
1299 UR_OUT("Type '" << Ty->getDescription() <<
1300 "' newly formed. Resolving upreferences.\n" <<
1301 UpRefs.size() << " upreferences active!\n");
1302
1303 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1304 // to zero), we resolve them all together before we resolve them to Ty. At
1305 // the end of the loop, if there is anything to resolve to Ty, it will be in
1306 // this variable.
1307 OpaqueType *TypeToResolve = 0;
1308
1309 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1310 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1311 << UpRefs[i].second->getDescription() << ") = "
1312 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1313 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1314 // Decrement level of upreference
1315 unsigned Level = --UpRefs[i].NestingLevel;
1316 UpRefs[i].LastContainedTy = Ty;
1317 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1318 if (Level == 0) { // Upreference should be resolved!
1319 if (!TypeToResolve) {
1320 TypeToResolve = UpRefs[i].UpRefTy;
1321 } else {
1322 UR_OUT(" * Resolving upreference for "
1323 << UpRefs[i].second->getDescription() << "\n";
1324 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1325 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1326 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1327 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1328 }
1329 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1330 --i; // Do not skip the next element...
1331 }
1332 }
1333 }
1334
1335 if (TypeToResolve) {
1336 UR_OUT(" * Resolving upreference for "
1337 << UpRefs[i].second->getDescription() << "\n";
1338 std::string OldName = TypeToResolve->getDescription());
1339 TypeToResolve->refineAbstractTypeTo(Ty);
1340 }
1341
1342 return Ty;
1343}
1344
1345//===----------------------------------------------------------------------===//
1346// RunVMAsmParser - Define an interface to this parser
1347//===----------------------------------------------------------------------===//
1348//
1349static Module* RunParser(Module * M);
1350
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001351Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1352 InitLLLexer(MB);
1353 Module *M = RunParser(new Module(LLLgetFilename()));
1354 FreeLexer();
1355 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001356}
1357
1358
Dan Gohman54392c12008-04-19 00:24:39 +00001359
1360/* Enabling traces. */
1361#ifndef YYDEBUG
1362# define YYDEBUG 0
1363#endif
1364
1365/* Enabling verbose error messages. */
1366#ifdef YYERROR_VERBOSE
1367# undef YYERROR_VERBOSE
1368# define YYERROR_VERBOSE 1
1369#else
1370# define YYERROR_VERBOSE 0
1371#endif
1372
1373/* Enabling the token table. */
1374#ifndef YYTOKEN_TABLE
1375# define YYTOKEN_TABLE 0
1376#endif
1377
1378#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1379typedef union YYSTYPE
Devang Patele01c06b2008-09-23 23:25:44 +00001380#line 970 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001381{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001382 llvm::Module *ModuleVal;
1383 llvm::Function *FunctionVal;
1384 llvm::BasicBlock *BasicBlockVal;
1385 llvm::TerminatorInst *TermInstVal;
1386 llvm::Instruction *InstVal;
1387 llvm::Constant *ConstVal;
1388
1389 const llvm::Type *PrimType;
1390 std::list<llvm::PATypeHolder> *TypeList;
1391 llvm::PATypeHolder *TypeVal;
1392 llvm::Value *ValueVal;
1393 std::vector<llvm::Value*> *ValueList;
Dan Gohmane5febe42008-05-31 00:58:22 +00001394 std::vector<unsigned> *ConstantList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001395 llvm::ArgListType *ArgList;
1396 llvm::TypeWithAttrs TypeWithAttrs;
1397 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001398 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001399
1400 // Represent the RHS of PHI node
1401 std::list<std::pair<llvm::Value*,
1402 llvm::BasicBlock*> > *PHIList;
1403 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1404 std::vector<llvm::Constant*> *ConstVector;
1405
1406 llvm::GlobalValue::LinkageTypes Linkage;
1407 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Patele01c06b2008-09-23 23:25:44 +00001408 llvm::Attributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409 llvm::APInt *APIntVal;
1410 int64_t SInt64Val;
1411 uint64_t UInt64Val;
1412 int SIntVal;
1413 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001414 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001415 bool BoolVal;
1416
1417 std::string *StrVal; // This memory must be deleted
1418 llvm::ValID ValIDVal;
1419
1420 llvm::Instruction::BinaryOps BinaryOpVal;
1421 llvm::Instruction::TermOps TermOpVal;
1422 llvm::Instruction::MemoryOps MemOpVal;
1423 llvm::Instruction::CastOps CastOpVal;
1424 llvm::Instruction::OtherOps OtherOpVal;
1425 llvm::ICmpInst::Predicate IPredicate;
1426 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001427}
Dan Gohman7185e4b2008-06-23 18:43:26 +00001428/* Line 193 of yacc.c. */
Devang Patele01c06b2008-09-23 23:25:44 +00001429#line 1430 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001430 YYSTYPE;
1431# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1432# define YYSTYPE_IS_DECLARED 1
1433# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001434#endif
1435
1436
1437
Dan Gohman54392c12008-04-19 00:24:39 +00001438/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001439
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001440
Dan Gohman54392c12008-04-19 00:24:39 +00001441/* Line 216 of yacc.c. */
Devang Patele01c06b2008-09-23 23:25:44 +00001442#line 1443 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001443
Dan Gohman54392c12008-04-19 00:24:39 +00001444#ifdef short
1445# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001446#endif
1447
Dan Gohman54392c12008-04-19 00:24:39 +00001448#ifdef YYTYPE_UINT8
1449typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001450#else
Dan Gohman54392c12008-04-19 00:24:39 +00001451typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001452#endif
1453
Dan Gohman54392c12008-04-19 00:24:39 +00001454#ifdef YYTYPE_INT8
1455typedef YYTYPE_INT8 yytype_int8;
1456#elif (defined __STDC__ || defined __C99__FUNC__ \
1457 || defined __cplusplus || defined _MSC_VER)
1458typedef signed char yytype_int8;
1459#else
1460typedef short int yytype_int8;
1461#endif
1462
1463#ifdef YYTYPE_UINT16
1464typedef YYTYPE_UINT16 yytype_uint16;
1465#else
1466typedef unsigned short int yytype_uint16;
1467#endif
1468
1469#ifdef YYTYPE_INT16
1470typedef YYTYPE_INT16 yytype_int16;
1471#else
1472typedef short int yytype_int16;
1473#endif
1474
1475#ifndef YYSIZE_T
1476# ifdef __SIZE_TYPE__
1477# define YYSIZE_T __SIZE_TYPE__
1478# elif defined size_t
1479# define YYSIZE_T size_t
1480# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1481 || defined __cplusplus || defined _MSC_VER)
1482# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1483# define YYSIZE_T size_t
1484# else
1485# define YYSIZE_T unsigned int
1486# endif
1487#endif
1488
1489#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1490
1491#ifndef YY_
Dan Gohman7185e4b2008-06-23 18:43:26 +00001492# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohman54392c12008-04-19 00:24:39 +00001493# if ENABLE_NLS
1494# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1495# define YY_(msgid) dgettext ("bison-runtime", msgid)
1496# endif
1497# endif
1498# ifndef YY_
1499# define YY_(msgid) msgid
1500# endif
1501#endif
1502
1503/* Suppress unused-variable warnings by "using" E. */
1504#if ! defined lint || defined __GNUC__
1505# define YYUSE(e) ((void) (e))
1506#else
1507# define YYUSE(e) /* empty */
1508#endif
1509
1510/* Identity function, used to suppress warnings about constant conditions. */
1511#ifndef lint
1512# define YYID(n) (n)
1513#else
1514#if (defined __STDC__ || defined __C99__FUNC__ \
1515 || defined __cplusplus || defined _MSC_VER)
1516static int
1517YYID (int i)
1518#else
1519static int
1520YYID (i)
1521 int i;
1522#endif
1523{
1524 return i;
1525}
1526#endif
1527
1528#if ! defined yyoverflow || YYERROR_VERBOSE
1529
1530/* The parser invokes alloca or malloc; define the necessary symbols. */
1531
1532# ifdef YYSTACK_USE_ALLOCA
1533# if YYSTACK_USE_ALLOCA
1534# ifdef __GNUC__
1535# define YYSTACK_ALLOC __builtin_alloca
1536# elif defined __BUILTIN_VA_ARG_INCR
1537# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1538# elif defined _AIX
1539# define YYSTACK_ALLOC __alloca
1540# elif defined _MSC_VER
1541# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1542# define alloca _alloca
1543# else
1544# define YYSTACK_ALLOC alloca
1545# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1546 || defined __cplusplus || defined _MSC_VER)
1547# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1548# ifndef _STDLIB_H
1549# define _STDLIB_H 1
1550# endif
1551# endif
1552# endif
1553# endif
1554# endif
1555
1556# ifdef YYSTACK_ALLOC
1557 /* Pacify GCC's `empty if-body' warning. */
1558# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1559# ifndef YYSTACK_ALLOC_MAXIMUM
1560 /* The OS might guarantee only one guard page at the bottom of the stack,
1561 and a page size can be as small as 4096 bytes. So we cannot safely
1562 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1563 to allow for a few compiler-allocated temporary stack slots. */
1564# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1565# endif
1566# else
1567# define YYSTACK_ALLOC YYMALLOC
1568# define YYSTACK_FREE YYFREE
1569# ifndef YYSTACK_ALLOC_MAXIMUM
1570# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1571# endif
1572# if (defined __cplusplus && ! defined _STDLIB_H \
1573 && ! ((defined YYMALLOC || defined malloc) \
1574 && (defined YYFREE || defined free)))
1575# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1576# ifndef _STDLIB_H
1577# define _STDLIB_H 1
1578# endif
1579# endif
1580# ifndef YYMALLOC
1581# define YYMALLOC malloc
1582# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1583 || defined __cplusplus || defined _MSC_VER)
1584void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1585# endif
1586# endif
1587# ifndef YYFREE
1588# define YYFREE free
1589# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1590 || defined __cplusplus || defined _MSC_VER)
1591void free (void *); /* INFRINGES ON USER NAME SPACE */
1592# endif
1593# endif
1594# endif
1595#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1596
1597
1598#if (! defined yyoverflow \
1599 && (! defined __cplusplus \
1600 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1601
1602/* A type that is properly aligned for any stack member. */
1603union yyalloc
1604{
1605 yytype_int16 yyss;
1606 YYSTYPE yyvs;
1607 };
1608
1609/* The size of the maximum gap between one aligned stack and the next. */
1610# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1611
1612/* The size of an array large to enough to hold all stacks, each with
1613 N elements. */
1614# define YYSTACK_BYTES(N) \
1615 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1616 + YYSTACK_GAP_MAXIMUM)
1617
1618/* Copy COUNT objects from FROM to TO. The source and destination do
1619 not overlap. */
1620# ifndef YYCOPY
1621# if defined __GNUC__ && 1 < __GNUC__
1622# define YYCOPY(To, From, Count) \
1623 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1624# else
1625# define YYCOPY(To, From, Count) \
1626 do \
1627 { \
1628 YYSIZE_T yyi; \
1629 for (yyi = 0; yyi < (Count); yyi++) \
1630 (To)[yyi] = (From)[yyi]; \
1631 } \
1632 while (YYID (0))
1633# endif
1634# endif
1635
1636/* Relocate STACK from its old location to the new one. The
1637 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1638 elements in the stack, and YYPTR gives the new location of the
1639 stack. Advance YYPTR to a properly aligned location for the next
1640 stack. */
1641# define YYSTACK_RELOCATE(Stack) \
1642 do \
1643 { \
1644 YYSIZE_T yynewbytes; \
1645 YYCOPY (&yyptr->Stack, Stack, yysize); \
1646 Stack = &yyptr->Stack; \
1647 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1648 yyptr += yynewbytes / sizeof (*yyptr); \
1649 } \
1650 while (YYID (0))
1651
1652#endif
1653
1654/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001655#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001656/* YYLAST -- Last index in YYTABLE. */
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00001657#define YYLAST 2384
Dan Gohman54392c12008-04-19 00:24:39 +00001658
1659/* YYNTOKENS -- Number of terminals. */
Devang Patel5df692d2008-09-02 20:52:40 +00001660#define YYNTOKENS 176
Dan Gohman54392c12008-04-19 00:24:39 +00001661/* YYNNTS -- Number of nonterminals. */
Devang Patel5df692d2008-09-02 20:52:40 +00001662#define YYNNTS 90
Dan Gohman54392c12008-04-19 00:24:39 +00001663/* YYNRULES -- Number of rules. */
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00001664#define YYNRULES 354
Dan Gohman54392c12008-04-19 00:24:39 +00001665/* YYNRULES -- Number of states. */
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00001666#define YYNSTATES 721
Dan Gohman54392c12008-04-19 00:24:39 +00001667
1668/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1669#define YYUNDEFTOK 2
Devang Patel5df692d2008-09-02 20:52:40 +00001670#define YYMAXUTOK 416
Dan Gohman54392c12008-04-19 00:24:39 +00001671
1672#define YYTRANSLATE(YYX) \
1673 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1674
1675/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1676static const yytype_uint8 yytranslate[] =
1677{
1678 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5df692d2008-09-02 20:52:40 +00001682 162, 163, 166, 2, 165, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5df692d2008-09-02 20:52:40 +00001684 171, 164, 172, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5df692d2008-09-02 20:52:40 +00001687 2, 168, 167, 170, 2, 2, 2, 2, 2, 175,
Dan Gohman54392c12008-04-19 00:24:39 +00001688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5df692d2008-09-02 20:52:40 +00001690 169, 2, 2, 173, 2, 174, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1704 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1705 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1706 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1707 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1708 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1709 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1710 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1711 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1712 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1713 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1714 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1715 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1716 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1717 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001718 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Patel5df692d2008-09-02 20:52:40 +00001719 155, 156, 157, 158, 159, 160, 161
Dan Gohman54392c12008-04-19 00:24:39 +00001720};
1721
1722#if YYDEBUG
1723/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1724 YYRHS. */
1725static const yytype_uint16 yyprhs[] =
1726{
1727 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1728 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1729 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1730 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1731 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1732 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1733 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
Chris Lattner906773a2008-08-29 17:20:18 +00001734 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1735 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1736 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
1737 197, 198, 200, 202, 204, 206, 208, 210, 213, 215,
1738 217, 219, 221, 223, 225, 227, 229, 231, 234, 235,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00001739 238, 240, 242, 244, 246, 248, 250, 252, 253, 256,
1740 258, 262, 266, 270, 272, 273, 278, 279, 282, 283,
1741 286, 287, 291, 294, 295, 297, 298, 302, 304, 307,
1742 309, 311, 313, 315, 317, 319, 321, 323, 325, 329,
1743 331, 334, 340, 346, 352, 358, 362, 365, 371, 376,
1744 379, 381, 383, 385, 389, 391, 395, 397, 398, 400,
1745 404, 409, 413, 417, 422, 427, 431, 438, 444, 447,
1746 450, 453, 456, 459, 462, 465, 468, 471, 474, 477,
1747 480, 487, 493, 502, 509, 516, 524, 532, 540, 548,
1748 555, 564, 573, 579, 587, 591, 593, 595, 597, 599,
1749 600, 603, 610, 612, 613, 615, 618, 619, 623, 624,
1750 628, 632, 636, 640, 641, 650, 651, 661, 662, 672,
1751 678, 681, 685, 687, 691, 695, 699, 703, 705, 706,
1752 712, 716, 718, 722, 724, 725, 737, 739, 741, 746,
1753 748, 750, 753, 757, 758, 760, 762, 764, 766, 768,
1754 770, 772, 774, 776, 778, 780, 784, 788, 791, 794,
1755 798, 801, 807, 812, 814, 820, 822, 824, 826, 828,
1756 830, 832, 835, 837, 841, 844, 847, 851, 855, 858,
1757 859, 861, 864, 867, 871, 881, 891, 900, 915, 917,
1758 919, 926, 932, 935, 938, 945, 953, 958, 963, 970,
1759 977, 978, 979, 983, 986, 990, 993, 995, 1001, 1007,
1760 1014, 1021, 1028, 1035, 1040, 1047, 1052, 1057, 1064, 1071,
1761 1074, 1083, 1085, 1087, 1088, 1092, 1099, 1103, 1110, 1113,
1762 1119, 1127, 1133, 1138, 1143
Dan Gohman54392c12008-04-19 00:24:39 +00001763};
1764
1765/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1766static const yytype_int16 yyrhs[] =
1767{
Devang Patel5df692d2008-09-02 20:52:40 +00001768 226, 0, -1, 76, -1, 77, -1, 78, -1, 79,
Dale Johannesen9cdf0652008-08-13 18:41:46 +00001769 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1770 -1, 88, -1, 89, -1, 90, -1, 85, -1, 86,
1771 -1, 87, -1, 121, -1, 122, -1, 123, -1, 124,
1772 -1, 125, -1, 126, -1, 127, -1, 128, -1, 129,
1773 -1, 130, -1, 131, -1, 132, -1, 95, -1, 96,
1774 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1775 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1776 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1777 -1, 112, -1, 113, -1, 114, -1, 101, -1, 102,
1778 -1, 103, -1, 104, -1, 26, -1, 27, -1, 11,
Dan Gohman54392c12008-04-19 00:24:39 +00001779 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patel5df692d2008-09-02 20:52:40 +00001780 -1, 19, -1, 22, -1, 24, -1, 184, -1, -1,
1781 55, 162, 4, 163, -1, -1, 184, 164, -1, -1,
1782 7, 164, -1, 20, -1, 23, -1, 191, -1, -1,
1783 189, 164, -1, 42, -1, 44, -1, 43, -1, 45,
Chris Lattner906773a2008-08-29 17:20:18 +00001784 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
Devang Patel5df692d2008-09-02 20:52:40 +00001785 -1, -1, 159, -1, 160, -1, 161, -1, -1, 46,
Chris Lattner906773a2008-08-29 17:20:18 +00001786 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1787 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
1788 64, -1, 65, -1, 66, -1, 67, -1, 68, -1,
1789 62, 4, -1, 143, -1, 122, -1, 142, -1, 123,
1790 -1, 145, -1, 146, -1, 148, -1, 149, -1, 150,
Devang Patel5df692d2008-09-02 20:52:40 +00001791 -1, 54, 4, -1, -1, 200, 199, -1, 144, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00001792 147, -1, 145, -1, 143, -1, 142, -1, 151, -1,
1793 152, -1, -1, 202, 201, -1, 204, -1, 203, 165,
1794 204, -1, 155, 164, 157, -1, 155, 164, 156, -1,
1795 158, -1, -1, 154, 162, 203, 163, -1, -1, 153,
1796 22, -1, -1, 54, 4, -1, -1, 165, 54, 4,
1797 -1, 34, 22, -1, -1, 209, -1, -1, 165, 212,
1798 211, -1, 209, -1, 54, 4, -1, 11, -1, 12,
1799 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
1800 -1, 50, -1, 213, -1, 214, 186, 166, -1, 248,
1801 -1, 167, 4, -1, 214, 162, 218, 163, 202, -1,
1802 10, 162, 218, 163, 202, -1, 168, 4, 169, 214,
1803 170, -1, 171, 4, 169, 214, 172, -1, 173, 219,
1804 174, -1, 173, 174, -1, 171, 173, 219, 174, 172,
1805 -1, 171, 173, 174, 172, -1, 214, 200, -1, 214,
1806 -1, 10, -1, 215, -1, 217, 165, 215, -1, 217,
1807 -1, 217, 165, 39, -1, 39, -1, -1, 214, -1,
1808 219, 165, 214, -1, 214, 168, 222, 170, -1, 214,
1809 168, 170, -1, 214, 175, 22, -1, 214, 171, 222,
1810 172, -1, 214, 173, 222, 174, -1, 214, 173, 174,
1811 -1, 214, 171, 173, 222, 174, 172, -1, 214, 171,
1812 173, 174, 172, -1, 214, 40, -1, 214, 41, -1,
1813 214, 248, -1, 214, 221, -1, 214, 25, -1, 182,
1814 3, -1, 182, 5, -1, 182, 4, -1, 182, 6,
1815 -1, 11, 26, -1, 11, 27, -1, 183, 9, -1,
1816 179, 162, 220, 38, 214, 163, -1, 120, 162, 220,
1817 260, 163, -1, 134, 162, 220, 165, 220, 165, 220,
1818 163, -1, 177, 162, 220, 165, 220, 163, -1, 178,
1819 162, 220, 165, 220, 163, -1, 91, 180, 162, 220,
1820 165, 220, 163, -1, 92, 181, 162, 220, 165, 220,
1821 163, -1, 93, 180, 162, 220, 165, 220, 163, -1,
1822 94, 181, 162, 220, 165, 220, 163, -1, 136, 162,
1823 220, 165, 220, 163, -1, 137, 162, 220, 165, 220,
1824 165, 220, 163, -1, 138, 162, 220, 165, 220, 165,
1825 220, 163, -1, 140, 162, 220, 261, 163, -1, 141,
1826 162, 220, 165, 220, 261, 163, -1, 222, 165, 220,
1827 -1, 220, -1, 32, -1, 33, -1, 37, -1, -1,
1828 216, 248, -1, 126, 162, 225, 38, 214, 163, -1,
1829 227, -1, -1, 228, -1, 227, 228, -1, -1, 31,
1830 229, 244, -1, -1, 30, 230, 245, -1, 60, 59,
1831 234, -1, 187, 18, 214, -1, 187, 18, 10, -1,
1832 -1, 190, 194, 224, 223, 220, 186, 231, 211, -1,
1833 -1, 190, 192, 194, 224, 223, 220, 186, 232, 211,
1834 -1, -1, 190, 193, 194, 224, 223, 214, 186, 233,
1835 211, -1, 190, 194, 35, 197, 225, -1, 52, 235,
1836 -1, 56, 164, 236, -1, 22, -1, 53, 164, 22,
1837 -1, 69, 164, 22, -1, 168, 237, 170, -1, 237,
1838 165, 22, -1, 22, -1, -1, 238, 165, 214, 200,
1839 185, -1, 214, 200, 185, -1, 238, -1, 238, 165,
1840 39, -1, 39, -1, -1, 198, 216, 189, 162, 239,
1841 163, 202, 210, 207, 206, 205, -1, 28, -1, 173,
1842 -1, 196, 194, 240, 241, -1, 29, -1, 174, -1,
1843 252, 243, -1, 195, 194, 240, -1, -1, 61, -1,
1844 3, -1, 4, -1, 5, -1, 6, -1, 9, -1,
1845 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
1846 171, 222, 172, -1, 168, 222, 170, -1, 168, 170,
1847 -1, 175, 22, -1, 173, 222, 174, -1, 173, 174,
1848 -1, 171, 173, 222, 174, 172, -1, 171, 173, 174,
1849 172, -1, 221, -1, 59, 246, 22, 165, 22, -1,
1850 7, -1, 8, -1, 184, -1, 189, -1, 248, -1,
1851 247, -1, 214, 249, -1, 250, -1, 251, 165, 250,
1852 -1, 252, 253, -1, 242, 253, -1, 254, 187, 255,
1853 -1, 254, 188, 255, -1, 254, 257, -1, -1, 21,
1854 -1, 70, 251, -1, 70, 10, -1, 71, 17, 249,
1855 -1, 71, 11, 249, 165, 17, 249, 165, 17, 249,
1856 -1, 72, 182, 249, 165, 17, 249, 168, 256, 170,
1857 -1, 72, 182, 249, 165, 17, 249, 168, 170, -1,
1858 73, 198, 216, 249, 162, 259, 163, 202, 38, 17,
1859 249, 74, 17, 249, -1, 74, -1, 75, -1, 256,
1860 182, 247, 165, 17, 249, -1, 182, 247, 165, 17,
1861 249, -1, 187, 263, -1, 188, 263, -1, 214, 168,
1862 249, 165, 249, 170, -1, 258, 165, 168, 249, 165,
1863 249, 170, -1, 214, 200, 249, 200, -1, 17, 200,
1864 249, 200, -1, 259, 165, 214, 200, 249, 200, -1,
1865 259, 165, 17, 200, 249, 200, -1, -1, -1, 260,
1866 165, 250, -1, 165, 4, -1, 261, 165, 4, -1,
1867 58, 57, -1, 57, -1, 177, 214, 249, 165, 249,
1868 -1, 178, 214, 249, 165, 249, -1, 91, 180, 214,
1869 249, 165, 249, -1, 92, 181, 214, 249, 165, 249,
1870 -1, 93, 180, 214, 249, 165, 249, -1, 94, 181,
1871 214, 249, 165, 249, -1, 179, 250, 38, 214, -1,
1872 134, 250, 165, 250, 165, 250, -1, 135, 250, 165,
1873 214, -1, 136, 250, 165, 250, -1, 137, 250, 165,
1874 250, 165, 250, -1, 138, 250, 165, 250, 165, 250,
1875 -1, 133, 258, -1, 262, 198, 216, 249, 162, 259,
1876 163, 202, -1, 265, -1, 36, -1, -1, 115, 214,
1877 208, -1, 115, 214, 165, 11, 249, 208, -1, 116,
1878 214, 208, -1, 116, 214, 165, 11, 249, 208, -1,
1879 117, 250, -1, 264, 118, 214, 249, 208, -1, 264,
1880 119, 250, 165, 214, 249, 208, -1, 139, 214, 249,
1881 165, 4, -1, 120, 214, 249, 260, -1, 140, 214,
1882 249, 261, -1, 141, 214, 249, 165, 214, 249, 261,
1883 -1
Dan Gohman54392c12008-04-19 00:24:39 +00001884};
1885
1886/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1887static const yytype_uint16 yyrline[] =
1888{
Devang Patele01c06b2008-09-23 23:25:44 +00001889 0, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141,
1890 1141, 1142, 1142, 1142, 1142, 1142, 1142, 1143, 1143, 1143,
1891 1143, 1143, 1143, 1144, 1144, 1144, 1144, 1144, 1144, 1147,
1892 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1155,
1893 1155, 1156, 1156, 1157, 1157, 1158, 1158, 1159, 1159, 1160,
1894 1160, 1161, 1161, 1162, 1163, 1168, 1169, 1169, 1169, 1169,
1895 1169, 1171, 1171, 1171, 1172, 1172, 1174, 1175, 1179, 1183,
1896 1188, 1194, 1194, 1196, 1197, 1202, 1208, 1209, 1210, 1211,
1897 1212, 1213, 1217, 1218, 1219, 1223, 1224, 1225, 1226, 1230,
1898 1231, 1232, 1236, 1237, 1238, 1239, 1240, 1244, 1245, 1246,
1899 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1263, 1264,
1900 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1276, 1277,
1901 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1291, 1292, 1297,
1902 1298, 1311, 1312, 1313, 1316, 1317, 1322, 1323, 1330, 1331,
1903 1337, 1338, 1347, 1355, 1356, 1361, 1362, 1363, 1368, 1381,
1904 1381, 1381, 1381, 1381, 1381, 1381, 1384, 1388, 1392, 1399,
1905 1404, 1412, 1441, 1466, 1471, 1481, 1491, 1495, 1505, 1512,
1906 1521, 1528, 1533, 1538, 1545, 1546, 1553, 1560, 1568, 1574,
1907 1586, 1614, 1630, 1657, 1685, 1711, 1731, 1757, 1777, 1789,
1908 1796, 1862, 1872, 1882, 1888, 1898, 1904, 1914, 1920, 1926,
1909 1939, 1951, 1972, 1980, 1986, 1997, 2002, 2007, 2012, 2017,
1910 2023, 2029, 2035, 2043, 2054, 2058, 2066, 2066, 2069, 2069,
1911 2072, 2084, 2105, 2110, 2118, 2119, 2123, 2123, 2127, 2127,
1912 2130, 2133, 2157, 2169, 2168, 2180, 2179, 2189, 2188, 2199,
1913 2239, 2242, 2248, 2258, 2262, 2267, 2269, 2274, 2279, 2288,
1914 2298, 2309, 2313, 2322, 2331, 2336, 2468, 2468, 2470, 2479,
1915 2479, 2481, 2486, 2498, 2502, 2507, 2511, 2515, 2520, 2525,
1916 2529, 2533, 2537, 2541, 2545, 2549, 2571, 2593, 2599, 2612,
1917 2624, 2629, 2641, 2647, 2651, 2661, 2665, 2669, 2674, 2681,
1918 2681, 2687, 2696, 2701, 2706, 2710, 2719, 2728, 2741, 2750,
1919 2754, 2762, 2782, 2786, 2791, 2802, 2821, 2830, 2916, 2920,
1920 2927, 2938, 2951, 2960, 2973, 2984, 2994, 3005, 3013, 3023,
1921 3030, 3033, 3034, 3042, 3048, 3057, 3061, 3066, 3082, 3099,
1922 3111, 3123, 3137, 3151, 3163, 3184, 3191, 3197, 3203, 3209,
1923 3224, 3314, 3319, 3323, 3330, 3337, 3347, 3354, 3364, 3372,
1924 3386, 3403, 3417, 3432, 3447
Dan Gohman54392c12008-04-19 00:24:39 +00001925};
1926#endif
1927
1928#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1929/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1930 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1931static const char *const yytname[] =
1932{
1933 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1934 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1935 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1936 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1937 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1938 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1939 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1940 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001941 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001942 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1943 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1944 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesen9cdf0652008-08-13 18:41:46 +00001945 "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1946 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1947 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1948 "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1949 "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE",
1950 "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1951 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1952 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1953 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1954 "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT",
1955 "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL",
Devang Patel5df692d2008-09-02 20:52:40 +00001956 "NEST", "READNONE", "READONLY", "GC", "FNNOTE", "INLINE", "ALWAYS",
1957 "NEVER", "OPTIMIZEFORSIZE", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1958 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1959 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1960 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1961 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "LocalNumber",
1962 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1963 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1964 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1965 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "FuncNoteList", "FuncNote",
1966 "OptFuncNotes", "OptGC", "OptAlign", "OptCAlign", "SectionString",
Chris Lattner906773a2008-08-29 17:20:18 +00001967 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1968 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1969 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1970 "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition",
1971 "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition",
1972 "LibrariesDefinition", "LibList", "ArgListH", "ArgList",
1973 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1974 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1975 "ValueRef", "ResolvedVal", "ReturnedVal", "BasicBlockList", "BasicBlock",
1976 "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1977 "ParamList", "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
1978 "OptVolatile", "MemoryInst", 0
Dan Gohman54392c12008-04-19 00:24:39 +00001979};
1980#endif
1981
1982# ifdef YYPRINT
1983/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1984 token YYLEX-NUM. */
1985static const yytype_uint16 yytoknum[] =
1986{
1987 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1988 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1989 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1990 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1991 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1992 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1993 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1994 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1995 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1996 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1997 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1998 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1999 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2000 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2001 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel5df692d2008-09-02 20:52:40 +00002002 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
2003 415, 416, 40, 41, 61, 44, 42, 92, 91, 120,
2004 93, 60, 62, 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00002005};
2006# endif
2007
2008/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002009static const yytype_uint16 yyr1[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002010{
Devang Patel5df692d2008-09-02 20:52:40 +00002011 0, 176, 177, 177, 177, 177, 177, 177, 177, 177,
2012 177, 178, 178, 178, 178, 178, 178, 179, 179, 179,
2013 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
2014 180, 180, 180, 180, 180, 180, 180, 180, 180, 181,
2015 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
2016 181, 181, 181, 181, 181, 182, 183, 183, 183, 183,
2017 183, 184, 184, 184, 185, 185, 186, 186, 187, 187,
2018 188, 189, 189, 190, 190, 191, 192, 192, 192, 192,
2019 192, 192, 193, 193, 193, 194, 194, 194, 194, 195,
2020 195, 195, 196, 196, 196, 196, 196, 197, 197, 197,
2021 198, 198, 198, 198, 198, 198, 198, 198, 199, 199,
2022 199, 199, 199, 199, 199, 199, 199, 199, 200, 200,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002023 201, 201, 201, 201, 201, 201, 201, 202, 202, 203,
2024 203, 204, 204, 204, 205, 205, 206, 206, 207, 207,
2025 208, 208, 209, 210, 210, 211, 211, 212, 212, 213,
2026 213, 213, 213, 213, 213, 213, 214, 214, 214, 214,
2027 214, 214, 214, 214, 214, 214, 214, 214, 214, 215,
2028 216, 216, 217, 217, 218, 218, 218, 218, 219, 219,
Devang Patel5df692d2008-09-02 20:52:40 +00002029 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002030 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
Devang Patel5df692d2008-09-02 20:52:40 +00002031 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002032 221, 221, 221, 221, 222, 222, 223, 223, 224, 224,
2033 225, 225, 226, 226, 227, 227, 229, 228, 230, 228,
2034 228, 228, 228, 231, 228, 232, 228, 233, 228, 228,
2035 228, 228, 234, 235, 235, 236, 237, 237, 237, 238,
2036 238, 239, 239, 239, 239, 240, 241, 241, 242, 243,
2037 243, 244, 245, 246, 246, 247, 247, 247, 247, 247,
Devang Patel5df692d2008-09-02 20:52:40 +00002038 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002039 247, 247, 247, 247, 247, 248, 248, 248, 248, 249,
2040 249, 250, 251, 251, 252, 252, 253, 253, 254, 254,
2041 254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
2042 256, 256, 257, 257, 258, 258, 259, 259, 259, 259,
2043 259, 260, 260, 261, 261, 262, 262, 263, 263, 263,
Devang Patel5df692d2008-09-02 20:52:40 +00002044 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002045 263, 263, 264, 264, 265, 265, 265, 265, 265, 265,
2046 265, 265, 265, 265, 265
Dan Gohman54392c12008-04-19 00:24:39 +00002047};
2048
2049/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2050static const yytype_uint8 yyr2[] =
2051{
2052 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002059 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2060 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2061 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
2062 0, 1, 1, 1, 1, 1, 1, 2, 1, 1,
2063 1, 1, 1, 1, 1, 1, 1, 2, 0, 2,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002064 1, 1, 1, 1, 1, 1, 1, 0, 2, 1,
2065 3, 3, 3, 1, 0, 4, 0, 2, 0, 2,
2066 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2067 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2068 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2069 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2070 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2071 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2072 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2073 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2074 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2075 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2076 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2077 3, 1, 3, 1, 0, 11, 1, 1, 4, 1,
2078 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2079 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2080 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2081 1, 2, 1, 3, 2, 2, 3, 3, 2, 0,
2082 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
2083 6, 5, 2, 2, 6, 7, 4, 4, 6, 6,
2084 0, 0, 3, 2, 3, 2, 1, 5, 5, 6,
2085 6, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2086 8, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2087 7, 5, 4, 4, 7
Dan Gohman54392c12008-04-19 00:24:39 +00002088};
2089
2090/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2091 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2092 means the default is an error. */
2093static const yytype_uint16 yydefact[] =
2094{
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002095 74, 61, 71, 62, 72, 63, 228, 226, 0, 0,
2096 0, 0, 0, 0, 85, 73, 0, 74, 224, 89,
2097 92, 0, 0, 240, 0, 0, 68, 0, 75, 76,
Chris Lattner906773a2008-08-29 17:20:18 +00002098 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002099 88, 85, 85, 219, 1, 225, 90, 91, 85, 229,
2100 93, 94, 95, 96, 85, 299, 227, 299, 0, 0,
2101 248, 241, 242, 230, 285, 286, 232, 149, 150, 151,
2102 154, 153, 152, 155, 156, 0, 0, 0, 0, 287,
2103 288, 157, 231, 159, 219, 219, 97, 218, 0, 100,
2104 100, 300, 295, 69, 259, 260, 261, 294, 243, 244,
2105 247, 0, 177, 160, 0, 0, 0, 0, 166, 178,
2106 0, 0, 177, 0, 0, 0, 99, 98, 0, 216,
2107 217, 0, 0, 101, 102, 103, 104, 105, 106, 0,
2108 262, 0, 0, 343, 343, 298, 0, 245, 176, 118,
2109 172, 174, 0, 0, 0, 0, 0, 0, 165, 0,
2110 0, 158, 0, 0, 171, 0, 170, 0, 239, 149,
2111 150, 151, 154, 153, 152, 0, 0, 67, 67, 107,
2112 0, 256, 257, 258, 70, 342, 326, 0, 0, 0,
2113 0, 100, 308, 309, 2, 3, 4, 5, 6, 7,
Chris Lattner906773a2008-08-29 17:20:18 +00002114 8, 9, 10, 14, 15, 16, 11, 12, 13, 0,
2115 0, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2116 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002118 0, 296, 100, 312, 0, 341, 297, 313, 246, 169,
2119 0, 127, 67, 67, 168, 0, 179, 0, 127, 67,
2120 67, 0, 220, 197, 198, 193, 195, 194, 196, 199,
2121 192, 188, 189, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002123 0, 191, 190, 233, 0, 325, 302, 67, 292, 301,
Chris Lattner906773a2008-08-29 17:20:18 +00002124 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2125 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2126 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002127 47, 48, 0, 0, 0, 140, 140, 348, 67, 67,
2128 339, 0, 0, 0, 0, 0, 67, 67, 67, 67,
Chris Lattner906773a2008-08-29 17:20:18 +00002129 67, 0, 0, 0, 0, 0, 109, 111, 110, 108,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002130 112, 113, 114, 115, 116, 119, 175, 173, 162, 163,
2131 164, 167, 66, 161, 235, 237, 0, 0, 0, 0,
2132 0, 0, 0, 0, 0, 0, 0, 0, 181, 215,
2133 0, 0, 0, 185, 0, 182, 0, 0, 0, 145,
2134 254, 265, 266, 267, 268, 269, 274, 270, 271, 272,
2135 273, 263, 0, 0, 0, 0, 283, 290, 289, 291,
2136 0, 0, 303, 0, 0, 67, 67, 67, 67, 0,
2137 344, 0, 346, 321, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002138 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002139 117, 124, 123, 120, 122, 121, 125, 126, 128, 145,
2140 145, 0, 0, 0, 0, 0, 321, 0, 0, 0,
2141 0, 0, 0, 0, 180, 166, 178, 0, 183, 184,
2142 0, 0, 0, 0, 234, 253, 118, 251, 0, 264,
2143 0, 277, 0, 0, 0, 280, 0, 278, 293, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 0, 352,
2145 0, 0, 0, 335, 336, 0, 0, 0, 0, 353,
2146 0, 0, 0, 333, 0, 140, 0, 236, 238, 67,
Chris Lattner906773a2008-08-29 17:20:18 +00002147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002148 0, 214, 187, 0, 0, 0, 0, 0, 0, 147,
2149 145, 65, 0, 127, 0, 276, 166, 0, 275, 279,
2150 0, 0, 320, 0, 0, 0, 0, 140, 141, 140,
2151 0, 0, 0, 0, 0, 0, 351, 323, 0, 67,
2152 327, 328, 320, 0, 349, 67, 221, 0, 0, 0,
2153 0, 201, 0, 0, 0, 0, 212, 0, 186, 0,
2154 0, 67, 142, 148, 146, 64, 250, 252, 118, 143,
2155 0, 282, 0, 0, 0, 118, 118, 0, 329, 330,
2156 331, 332, 345, 347, 322, 0, 0, 334, 337, 338,
2157 324, 0, 0, 140, 0, 0, 0, 0, 0, 209,
2158 0, 0, 0, 203, 204, 200, 65, 144, 138, 284,
2159 281, 0, 0, 0, 0, 127, 0, 314, 0, 354,
2160 127, 350, 205, 206, 207, 208, 0, 0, 0, 213,
2161 249, 0, 136, 0, 306, 0, 0, 109, 111, 118,
2162 118, 0, 118, 118, 315, 340, 202, 210, 211, 139,
2163 0, 134, 304, 0, 305, 0, 317, 316, 0, 0,
2164 0, 137, 0, 255, 0, 0, 0, 118, 118, 0,
2165 0, 0, 0, 319, 318, 0, 133, 0, 129, 311,
2166 0, 0, 0, 135, 0, 310, 0, 132, 131, 130,
2167 307
Dan Gohman54392c12008-04-19 00:24:39 +00002168};
2169
2170/* YYDEFGOTO[NTERM-NUM]. */
2171static const yytype_int16 yydefgoto[] =
2172{
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002173 -1, 278, 279, 280, 305, 322, 165, 166, 79, 596,
Chris Lattner906773a2008-08-29 17:20:18 +00002174 113, 12, 134, 80, 14, 15, 41, 42, 43, 48,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002175 54, 118, 129, 355, 239, 448, 358, 707, 708, 693,
2176 681, 662, 420, 539, 638, 474, 540, 81, 167, 140,
Devang Patel5df692d2008-09-02 20:52:40 +00002177 157, 141, 142, 110, 379, 406, 380, 121, 88, 158,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002178 16, 17, 18, 20, 19, 389, 449, 450, 63, 23,
2179 61, 101, 477, 478, 130, 173, 55, 96, 56, 49,
2180 480, 407, 83, 409, 288, 289, 57, 92, 93, 231,
2181 666, 135, 330, 607, 499, 509, 232, 233, 234, 235
Dan Gohman54392c12008-04-19 00:24:39 +00002182};
2183
2184/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2185 STATE-NUM. */
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002186#define YYPACT_NINF -613
Dan Gohman54392c12008-04-19 00:24:39 +00002187static const yytype_int16 yypact[] =
2188{
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002189 872, -613, -613, -613, -613, -613, -613, -613, 37, -106,
2190 25, -23, 155, 44, -11, -613, 189, 1045, -613, 66,
2191 239, 56, 60, -613, 64, 218, -613, 1877, -613, -613,
2192 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2193 -613, 178, 178, 181, -613, -613, -613, -613, 178, -613,
2194 -613, -613, -613, -613, 178, 223, -613, 1, 226, 230,
2195 237, -613, -613, -613, -613, -613, 116, -613, -613, -613,
2196 -613, -613, -613, -613, -613, 291, 296, 3, 55, -613,
2197 -613, -613, 49, -613, 278, 278, 194, -613, 252, 485,
2198 485, -613, -613, 144, -613, -613, -613, -613, -613, -613,
2199 -613, -109, 1581, -613, 152, 161, 312, 116, -613, 49,
2200 -117, 171, 1581, 174, 252, 252, -613, -613, 1625, -613,
2201 -613, 1918, 342, -613, -613, -613, -613, -613, -613, 1959,
2202 -613, -14, 186, 2193, 2193, -613, 331, -613, -613, 49,
2203 -613, 192, 200, 2003, 2003, 193, -115, 2003, -613, 371,
2204 214, -613, 1918, 2003, 116, 220, 49, 163, -613, 267,
2205 376, 384, 390, 396, 400, 305, 413, 1444, 375, -613,
2206 279, -613, -613, -613, -613, -613, -613, 377, 2044, 173,
2207 427, 485, -613, -613, -613, -613, -613, -613, -613, -613,
2208 -613, -613, -613, -613, -613, -613, -613, -613, -613, 594,
2209 574, 594, 574, 2003, 2003, 2003, 2003, -613, -613, -613,
2210 -613, -613, -613, -613, -613, -613, -613, -613, -613, 2003,
2211 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003,
2212 2003, -613, 485, -613, 253, -613, -613, -613, -613, 108,
2213 1666, -613, -31, -36, -613, 271, 49, 276, -613, 375,
2214 -1, 1625, -613, -613, -613, -613, -613, -613, -613, -613,
2215 -613, -613, -613, 594, 574, 594, 574, 282, 283, 285,
2216 289, 290, 292, 293, 1707, 2085, 566, 424, 294, 297,
2217 299, -613, -613, -613, 300, -613, 116, 860, -613, 295,
2218 1033, 1033, -613, 1033, 1959, -613, -613, -613, -613, -613,
2219 -613, -613, -613, -613, -613, 2003, -613, -613, -613, -613,
2220 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2221 -613, -613, 2003, 2003, 2003, -37, 26, -613, 860, 65,
2222 306, 313, 316, 322, 323, 326, 860, 860, 860, 860,
2223 860, 411, 1959, 2003, 2003, 454, -613, -613, -613, -613,
2224 -613, -613, -613, -613, -613, -613, -613, -613, 284, -613,
2225 -613, -613, -613, 284, -613, 174, 432, 315, 330, 332,
2226 335, 1918, 1918, 1918, 1918, 1918, 1918, 1918, -613, -613,
2227 -55, 792, -28, -613, -114, -613, 1918, 1918, 1918, 328,
2228 1751, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2229 -613, 437, 1792, 2129, 1490, 477, -613, -613, -613, -613,
2230 2003, 336, -613, 339, 1033, 860, 860, 860, 860, 33,
2231 -613, 34, -613, -613, 1033, 341, 2003, 2003, 2003, 2003,
2232 2003, 346, 347, 349, 350, 353, 2003, 1033, 860, 357,
2233 -613, -613, -613, -613, -613, -613, -613, -613, -613, 328,
2234 328, 2003, 1918, 1918, 1918, 1918, -613, 358, 359, 360,
2235 363, 347, 364, 1918, -613, 361, 1308, -110, -613, -613,
2236 365, 366, 462, -5, -613, -613, 49, 367, 372, -613,
2237 514, -613, -25, 1536, 47, -613, -52, -613, -613, 525,
2238 527, 393, 392, 395, 397, 398, 1033, 554, 1033, 399,
2239 401, 1033, 402, 49, -613, 406, 407, 557, 561, 419,
2240 2003, 1033, 1033, 49, 425, 426, 2003, -613, -613, -16,
2241 428, 429, 433, 434, 104, 1918, 1918, 1918, 1918, 149,
2242 1918, -613, -613, 420, 1918, 1918, 2003, 575, 598, -613,
2243 328, 521, 1833, -613, 438, -613, 435, 81, -613, -613,
2244 1033, 1033, 2170, 1033, 1033, 1033, 1033, 426, -613, 426,
2245 2003, 1033, 439, 2003, 2003, 2003, -613, -613, 601, 860,
2246 -613, -613, 2170, 552, -613, 860, -613, 1918, 1918, 1918,
2247 1918, -613, 445, 455, 452, 456, -613, 347, -613, 459,
2248 460, -9, -613, -613, -613, -613, -613, -613, 49, 13,
2249 602, -613, 453, 461, 463, 75, 49, 182, -613, -613,
2250 -613, -613, -613, -613, -613, 458, 1033, -613, -613, -613,
2251 -613, 347, 191, 426, 466, 467, 469, 471, 1918, -613,
2252 1918, 1918, 195, -613, -613, -613, 521, -613, 581, -613,
2253 -613, 620, -3, 703, 703, -613, 2211, -613, 468, 419,
2254 -613, -613, -613, -613, -613, -613, 476, 482, 483, -613,
2255 -613, 636, 494, 1033, -613, 1172, 4, 487, 488, -613,
2256 -613, 236, 75, 49, -613, 284, -613, -613, -613, -613,
2257 629, 499, -613, 489, -613, 1172, 108, 108, 638, 703,
2258 703, -613, 495, -613, 639, 493, 1033, -613, -613, -135,
2259 1033, 642, 586, 108, 108, 497, -613, 196, -613, -613,
2260 1033, 648, 217, -613, -135, -613, 1033, -613, -613, -613,
2261 -613
Dan Gohman54392c12008-04-19 00:24:39 +00002262};
2263
2264/* YYPGOTO[NTERM-NUM]. */
2265static const yytype_int16 yypgoto[] =
2266{
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002267 -613, 258, 274, 287, -180, -175, -177, -613, 0, 36,
2268 -126, 580, -613, 11, -613, -613, -613, -613, 54, -613,
2269 -613, -613, -138, -613, -463, -613, -239, -613, -15, -613,
2270 -613, -613, -310, 101, -613, -424, -613, -613, -26, 464,
2271 -125, -613, 591, 599, -111, -165, -270, 298, 348, 465,
2272 -613, -613, 696, -613, -613, -613, -613, -613, -613, -613,
2273 -613, -613, -613, -613, 624, -613, -613, -613, -613, -613,
2274 -613, -612, -48, 58, -123, -613, -613, 658, -613, 583,
2275 -613, -613, -613, 146, 263, -449, -613, 590, -613, -613
Dan Gohman54392c12008-04-19 00:24:39 +00002276};
2277
2278/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2279 positive, shift that token. If negative, reduce the rule which
2280 number is the opposite. If zero, do what YYDEFACT says.
2281 If YYTABLE_NINF, syntax error. */
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002282#define YYTABLE_NINF -224
Dan Gohman54392c12008-04-19 00:24:39 +00002283static const yytype_int16 yytable[] =
2284{
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002285 11, 82, 281, 293, 170, 382, 384, 105, 292, 363,
2286 168, 13, 529, 541, 171, 292, 422, 11, 111, 111,
2287 705, 323, 91, 706, 111, 517, 518, 324, 13, 537,
2288 94, 29, 30, 31, 32, 33, 34, 35, 36, 111,
2289 37, 249, 283, 294, 496, 498, 111, 537, 147, 538,
2290 147, 463, 109, 683, 111, 463, 136, 148, 24, 245,
2291 469, 137, 64, 65, 533, 107, 67, 68, 69, 70,
2292 71, 72, 73, 695, 1, 2, 139, 3, 4, 5,
2293 109, 111, 327, 367, 25, 369, 139, 497, 497, 368,
2294 21, 370, 156, 11, 342, 84, 85, 331, 332, 333,
2295 334, 335, 89, 156, 111, 74, 22, 341, 90, 252,
2296 463, 467, 46, 463, 47, 464, 594, 242, 243, 282,
2297 111, 246, 549, 364, 365, 112, 112, 250, 419, -67,
2298 -155, 112, 482, 484, 486, 636, 360, 463, 632, 359,
2299 463, 26, 643, 644, 468, 545, 112, 576, 38, 39,
2300 40, 132, 287, 112, 635, 441, 442, 443, 444, 172,
2301 445, 112, 345, 1, 446, 447, 3, 664, 5, 414,
2302 64, 65, 649, 27, 684, 95, 106, 325, 326, 287,
2303 328, 284, 1, 2, 290, 3, 4, 5, 112, 44,
2304 291, 421, -67, 329, 287, 287, 287, 287, 287, 336,
2305 337, 338, 339, 340, 287, 574, 686, 687, 28, 689,
2306 690, 112, 463, 547, 139, -67, 86, 437, 87, 548,
2307 58, 439, 75, 76, 59, 156, 77, 112, 78, 108,
2308 346, 347, 60, 424, 703, 704, 116, -155, 117, 408,
2309 62, -155, 408, 408, 91, 408, 463, 612, 98, 613,
2310 348, 349, 99, 350, 351, 602, 352, 353, 354, 100,
2311 456, 457, 458, 459, 460, 461, 462, 581, 156, 560,
2312 -55, -55, -55, -55, 688, 470, 471, 472, 102, 415,
2313 408, 50, 51, 52, 119, 120, 53, 488, 408, 408,
2314 408, 408, 408, 253, 254, 103, 416, 417, 418, 2,
2315 104, 281, 4, 502, 599, 504, 505, 506, 255, 256,
2316 257, 258, 586, 651, 568, 87, 156, 438, 287, 64,
2317 65, 143, 107, 67, 68, 69, 70, 71, 72, 73,
2318 144, 1, 2, 149, 3, 4, 5, 38, 39, 40,
2319 151, 520, 521, 522, 523, 645, 169, 646, 411, 412,
2320 174, 413, 531, 238, 650, 466, 646, 240, 659, 713,
2321 568, 714, 74, 241, 476, 244, 408, 408, 408, 408,
2322 408, 343, 344, 717, 718, 247, 408, 248, 441, 442,
2323 443, 444, 251, 445, 287, -56, 423, 446, 447, 408,
2324 408, 228, 228, -57, 431, 432, 433, 434, 435, -60,
2325 287, 503, 287, 287, 287, -59, 671, 229, 229, -58,
2326 513, 675, 152, 153, 582, 583, 584, 585, 282, 587,
2327 230, 230, 259, 589, 590, 519, 441, 442, 443, 444,
2328 111, 445, 114, 115, 285, 446, 447, 614, 292, 362,
2329 617, 618, 619, 361, 371, 372, 385, 373, 408, 436,
2330 408, 374, 375, 408, 376, 377, 386, 466, 440, 387,
2331 410, 388, 390, 408, 408, 665, 624, 625, 626, 627,
2332 451, 425, 491, 492, 493, 494, 495, 452, 426, 75,
2333 76, 427, 500, 77, 569, 78, 145, 428, 429, 685,
2334 575, 430, 453, 473, 454, 514, 515, 455, 479, 487,
2335 536, 489, 408, 408, 490, 408, 408, 408, 408, 501,
2336 591, 507, 508, 408, 510, 511, 598, 656, 512, 657,
2337 658, 408, 516, 525, 526, 527, 606, 408, 528, 530,
2338 534, 535, 542, 532, 287, 543, 544, 287, 287, 287,
2339 1, 595, 550, 3, 551, 5, 606, 122, 123, 124,
2340 125, 126, 127, 128, 557, 552, 559, 553, 558, 562,
2341 554, 566, 555, 556, 560, 567, 561, 563, 408, 570,
2342 571, 564, 565, 64, 65, 345, 107, 159, 160, 161,
2343 162, 163, 164, 73, 568, 1, 2, 572, 3, 4,
2344 5, 573, 588, 577, 578, 408, 408, 592, 579, 580,
2345 306, 307, 593, 600, 616, 620, 497, 601, 603, 604,
2346 628, 608, 609, 610, 611, 408, 74, 630, 629, 615,
2347 673, 631, 633, 634, 639, 640, 641, 621, 647, 652,
2348 653, 642, 654, 623, 655, 661, 595, 663, 674, 676,
2349 679, 408, 408, 346, 347, 677, 678, 680, 408, -18,
2350 -19, 691, 408, 692, 694, 696, 700, 699, 701, 710,
2351 711, 712, 408, 348, 349, 716, 350, 351, 408, 352,
2352 353, 354, 660, 133, 648, 308, 309, 310, 311, 312,
2353 313, 314, 315, 316, 317, 318, 319, 320, 321, 295,
2354 296, 297, 298, 299, 300, 301, 302, 303, 304, 719,
2355 637, 669, 670, 150, 357, 146, 391, 392, 393, 394,
2356 64, 65, 395, 45, 131, 97, 366, 236, 622, 524,
2357 0, 682, 1, 2, 237, 3, 4, 5, 396, 397,
2358 398, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2359 383, 0, 0, 399, 400, 0, 0, 697, 698, 0,
2360 0, 0, 0, 0, 702, 0, 0, 345, 709, 0,
2361 0, 0, 401, 0, 0, 0, 0, 0, 715, 0,
2362 0, 0, 0, 0, 720, 0, 0, 0, 0, 184,
2363 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2364 195, 196, 197, 198, 263, 264, 265, 266, 0, 64,
2365 65, 0, 107, 159, 160, 161, 162, 163, 164, 73,
2366 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2367 0, 0, 0, 267, 207, 667, 668, 210, 211, 212,
2368 213, 214, 215, 216, 217, 218, 0, 268, 0, 269,
2369 270, 271, 74, 272, 273, 348, 349, 0, 350, 351,
2370 0, 352, 353, 354, 0, 0, 0, 0, 0, 0,
2371 0, 0, 0, 391, 392, 393, 394, 64, 65, 395,
2372 0, 402, -223, 0, 403, 0, 404, 0, 405, 1,
2373 2, 0, 3, 4, 5, 396, 397, 398, 0, 0,
2374 -69, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2375 399, 400, 6, 7, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 0, 111, 0, 0, 0, 401,
2377 0, 0, 0, 0, 8, 0, 0, 0, 9, 0,
2378 0, 0, 10, 0, 0, 0, 184, 185, 186, 187,
2379 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
2380 198, 263, 264, 265, 266, 0, 0, 0, 0, 75,
2381 76, 0, 0, 77, 0, 78, 465, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002383 267, 207, 208, 209, 210, 211, 212, 213, 214, 215,
2384 216, 217, 218, 0, 268, 0, 269, 270, 271, 0,
2385 272, 273, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002387 0, 0, 112, 0, 0, 0, 0, 0, 402, 0,
2388 0, 403, 0, 404, 0, 405, 391, 392, 393, 394,
2389 64, 65, 395, 0, 0, -222, 0, 0, 0, 0,
2390 0, 0, 1, 2, 0, 3, 4, 5, 396, 397,
2391 398, 0, 0, -69, 1, 2, 0, 3, 4, 5,
2392 0, 0, 0, 399, 400, 6, 7, 0, 0, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002393 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002394 0, 0, 401, 0, 0, 0, 0, 8, 0, 0,
2395 0, 9, 0, 0, 0, 10, 0, 0, 0, 184,
2396 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2397 195, 196, 197, 198, 263, 264, 265, 266, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002398 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002400 0, 0, 0, 267, 207, 208, 209, 210, 211, 212,
2401 213, 214, 215, 216, 217, 218, 0, 268, 0, 269,
2402 270, 271, 0, 272, 273, 391, 392, 393, 394, 0,
2403 0, 395, 0, 0, 0, 0, 0, 0, 0, 0,
2404 0, 0, 0, 0, 0, 0, 0, 396, 397, 398,
2405 0, 402, 0, 0, 403, 0, 404, 0, 405, 0,
2406 0, 0, 399, 400, 0, 0, 0, 0, 0, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002407 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002408 0, 401, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002409 0, 0, 0, 0, 0, 0, 0, 0, 184, 185,
2410 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2411 196, 197, 198, 263, 264, 265, 266, 0, 0, 0,
2412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2413 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2414 0, 0, 267, 207, 208, 209, 210, 211, 212, 213,
2415 214, 215, 216, 217, 218, 0, 268, 0, 269, 270,
2416 271, 0, 272, 273, 0, 64, 65, 0, 0, 0,
2417 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002418 3, 4, 5, 260, 0, 0, 0, 0, 0, 0,
2419 402, 0, 0, 403, 0, 404, 0, 405, 261, 262,
Devang Patel5df692d2008-09-02 20:52:40 +00002420 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002421 0, 0, 0, 111, 0, 0, 0, 0, 0, 0,
2422 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002423 0, 0, 0, 0, 184, 185, 186, 187, 188, 189,
2424 190, 191, 192, 193, 194, 195, 196, 197, 198, 263,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002425 264, 265, 266, 0, 0, 0, 0, 0, 0, 0,
2426 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2427 0, 0, 0, 0, 0, 0, 0, 0, 267, 207,
Devang Patel5df692d2008-09-02 20:52:40 +00002428 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002429 218, 0, 268, 0, 269, 270, 271, 0, 272, 273,
2430 0, 64, 65, 0, 0, 0, 0, 0, 0, 0,
2431 0, 0, 0, 1, 2, 0, 3, 4, 5, 260,
2432 112, 0, 0, 0, -67, 0, 274, 0, 0, 275,
2433 0, 276, 0, 277, 261, 262, 0, 0, 0, 0,
2434 0, 0, 0, 0, 0, 0, 0, 64, 65, 111,
2435 107, 159, 160, 161, 162, 163, 164, 73, 0, 1,
2436 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2437 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2438 194, 195, 196, 197, 198, 263, 264, 265, 266, 0,
2439 74, 0, 0, 64, 65, 0, 107, 159, 160, 161,
2440 162, 163, 164, 73, 0, 1, 2, 0, 3, 4,
2441 5, 0, 0, 0, 267, 207, 208, 209, 210, 211,
2442 212, 213, 214, 215, 216, 217, 218, 0, 268, 0,
2443 269, 270, 271, 0, 272, 273, 74, 0, 64, 65,
2444 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2445 1, 2, 0, 3, 4, 5, 112, 0, 0, 0,
2446 0, 0, 274, 0, 0, 275, 0, 276, 0, 277,
2447 138, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2448 0, 74, 64, 65, 0, 154, 67, 68, 69, 70,
2449 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2450 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2451 0, 77, 0, 78, 485, 0, 0, 0, 0, 0,
2452 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
2453 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2454 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2455 0, 0, 0, 75, 76, 356, 0, 77, 0, 78,
2456 546, 0, 0, 0, 64, 65, 74, 107, 159, 160,
2457 161, 162, 163, 164, 73, 0, 1, 2, 0, 3,
2458 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2459 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2460 0, 155, 77, 0, 78, 0, 0, 74, 64, 65,
2461 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2462 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2463 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2464 475, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2465 65, 74, 107, 159, 160, 161, 162, 163, 164, 73,
2466 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2467 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2468 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Devang Patel5df692d2008-09-02 20:52:40 +00002469 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2470 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002472 0, 0, 597, 0, 75, 76, 0, 378, 77, 0,
2473 78, 0, 0, 74, 64, 65, 0, 66, 67, 68,
2474 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2475 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2476 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2477 0, 0, 77, 0, 78, 64, 65, 74, 107, 159,
2478 160, 161, 162, 163, 164, 73, 0, 1, 2, 0,
Devang Patel5df692d2008-09-02 20:52:40 +00002479 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002480 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2481 76, 0, 481, 77, 0, 78, 64, 65, 74, 154,
2482 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
Devang Patel5df692d2008-09-02 20:52:40 +00002483 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2484 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002485 75, 76, 0, 0, 77, 0, 78, 0, 0, 74,
2486 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2487 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2488 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2489 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2490 78, 64, 65, 74, 286, 67, 68, 69, 70, 71,
Devang Patel5df692d2008-09-02 20:52:40 +00002491 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2492 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2493 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2494 0, 78, 64, 65, 74, 107, 159, 160, 161, 162,
2495 163, 164, 73, 0, 1, 2, 0, 3, 4, 5,
2496 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002497 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2498 77, 0, 78, 0, 0, 74, 64, 65, 0, 107,
2499 159, 160, 161, 162, 163, 164, 73, 0, 1, 2,
2500 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2501 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2502 75, 76, 0, 0, 77, 0, 78, 64, 65, 74,
2503 107, 67, 68, 69, 70, 71, 72, 605, 0, 1,
Devang Patel5df692d2008-09-02 20:52:40 +00002504 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2505 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002506 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002507 74, 107, 67, 68, 69, 70, 71, 72, 672, 175,
Chris Lattner906773a2008-08-29 17:20:18 +00002508 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2509 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002510 176, 177, 75, 76, 0, 0, 77, 0, 381, 0,
2511 0, 74, 0, 178, 179, 180, 181, 182, 183, 184,
2512 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2513 195, 196, 197, 198, 199, 200, 201, 202, 0, 0,
2514 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2515 77, 0, 483, 0, 0, 0, 0, 0, 203, 204,
2516 205, 0, 0, 206, 207, 208, 209, 210, 211, 212,
2517 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
2518 223, 224, 225, 226, 227, 0, 0, 75, 76, 0,
2519 0, 77, 0, 78, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002520 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002521 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002522 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002523 0, 0, 77, 0, 78
Dan Gohman54392c12008-04-19 00:24:39 +00002524};
2525
2526static const yytype_int16 yycheck[] =
2527{
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002528 0, 27, 167, 180, 129, 275, 276, 4, 11, 248,
2529 121, 0, 461, 476, 28, 11, 326, 17, 55, 55,
2530 155, 201, 21, 158, 55, 449, 450, 202, 17, 34,
2531 29, 42, 43, 44, 45, 46, 47, 48, 49, 55,
2532 51, 152, 168, 181, 11, 11, 55, 34, 165, 54,
2533 165, 165, 78, 665, 55, 165, 165, 174, 164, 174,
2534 174, 170, 7, 8, 174, 10, 11, 12, 13, 14,
2535 15, 16, 17, 685, 19, 20, 102, 22, 23, 24,
2536 106, 55, 205, 263, 59, 265, 112, 54, 54, 264,
2537 53, 266, 118, 93, 232, 41, 42, 220, 221, 222,
2538 223, 224, 48, 129, 55, 50, 69, 230, 54, 157,
2539 165, 381, 46, 165, 48, 170, 540, 143, 144, 167,
2540 55, 147, 174, 249, 250, 162, 162, 153, 165, 166,
2541 55, 162, 402, 403, 404, 598, 172, 165, 587, 170,
2542 165, 164, 605, 606, 172, 170, 162, 163, 159, 160,
2543 161, 7, 178, 162, 163, 142, 143, 144, 145, 173,
2544 147, 162, 54, 19, 151, 152, 22, 170, 24, 294,
2545 7, 8, 621, 18, 170, 174, 173, 203, 204, 205,
2546 206, 170, 19, 20, 11, 22, 23, 24, 162, 0,
2547 17, 165, 166, 219, 220, 221, 222, 223, 224, 225,
2548 226, 227, 228, 229, 230, 515, 669, 670, 164, 672,
2549 673, 162, 165, 483, 240, 166, 35, 342, 37, 172,
2550 164, 344, 167, 168, 164, 251, 171, 162, 173, 174,
2551 122, 123, 168, 168, 697, 698, 42, 162, 44, 287,
2552 22, 166, 290, 291, 21, 293, 165, 557, 22, 559,
2553 142, 143, 22, 145, 146, 174, 148, 149, 150, 22,
2554 371, 372, 373, 374, 375, 376, 377, 163, 294, 165,
2555 3, 4, 5, 6, 38, 386, 387, 388, 162, 305,
2556 328, 42, 43, 44, 32, 33, 47, 410, 336, 337,
2557 338, 339, 340, 26, 27, 4, 322, 323, 324, 20,
2558 4, 466, 23, 426, 543, 428, 429, 430, 3, 4,
2559 5, 6, 163, 623, 165, 37, 342, 343, 344, 7,
2560 8, 169, 10, 11, 12, 13, 14, 15, 16, 17,
2561 169, 19, 20, 162, 22, 23, 24, 159, 160, 161,
2562 166, 452, 453, 454, 455, 163, 4, 165, 290, 291,
2563 164, 293, 463, 22, 163, 381, 165, 165, 163, 163,
2564 165, 165, 50, 163, 390, 172, 414, 415, 416, 417,
2565 418, 118, 119, 156, 157, 4, 424, 163, 142, 143,
2566 144, 145, 162, 147, 410, 9, 328, 151, 152, 437,
2567 438, 133, 134, 9, 336, 337, 338, 339, 340, 9,
2568 426, 427, 428, 429, 430, 9, 645, 133, 134, 9,
2569 436, 650, 114, 115, 525, 526, 527, 528, 466, 530,
2570 133, 134, 9, 534, 535, 451, 142, 143, 144, 145,
2571 55, 147, 84, 85, 57, 151, 152, 560, 11, 163,
2572 563, 564, 565, 172, 162, 162, 22, 162, 496, 38,
2573 498, 162, 162, 501, 162, 162, 162, 483, 4, 162,
2574 165, 162, 162, 511, 512, 642, 577, 578, 579, 580,
2575 38, 165, 414, 415, 416, 417, 418, 162, 165, 167,
2576 168, 165, 424, 171, 510, 173, 174, 165, 165, 666,
2577 516, 165, 162, 165, 162, 437, 438, 162, 61, 22,
2578 38, 165, 550, 551, 165, 553, 554, 555, 556, 168,
2579 536, 165, 165, 561, 165, 165, 542, 628, 165, 630,
2580 631, 569, 165, 165, 165, 165, 552, 575, 165, 165,
2581 165, 165, 165, 172, 560, 163, 22, 563, 564, 565,
2582 19, 541, 17, 22, 17, 24, 572, 62, 63, 64,
2583 65, 66, 67, 68, 496, 162, 498, 165, 4, 501,
2584 165, 4, 165, 165, 165, 4, 165, 165, 616, 511,
2585 512, 165, 165, 7, 8, 54, 10, 11, 12, 13,
2586 14, 15, 16, 17, 165, 19, 20, 162, 22, 23,
2587 24, 165, 172, 165, 165, 643, 644, 22, 165, 165,
2588 26, 27, 4, 165, 165, 4, 54, 172, 550, 551,
2589 165, 553, 554, 555, 556, 663, 50, 165, 163, 561,
2590 646, 165, 163, 163, 22, 172, 165, 569, 170, 163,
2591 163, 168, 163, 575, 163, 54, 636, 17, 170, 163,
2592 4, 689, 690, 122, 123, 163, 163, 153, 696, 162,
2593 162, 22, 700, 154, 165, 17, 17, 162, 165, 17,
2594 74, 164, 710, 142, 143, 17, 145, 146, 716, 148,
2595 149, 150, 636, 93, 616, 101, 102, 103, 104, 105,
2596 106, 107, 108, 109, 110, 111, 112, 113, 114, 95,
2597 96, 97, 98, 99, 100, 101, 102, 103, 104, 714,
2598 599, 643, 644, 112, 240, 106, 3, 4, 5, 6,
2599 7, 8, 9, 17, 90, 57, 251, 134, 572, 456,
2600 -1, 663, 19, 20, 134, 22, 23, 24, 25, 26,
2601 27, -1, -1, 167, 168, -1, -1, 171, -1, 173,
2602 174, -1, -1, 40, 41, -1, -1, 689, 690, -1,
2603 -1, -1, -1, -1, 696, -1, -1, 54, 700, -1,
2604 -1, -1, 59, -1, -1, -1, -1, -1, 710, -1,
2605 -1, -1, -1, -1, 716, -1, -1, -1, -1, 76,
2606 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2607 87, 88, 89, 90, 91, 92, 93, 94, -1, 7,
2608 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2609 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2610 -1, -1, -1, 120, 121, 122, 123, 124, 125, 126,
2611 127, 128, 129, 130, 131, 132, -1, 134, -1, 136,
2612 137, 138, 50, 140, 141, 142, 143, -1, 145, 146,
2613 -1, 148, 149, 150, -1, -1, -1, -1, -1, -1,
2614 -1, -1, -1, 3, 4, 5, 6, 7, 8, 9,
2615 -1, 168, 0, -1, 171, -1, 173, -1, 175, 19,
2616 20, -1, 22, 23, 24, 25, 26, 27, -1, -1,
2617 18, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2618 40, 41, 30, 31, -1, -1, -1, -1, -1, -1,
2619 -1, -1, -1, -1, -1, 55, -1, -1, -1, 59,
2620 -1, -1, -1, -1, 52, -1, -1, -1, 56, -1,
2621 -1, -1, 60, -1, -1, -1, 76, 77, 78, 79,
2622 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2623 90, 91, 92, 93, 94, -1, -1, -1, -1, 167,
2624 168, -1, -1, 171, -1, 173, 174, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002625 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002626 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2627 130, 131, 132, -1, 134, -1, 136, 137, 138, -1,
2628 140, 141, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002629 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002630 -1, -1, 162, -1, -1, -1, -1, -1, 168, -1,
2631 -1, 171, -1, 173, -1, 175, 3, 4, 5, 6,
2632 7, 8, 9, -1, -1, 0, -1, -1, -1, -1,
2633 -1, -1, 19, 20, -1, 22, 23, 24, 25, 26,
2634 27, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2635 -1, -1, -1, 40, 41, 30, 31, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002636 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002637 -1, -1, 59, -1, -1, -1, -1, 52, -1, -1,
2638 -1, 56, -1, -1, -1, 60, -1, -1, -1, 76,
2639 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2640 87, 88, 89, 90, 91, 92, 93, 94, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002641 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002642 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002643 -1, -1, -1, 120, 121, 122, 123, 124, 125, 126,
2644 127, 128, 129, 130, 131, 132, -1, 134, -1, 136,
2645 137, 138, -1, 140, 141, 3, 4, 5, 6, -1,
2646 -1, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2647 -1, -1, -1, -1, -1, -1, -1, 25, 26, 27,
2648 -1, 168, -1, -1, 171, -1, 173, -1, 175, -1,
2649 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002650 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002651 -1, 59, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002652 -1, -1, -1, -1, -1, -1, -1, -1, 76, 77,
2653 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2654 88, 89, 90, 91, 92, 93, 94, -1, -1, -1,
2655 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2657 -1, -1, 120, 121, 122, 123, 124, 125, 126, 127,
2658 128, 129, 130, 131, 132, -1, 134, -1, 136, 137,
2659 138, -1, 140, 141, -1, 7, 8, -1, -1, -1,
2660 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002661 22, 23, 24, 25, -1, -1, -1, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002662 168, -1, -1, 171, -1, 173, -1, 175, 40, 41,
2663 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002664 -1, -1, -1, 55, -1, -1, -1, -1, -1, -1,
2665 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002666 -1, -1, -1, -1, 76, 77, 78, 79, 80, 81,
2667 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002668 92, 93, 94, -1, -1, -1, -1, -1, -1, -1,
2669 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2670 -1, -1, -1, -1, -1, -1, -1, -1, 120, 121,
Devang Patel5df692d2008-09-02 20:52:40 +00002671 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002672 132, -1, 134, -1, 136, 137, 138, -1, 140, 141,
2673 -1, 7, 8, -1, -1, -1, -1, -1, -1, -1,
2674 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2675 162, -1, -1, -1, 166, -1, 168, -1, -1, 171,
2676 -1, 173, -1, 175, 40, 41, -1, -1, -1, -1,
2677 -1, -1, -1, -1, -1, -1, -1, 7, 8, 55,
2678 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2679 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2680 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2681 86, 87, 88, 89, 90, 91, 92, 93, 94, -1,
2682 50, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2683 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2684 24, -1, -1, -1, 120, 121, 122, 123, 124, 125,
2685 126, 127, 128, 129, 130, 131, 132, -1, 134, -1,
2686 136, 137, 138, -1, 140, 141, 50, -1, 7, 8,
2687 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2688 19, 20, -1, 22, 23, 24, 162, -1, -1, -1,
2689 -1, -1, 168, -1, -1, 171, -1, 173, -1, 175,
2690 39, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2691 -1, 50, 7, 8, -1, 10, 11, 12, 13, 14,
2692 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2693 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2694 -1, 171, -1, 173, 174, -1, -1, -1, -1, -1,
2695 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2696 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2697 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2698 -1, -1, -1, 167, 168, 39, -1, 171, -1, 173,
2699 174, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2700 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2701 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2702 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2703 -1, 126, 171, -1, 173, -1, -1, 50, 7, 8,
2704 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2705 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2706 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2707 39, -1, 167, 168, -1, -1, 171, -1, 173, 7,
2708 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2709 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2710 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2711 -1, -1, -1, 167, 168, -1, -1, 171, -1, 173,
Devang Patel5df692d2008-09-02 20:52:40 +00002712 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2713 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002714 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002715 -1, -1, 39, -1, 167, 168, -1, 170, 171, -1,
2716 173, -1, -1, 50, 7, 8, -1, 10, 11, 12,
2717 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2718 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2719 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2720 -1, -1, 171, -1, 173, 7, 8, 50, 10, 11,
Devang Patel5df692d2008-09-02 20:52:40 +00002721 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2722 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002723 -1, -1, -1, -1, -1, -1, -1, -1, -1, 167,
2724 168, -1, 170, 171, -1, 173, 7, 8, 50, 10,
Devang Patel5df692d2008-09-02 20:52:40 +00002725 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2726 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2727 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002728 167, 168, -1, -1, 171, -1, 173, -1, -1, 50,
2729 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2730 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2731 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2732 -1, -1, -1, -1, 167, 168, -1, -1, 171, -1,
2733 173, 7, 8, 50, 10, 11, 12, 13, 14, 15,
Devang Patel5df692d2008-09-02 20:52:40 +00002734 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2735 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2736 -1, -1, -1, -1, -1, 167, 168, -1, -1, 171,
2737 -1, 173, 7, 8, 50, 10, 11, 12, 13, 14,
2738 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2739 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002740 -1, -1, -1, -1, -1, -1, 167, 168, -1, -1,
2741 171, -1, 173, -1, -1, 50, 7, 8, -1, 10,
2742 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2743 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2744 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2745 167, 168, -1, -1, 171, -1, 173, 7, 8, 50,
Devang Patel5df692d2008-09-02 20:52:40 +00002746 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2747 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2748 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2749 -1, 167, 168, -1, -1, 171, -1, 173, 7, 8,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002750 50, 10, 11, 12, 13, 14, 15, 16, 17, 36,
Chris Lattner906773a2008-08-29 17:20:18 +00002751 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2752 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002753 57, 58, 167, 168, -1, -1, 171, -1, 173, -1,
2754 -1, 50, -1, 70, 71, 72, 73, 74, 75, 76,
2755 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2756 87, 88, 89, 90, 91, 92, 93, 94, -1, -1,
2757 -1, -1, -1, -1, -1, -1, 167, 168, -1, -1,
2758 171, -1, 173, -1, -1, -1, -1, -1, 115, 116,
2759 117, -1, -1, 120, 121, 122, 123, 124, 125, 126,
2760 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2761 137, 138, 139, 140, 141, -1, -1, 167, 168, -1,
2762 -1, 171, -1, 173, -1, -1, -1, -1, -1, -1,
Chris Lattner906773a2008-08-29 17:20:18 +00002763 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002765 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002766 -1, -1, 171, -1, 173
Dan Gohman54392c12008-04-19 00:24:39 +00002767};
2768
2769/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2770 symbol of state STATE-NUM. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002771static const yytype_uint16 yystos[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002772{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002773 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Devang Patel5df692d2008-09-02 20:52:40 +00002774 60, 184, 187, 189, 190, 191, 226, 227, 228, 230,
2775 229, 53, 69, 235, 164, 59, 164, 18, 164, 42,
2776 43, 44, 45, 46, 47, 48, 49, 51, 159, 160,
2777 161, 192, 193, 194, 0, 228, 46, 48, 195, 245,
2778 42, 43, 44, 47, 196, 242, 244, 252, 164, 164,
2779 168, 236, 22, 234, 7, 8, 10, 11, 12, 13,
2780 14, 15, 16, 17, 50, 167, 168, 171, 173, 184,
2781 189, 213, 214, 248, 194, 194, 35, 37, 224, 194,
2782 194, 21, 253, 254, 29, 174, 243, 253, 22, 22,
2783 22, 237, 162, 4, 4, 4, 173, 10, 174, 214,
2784 219, 55, 162, 186, 224, 224, 42, 44, 197, 32,
2785 33, 223, 62, 63, 64, 65, 66, 67, 68, 198,
2786 240, 240, 7, 187, 188, 257, 165, 170, 39, 214,
2787 215, 217, 218, 169, 169, 174, 219, 165, 174, 162,
2788 218, 166, 223, 223, 10, 126, 214, 216, 225, 11,
2789 12, 13, 14, 15, 16, 182, 183, 214, 220, 4,
2790 216, 28, 173, 241, 164, 36, 57, 58, 70, 71,
Chris Lattner906773a2008-08-29 17:20:18 +00002791 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2792 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2793 92, 93, 94, 115, 116, 117, 120, 121, 122, 123,
2794 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
Devang Patel5df692d2008-09-02 20:52:40 +00002795 134, 135, 136, 137, 138, 139, 140, 141, 177, 178,
2796 179, 255, 262, 263, 264, 265, 255, 263, 22, 200,
2797 165, 163, 214, 214, 172, 174, 214, 4, 163, 220,
2798 214, 162, 248, 26, 27, 3, 4, 5, 6, 9,
Chris Lattner906773a2008-08-29 17:20:18 +00002799 25, 40, 41, 91, 92, 93, 94, 120, 134, 136,
Devang Patel5df692d2008-09-02 20:52:40 +00002800 137, 138, 140, 141, 168, 171, 173, 175, 177, 178,
2801 179, 221, 248, 186, 189, 57, 10, 214, 250, 251,
2802 11, 17, 11, 182, 198, 95, 96, 97, 98, 99,
2803 100, 101, 102, 103, 104, 180, 26, 27, 101, 102,
Chris Lattner906773a2008-08-29 17:20:18 +00002804 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
Devang Patel5df692d2008-09-02 20:52:40 +00002805 113, 114, 181, 180, 181, 214, 214, 250, 214, 214,
2806 258, 250, 250, 250, 250, 250, 214, 214, 214, 214,
2807 214, 250, 198, 118, 119, 54, 122, 123, 142, 143,
2808 145, 146, 148, 149, 150, 199, 39, 215, 202, 170,
2809 172, 172, 163, 202, 186, 186, 225, 180, 181, 180,
2810 181, 162, 162, 162, 162, 162, 162, 162, 170, 220,
2811 222, 173, 222, 174, 222, 22, 162, 162, 162, 231,
2812 162, 3, 4, 5, 6, 9, 25, 26, 27, 40,
2813 41, 59, 168, 171, 173, 175, 221, 247, 248, 249,
2814 165, 249, 249, 249, 216, 214, 214, 214, 214, 165,
2815 208, 165, 208, 249, 168, 165, 165, 165, 165, 165,
2816 165, 249, 249, 249, 249, 249, 38, 216, 214, 250,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002817 4, 142, 143, 144, 145, 147, 151, 152, 201, 232,
2818 233, 38, 162, 162, 162, 162, 220, 220, 220, 220,
2819 220, 220, 220, 165, 170, 174, 214, 222, 172, 174,
2820 220, 220, 220, 165, 211, 39, 214, 238, 239, 61,
2821 246, 170, 222, 173, 222, 174, 222, 22, 250, 165,
2822 165, 249, 249, 249, 249, 249, 11, 54, 11, 260,
2823 249, 168, 250, 214, 250, 250, 250, 165, 165, 261,
2824 165, 165, 165, 214, 249, 249, 165, 211, 211, 214,
2825 220, 220, 220, 220, 260, 165, 165, 165, 165, 261,
2826 165, 220, 172, 174, 165, 165, 38, 34, 54, 209,
2827 212, 200, 165, 163, 22, 170, 174, 222, 172, 174,
2828 17, 17, 162, 165, 165, 165, 165, 249, 4, 249,
2829 165, 165, 249, 165, 165, 165, 4, 4, 165, 214,
2830 249, 249, 162, 165, 208, 214, 163, 165, 165, 165,
2831 165, 163, 220, 220, 220, 220, 163, 220, 172, 220,
2832 220, 214, 22, 4, 211, 184, 185, 39, 214, 202,
2833 165, 172, 174, 249, 249, 17, 214, 259, 249, 249,
2834 249, 249, 208, 208, 250, 249, 165, 250, 250, 250,
2835 4, 249, 259, 249, 220, 220, 220, 220, 165, 163,
2836 165, 165, 261, 163, 163, 163, 200, 209, 210, 22,
2837 172, 165, 168, 200, 200, 163, 165, 170, 249, 261,
2838 163, 208, 163, 163, 163, 163, 220, 220, 220, 163,
2839 185, 54, 207, 17, 170, 182, 256, 122, 123, 249,
2840 249, 202, 17, 214, 170, 202, 163, 163, 163, 4,
2841 153, 206, 249, 247, 170, 182, 200, 200, 38, 200,
2842 200, 22, 154, 205, 165, 247, 17, 249, 249, 162,
2843 17, 165, 249, 200, 200, 155, 158, 203, 204, 249,
2844 17, 74, 164, 163, 165, 249, 17, 156, 157, 204,
2845 249
Dan Gohman54392c12008-04-19 00:24:39 +00002846};
David Greene9145dd22007-08-01 03:59:32 +00002847
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002848#define yyerrok (yyerrstatus = 0)
2849#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002850#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002851#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002852
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002853#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002854#define YYABORT goto yyabortlab
2855#define YYERROR goto yyerrorlab
2856
2857
2858/* Like YYERROR except do call yyerror. This remains here temporarily
2859 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002860 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002861
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002862#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002863
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002864#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002865
2866#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002867do \
2868 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002869 { \
2870 yychar = (Token); \
2871 yylval = (Value); \
2872 yytoken = YYTRANSLATE (yychar); \
2873 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002874 goto yybackup; \
2875 } \
2876 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002877 { \
2878 yyerror (YY_("syntax error: cannot back up")); \
2879 YYERROR; \
2880 } \
2881while (YYID (0))
2882
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002883
2884#define YYTERROR 1
2885#define YYERRCODE 256
2886
Dan Gohman54392c12008-04-19 00:24:39 +00002887
2888/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2889 If N is 0, then set CURRENT to the empty location which ends
2890 the previous symbol: RHS[0] (always defined). */
2891
2892#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2893#ifndef YYLLOC_DEFAULT
2894# define YYLLOC_DEFAULT(Current, Rhs, N) \
2895 do \
2896 if (YYID (N)) \
2897 { \
2898 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2899 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2900 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2901 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2902 } \
2903 else \
2904 { \
2905 (Current).first_line = (Current).last_line = \
2906 YYRHSLOC (Rhs, 0).last_line; \
2907 (Current).first_column = (Current).last_column = \
2908 YYRHSLOC (Rhs, 0).last_column; \
2909 } \
2910 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002911#endif
2912
Dan Gohman54392c12008-04-19 00:24:39 +00002913
2914/* YY_LOCATION_PRINT -- Print the location on the stream.
2915 This macro was not mandated originally: define only if we know
2916 we won't break user code: when these are the locations we know. */
2917
2918#ifndef YY_LOCATION_PRINT
Dan Gohman7185e4b2008-06-23 18:43:26 +00002919# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohman54392c12008-04-19 00:24:39 +00002920# define YY_LOCATION_PRINT(File, Loc) \
2921 fprintf (File, "%d.%d-%d.%d", \
2922 (Loc).first_line, (Loc).first_column, \
2923 (Loc).last_line, (Loc).last_column)
2924# else
2925# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2926# endif
2927#endif
2928
2929
2930/* YYLEX -- calling `yylex' with the right arguments. */
2931
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002932#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002933# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002934#else
Dan Gohman54392c12008-04-19 00:24:39 +00002935# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002936#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002937
2938/* Enable debugging if requested. */
2939#if YYDEBUG
2940
2941# ifndef YYFPRINTF
2942# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2943# define YYFPRINTF fprintf
2944# endif
2945
2946# define YYDPRINTF(Args) \
2947do { \
2948 if (yydebug) \
2949 YYFPRINTF Args; \
2950} while (YYID (0))
2951
2952# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2953do { \
2954 if (yydebug) \
2955 { \
2956 YYFPRINTF (stderr, "%s ", Title); \
2957 yy_symbol_print (stderr, \
2958 Type, Value); \
2959 YYFPRINTF (stderr, "\n"); \
2960 } \
2961} while (YYID (0))
2962
2963
2964/*--------------------------------.
2965| Print this symbol on YYOUTPUT. |
2966`--------------------------------*/
2967
2968/*ARGSUSED*/
2969#if (defined __STDC__ || defined __C99__FUNC__ \
2970 || defined __cplusplus || defined _MSC_VER)
2971static void
2972yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002973#else
Dan Gohman54392c12008-04-19 00:24:39 +00002974static void
2975yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2976 FILE *yyoutput;
2977 int yytype;
2978 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002979#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002980{
2981 if (!yyvaluep)
2982 return;
2983# ifdef YYPRINT
2984 if (yytype < YYNTOKENS)
2985 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2986# else
2987 YYUSE (yyoutput);
2988# endif
2989 switch (yytype)
2990 {
2991 default:
2992 break;
2993 }
2994}
2995
2996
2997/*--------------------------------.
2998| Print this symbol on YYOUTPUT. |
2999`--------------------------------*/
3000
3001#if (defined __STDC__ || defined __C99__FUNC__ \
3002 || defined __cplusplus || defined _MSC_VER)
3003static void
3004yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3005#else
3006static void
3007yy_symbol_print (yyoutput, yytype, yyvaluep)
3008 FILE *yyoutput;
3009 int yytype;
3010 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00003011#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003012{
3013 if (yytype < YYNTOKENS)
3014 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3015 else
3016 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00003017
Dan Gohman54392c12008-04-19 00:24:39 +00003018 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3019 YYFPRINTF (yyoutput, ")");
3020}
Chris Lattner59363a32008-02-19 04:36:25 +00003021
Dan Gohman54392c12008-04-19 00:24:39 +00003022/*------------------------------------------------------------------.
3023| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3024| TOP (included). |
3025`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00003026
Dan Gohman54392c12008-04-19 00:24:39 +00003027#if (defined __STDC__ || defined __C99__FUNC__ \
3028 || defined __cplusplus || defined _MSC_VER)
3029static void
3030yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3031#else
3032static void
3033yy_stack_print (bottom, top)
3034 yytype_int16 *bottom;
3035 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00003036#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003037{
3038 YYFPRINTF (stderr, "Stack now");
3039 for (; bottom <= top; ++bottom)
3040 YYFPRINTF (stderr, " %d", *bottom);
3041 YYFPRINTF (stderr, "\n");
3042}
Chris Lattner59363a32008-02-19 04:36:25 +00003043
Dan Gohman54392c12008-04-19 00:24:39 +00003044# define YY_STACK_PRINT(Bottom, Top) \
3045do { \
3046 if (yydebug) \
3047 yy_stack_print ((Bottom), (Top)); \
3048} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00003049
Dan Gohman54392c12008-04-19 00:24:39 +00003050
3051/*------------------------------------------------.
3052| Report that the YYRULE is going to be reduced. |
3053`------------------------------------------------*/
3054
3055#if (defined __STDC__ || defined __C99__FUNC__ \
3056 || defined __cplusplus || defined _MSC_VER)
3057static void
3058yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3059#else
3060static void
3061yy_reduce_print (yyvsp, yyrule)
3062 YYSTYPE *yyvsp;
3063 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00003064#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003065{
3066 int yynrhs = yyr2[yyrule];
3067 int yyi;
3068 unsigned long int yylno = yyrline[yyrule];
3069 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3070 yyrule - 1, yylno);
3071 /* The symbols being reduced. */
3072 for (yyi = 0; yyi < yynrhs; yyi++)
3073 {
3074 fprintf (stderr, " $%d = ", yyi + 1);
3075 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3076 &(yyvsp[(yyi + 1) - (yynrhs)])
3077 );
3078 fprintf (stderr, "\n");
3079 }
3080}
Scott Michel5a6f17b2008-01-30 02:55:46 +00003081
Dan Gohman54392c12008-04-19 00:24:39 +00003082# define YY_REDUCE_PRINT(Rule) \
3083do { \
3084 if (yydebug) \
3085 yy_reduce_print (yyvsp, Rule); \
3086} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00003087
Dan Gohman54392c12008-04-19 00:24:39 +00003088/* Nonzero means print parse trace. It is left uninitialized so that
3089 multiple parsers can coexist. */
3090int yydebug;
3091#else /* !YYDEBUG */
3092# define YYDPRINTF(Args)
3093# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3094# define YY_STACK_PRINT(Bottom, Top)
3095# define YY_REDUCE_PRINT(Rule)
3096#endif /* !YYDEBUG */
3097
3098
3099/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003100#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003101# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003102#endif
3103
Dan Gohman54392c12008-04-19 00:24:39 +00003104/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3105 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003106
Dan Gohman54392c12008-04-19 00:24:39 +00003107 Do not make this value too large; the results are undefined if
3108 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3109 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00003110
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003111#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003112# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003113#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003114
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003115
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003116
Dan Gohman54392c12008-04-19 00:24:39 +00003117#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003118
Dan Gohman54392c12008-04-19 00:24:39 +00003119# ifndef yystrlen
3120# if defined __GLIBC__ && defined _STRING_H
3121# define yystrlen strlen
3122# else
3123/* Return the length of YYSTR. */
3124#if (defined __STDC__ || defined __C99__FUNC__ \
3125 || defined __cplusplus || defined _MSC_VER)
3126static YYSIZE_T
3127yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00003128#else
Dan Gohman54392c12008-04-19 00:24:39 +00003129static YYSIZE_T
3130yystrlen (yystr)
3131 const char *yystr;
3132#endif
3133{
3134 YYSIZE_T yylen;
3135 for (yylen = 0; yystr[yylen]; yylen++)
3136 continue;
3137 return yylen;
3138}
3139# endif
3140# endif
3141
3142# ifndef yystpcpy
3143# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3144# define yystpcpy stpcpy
3145# else
3146/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3147 YYDEST. */
3148#if (defined __STDC__ || defined __C99__FUNC__ \
3149 || defined __cplusplus || defined _MSC_VER)
3150static char *
3151yystpcpy (char *yydest, const char *yysrc)
3152#else
3153static char *
3154yystpcpy (yydest, yysrc)
3155 char *yydest;
3156 const char *yysrc;
3157#endif
3158{
3159 char *yyd = yydest;
3160 const char *yys = yysrc;
3161
3162 while ((*yyd++ = *yys++) != '\0')
3163 continue;
3164
3165 return yyd - 1;
3166}
3167# endif
3168# endif
3169
3170# ifndef yytnamerr
3171/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3172 quotes and backslashes, so that it's suitable for yyerror. The
3173 heuristic is that double-quoting is unnecessary unless the string
3174 contains an apostrophe, a comma, or backslash (other than
3175 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3176 null, do not copy; instead, return the length of what the result
3177 would have been. */
3178static YYSIZE_T
3179yytnamerr (char *yyres, const char *yystr)
3180{
3181 if (*yystr == '"')
3182 {
3183 YYSIZE_T yyn = 0;
3184 char const *yyp = yystr;
3185
3186 for (;;)
3187 switch (*++yyp)
3188 {
3189 case '\'':
3190 case ',':
3191 goto do_not_strip_quotes;
3192
3193 case '\\':
3194 if (*++yyp != '\\')
3195 goto do_not_strip_quotes;
3196 /* Fall through. */
3197 default:
3198 if (yyres)
3199 yyres[yyn] = *yyp;
3200 yyn++;
3201 break;
3202
3203 case '"':
3204 if (yyres)
3205 yyres[yyn] = '\0';
3206 return yyn;
3207 }
3208 do_not_strip_quotes: ;
3209 }
3210
3211 if (! yyres)
3212 return yystrlen (yystr);
3213
3214 return yystpcpy (yyres, yystr) - yyres;
3215}
3216# endif
3217
3218/* Copy into YYRESULT an error message about the unexpected token
3219 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3220 including the terminating null byte. If YYRESULT is null, do not
3221 copy anything; just return the number of bytes that would be
3222 copied. As a special case, return 0 if an ordinary "syntax error"
3223 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3224 size calculation. */
3225static YYSIZE_T
3226yysyntax_error (char *yyresult, int yystate, int yychar)
3227{
3228 int yyn = yypact[yystate];
3229
3230 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3231 return 0;
3232 else
3233 {
3234 int yytype = YYTRANSLATE (yychar);
3235 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3236 YYSIZE_T yysize = yysize0;
3237 YYSIZE_T yysize1;
3238 int yysize_overflow = 0;
3239 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3240 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3241 int yyx;
3242
3243# if 0
3244 /* This is so xgettext sees the translatable formats that are
3245 constructed on the fly. */
3246 YY_("syntax error, unexpected %s");
3247 YY_("syntax error, unexpected %s, expecting %s");
3248 YY_("syntax error, unexpected %s, expecting %s or %s");
3249 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3250 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3251# endif
3252 char *yyfmt;
3253 char const *yyf;
3254 static char const yyunexpected[] = "syntax error, unexpected %s";
3255 static char const yyexpecting[] = ", expecting %s";
3256 static char const yyor[] = " or %s";
3257 char yyformat[sizeof yyunexpected
3258 + sizeof yyexpecting - 1
3259 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3260 * (sizeof yyor - 1))];
3261 char const *yyprefix = yyexpecting;
3262
3263 /* Start YYX at -YYN if negative to avoid negative indexes in
3264 YYCHECK. */
3265 int yyxbegin = yyn < 0 ? -yyn : 0;
3266
3267 /* Stay within bounds of both yycheck and yytname. */
3268 int yychecklim = YYLAST - yyn + 1;
3269 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3270 int yycount = 1;
3271
3272 yyarg[0] = yytname[yytype];
3273 yyfmt = yystpcpy (yyformat, yyunexpected);
3274
3275 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3276 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3277 {
3278 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3279 {
3280 yycount = 1;
3281 yysize = yysize0;
3282 yyformat[sizeof yyunexpected - 1] = '\0';
3283 break;
3284 }
3285 yyarg[yycount++] = yytname[yyx];
3286 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3287 yysize_overflow |= (yysize1 < yysize);
3288 yysize = yysize1;
3289 yyfmt = yystpcpy (yyfmt, yyprefix);
3290 yyprefix = yyor;
3291 }
3292
3293 yyf = YY_(yyformat);
3294 yysize1 = yysize + yystrlen (yyf);
3295 yysize_overflow |= (yysize1 < yysize);
3296 yysize = yysize1;
3297
3298 if (yysize_overflow)
3299 return YYSIZE_MAXIMUM;
3300
3301 if (yyresult)
3302 {
3303 /* Avoid sprintf, as that infringes on the user's name space.
3304 Don't have undefined behavior even if the translation
3305 produced a string with the wrong number of "%s"s. */
3306 char *yyp = yyresult;
3307 int yyi = 0;
3308 while ((*yyp = *yyf) != '\0')
3309 {
3310 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3311 {
3312 yyp += yytnamerr (yyp, yyarg[yyi++]);
3313 yyf += 2;
3314 }
3315 else
3316 {
3317 yyp++;
3318 yyf++;
3319 }
3320 }
3321 }
3322 return yysize;
3323 }
3324}
3325#endif /* YYERROR_VERBOSE */
3326
3327
3328/*-----------------------------------------------.
3329| Release the memory associated to this symbol. |
3330`-----------------------------------------------*/
3331
3332/*ARGSUSED*/
3333#if (defined __STDC__ || defined __C99__FUNC__ \
3334 || defined __cplusplus || defined _MSC_VER)
3335static void
3336yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3337#else
3338static void
3339yydestruct (yymsg, yytype, yyvaluep)
3340 const char *yymsg;
3341 int yytype;
3342 YYSTYPE *yyvaluep;
3343#endif
3344{
3345 YYUSE (yyvaluep);
3346
3347 if (!yymsg)
3348 yymsg = "Deleting";
3349 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3350
3351 switch (yytype)
3352 {
3353
3354 default:
3355 break;
3356 }
3357}
3358
3359
3360/* Prevent warnings from -Wmissing-prototypes. */
3361
3362#ifdef YYPARSE_PARAM
3363#if defined __STDC__ || defined __cplusplus
3364int yyparse (void *YYPARSE_PARAM);
3365#else
3366int yyparse ();
3367#endif
3368#else /* ! YYPARSE_PARAM */
3369#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003370int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003371#else
Dan Gohman54392c12008-04-19 00:24:39 +00003372int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003373#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003374#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003375
Chris Lattner59363a32008-02-19 04:36:25 +00003376
Dan Gohman54392c12008-04-19 00:24:39 +00003377
3378/* The look-ahead symbol. */
3379int yychar;
3380
3381/* The semantic value of the look-ahead symbol. */
3382YYSTYPE yylval;
3383
3384/* Number of syntax errors so far. */
3385int yynerrs;
3386
3387
3388
3389/*----------.
3390| yyparse. |
3391`----------*/
3392
3393#ifdef YYPARSE_PARAM
3394#if (defined __STDC__ || defined __C99__FUNC__ \
3395 || defined __cplusplus || defined _MSC_VER)
3396int
3397yyparse (void *YYPARSE_PARAM)
3398#else
3399int
3400yyparse (YYPARSE_PARAM)
3401 void *YYPARSE_PARAM;
3402#endif
3403#else /* ! YYPARSE_PARAM */
3404#if (defined __STDC__ || defined __C99__FUNC__ \
3405 || defined __cplusplus || defined _MSC_VER)
3406int
3407yyparse (void)
3408#else
3409int
3410yyparse ()
3411
Gabor Greif89f01162008-04-06 23:07:54 +00003412#endif
3413#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003414{
3415
3416 int yystate;
3417 int yyn;
3418 int yyresult;
3419 /* Number of tokens to shift before error messages enabled. */
3420 int yyerrstatus;
3421 /* Look-ahead token as an internal (translated) token number. */
3422 int yytoken = 0;
3423#if YYERROR_VERBOSE
3424 /* Buffer for error messages, and its allocated size. */
3425 char yymsgbuf[128];
3426 char *yymsg = yymsgbuf;
3427 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003428#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003429
Dan Gohman54392c12008-04-19 00:24:39 +00003430 /* Three stacks and their tools:
3431 `yyss': related to states,
3432 `yyvs': related to semantic values,
3433 `yyls': related to locations.
3434
3435 Refer to the stacks thru separate pointers, to allow yyoverflow
3436 to reallocate them elsewhere. */
3437
3438 /* The state stack. */
3439 yytype_int16 yyssa[YYINITDEPTH];
3440 yytype_int16 *yyss = yyssa;
3441 yytype_int16 *yyssp;
3442
3443 /* The semantic value stack. */
3444 YYSTYPE yyvsa[YYINITDEPTH];
3445 YYSTYPE *yyvs = yyvsa;
3446 YYSTYPE *yyvsp;
3447
3448
3449
3450#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3451
3452 YYSIZE_T yystacksize = YYINITDEPTH;
3453
3454 /* The variables used to return semantic value and location from the
3455 action routines. */
3456 YYSTYPE yyval;
3457
3458
3459 /* The number of symbols on the RHS of the reduced rule.
3460 Keep to zero when no symbol should be popped. */
3461 int yylen = 0;
3462
3463 YYDPRINTF ((stderr, "Starting parse\n"));
3464
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003465 yystate = 0;
3466 yyerrstatus = 0;
3467 yynerrs = 0;
3468 yychar = YYEMPTY; /* Cause a token to be read. */
3469
3470 /* Initialize stack pointers.
3471 Waste one element of value and location stack
3472 so that they stay on the same level as the state stack.
3473 The wasted elements are never initialized. */
3474
Dan Gohman54392c12008-04-19 00:24:39 +00003475 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003476 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003477
Dan Gohman54392c12008-04-19 00:24:39 +00003478 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003479
Dan Gohman54392c12008-04-19 00:24:39 +00003480/*------------------------------------------------------------.
3481| yynewstate -- Push a new state, which is found in yystate. |
3482`------------------------------------------------------------*/
3483 yynewstate:
3484 /* In all cases, when you get here, the value and location stacks
3485 have just been pushed. So pushing a state here evens the stacks. */
3486 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003487
Dan Gohman54392c12008-04-19 00:24:39 +00003488 yysetstate:
3489 *yyssp = yystate;
3490
3491 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003492 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003493 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003494 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003495
3496#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003497 {
3498 /* Give user a chance to reallocate the stack. Use copies of
3499 these so that the &'s don't force the real ones into
3500 memory. */
3501 YYSTYPE *yyvs1 = yyvs;
3502 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003503
Dan Gohman54392c12008-04-19 00:24:39 +00003504
3505 /* Each stack pointer address is followed by the size of the
3506 data in use in that stack, in bytes. This used to be a
3507 conditional around just the two extra args, but that might
3508 be undefined if yyoverflow is a macro. */
3509 yyoverflow (YY_("memory exhausted"),
3510 &yyss1, yysize * sizeof (*yyssp),
3511 &yyvs1, yysize * sizeof (*yyvsp),
3512
3513 &yystacksize);
3514
3515 yyss = yyss1;
3516 yyvs = yyvs1;
3517 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003518#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003519# ifndef YYSTACK_RELOCATE
3520 goto yyexhaustedlab;
3521# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003522 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003523 if (YYMAXDEPTH <= yystacksize)
3524 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003525 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003526 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003527 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003528
3529 {
3530 yytype_int16 *yyss1 = yyss;
3531 union yyalloc *yyptr =
3532 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3533 if (! yyptr)
3534 goto yyexhaustedlab;
3535 YYSTACK_RELOCATE (yyss);
3536 YYSTACK_RELOCATE (yyvs);
3537
3538# undef YYSTACK_RELOCATE
3539 if (yyss1 != yyssa)
3540 YYSTACK_FREE (yyss1);
3541 }
3542# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003543#endif /* no yyoverflow */
3544
Dan Gohman54392c12008-04-19 00:24:39 +00003545 yyssp = yyss + yysize - 1;
3546 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003547
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003548
Dan Gohman54392c12008-04-19 00:24:39 +00003549 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3550 (unsigned long int) yystacksize));
3551
3552 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003553 YYABORT;
3554 }
3555
Dan Gohman54392c12008-04-19 00:24:39 +00003556 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003557
3558 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003559
Dan Gohman54392c12008-04-19 00:24:39 +00003560/*-----------.
3561| yybackup. |
3562`-----------*/
3563yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003564
Dan Gohman54392c12008-04-19 00:24:39 +00003565 /* Do appropriate processing given the current state. Read a
3566 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003567
Dan Gohman54392c12008-04-19 00:24:39 +00003568 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003569 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003570 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003571 goto yydefault;
3572
Dan Gohman54392c12008-04-19 00:24:39 +00003573 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003574
Dan Gohman54392c12008-04-19 00:24:39 +00003575 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003576 if (yychar == YYEMPTY)
3577 {
Dan Gohman54392c12008-04-19 00:24:39 +00003578 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003579 yychar = YYLEX;
3580 }
3581
Dan Gohman54392c12008-04-19 00:24:39 +00003582 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003583 {
Dan Gohman54392c12008-04-19 00:24:39 +00003584 yychar = yytoken = YYEOF;
3585 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003586 }
3587 else
3588 {
Dan Gohman54392c12008-04-19 00:24:39 +00003589 yytoken = YYTRANSLATE (yychar);
3590 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003591 }
3592
Dan Gohman54392c12008-04-19 00:24:39 +00003593 /* If the proper action on seeing token YYTOKEN is to reduce or to
3594 detect an error, take that action. */
3595 yyn += yytoken;
3596 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003597 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003598 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003599 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003600 {
Dan Gohman54392c12008-04-19 00:24:39 +00003601 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003602 goto yyerrlab;
3603 yyn = -yyn;
3604 goto yyreduce;
3605 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003606
3607 if (yyn == YYFINAL)
3608 YYACCEPT;
3609
Dan Gohman54392c12008-04-19 00:24:39 +00003610 /* Count tokens shifted since error; after three, turn off error
3611 status. */
3612 if (yyerrstatus)
3613 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003614
Dan Gohman54392c12008-04-19 00:24:39 +00003615 /* Shift the look-ahead token. */
3616 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003617
Dan Gohman54392c12008-04-19 00:24:39 +00003618 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003619 if (yychar != YYEOF)
3620 yychar = YYEMPTY;
3621
Gabor Greif89f01162008-04-06 23:07:54 +00003622 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003623 *++yyvsp = yylval;
3624
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003625 goto yynewstate;
3626
Gabor Greif89f01162008-04-06 23:07:54 +00003627
Dan Gohman54392c12008-04-19 00:24:39 +00003628/*-----------------------------------------------------------.
3629| yydefault -- do the default action for the current state. |
3630`-----------------------------------------------------------*/
3631yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003632 yyn = yydefact[yystate];
3633 if (yyn == 0)
3634 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003635 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003636
Dan Gohman54392c12008-04-19 00:24:39 +00003637
3638/*-----------------------------.
3639| yyreduce -- Do a reduction. |
3640`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003641yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003642 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003643 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003644
Dan Gohman54392c12008-04-19 00:24:39 +00003645 /* If YYLEN is nonzero, implement the default value of the action:
3646 `$$ = $1'.
3647
3648 Otherwise, the following line sets YYVAL to garbage.
3649 This behavior is undocumented and Bison
3650 users should not rely upon it. Assigning to YYVAL
3651 unconditionally makes the parser a bit smaller, and it avoids a
3652 GCC warning that YYVAL may be used uninitialized. */
3653 yyval = yyvsp[1-yylen];
3654
3655
3656 YY_REDUCE_PRINT (yyn);
3657 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003658 {
Dan Gohman54392c12008-04-19 00:24:39 +00003659 case 29:
Devang Patele01c06b2008-09-23 23:25:44 +00003660#line 1147 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003661 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3662 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003663
Dan Gohman54392c12008-04-19 00:24:39 +00003664 case 30:
Devang Patele01c06b2008-09-23 23:25:44 +00003665#line 1147 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003666 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3667 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003668
Dan Gohman54392c12008-04-19 00:24:39 +00003669 case 31:
Devang Patele01c06b2008-09-23 23:25:44 +00003670#line 1148 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003671 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3672 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003673
Dan Gohman54392c12008-04-19 00:24:39 +00003674 case 32:
Devang Patele01c06b2008-09-23 23:25:44 +00003675#line 1148 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003676 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3677 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003678
Dan Gohman54392c12008-04-19 00:24:39 +00003679 case 33:
Devang Patele01c06b2008-09-23 23:25:44 +00003680#line 1149 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003681 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3682 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003683
Dan Gohman54392c12008-04-19 00:24:39 +00003684 case 34:
Devang Patele01c06b2008-09-23 23:25:44 +00003685#line 1149 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003686 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3687 break;
3688
3689 case 35:
Devang Patele01c06b2008-09-23 23:25:44 +00003690#line 1150 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003691 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3692 break;
3693
3694 case 36:
Devang Patele01c06b2008-09-23 23:25:44 +00003695#line 1150 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003696 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3697 break;
3698
3699 case 37:
Devang Patele01c06b2008-09-23 23:25:44 +00003700#line 1151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003701 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3702 break;
3703
3704 case 38:
Devang Patele01c06b2008-09-23 23:25:44 +00003705#line 1151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003706 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3707 break;
3708
3709 case 39:
Devang Patele01c06b2008-09-23 23:25:44 +00003710#line 1155 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003711 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3712 break;
3713
3714 case 40:
Devang Patele01c06b2008-09-23 23:25:44 +00003715#line 1155 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003716 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3717 break;
3718
3719 case 41:
Devang Patele01c06b2008-09-23 23:25:44 +00003720#line 1156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003721 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3722 break;
3723
3724 case 42:
Devang Patele01c06b2008-09-23 23:25:44 +00003725#line 1156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003726 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3727 break;
3728
3729 case 43:
Devang Patele01c06b2008-09-23 23:25:44 +00003730#line 1157 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003731 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3732 break;
3733
3734 case 44:
Devang Patele01c06b2008-09-23 23:25:44 +00003735#line 1157 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003736 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3737 break;
3738
3739 case 45:
Devang Patele01c06b2008-09-23 23:25:44 +00003740#line 1158 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003741 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3742 break;
3743
3744 case 46:
Devang Patele01c06b2008-09-23 23:25:44 +00003745#line 1158 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003746 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3747 break;
3748
3749 case 47:
Devang Patele01c06b2008-09-23 23:25:44 +00003750#line 1159 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003751 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3752 break;
3753
3754 case 48:
Devang Patele01c06b2008-09-23 23:25:44 +00003755#line 1159 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003756 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3757 break;
3758
3759 case 49:
Devang Patele01c06b2008-09-23 23:25:44 +00003760#line 1160 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003761 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3762 break;
3763
3764 case 50:
Devang Patele01c06b2008-09-23 23:25:44 +00003765#line 1160 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003766 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3767 break;
3768
3769 case 51:
Devang Patele01c06b2008-09-23 23:25:44 +00003770#line 1161 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003771 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3772 break;
3773
3774 case 52:
Devang Patele01c06b2008-09-23 23:25:44 +00003775#line 1161 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003776 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3777 break;
3778
3779 case 53:
Devang Patele01c06b2008-09-23 23:25:44 +00003780#line 1162 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003781 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3782 break;
3783
3784 case 54:
Devang Patele01c06b2008-09-23 23:25:44 +00003785#line 1163 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003786 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3787 break;
3788
3789 case 65:
Devang Patele01c06b2008-09-23 23:25:44 +00003790#line 1172 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003791 { (yyval.StrVal) = 0; ;}
3792 break;
3793
3794 case 66:
Devang Patele01c06b2008-09-23 23:25:44 +00003795#line 1174 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003796 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3797 break;
3798
3799 case 67:
Devang Patele01c06b2008-09-23 23:25:44 +00003800#line 1175 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003801 { (yyval.UIntVal)=0; ;}
3802 break;
3803
3804 case 68:
Devang Patele01c06b2008-09-23 23:25:44 +00003805#line 1179 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003806 {
3807 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003808 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003809 ;}
3810 break;
3811
3812 case 69:
Devang Patele01c06b2008-09-23 23:25:44 +00003813#line 1183 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003814 {
3815 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003816 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003817 ;}
3818 break;
3819
Chris Lattner906773a2008-08-29 17:20:18 +00003820 case 70:
Devang Patele01c06b2008-09-23 23:25:44 +00003821#line 1188 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003822 {
Chris Lattner906773a2008-08-29 17:20:18 +00003823 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3824 CHECK_FOR_ERROR
3825;}
Dan Gohman54392c12008-04-19 00:24:39 +00003826 break;
3827
3828 case 74:
Devang Patele01c06b2008-09-23 23:25:44 +00003829#line 1197 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003830 {
3831 (yyval.StrVal) = 0;
3832 CHECK_FOR_ERROR
3833 ;}
3834 break;
3835
3836 case 75:
Devang Patele01c06b2008-09-23 23:25:44 +00003837#line 1202 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003838 {
3839 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003840 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003841 ;}
3842 break;
3843
Chris Lattner906773a2008-08-29 17:20:18 +00003844 case 76:
Devang Patele01c06b2008-09-23 23:25:44 +00003845#line 1208 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003846 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3847 break;
3848
Chris Lattner906773a2008-08-29 17:20:18 +00003849 case 77:
Devang Patele01c06b2008-09-23 23:25:44 +00003850#line 1209 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003851 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3852 break;
3853
Chris Lattner906773a2008-08-29 17:20:18 +00003854 case 78:
Devang Patele01c06b2008-09-23 23:25:44 +00003855#line 1210 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003856 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3857 break;
3858
Chris Lattner906773a2008-08-29 17:20:18 +00003859 case 79:
Devang Patele01c06b2008-09-23 23:25:44 +00003860#line 1211 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003861 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3862 break;
3863
Chris Lattner906773a2008-08-29 17:20:18 +00003864 case 80:
Devang Patele01c06b2008-09-23 23:25:44 +00003865#line 1212 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003866 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3867 break;
3868
Chris Lattner906773a2008-08-29 17:20:18 +00003869 case 81:
Devang Patele01c06b2008-09-23 23:25:44 +00003870#line 1213 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003871 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003872 break;
3873
Chris Lattner906773a2008-08-29 17:20:18 +00003874 case 82:
Devang Patele01c06b2008-09-23 23:25:44 +00003875#line 1217 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003876 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003877 break;
3878
Chris Lattner906773a2008-08-29 17:20:18 +00003879 case 83:
Devang Patele01c06b2008-09-23 23:25:44 +00003880#line 1218 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003881 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003882 break;
3883
Chris Lattner906773a2008-08-29 17:20:18 +00003884 case 84:
Devang Patele01c06b2008-09-23 23:25:44 +00003885#line 1219 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003886 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003887 break;
3888
Dan Gohman54392c12008-04-19 00:24:39 +00003889 case 85:
Devang Patele01c06b2008-09-23 23:25:44 +00003890#line 1223 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003891 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003892 break;
3893
3894 case 86:
Devang Patele01c06b2008-09-23 23:25:44 +00003895#line 1224 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003896 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003897 break;
3898
3899 case 87:
Devang Patele01c06b2008-09-23 23:25:44 +00003900#line 1225 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003901 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003902 break;
3903
3904 case 88:
Devang Patele01c06b2008-09-23 23:25:44 +00003905#line 1226 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003906 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003907 break;
3908
Dan Gohmane5febe42008-05-31 00:58:22 +00003909 case 89:
Devang Patele01c06b2008-09-23 23:25:44 +00003910#line 1230 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003911 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003912 break;
3913
3914 case 90:
Devang Patele01c06b2008-09-23 23:25:44 +00003915#line 1231 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003916 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003917 break;
3918
3919 case 91:
Devang Patele01c06b2008-09-23 23:25:44 +00003920#line 1232 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003921 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003922 break;
3923
3924 case 92:
Devang Patele01c06b2008-09-23 23:25:44 +00003925#line 1236 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00003926 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3927 break;
3928
Chris Lattner906773a2008-08-29 17:20:18 +00003929 case 93:
Devang Patele01c06b2008-09-23 23:25:44 +00003930#line 1237 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003931 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003932 break;
3933
Chris Lattner906773a2008-08-29 17:20:18 +00003934 case 94:
Devang Patele01c06b2008-09-23 23:25:44 +00003935#line 1238 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003936 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3937 break;
3938
3939 case 95:
Devang Patele01c06b2008-09-23 23:25:44 +00003940#line 1239 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003941 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3942 break;
3943
3944 case 96:
Devang Patele01c06b2008-09-23 23:25:44 +00003945#line 1240 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003946 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3947 break;
3948
3949 case 97:
Devang Patele01c06b2008-09-23 23:25:44 +00003950#line 1244 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003951 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3952 break;
3953
3954 case 98:
Devang Patele01c06b2008-09-23 23:25:44 +00003955#line 1245 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003956 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3957 break;
3958
Dan Gohman54392c12008-04-19 00:24:39 +00003959 case 99:
Devang Patele01c06b2008-09-23 23:25:44 +00003960#line 1246 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003961 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003962 break;
3963
3964 case 100:
Devang Patele01c06b2008-09-23 23:25:44 +00003965#line 1249 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003966 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003967 break;
3968
3969 case 101:
Devang Patele01c06b2008-09-23 23:25:44 +00003970#line 1250 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003971 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003972 break;
3973
3974 case 102:
Devang Patele01c06b2008-09-23 23:25:44 +00003975#line 1251 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003976 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003977 break;
3978
3979 case 103:
Devang Patele01c06b2008-09-23 23:25:44 +00003980#line 1252 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003981 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003982 break;
3983
3984 case 104:
Devang Patele01c06b2008-09-23 23:25:44 +00003985#line 1253 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003986 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003987 break;
3988
3989 case 105:
Devang Patele01c06b2008-09-23 23:25:44 +00003990#line 1254 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003991 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00003992 break;
3993
3994 case 106:
Devang Patele01c06b2008-09-23 23:25:44 +00003995#line 1255 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003996 { (yyval.UIntVal) = CallingConv::X86_SSECall; ;}
3997 break;
3998
3999 case 107:
Devang Patele01c06b2008-09-23 23:25:44 +00004000#line 1256 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004001 {
4002 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004003 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00004004 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004005 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004006 ;}
4007 break;
4008
Dan Gohman54392c12008-04-19 00:24:39 +00004009 case 108:
Devang Patele01c06b2008-09-23 23:25:44 +00004010#line 1263 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004011 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004012 break;
4013
4014 case 109:
Devang Patele01c06b2008-09-23 23:25:44 +00004015#line 1264 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004016 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004017 break;
4018
4019 case 110:
Devang Patele01c06b2008-09-23 23:25:44 +00004020#line 1265 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004021 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004022 break;
4023
4024 case 111:
Devang Patele01c06b2008-09-23 23:25:44 +00004025#line 1266 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004026 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004027 break;
4028
4029 case 112:
Devang Patele01c06b2008-09-23 23:25:44 +00004030#line 1267 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004031 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004032 break;
4033
4034 case 113:
Devang Patele01c06b2008-09-23 23:25:44 +00004035#line 1268 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004036 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004037 break;
4038
4039 case 114:
Devang Patele01c06b2008-09-23 23:25:44 +00004040#line 1269 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004041 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004042 break;
4043
4044 case 115:
Devang Patele01c06b2008-09-23 23:25:44 +00004045#line 1270 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004046 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004047 break;
4048
4049 case 116:
Devang Patele01c06b2008-09-23 23:25:44 +00004050#line 1271 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004051 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
4052 break;
4053
4054 case 117:
Devang Patele01c06b2008-09-23 23:25:44 +00004055#line 1272 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004056 { (yyval.ParamAttrs) =
4057 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4058 break;
4059
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004060 case 118:
Devang Patele01c06b2008-09-23 23:25:44 +00004061#line 1276 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004062 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004063 break;
4064
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004065 case 119:
Devang Patele01c06b2008-09-23 23:25:44 +00004066#line 1277 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004067 {
4068 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4069 ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004070 break;
4071
Chris Lattner906773a2008-08-29 17:20:18 +00004072 case 120:
Devang Patele01c06b2008-09-23 23:25:44 +00004073#line 1282 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004074 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4075 break;
4076
4077 case 121:
Devang Patele01c06b2008-09-23 23:25:44 +00004078#line 1283 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004079 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4080 break;
4081
4082 case 122:
Devang Patele01c06b2008-09-23 23:25:44 +00004083#line 1284 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004084 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004085 break;
4086
4087 case 123:
Devang Patele01c06b2008-09-23 23:25:44 +00004088#line 1285 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004089 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004090 break;
4091
4092 case 124:
Devang Patele01c06b2008-09-23 23:25:44 +00004093#line 1286 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004094 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004095 break;
4096
4097 case 125:
Devang Patele01c06b2008-09-23 23:25:44 +00004098#line 1287 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004099 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004100 break;
4101
4102 case 126:
Devang Patele01c06b2008-09-23 23:25:44 +00004103#line 1288 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004104 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004105 break;
4106
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004107 case 127:
Devang Patele01c06b2008-09-23 23:25:44 +00004108#line 1291 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004109 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4110 break;
4111
4112 case 128:
Devang Patele01c06b2008-09-23 23:25:44 +00004113#line 1292 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004114 {
4115 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4116 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004117 break;
4118
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004119 case 129:
Devang Patele01c06b2008-09-23 23:25:44 +00004120#line 1297 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
4121 { (yyval.ParamAttrs) = (yyvsp[(1) - (1)].ParamAttrs); ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004122 break;
4123
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004124 case 130:
Devang Patele01c06b2008-09-23 23:25:44 +00004125#line 1298 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004126 {
Devang Patele01c06b2008-09-23 23:25:44 +00004127 unsigned tmp = (yyvsp[(1) - (3)].ParamAttrs) | (yyvsp[(3) - (3)].ParamAttrs);
Devang Pateldc1611f2008-09-24 00:06:15 +00004128 if ((yyvsp[(3) - (3)].ParamAttrs) == FnAttr::NoInline
4129 && ((yyvsp[(1) - (3)].ParamAttrs) & FnAttr::AlwaysInline))
Devang Patel5df692d2008-09-02 20:52:40 +00004130 GEN_ERROR("Function Notes may include only one inline notes!")
Devang Pateldc1611f2008-09-24 00:06:15 +00004131 if ((yyvsp[(3) - (3)].ParamAttrs) == FnAttr::AlwaysInline
4132 && ((yyvsp[(1) - (3)].ParamAttrs) & FnAttr::NoInline))
Devang Patel5df692d2008-09-02 20:52:40 +00004133 GEN_ERROR("Function Notes may include only one inline notes!")
Devang Patele01c06b2008-09-23 23:25:44 +00004134 (yyval.ParamAttrs) = tmp;
Devang Patel5df692d2008-09-02 20:52:40 +00004135 CHECK_FOR_ERROR
4136 ;}
4137 break;
4138
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004139 case 131:
Devang Patele01c06b2008-09-23 23:25:44 +00004140#line 1311 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateldc1611f2008-09-24 00:06:15 +00004141 { (yyval.ParamAttrs) = FnAttr::NoInline; ;}
Devang Patel5df692d2008-09-02 20:52:40 +00004142 break;
4143
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004144 case 132:
Devang Patele01c06b2008-09-23 23:25:44 +00004145#line 1312 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateldc1611f2008-09-24 00:06:15 +00004146 { (yyval.ParamAttrs) = FnAttr::AlwaysInline; ;}
Devang Patel5df692d2008-09-02 20:52:40 +00004147 break;
4148
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004149 case 133:
Devang Patele01c06b2008-09-23 23:25:44 +00004150#line 1313 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateldc1611f2008-09-24 00:06:15 +00004151 { (yyval.ParamAttrs) = FnAttr::OptimizeForSize; ;}
Devang Patel5df692d2008-09-02 20:52:40 +00004152 break;
4153
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004154 case 134:
Devang Patele01c06b2008-09-23 23:25:44 +00004155#line 1316 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateldc1611f2008-09-24 00:06:15 +00004156 { (yyval.ParamAttrs) = FnAttr::None; ;}
Devang Patel5df692d2008-09-02 20:52:40 +00004157 break;
4158
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004159 case 135:
Devang Patele01c06b2008-09-23 23:25:44 +00004160#line 1317 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004161 {
Devang Patele01c06b2008-09-23 23:25:44 +00004162 (yyval.ParamAttrs) = (yyvsp[(3) - (4)].ParamAttrs);
Devang Patel5df692d2008-09-02 20:52:40 +00004163 ;}
4164 break;
4165
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004166 case 136:
Devang Patele01c06b2008-09-23 23:25:44 +00004167#line 1322 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004168 { (yyval.StrVal) = 0; ;}
4169 break;
4170
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004171 case 137:
Devang Patele01c06b2008-09-23 23:25:44 +00004172#line 1323 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004173 {
4174 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4175 ;}
4176 break;
4177
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004178 case 138:
Devang Patele01c06b2008-09-23 23:25:44 +00004179#line 1330 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004180 { (yyval.UIntVal) = 0; ;}
4181 break;
4182
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004183 case 139:
Devang Patele01c06b2008-09-23 23:25:44 +00004184#line 1331 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004185 {
4186 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4187 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004188 GEN_ERROR("Alignment must be a power of two");
4189 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004190;}
4191 break;
4192
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004193 case 140:
Devang Patele01c06b2008-09-23 23:25:44 +00004194#line 1337 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004195 { (yyval.UIntVal) = 0; ;}
4196 break;
4197
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004198 case 141:
Devang Patele01c06b2008-09-23 23:25:44 +00004199#line 1338 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004200 {
4201 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4202 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00004203 GEN_ERROR("Alignment must be a power of two");
4204 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004205;}
4206 break;
4207
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004208 case 142:
Devang Patele01c06b2008-09-23 23:25:44 +00004209#line 1347 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004210 {
4211 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4212 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004213 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00004214 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004215 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004216;}
4217 break;
4218
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004219 case 143:
Devang Patele01c06b2008-09-23 23:25:44 +00004220#line 1355 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004221 { (yyval.StrVal) = 0; ;}
4222 break;
4223
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004224 case 144:
Devang Patele01c06b2008-09-23 23:25:44 +00004225#line 1356 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004226 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4227 break;
4228
Devang Patel5df692d2008-09-02 20:52:40 +00004229 case 145:
Devang Patele01c06b2008-09-23 23:25:44 +00004230#line 1361 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004231 {;}
4232 break;
4233
Devang Patel5df692d2008-09-02 20:52:40 +00004234 case 146:
Devang Patele01c06b2008-09-23 23:25:44 +00004235#line 1362 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004236 {;}
4237 break;
4238
4239 case 147:
Devang Patele01c06b2008-09-23 23:25:44 +00004240#line 1363 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004241 {
4242 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4243 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004244 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004245 ;}
4246 break;
4247
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004248 case 148:
Devang Patele01c06b2008-09-23 23:25:44 +00004249#line 1368 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004250 {
4251 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004252 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004253 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004254 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004255 ;}
4256 break;
4257
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004258 case 156:
Devang Patele01c06b2008-09-23 23:25:44 +00004259#line 1384 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004260 {
4261 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004262 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004263 ;}
4264 break;
4265
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004266 case 157:
Devang Patele01c06b2008-09-23 23:25:44 +00004267#line 1388 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004268 {
4269 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004270 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004271 ;}
4272 break;
4273
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004274 case 158:
Devang Patele01c06b2008-09-23 23:25:44 +00004275#line 1392 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004276 { // Pointer type?
4277 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004278 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004279 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4280 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004281 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004282 ;}
4283 break;
4284
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004285 case 159:
Devang Patele01c06b2008-09-23 23:25:44 +00004286#line 1399 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004287 { // Named types are also simple types...
4288 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004289 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004290 (yyval.TypeVal) = new PATypeHolder(tmp);
4291 ;}
4292 break;
4293
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004294 case 160:
Devang Patele01c06b2008-09-23 23:25:44 +00004295#line 1404 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004296 { // Type UpReference
4297 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004298 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004299 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4300 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004301 UR_OUT("New Upreference!\n");
4302 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004303 ;}
4304 break;
4305
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004306 case 161:
Devang Patele01c06b2008-09-23 23:25:44 +00004307#line 1412 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004308 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004309 // Allow but ignore attributes on function types; this permits auto-upgrade.
4310 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004311 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4312 if (!FunctionType::isValidReturnType(RetTy))
4313 GEN_ERROR("Invalid result type for LLVM function");
4314
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004315 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004316 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004317 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004318 const Type *Ty = I->Ty->get();
4319 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004320 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004321
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4323 if (isVarArg) Params.pop_back();
4324
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004325 for (unsigned i = 0; i != Params.size(); ++i)
4326 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4327 GEN_ERROR("Function arguments must be value types!");
4328
4329 CHECK_FOR_ERROR
4330
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004331 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004332 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4333 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4334 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004335 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004336 ;}
4337 break;
4338
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004339 case 162:
Devang Patele01c06b2008-09-23 23:25:44 +00004340#line 1441 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004341 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004342 // Allow but ignore attributes on function types; this permits auto-upgrade.
4343 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004344 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004345 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004346 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004347 const Type* Ty = I->Ty->get();
4348 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004349 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004350
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004351 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4352 if (isVarArg) Params.pop_back();
4353
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004354 for (unsigned i = 0; i != Params.size(); ++i)
4355 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4356 GEN_ERROR("Function arguments must be value types!");
4357
4358 CHECK_FOR_ERROR
4359
Dan Gohman54392c12008-04-19 00:24:39 +00004360 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4361 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4362 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004363 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004364 ;}
4365 break;
4366
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004367 case 163:
Devang Patele01c06b2008-09-23 23:25:44 +00004368#line 1466 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004369 { // Sized array type?
Dan Gohmane5febe42008-05-31 00:58:22 +00004370 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohman54392c12008-04-19 00:24:39 +00004371 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004372 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004373 ;}
4374 break;
4375
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004376 case 164:
Devang Patele01c06b2008-09-23 23:25:44 +00004377#line 1471 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004378 { // Vector type?
4379 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4380 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004381 GEN_ERROR("Unsigned result not equal to signed result");
4382 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4383 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004384 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4385 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004386 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004387 ;}
4388 break;
4389
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004390 case 165:
Devang Patele01c06b2008-09-23 23:25:44 +00004391#line 1481 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004392 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004393 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004394 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4395 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004396 Elements.push_back(*I);
4397
Dan Gohman54392c12008-04-19 00:24:39 +00004398 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4399 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004400 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004401 ;}
4402 break;
4403
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004404 case 166:
Devang Patele01c06b2008-09-23 23:25:44 +00004405#line 1491 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004406 { // Empty structure type?
4407 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004408 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004409 ;}
4410 break;
4411
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004412 case 167:
Devang Patele01c06b2008-09-23 23:25:44 +00004413#line 1495 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004414 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004415 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004416 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4417 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004418 Elements.push_back(*I);
4419
Dan Gohman54392c12008-04-19 00:24:39 +00004420 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4421 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004422 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004423 ;}
4424 break;
4425
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004426 case 168:
Devang Patele01c06b2008-09-23 23:25:44 +00004427#line 1505 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004428 { // Empty structure type?
4429 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004430 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004431 ;}
4432 break;
4433
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004434 case 169:
Devang Patele01c06b2008-09-23 23:25:44 +00004435#line 1512 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004436 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004437 // Allow but ignore attributes on function types; this permits auto-upgrade.
4438 // FIXME: remove in LLVM 3.0.
Dan Gohman54392c12008-04-19 00:24:39 +00004439 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4440 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4441 ;}
4442 break;
4443
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004444 case 170:
Devang Patele01c06b2008-09-23 23:25:44 +00004445#line 1521 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004446 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004447 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004448 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4449 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004450 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004451 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4452 ;}
4453 break;
4454
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004455 case 171:
Devang Patele01c06b2008-09-23 23:25:44 +00004456#line 1528 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004457 {
4458 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4459 ;}
4460 break;
4461
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004462 case 172:
Devang Patele01c06b2008-09-23 23:25:44 +00004463#line 1533 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004464 {
4465 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4466 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004467 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004468 ;}
4469 break;
4470
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004471 case 173:
Devang Patele01c06b2008-09-23 23:25:44 +00004472#line 1538 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004473 {
4474 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004475 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004476 ;}
4477 break;
4478
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004479 case 175:
Devang Patele01c06b2008-09-23 23:25:44 +00004480#line 1546 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004481 {
4482 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004483 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4484 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004485 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004486 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004487 ;}
4488 break;
4489
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004490 case 176:
Devang Patele01c06b2008-09-23 23:25:44 +00004491#line 1553 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004492 {
4493 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004494 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4495 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004496 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004497 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004498 ;}
4499 break;
4500
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004501 case 177:
Devang Patele01c06b2008-09-23 23:25:44 +00004502#line 1560 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004503 {
4504 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004505 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004506 ;}
4507 break;
4508
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004509 case 178:
Devang Patele01c06b2008-09-23 23:25:44 +00004510#line 1568 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004511 {
4512 (yyval.TypeList) = new std::list<PATypeHolder>();
4513 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4514 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004515 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004516 ;}
4517 break;
4518
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004519 case 179:
Devang Patele01c06b2008-09-23 23:25:44 +00004520#line 1574 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004521 {
4522 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4523 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004524 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004525 ;}
4526 break;
4527
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004528 case 180:
Devang Patele01c06b2008-09-23 23:25:44 +00004529#line 1586 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004530 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004531 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004532 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4533 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004534 if (ATy == 0)
4535 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004536 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004537 const Type *ETy = ATy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004538 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004539
4540 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004541 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004542 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004543 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004544 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004545
4546 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004547 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4548 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004549 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4550 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004551 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004552 }
4553
Dan Gohman54392c12008-04-19 00:24:39 +00004554 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4555 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004556 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004557 ;}
4558 break;
4559
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004560 case 181:
Devang Patele01c06b2008-09-23 23:25:44 +00004561#line 1614 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004562 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004563 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004564 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4565 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004566 if (ATy == 0)
4567 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004568 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004569
Dan Gohman7185e4b2008-06-23 18:43:26 +00004570 uint64_t NumElements = ATy->getNumElements();
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004571 if (NumElements != uint64_t(-1) && NumElements != 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004572 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004573 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004574 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4575 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004576 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004577 ;}
4578 break;
4579
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004580 case 182:
Devang Patele01c06b2008-09-23 23:25:44 +00004581#line 1630 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004582 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004583 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004584 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4585 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004586 if (ATy == 0)
4587 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004588 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004589
Dan Gohman7185e4b2008-06-23 18:43:26 +00004590 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004591 const Type *ETy = ATy->getElementType();
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004592 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004593 GEN_ERROR("Can't build string constant of size " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004594 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4595 " when array has size " + utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004596 std::vector<Constant*> Vals;
4597 if (ETy == Type::Int8Ty) {
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004598 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohman54392c12008-04-19 00:24:39 +00004599 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004600 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004601 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004602 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4603 }
Dan Gohman54392c12008-04-19 00:24:39 +00004604 delete (yyvsp[(3) - (3)].StrVal);
4605 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4606 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004607 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004608 ;}
4609 break;
4610
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004611 case 183:
Devang Patele01c06b2008-09-23 23:25:44 +00004612#line 1657 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004613 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004614 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004615 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4616 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004617 if (PTy == 0)
4618 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004619 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004620 const Type *ETy = PTy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004621 unsigned NumElements = PTy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004622
4623 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004624 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004625 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004626 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004627 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004628
4629 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004630 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4631 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004632 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4633 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004634 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004635 }
4636
Dan Gohman54392c12008-04-19 00:24:39 +00004637 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4638 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004639 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004640 ;}
4641 break;
4642
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004643 case 184:
Devang Patele01c06b2008-09-23 23:25:44 +00004644#line 1685 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004645 {
4646 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004647 if (STy == 0)
4648 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004649 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650
Dan Gohman54392c12008-04-19 00:24:39 +00004651 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004652 GEN_ERROR("Illegal number of initializers for structure type");
4653
4654 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004655 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4656 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004657 GEN_ERROR("Expected type '" +
4658 STy->getElementType(i)->getDescription() +
4659 "' for element #" + utostr(i) +
4660 " of structure initializer");
4661
4662 // Check to ensure that Type is not packed
4663 if (STy->isPacked())
4664 GEN_ERROR("Unpacked Initializer to vector type '" +
4665 STy->getDescription() + "'");
4666
Dan Gohman54392c12008-04-19 00:24:39 +00004667 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4668 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004669 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004670 ;}
4671 break;
4672
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004673 case 185:
Devang Patele01c06b2008-09-23 23:25:44 +00004674#line 1711 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004675 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004676 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004677 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4678 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004679 if (STy == 0)
4680 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004681 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004682
4683 if (STy->getNumContainedTypes() != 0)
4684 GEN_ERROR("Illegal number of initializers for structure type");
4685
4686 // Check to ensure that Type is not packed
4687 if (STy->isPacked())
4688 GEN_ERROR("Unpacked Initializer to vector type '" +
4689 STy->getDescription() + "'");
4690
Dan Gohman54392c12008-04-19 00:24:39 +00004691 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4692 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004693 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004694 ;}
4695 break;
4696
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004697 case 186:
Devang Patele01c06b2008-09-23 23:25:44 +00004698#line 1731 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004699 {
4700 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004701 if (STy == 0)
4702 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004703 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004704
Dan Gohman54392c12008-04-19 00:24:39 +00004705 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004706 GEN_ERROR("Illegal number of initializers for structure type");
4707
4708 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004709 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4710 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004711 GEN_ERROR("Expected type '" +
4712 STy->getElementType(i)->getDescription() +
4713 "' for element #" + utostr(i) +
4714 " of structure initializer");
4715
4716 // Check to ensure that Type is packed
4717 if (!STy->isPacked())
4718 GEN_ERROR("Vector initializer to non-vector type '" +
4719 STy->getDescription() + "'");
4720
Dan Gohman54392c12008-04-19 00:24:39 +00004721 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4722 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004723 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004724 ;}
4725 break;
4726
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004727 case 187:
Devang Patele01c06b2008-09-23 23:25:44 +00004728#line 1757 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004729 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004730 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004731 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4732 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004733 if (STy == 0)
4734 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004735 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004736
4737 if (STy->getNumContainedTypes() != 0)
4738 GEN_ERROR("Illegal number of initializers for structure type");
4739
4740 // Check to ensure that Type is packed
4741 if (!STy->isPacked())
4742 GEN_ERROR("Vector initializer to non-vector type '" +
4743 STy->getDescription() + "'");
4744
Dan Gohman54392c12008-04-19 00:24:39 +00004745 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4746 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004747 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004748 ;}
4749 break;
4750
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004751 case 188:
Devang Patele01c06b2008-09-23 23:25:44 +00004752#line 1777 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004753 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004754 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004755 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4756 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004757 if (PTy == 0)
4758 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004759 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004760
Dan Gohman54392c12008-04-19 00:24:39 +00004761 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4762 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004763 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004764 ;}
4765 break;
4766
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004767 case 189:
Devang Patele01c06b2008-09-23 23:25:44 +00004768#line 1789 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004769 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004770 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004771 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4772 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4773 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004774 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004775 ;}
4776 break;
4777
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004778 case 190:
Devang Patele01c06b2008-09-23 23:25:44 +00004779#line 1796 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004780 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004781 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004782 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4783 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004784 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004785 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004786
4787 // ConstExprs can exist in the body of a function, thus creating
4788 // GlobalValues whenever they refer to a variable. Because we are in
4789 // the context of a function, getExistingVal will search the functions
4790 // symbol table instead of the module symbol table for the global symbol,
4791 // which throws things all off. To get around this, we just tell
4792 // getExistingVal that we are at global scope here.
4793 //
4794 Function *SavedCurFn = CurFun.CurrentFunction;
4795 CurFun.CurrentFunction = 0;
4796
Dan Gohman54392c12008-04-19 00:24:39 +00004797 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004798 CHECK_FOR_ERROR
4799
4800 CurFun.CurrentFunction = SavedCurFn;
4801
4802 // If this is an initializer for a constant pointer, which is referencing a
4803 // (currently) undefined variable, create a stub now that shall be replaced
4804 // in the future with the right type of variable.
4805 //
4806 if (V == 0) {
4807 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4808 const PointerType *PT = cast<PointerType>(Ty);
4809
4810 // First check to see if the forward references value is already created!
4811 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004812 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004813
4814 if (I != CurModule.GlobalRefs.end()) {
4815 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004816 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004817 } else {
4818 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004819 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4820 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4821 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004822 GEN_ERROR("Invalid reference to global");
4823
4824 // Create the forward referenced global.
4825 GlobalValue *GV;
4826 if (const FunctionType *FTy =
4827 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004828 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4829 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004830 } else {
4831 GV = new GlobalVariable(PT->getElementType(), false,
4832 GlobalValue::ExternalWeakLinkage, 0,
4833 Name, CurModule.CurrentModule);
4834 }
4835
4836 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004837 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004838 V = GV;
4839 }
4840 }
4841
Dan Gohman54392c12008-04-19 00:24:39 +00004842 (yyval.ConstVal) = cast<GlobalValue>(V);
4843 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004844 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004845 ;}
4846 break;
4847
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004848 case 191:
Devang Patele01c06b2008-09-23 23:25:44 +00004849#line 1862 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004850 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004851 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004852 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4853 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004854 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004855 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4856 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4857 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004858 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004859 ;}
4860 break;
4861
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004862 case 192:
Devang Patele01c06b2008-09-23 23:25:44 +00004863#line 1872 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004864 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004865 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004866 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4867 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004868 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4869 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004870 (yyval.ConstVal) = Constant::getNullValue(Ty);
4871 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004872 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004873 ;}
4874 break;
4875
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004876 case 193:
Devang Patele01c06b2008-09-23 23:25:44 +00004877#line 1882 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004878 { // integral constants
4879 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004880 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004881 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004882 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004883 ;}
4884 break;
4885
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004886 case 194:
Devang Patele01c06b2008-09-23 23:25:44 +00004887#line 1888 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004888 { // arbitrary precision integer constants
4889 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4890 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004891 GEN_ERROR("Constant value does not fit in type");
4892 }
Dan Gohman54392c12008-04-19 00:24:39 +00004893 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4894 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4895 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004896 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004897 ;}
4898 break;
4899
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004900 case 195:
Devang Patele01c06b2008-09-23 23:25:44 +00004901#line 1898 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004902 { // integral constants
4903 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004904 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004905 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004906 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004907 ;}
4908 break;
4909
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004910 case 196:
Devang Patele01c06b2008-09-23 23:25:44 +00004911#line 1904 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004912 { // arbitrary precision integer constants
4913 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4914 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004915 GEN_ERROR("Constant value does not fit in type");
4916 }
Dan Gohman54392c12008-04-19 00:24:39 +00004917 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4918 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4919 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004920 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004921 ;}
4922 break;
4923
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004924 case 197:
Devang Patele01c06b2008-09-23 23:25:44 +00004925#line 1914 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004926 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004927 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4928 GEN_ERROR("Constant true must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004929 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004930 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004931 ;}
4932 break;
4933
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004934 case 198:
Devang Patele01c06b2008-09-23 23:25:44 +00004935#line 1920 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004936 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004937 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4938 GEN_ERROR("Constant false must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004939 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004940 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004941 ;}
4942 break;
4943
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004944 case 199:
Devang Patele01c06b2008-09-23 23:25:44 +00004945#line 1926 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004946 { // Floating point constants
4947 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004948 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004949 // Lexer has no type info, so builds all float and double FP constants
4950 // as double. Fix this here. Long double is done right.
Dan Gohman54392c12008-04-19 00:24:39 +00004951 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4952 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +00004953 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004954 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004955 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004956 ;}
4957 break;
4958
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004959 case 200:
Devang Patele01c06b2008-09-23 23:25:44 +00004960#line 1939 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004961 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004962 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004963 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4964 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4965 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4966 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004967 GEN_ERROR("invalid cast opcode for cast from '" +
4968 Val->getType()->getDescription() + "' to '" +
4969 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004970 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4971 delete (yyvsp[(5) - (6)].TypeVal);
4972 ;}
4973 break;
4974
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004975 case 201:
Devang Patele01c06b2008-09-23 23:25:44 +00004976#line 1951 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004977 {
4978 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004979 GEN_ERROR("GetElementPtr requires a pointer operand");
4980
4981 const Type *IdxTy =
Dan Gohman8055f772008-05-15 19:50:34 +00004982 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004983 if (!IdxTy)
4984 GEN_ERROR("Index list invalid for constant getelementptr");
4985
4986 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00004987 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4988 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004989 IdxVec.push_back(C);
4990 else
4991 GEN_ERROR("Indices to constant getelementptr must be constants");
4992
Dan Gohman54392c12008-04-19 00:24:39 +00004993 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004994
Dan Gohman54392c12008-04-19 00:24:39 +00004995 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004996 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004997 ;}
4998 break;
4999
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005000 case 202:
Devang Patele01c06b2008-09-23 23:25:44 +00005001#line 1972 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005002 {
5003 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005004 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00005005 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005006 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005007 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005008 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005009 ;}
5010 break;
5011
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005012 case 203:
Devang Patele01c06b2008-09-23 23:25:44 +00005013#line 1980 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005014 {
5015 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005016 GEN_ERROR("Binary operator types must match");
5017 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00005018 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5019 ;}
5020 break;
5021
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005022 case 204:
Devang Patele01c06b2008-09-23 23:25:44 +00005023#line 1986 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005024 {
5025 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005026 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005027 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Nate Begemanbb1ce942008-07-29 15:49:41 +00005028 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00005029 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005030 GEN_ERROR("Logical operator requires integral operands");
5031 }
Dan Gohman54392c12008-04-19 00:24:39 +00005032 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005033 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005034 ;}
5035 break;
5036
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005037 case 205:
Devang Patele01c06b2008-09-23 23:25:44 +00005038#line 1997 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005039 {
5040 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005041 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005042 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5043 ;}
5044 break;
5045
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005046 case 206:
Devang Patele01c06b2008-09-23 23:25:44 +00005047#line 2002 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005048 {
5049 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005050 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005051 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5052 ;}
5053 break;
5054
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005055 case 207:
Devang Patele01c06b2008-09-23 23:25:44 +00005056#line 2007 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005057 {
5058 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5059 GEN_ERROR("vicmp operand types must match");
5060 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5061 ;}
5062 break;
5063
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005064 case 208:
Devang Patele01c06b2008-09-23 23:25:44 +00005065#line 2012 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005066 {
5067 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5068 GEN_ERROR("vfcmp operand types must match");
5069 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5070 ;}
5071 break;
5072
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005073 case 209:
Devang Patele01c06b2008-09-23 23:25:44 +00005074#line 2017 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005075 {
5076 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005077 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005078 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005079 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005080 ;}
5081 break;
5082
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005083 case 210:
Devang Patele01c06b2008-09-23 23:25:44 +00005084#line 2023 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005085 {
5086 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005087 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005088 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005089 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005090 ;}
5091 break;
5092
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005093 case 211:
Devang Patele01c06b2008-09-23 23:25:44 +00005094#line 2029 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005095 {
5096 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005097 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005098 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005099 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005100 ;}
5101 break;
5102
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005103 case 212:
Devang Patele01c06b2008-09-23 23:25:44 +00005104#line 2035 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005105 {
5106 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5107 GEN_ERROR("ExtractValue requires an aggregate operand");
5108
Dan Gohmane5febe42008-05-31 00:58:22 +00005109 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5110 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005111 CHECK_FOR_ERROR
5112 ;}
5113 break;
5114
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005115 case 213:
Devang Patele01c06b2008-09-23 23:25:44 +00005116#line 2043 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005117 {
5118 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5119 GEN_ERROR("InsertValue requires an aggregate operand");
5120
Dan Gohmane5febe42008-05-31 00:58:22 +00005121 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5122 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005123 CHECK_FOR_ERROR
5124 ;}
5125 break;
5126
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005127 case 214:
Devang Patele01c06b2008-09-23 23:25:44 +00005128#line 2054 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005129 {
5130 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005131 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005132 ;}
5133 break;
5134
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005135 case 215:
Devang Patele01c06b2008-09-23 23:25:44 +00005136#line 2058 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005137 {
5138 (yyval.ConstVector) = new std::vector<Constant*>();
5139 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005140 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005141 ;}
5142 break;
5143
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005144 case 216:
Devang Patele01c06b2008-09-23 23:25:44 +00005145#line 2066 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005146 { (yyval.BoolVal) = false; ;}
Nate Begeman646fa482008-05-12 19:01:56 +00005147 break;
5148
Devang Patel5df692d2008-09-02 20:52:40 +00005149 case 217:
Devang Patele01c06b2008-09-23 23:25:44 +00005150#line 2066 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005151 { (yyval.BoolVal) = true; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005152 break;
5153
Devang Patel5df692d2008-09-02 20:52:40 +00005154 case 218:
Devang Patele01c06b2008-09-23 23:25:44 +00005155#line 2069 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005156 { (yyval.BoolVal) = true; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00005157 break;
5158
Devang Patel5df692d2008-09-02 20:52:40 +00005159 case 219:
Devang Patele01c06b2008-09-23 23:25:44 +00005160#line 2069 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005161 { (yyval.BoolVal) = false; ;}
5162 break;
5163
5164 case 220:
Devang Patele01c06b2008-09-23 23:25:44 +00005165#line 2072 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005166 {
5167 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5168 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00005169 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005170 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5171 if (!Aliasee)
5172 GEN_ERROR("Aliases can be created only to global values");
5173
Dan Gohman54392c12008-04-19 00:24:39 +00005174 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005175 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005176 delete (yyvsp[(1) - (2)].TypeVal);
5177 ;}
5178 break;
5179
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005180 case 221:
Devang Patele01c06b2008-09-23 23:25:44 +00005181#line 2084 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005182 {
5183 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5184 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5185 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005186 GEN_ERROR("invalid cast opcode for cast from '" +
5187 Val->getType()->getDescription() + "' to '" +
5188 DestTy->getDescription() + "'");
5189
Dan Gohman54392c12008-04-19 00:24:39 +00005190 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005191 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005192 delete (yyvsp[(5) - (6)].TypeVal);
5193 ;}
5194 break;
5195
Devang Patel5df692d2008-09-02 20:52:40 +00005196 case 222:
Devang Patele01c06b2008-09-23 23:25:44 +00005197#line 2105 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005198 {
5199 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5200 CurModule.ModuleDone();
5201 CHECK_FOR_ERROR;
5202 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005203 break;
5204
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005205 case 223:
Devang Patele01c06b2008-09-23 23:25:44 +00005206#line 2110 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005207 {
5208 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5209 CurModule.ModuleDone();
5210 CHECK_FOR_ERROR;
5211 ;}
Chris Lattner906773a2008-08-29 17:20:18 +00005212 break;
5213
Devang Patel5df692d2008-09-02 20:52:40 +00005214 case 226:
Devang Patele01c06b2008-09-23 23:25:44 +00005215#line 2123 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005216 { CurFun.isDeclare = false; ;}
5217 break;
5218
5219 case 227:
Devang Patele01c06b2008-09-23 23:25:44 +00005220#line 2123 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005221 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005222 CurFun.FunctionDone();
5223 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005224 ;}
5225 break;
5226
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005227 case 228:
Devang Patele01c06b2008-09-23 23:25:44 +00005228#line 2127 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005229 { CurFun.isDeclare = true; ;}
5230 break;
5231
Devang Patel5df692d2008-09-02 20:52:40 +00005232 case 229:
Devang Patele01c06b2008-09-23 23:25:44 +00005233#line 2127 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005234 {
5235 CHECK_FOR_ERROR
5236 ;}
5237 break;
5238
Devang Patel5df692d2008-09-02 20:52:40 +00005239 case 230:
Devang Patele01c06b2008-09-23 23:25:44 +00005240#line 2130 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005241 {
5242 CHECK_FOR_ERROR
5243 ;}
5244 break;
5245
5246 case 231:
Devang Patele01c06b2008-09-23 23:25:44 +00005247#line 2133 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005248 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005249 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005250 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005251 // Eagerly resolve types. This is not an optimization, this is a
5252 // requirement that is due to the fact that we could have this:
5253 //
5254 // %list = type { %list * }
5255 // %list = type { %list * } ; repeated type decl
5256 //
5257 // If types are not resolved eagerly, then the two types will not be
5258 // determined to be the same type!
5259 //
Dan Gohman54392c12008-04-19 00:24:39 +00005260 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005261
Dan Gohman54392c12008-04-19 00:24:39 +00005262 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005263 CHECK_FOR_ERROR
5264 // If this is a named type that is not a redefinition, add it to the slot
5265 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005266 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005267 }
5268
Dan Gohman54392c12008-04-19 00:24:39 +00005269 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005270 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005271 ;}
5272 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005273
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005274 case 232:
Devang Patele01c06b2008-09-23 23:25:44 +00005275#line 2157 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005276 {
5277 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5278
5279 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005280 CHECK_FOR_ERROR
5281 // If this is a named type that is not a redefinition, add it to the slot
5282 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005283 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005284 }
5285 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005286 ;}
5287 break;
5288
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005289 case 233:
Devang Patele01c06b2008-09-23 23:25:44 +00005290#line 2169 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005291 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005292 /* "Externally Visible" Linkage */
Dan Gohman54392c12008-04-19 00:24:39 +00005293 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005294 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005295 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5296 (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 +00005297 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005298 ;}
5299 break;
5300
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005301 case 234:
Devang Patele01c06b2008-09-23 23:25:44 +00005302#line 2176 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005303 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005304 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005305 ;}
5306 break;
5307
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005308 case 235:
Devang Patele01c06b2008-09-23 23:25:44 +00005309#line 2180 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005310 {
5311 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005312 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005313 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 +00005314 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005315 ;}
5316 break;
5317
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005318 case 236:
Devang Patele01c06b2008-09-23 23:25:44 +00005319#line 2185 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005320 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005321 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005322 ;}
5323 break;
5324
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005325 case 237:
Devang Patele01c06b2008-09-23 23:25:44 +00005326#line 2189 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005327 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005328 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005329 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5330 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 +00005331 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005332 delete (yyvsp[(6) - (7)].TypeVal);
5333 ;}
5334 break;
5335
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005336 case 238:
Devang Patele01c06b2008-09-23 23:25:44 +00005337#line 2195 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005338 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005339 CurGV = 0;
5340 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005341 ;}
5342 break;
5343
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005344 case 239:
Devang Patele01c06b2008-09-23 23:25:44 +00005345#line 2199 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005346 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005347 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005348 if ((yyvsp[(1) - (5)].StrVal)) {
5349 Name = *(yyvsp[(1) - (5)].StrVal);
5350 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005351 }
5352 if (Name.empty())
5353 GEN_ERROR("Alias name cannot be empty");
5354
Dan Gohman54392c12008-04-19 00:24:39 +00005355 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005356 if (Aliasee == 0)
5357 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5358
Dan Gohman54392c12008-04-19 00:24:39 +00005359 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005360 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005361 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005362 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005363
5364
5365 // If there was a forward reference of this alias, resolve it now.
5366
5367 ValID ID;
5368 if (!Name.empty())
5369 ID = ValID::createGlobalName(Name);
5370 else
5371 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5372
5373 if (GlobalValue *FWGV =
5374 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5375 // Replace uses of the fwdref with the actual alias.
5376 FWGV->replaceAllUsesWith(GA);
5377 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5378 GV->eraseFromParent();
5379 else
5380 cast<Function>(FWGV)->eraseFromParent();
5381 }
5382 ID.destroy();
5383
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005384 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005385 ;}
5386 break;
5387
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005388 case 240:
Devang Patele01c06b2008-09-23 23:25:44 +00005389#line 2239 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005390 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005391 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005392 ;}
5393 break;
5394
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005395 case 241:
Devang Patele01c06b2008-09-23 23:25:44 +00005396#line 2242 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005397 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005398 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005399 ;}
5400 break;
5401
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005402 case 242:
Devang Patele01c06b2008-09-23 23:25:44 +00005403#line 2248 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005404 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005405 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5406 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005407 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005408 else
Dan Gohman54392c12008-04-19 00:24:39 +00005409 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5410 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005411 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005412;}
5413 break;
5414
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005415 case 243:
Devang Patele01c06b2008-09-23 23:25:44 +00005416#line 2258 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005417 {
5418 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5419 delete (yyvsp[(3) - (3)].StrVal);
5420 ;}
5421 break;
5422
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005423 case 244:
Devang Patele01c06b2008-09-23 23:25:44 +00005424#line 2262 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005425 {
5426 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5427 delete (yyvsp[(3) - (3)].StrVal);
5428 ;}
5429 break;
5430
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005431 case 246:
Devang Patele01c06b2008-09-23 23:25:44 +00005432#line 2269 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005433 {
5434 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5435 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005436 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005437 ;}
5438 break;
5439
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005440 case 247:
Devang Patele01c06b2008-09-23 23:25:44 +00005441#line 2274 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005442 {
5443 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5444 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005445 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005446 ;}
5447 break;
5448
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005449 case 248:
Devang Patele01c06b2008-09-23 23:25:44 +00005450#line 2279 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005451 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005452 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005453 ;}
5454 break;
5455
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005456 case 249:
Devang Patele01c06b2008-09-23 23:25:44 +00005457#line 2288 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005458 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005459 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005460 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005461 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5462 GEN_ERROR("Argument types must be first-class");
Dan Gohman54392c12008-04-19 00:24:39 +00005463 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5464 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5465 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005466 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005467 ;}
5468 break;
5469
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005470 case 250:
Devang Patele01c06b2008-09-23 23:25:44 +00005471#line 2298 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005472 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005473 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005474 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005475 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5476 GEN_ERROR("Argument types must be first-class");
Dan Gohman54392c12008-04-19 00:24:39 +00005477 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5478 (yyval.ArgList) = new ArgListType;
5479 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005480 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005481 ;}
5482 break;
5483
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005484 case 251:
Devang Patele01c06b2008-09-23 23:25:44 +00005485#line 2309 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005486 {
5487 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005488 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005489 ;}
5490 break;
5491
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005492 case 252:
Devang Patele01c06b2008-09-23 23:25:44 +00005493#line 2313 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005494 {
5495 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005496 struct ArgListEntry E;
5497 E.Ty = new PATypeHolder(Type::VoidTy);
5498 E.Name = 0;
5499 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005500 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005501 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005502 ;}
5503 break;
5504
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005505 case 253:
Devang Patele01c06b2008-09-23 23:25:44 +00005506#line 2322 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005507 {
5508 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005509 struct ArgListEntry E;
5510 E.Ty = new PATypeHolder(Type::VoidTy);
5511 E.Name = 0;
5512 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005513 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005514 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005515 ;}
5516 break;
5517
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005518 case 254:
Devang Patele01c06b2008-09-23 23:25:44 +00005519#line 2331 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005520 {
5521 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005522 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005523 ;}
5524 break;
5525
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005526 case 255:
Devang Patele01c06b2008-09-23 23:25:44 +00005527#line 2337 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005528 {
Devang Patel5df692d2008-09-02 20:52:40 +00005529 std::string FunctionName(*(yyvsp[(3) - (11)].StrVal));
5530 delete (yyvsp[(3) - (11)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005531
5532 // Check the function result for abstractness if this is a define. We should
5533 // have no abstract types at this point
Devang Patel5df692d2008-09-02 20:52:40 +00005534 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (11)].TypeVal)))
5535 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (11)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005536
Devang Patel5df692d2008-09-02 20:52:40 +00005537 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (11)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00005538 GEN_ERROR("Invalid result type for LLVM function");
5539
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005540 std::vector<const Type*> ParamTypeList;
Chris Lattner1c8733e2008-03-12 17:45:29 +00005541 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Devang Patel5df692d2008-09-02 20:52:40 +00005542 if ((yyvsp[(7) - (11)].ParamAttrs) != ParamAttr::None)
5543 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (11)].ParamAttrs)));
5544 if ((yyvsp[(5) - (11)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005545 unsigned index = 1;
Devang Patel5df692d2008-09-02 20:52:40 +00005546 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin(); I != (yyvsp[(5) - (11)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005547 const Type* Ty = I->Ty->get();
5548 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5549 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5550 ParamTypeList.push_back(Ty);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005551 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5552 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005553 }
5554 }
5555
5556 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5557 if (isVarArg) ParamTypeList.pop_back();
5558
Chris Lattner1c8733e2008-03-12 17:45:29 +00005559 PAListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005560 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00005561 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005562
Devang Patel5df692d2008-09-02 20:52:40 +00005563 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005564 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patel5df692d2008-09-02 20:52:40 +00005565 delete (yyvsp[(2) - (11)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005566
5567 ValID ID;
5568 if (!FunctionName.empty()) {
5569 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5570 } else {
5571 ID = ValID::createGlobalID(CurModule.Values.size());
5572 }
5573
5574 Function *Fn = 0;
5575 // See if this function was forward referenced. If so, recycle the object.
5576 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5577 // Move the function to the end of the list, from whereever it was
5578 // previously inserted.
5579 Fn = cast<Function>(FWRef);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005580 assert(Fn->getParamAttrs().isEmpty() &&
5581 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005582 CurModule.CurrentModule->getFunctionList().remove(Fn);
5583 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5584 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5585 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005586 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005587 // The existing function doesn't have the same type. This is an overload
5588 // error.
5589 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005590 } else if (Fn->getParamAttrs() != PAL) {
5591 // The existing function doesn't have the same parameter attributes.
5592 // This is an overload error.
5593 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005594 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5595 // Neither the existing or the current function is a declaration and they
5596 // have the same name and same type. Clearly this is a redefinition.
5597 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005598 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005599 // Make sure to strip off any argument names so we can't get conflicts.
5600 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5601 AI != AE; ++AI)
5602 AI->setName("");
5603 }
5604 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005605 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5606 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005607 InsertValue(Fn, CurModule.Values);
5608 }
5609
5610 CurFun.FunctionStart(Fn);
5611
5612 if (CurFun.isDeclare) {
5613 // If we have declaration, always overwrite linkage. This will allow us to
5614 // correctly handle cases, when pointer to function is passed as argument to
5615 // another function.
5616 Fn->setLinkage(CurFun.Linkage);
5617 Fn->setVisibility(CurFun.Visibility);
5618 }
Devang Patel5df692d2008-09-02 20:52:40 +00005619 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005620 Fn->setParamAttrs(PAL);
Devang Patel5df692d2008-09-02 20:52:40 +00005621 Fn->setAlignment((yyvsp[(9) - (11)].UIntVal));
5622 if ((yyvsp[(8) - (11)].StrVal)) {
5623 Fn->setSection(*(yyvsp[(8) - (11)].StrVal));
5624 delete (yyvsp[(8) - (11)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005625 }
Devang Patel5df692d2008-09-02 20:52:40 +00005626 if ((yyvsp[(10) - (11)].StrVal)) {
5627 Fn->setGC((yyvsp[(10) - (11)].StrVal)->c_str());
5628 delete (yyvsp[(10) - (11)].StrVal);
5629 }
Devang Patele01c06b2008-09-23 23:25:44 +00005630 if ((yyvsp[(11) - (11)].ParamAttrs)) {
5631 Fn->setNotes((yyvsp[(11) - (11)].ParamAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005632 }
5633
5634 // Add all of the arguments we parsed to the function...
Devang Patel5df692d2008-09-02 20:52:40 +00005635 if ((yyvsp[(5) - (11)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005636 if (isVarArg) { // Nuke the last entry
Devang Patel5df692d2008-09-02 20:52:40 +00005637 assert((yyvsp[(5) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (11)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005638 "Not a varargs marker!");
Devang Patel5df692d2008-09-02 20:52:40 +00005639 delete (yyvsp[(5) - (11)].ArgList)->back().Ty;
5640 (yyvsp[(5) - (11)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005641 }
5642 Function::arg_iterator ArgIt = Fn->arg_begin();
5643 Function::arg_iterator ArgEnd = Fn->arg_end();
5644 unsigned Idx = 1;
Devang Patel5df692d2008-09-02 20:52:40 +00005645 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin();
5646 I != (yyvsp[(5) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005647 delete I->Ty; // Delete the typeholder...
5648 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5649 CHECK_FOR_ERROR
5650 InsertValue(ArgIt);
5651 Idx++;
5652 }
5653
Devang Patel5df692d2008-09-02 20:52:40 +00005654 delete (yyvsp[(5) - (11)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005655 }
5656 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005657;}
5658 break;
5659
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005660 case 258:
Devang Patele01c06b2008-09-23 23:25:44 +00005661#line 2470 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005662 {
5663 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005664
5665 // Make sure that we keep track of the linkage type even if there was a
5666 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005667 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5668 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5669;}
5670 break;
5671
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005672 case 261:
Devang Patele01c06b2008-09-23 23:25:44 +00005673#line 2481 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005674 {
5675 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005676 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005677;}
5678 break;
5679
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005680 case 262:
Devang Patele01c06b2008-09-23 23:25:44 +00005681#line 2486 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005682 {
5683 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5684 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5685 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005686 CurFun.FunctionDone();
5687 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005688 ;}
5689 break;
5690
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005691 case 263:
Devang Patele01c06b2008-09-23 23:25:44 +00005692#line 2498 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005693 {
5694 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005695 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005696 ;}
5697 break;
5698
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005699 case 264:
Devang Patele01c06b2008-09-23 23:25:44 +00005700#line 2502 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005701 {
5702 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005703 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005704 ;}
5705 break;
5706
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005707 case 265:
Devang Patele01c06b2008-09-23 23:25:44 +00005708#line 2507 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005709 { // A reference to a direct constant
5710 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005711 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005712 ;}
5713 break;
5714
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005715 case 266:
Devang Patele01c06b2008-09-23 23:25:44 +00005716#line 2511 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005717 {
5718 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005719 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005720 ;}
5721 break;
5722
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005723 case 267:
Devang Patele01c06b2008-09-23 23:25:44 +00005724#line 2515 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005725 { // arbitrary precision integer constants
5726 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5727 delete (yyvsp[(1) - (1)].APIntVal);
5728 CHECK_FOR_ERROR
5729 ;}
5730 break;
5731
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005732 case 268:
Devang Patele01c06b2008-09-23 23:25:44 +00005733#line 2520 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005734 { // arbitrary precision integer constants
5735 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5736 delete (yyvsp[(1) - (1)].APIntVal);
5737 CHECK_FOR_ERROR
5738 ;}
5739 break;
5740
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005741 case 269:
Devang Patele01c06b2008-09-23 23:25:44 +00005742#line 2525 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005743 { // Perhaps it's an FP constant?
5744 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005745 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005746 ;}
5747 break;
5748
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005749 case 270:
Devang Patele01c06b2008-09-23 23:25:44 +00005750#line 2529 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005751 {
5752 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005753 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005754 ;}
5755 break;
5756
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005757 case 271:
Devang Patele01c06b2008-09-23 23:25:44 +00005758#line 2533 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005759 {
5760 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005761 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005762 ;}
5763 break;
5764
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005765 case 272:
Devang Patele01c06b2008-09-23 23:25:44 +00005766#line 2537 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005767 {
5768 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005769 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005770 ;}
5771 break;
5772
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005773 case 273:
Devang Patele01c06b2008-09-23 23:25:44 +00005774#line 2541 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005775 {
5776 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005777 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005778 ;}
5779 break;
5780
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005781 case 274:
Devang Patele01c06b2008-09-23 23:25:44 +00005782#line 2545 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005783 { // A vector zero constant.
5784 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005785 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005786 ;}
5787 break;
5788
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005789 case 275:
Devang Patele01c06b2008-09-23 23:25:44 +00005790#line 2549 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005791 { // Nonempty unsized packed vector
5792 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00005793 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmane5febe42008-05-31 00:58:22 +00005794
5795 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5796 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005797
5798 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005799 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005800
5801 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005802 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5803 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005804 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5805 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005806 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005807 }
5808
Dan Gohman54392c12008-04-19 00:24:39 +00005809 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5810 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005811 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005812 ;}
5813 break;
5814
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005815 case 276:
Devang Patele01c06b2008-09-23 23:25:44 +00005816#line 2571 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005817 { // Nonempty unsized arr
5818 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00005819 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005820
5821 if (!ETy->isFirstClassType())
5822 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5823
5824 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5825 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5826
5827 // Verify all elements are correct type!
5828 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5829 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5830 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5831 ETy->getDescription() +"' as required!\nIt is of type '"+
5832 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5833 }
5834
5835 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5836 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5837 CHECK_FOR_ERROR
5838 ;}
5839 break;
5840
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005841 case 277:
Devang Patele01c06b2008-09-23 23:25:44 +00005842#line 2593 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005843 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005844 // Use undef instead of an array because it's inconvenient to determine
5845 // the element type at this point, there being no elements to examine.
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005846 (yyval.ValIDVal) = ValID::createUndef();
5847 CHECK_FOR_ERROR
5848 ;}
5849 break;
5850
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005851 case 278:
Devang Patele01c06b2008-09-23 23:25:44 +00005852#line 2599 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005853 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005854 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005855 const Type *ETy = Type::Int8Ty;
5856
5857 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5858
5859 std::vector<Constant*> Vals;
5860 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5861 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5862 delete (yyvsp[(2) - (2)].StrVal);
5863 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5864 CHECK_FOR_ERROR
5865 ;}
5866 break;
5867
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005868 case 279:
Devang Patele01c06b2008-09-23 23:25:44 +00005869#line 2612 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005870 {
5871 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5872 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5873 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5874
5875 const StructType *STy = StructType::get(Elements);
5876 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5877
5878 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5879 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5880 CHECK_FOR_ERROR
5881 ;}
5882 break;
5883
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005884 case 280:
Devang Patele01c06b2008-09-23 23:25:44 +00005885#line 2624 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005886 {
5887 const StructType *STy = StructType::get(std::vector<const Type*>());
5888 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5889 CHECK_FOR_ERROR
5890 ;}
5891 break;
5892
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005893 case 281:
Devang Patele01c06b2008-09-23 23:25:44 +00005894#line 2629 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005895 {
5896 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5897 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5898 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5899
5900 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5901 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5902
5903 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5904 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5905 CHECK_FOR_ERROR
5906 ;}
5907 break;
5908
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005909 case 282:
Devang Patele01c06b2008-09-23 23:25:44 +00005910#line 2641 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005911 {
5912 const StructType *STy = StructType::get(std::vector<const Type*>(),
5913 /*isPacked=*/true);
5914 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5915 CHECK_FOR_ERROR
5916 ;}
5917 break;
5918
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005919 case 283:
Devang Patele01c06b2008-09-23 23:25:44 +00005920#line 2647 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005921 {
5922 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005923 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005924 ;}
5925 break;
5926
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005927 case 284:
Devang Patele01c06b2008-09-23 23:25:44 +00005928#line 2651 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005929 {
5930 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5931 delete (yyvsp[(3) - (5)].StrVal);
5932 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005933 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005934 ;}
5935 break;
5936
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005937 case 285:
Devang Patele01c06b2008-09-23 23:25:44 +00005938#line 2661 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005939 { // Is it an integer reference...?
5940 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005941 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005942 ;}
5943 break;
5944
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005945 case 286:
Devang Patele01c06b2008-09-23 23:25:44 +00005946#line 2665 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005947 {
5948 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005949 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005950 ;}
5951 break;
5952
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005953 case 287:
Devang Patele01c06b2008-09-23 23:25:44 +00005954#line 2669 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005955 { // Is it a named reference...?
5956 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5957 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005958 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005959 ;}
5960 break;
5961
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005962 case 288:
Devang Patele01c06b2008-09-23 23:25:44 +00005963#line 2674 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005964 { // Is it a named reference...?
5965 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5966 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005967 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005968 ;}
5969 break;
5970
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005971 case 291:
Devang Patele01c06b2008-09-23 23:25:44 +00005972#line 2687 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005973 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005974 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005975 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5976 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5977 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005978 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005979 ;}
5980 break;
5981
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005982 case 292:
Devang Patele01c06b2008-09-23 23:25:44 +00005983#line 2696 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005984 {
5985 (yyval.ValueList) = new std::vector<Value *>();
5986 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005987 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005988 ;}
5989 break;
5990
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005991 case 293:
Devang Patele01c06b2008-09-23 23:25:44 +00005992#line 2701 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005993 {
5994 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005995 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005996 ;}
5997 break;
5998
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005999 case 294:
Devang Patele01c06b2008-09-23 23:25:44 +00006000#line 2706 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006001 {
6002 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006003 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006004 ;}
6005 break;
6006
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006007 case 295:
Devang Patele01c06b2008-09-23 23:25:44 +00006008#line 2710 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006009 { // Do not allow functions with 0 basic blocks
6010 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006011 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006012 ;}
6013 break;
6014
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006015 case 296:
Devang Patele01c06b2008-09-23 23:25:44 +00006016#line 2719 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006017 {
6018 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006019 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006020 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6021 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6022 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006023 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006024 ;}
6025 break;
6026
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006027 case 297:
Devang Patele01c06b2008-09-23 23:25:44 +00006028#line 2728 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006029 {
6030 CHECK_FOR_ERROR
6031 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6032 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6033 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6034 " is incorrect, expected %" + utostr((unsigned)ValNum));
6035
6036 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6037 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6038 CHECK_FOR_ERROR
6039;}
6040 break;
6041
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006042 case 298:
Devang Patele01c06b2008-09-23 23:25:44 +00006043#line 2741 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006044 {
6045 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006046 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6047 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00006048 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6049 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6050 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006051 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006052 ;}
6053 break;
Chris Lattner59363a32008-02-19 04:36:25 +00006054
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006055 case 299:
Devang Patele01c06b2008-09-23 23:25:44 +00006056#line 2750 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006057 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00006058 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00006059 CHECK_FOR_ERROR
6060 ;}
6061 break;
6062
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006063 case 300:
Devang Patele01c06b2008-09-23 23:25:44 +00006064#line 2754 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00006065 { // Labelled (named) basic block
6066 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6067 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006068 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00006069
Dan Gohman54392c12008-04-19 00:24:39 +00006070 ;}
6071 break;
6072
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006073 case 301:
Devang Patele01c06b2008-09-23 23:25:44 +00006074#line 2762 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006075 { // Return with a result...
6076 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6077 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006078 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6079 if (VL.size() > 1 ||
6080 (isa<StructType>(ReturnType) &&
6081 (VL.empty() || VL[0]->getType() != ReturnType))) {
6082 Value *RV = UndefValue::get(ReturnType);
6083 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6084 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6085 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6086 RV = I;
6087 }
6088 (yyval.TermInstVal) = ReturnInst::Create(RV);
6089 } else {
6090 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6091 }
Dan Gohman54392c12008-04-19 00:24:39 +00006092 delete (yyvsp[(2) - (2)].ValueList);
6093 CHECK_FOR_ERROR
6094 ;}
6095 break;
6096
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006097 case 302:
Devang Patele01c06b2008-09-23 23:25:44 +00006098#line 2782 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006099 { // Return with no result...
6100 (yyval.TermInstVal) = ReturnInst::Create();
6101 CHECK_FOR_ERROR
6102 ;}
6103 break;
6104
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006105 case 303:
Devang Patele01c06b2008-09-23 23:25:44 +00006106#line 2786 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006107 { // Unconditional Branch...
6108 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6109 CHECK_FOR_ERROR
6110 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6111 ;}
6112 break;
6113
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006114 case 304:
Devang Patele01c06b2008-09-23 23:25:44 +00006115#line 2791 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006116 {
Dan Gohmane5febe42008-05-31 00:58:22 +00006117 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6118 GEN_ERROR("Branch condition must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00006119 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6120 CHECK_FOR_ERROR
6121 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6122 CHECK_FOR_ERROR
6123 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6124 CHECK_FOR_ERROR
6125 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6126 ;}
6127 break;
6128
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006129 case 305:
Devang Patele01c06b2008-09-23 23:25:44 +00006130#line 2802 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006131 {
6132 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6133 CHECK_FOR_ERROR
6134 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6135 CHECK_FOR_ERROR
6136 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6137 (yyval.TermInstVal) = S;
6138
6139 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6140 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006141 for (; I != E; ++I) {
6142 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6143 S->addCase(CI, I->second);
6144 else
6145 GEN_ERROR("Switch case is constant, but not a simple integer");
6146 }
Dan Gohman54392c12008-04-19 00:24:39 +00006147 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006148 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006149 ;}
6150 break;
6151
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006152 case 306:
Devang Patele01c06b2008-09-23 23:25:44 +00006153#line 2821 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006154 {
6155 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006156 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006157 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006158 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00006159 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00006160 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006161 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006162 ;}
6163 break;
6164
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006165 case 307:
Devang Patele01c06b2008-09-23 23:25:44 +00006166#line 2831 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006167 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006168
6169 // Handle the short syntax
6170 const PointerType *PFTy = 0;
6171 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00006172 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006173 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6174 // Pull out the types of all of the arguments...
6175 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00006176 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006177 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006178 const Type *Ty = I->Val->getType();
6179 if (Ty == Type::VoidTy)
6180 GEN_ERROR("Short call syntax cannot be used with varargs");
6181 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006182 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006183
6184 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6185 GEN_ERROR("Invalid result type for LLVM function");
6186
Dan Gohman54392c12008-04-19 00:24:39 +00006187 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006188 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006189 }
6190
Dan Gohman54392c12008-04-19 00:24:39 +00006191 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006192
Dan Gohman54392c12008-04-19 00:24:39 +00006193 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006194 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006195 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006196 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006197 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006198 CHECK_FOR_ERROR
6199
Chris Lattner1c8733e2008-03-12 17:45:29 +00006200 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006201 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6202 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006203
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006204 // Check the arguments
6205 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00006206 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006207 // Make sure no arguments is a good thing!
6208 if (Ty->getNumParams() != 0)
6209 GEN_ERROR("No arguments passed to a function that "
6210 "expects arguments");
6211 } else { // Has arguments?
6212 // Loop through FunctionType's arguments and ensure they are specified
6213 // correctly!
6214 FunctionType::param_iterator I = Ty->param_begin();
6215 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00006216 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006217 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006218
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006219 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006220 if (ArgI->Val->getType() != *I)
6221 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6222 (*I)->getDescription() + "'");
6223 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00006224 if (ArgI->Attrs != ParamAttr::None)
6225 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006226 }
6227
6228 if (Ty->isVarArg()) {
6229 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006230 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006231 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00006232 if (ArgI->Attrs != ParamAttr::None)
6233 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006234 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006235 } else if (I != E || ArgI != ArgE)
6236 GEN_ERROR("Invalid number of parameters detected");
6237 }
6238
Chris Lattner1c8733e2008-03-12 17:45:29 +00006239 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006240 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00006241 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006242
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006243 // Create the InvokeInst
Dan Gohman8055f772008-05-15 19:50:34 +00006244 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6245 Args.begin(), Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00006246 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006247 II->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006248 (yyval.TermInstVal) = II;
6249 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006250 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006251 ;}
6252 break;
6253
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006254 case 308:
Devang Patele01c06b2008-09-23 23:25:44 +00006255#line 2916 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006256 {
6257 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006258 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006259 ;}
6260 break;
6261
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006262 case 309:
Devang Patele01c06b2008-09-23 23:25:44 +00006263#line 2920 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006264 {
6265 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006266 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006267 ;}
6268 break;
6269
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006270 case 310:
Devang Patele01c06b2008-09-23 23:25:44 +00006271#line 2927 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006272 {
6273 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6274 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006275 CHECK_FOR_ERROR
6276 if (V == 0)
6277 GEN_ERROR("May only switch on a constant pool value");
6278
Dan Gohman54392c12008-04-19 00:24:39 +00006279 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006280 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006281 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6282 ;}
6283 break;
6284
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006285 case 311:
Devang Patele01c06b2008-09-23 23:25:44 +00006286#line 2938 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006287 {
6288 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6289 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006290 CHECK_FOR_ERROR
6291
6292 if (V == 0)
6293 GEN_ERROR("May only switch on a constant pool value");
6294
Dan Gohman54392c12008-04-19 00:24:39 +00006295 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006296 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006297 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6298 ;}
6299 break;
6300
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006301 case 312:
Devang Patele01c06b2008-09-23 23:25:44 +00006302#line 2951 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006303 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006304 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00006305 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006306 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006307 InsertValue((yyvsp[(2) - (2)].InstVal));
6308 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006309 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006310 ;}
6311 break;
6312
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006313 case 313:
Devang Patele01c06b2008-09-23 23:25:44 +00006314#line 2960 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006315 {
6316 CHECK_FOR_ERROR
6317 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
6318
6319 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6320 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6321 " is incorrect, expected %" + utostr((unsigned)ValNum));
6322
6323 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6324 CHECK_FOR_ERROR
6325 ;}
6326 break;
6327
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006328 case 314:
Devang Patele01c06b2008-09-23 23:25:44 +00006329#line 2973 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006330 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006331 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006332 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6333 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6334 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006335 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006336 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006337 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006338 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6339 delete (yyvsp[(1) - (6)].TypeVal);
6340 ;}
6341 break;
6342
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006343 case 315:
Devang Patele01c06b2008-09-23 23:25:44 +00006344#line 2984 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006345 {
6346 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6347 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006348 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006349 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006350 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006351 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6352 ;}
6353 break;
6354
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006355 case 316:
Devang Patele01c06b2008-09-23 23:25:44 +00006356#line 2994 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006357 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006358 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006359 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006360 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006361 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00006362 (yyval.ParamList) = new ParamList();
6363 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6364 (yyval.ParamList)->push_back(E);
6365 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006366 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006367 ;}
6368 break;
6369
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006370 case 317:
Devang Patele01c06b2008-09-23 23:25:44 +00006371#line 3005 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006372 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006373 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00006374 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00006375 (yyval.ParamList) = new ParamList();
6376 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6377 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006378 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006379 ;}
6380 break;
6381
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006382 case 318:
Devang Patele01c06b2008-09-23 23:25:44 +00006383#line 3013 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006384 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006385 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006386 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6388 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6389 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6390 (yyval.ParamList)->push_back(E);
6391 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006392 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006393 ;}
6394 break;
6395
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006396 case 319:
Devang Patele01c06b2008-09-23 23:25:44 +00006397#line 3023 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006398 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006399 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00006400 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6401 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6402 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00006403 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006404 ;}
6405 break;
6406
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006407 case 320:
Devang Patele01c06b2008-09-23 23:25:44 +00006408#line 3030 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006409 { (yyval.ParamList) = new ParamList(); ;}
6410 break;
6411
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006412 case 321:
Devang Patele01c06b2008-09-23 23:25:44 +00006413#line 3033 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006414 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6415 break;
6416
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006417 case 322:
Devang Patele01c06b2008-09-23 23:25:44 +00006418#line 3034 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006419 {
6420 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6421 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006422 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006423 ;}
6424 break;
6425
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006426 case 323:
Devang Patele01c06b2008-09-23 23:25:44 +00006427#line 3042 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006428 {
6429 (yyval.ConstantList) = new std::vector<unsigned>();
6430 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6431 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6432 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6433 ;}
6434 break;
6435
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006436 case 324:
Devang Patele01c06b2008-09-23 23:25:44 +00006437#line 3048 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006438 {
6439 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6440 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6441 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6442 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6443 CHECK_FOR_ERROR
6444 ;}
6445 break;
6446
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006447 case 325:
Devang Patele01c06b2008-09-23 23:25:44 +00006448#line 3057 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006449 {
6450 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006451 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006452 ;}
6453 break;
6454
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006455 case 326:
Devang Patele01c06b2008-09-23 23:25:44 +00006456#line 3061 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006457 {
6458 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006459 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006460 ;}
6461 break;
6462
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006463 case 327:
Devang Patele01c06b2008-09-23 23:25:44 +00006464#line 3066 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006465 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006466 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006467 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6468 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6469 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006470 GEN_ERROR(
6471 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006472 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006473 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006474 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006475 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006476 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohman54392c12008-04-19 00:24:39 +00006477 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006478 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006479 delete (yyvsp[(2) - (5)].TypeVal);
6480 ;}
6481 break;
6482
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006483 case 328:
Devang Patele01c06b2008-09-23 23:25:44 +00006484#line 3082 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006485 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006486 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006487 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6488 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begemanbb1ce942008-07-29 15:49:41 +00006489 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00006490 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006491 GEN_ERROR("Logical operator requires integral operands");
6492 }
Dan Gohman54392c12008-04-19 00:24:39 +00006493 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006494 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006495 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006496 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006497 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006498 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006499 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006500 delete (yyvsp[(2) - (5)].TypeVal);
6501 ;}
6502 break;
6503
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006504 case 329:
Devang Patele01c06b2008-09-23 23:25:44 +00006505#line 3099 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006506 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006507 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006508 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006509 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006510 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006511 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006512 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006513 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006514 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006515 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006516 delete (yyvsp[(3) - (6)].TypeVal);
6517 ;}
6518 break;
6519
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006520 case 330:
Devang Patele01c06b2008-09-23 23:25:44 +00006521#line 3111 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006522 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006523 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006524 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006525 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006526 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006527 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006528 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006529 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006530 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006531 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006532 delete (yyvsp[(3) - (6)].TypeVal);
6533 ;}
6534 break;
6535
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006536 case 331:
Devang Patele01c06b2008-09-23 23:25:44 +00006537#line 3123 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006538 {
6539 if (!UpRefs.empty())
6540 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6541 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6542 GEN_ERROR("Scalar types not supported by vicmp instruction");
6543 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6544 CHECK_FOR_ERROR
6545 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6546 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006547 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006548 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006549 GEN_ERROR("vicmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006550 delete (yyvsp[(3) - (6)].TypeVal);
6551 ;}
6552 break;
6553
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006554 case 332:
Devang Patele01c06b2008-09-23 23:25:44 +00006555#line 3137 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006556 {
6557 if (!UpRefs.empty())
6558 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6559 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6560 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6561 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6562 CHECK_FOR_ERROR
6563 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6564 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006565 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006566 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006567 GEN_ERROR("vfcmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006568 delete (yyvsp[(3) - (6)].TypeVal);
6569 ;}
6570 break;
6571
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006572 case 333:
Devang Patele01c06b2008-09-23 23:25:44 +00006573#line 3151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006574 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006575 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006576 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6577 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6578 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6579 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006580 GEN_ERROR("invalid cast opcode for cast from '" +
6581 Val->getType()->getDescription() + "' to '" +
6582 DestTy->getDescription() + "'");
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006583 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohman54392c12008-04-19 00:24:39 +00006584 delete (yyvsp[(4) - (4)].TypeVal);
6585 ;}
6586 break;
6587
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006588 case 334:
Devang Patele01c06b2008-09-23 23:25:44 +00006589#line 3163 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006590 {
Dan Gohman181f4e42008-09-09 01:13:24 +00006591 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6592 // vector select
6593 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6594 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6595 GEN_ERROR("vector select value types must be vector types");
6596 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6597 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6598 if (cond_type->getElementType() != Type::Int1Ty)
6599 GEN_ERROR("vector select condition element type must be boolean");
6600 if (cond_type->getNumElements() != select_type->getNumElements())
6601 GEN_ERROR("vector select number of elements must be the same");
6602 } else {
6603 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6604 GEN_ERROR("select condition must be boolean");
6605 }
Dan Gohman54392c12008-04-19 00:24:39 +00006606 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohman181f4e42008-09-09 01:13:24 +00006607 GEN_ERROR("select value types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00006608 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006609 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006610 ;}
6611 break;
6612
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006613 case 335:
Devang Patele01c06b2008-09-23 23:25:44 +00006614#line 3184 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006615 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006616 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006617 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6618 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6619 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006620 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006621 ;}
6622 break;
6623
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006624 case 336:
Devang Patele01c06b2008-09-23 23:25:44 +00006625#line 3191 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006626 {
6627 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006628 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006629 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006630 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006631 ;}
6632 break;
6633
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006634 case 337:
Devang Patele01c06b2008-09-23 23:25:44 +00006635#line 3197 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006636 {
6637 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006638 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006639 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006640 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006641 ;}
6642 break;
6643
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006644 case 338:
Devang Patele01c06b2008-09-23 23:25:44 +00006645#line 3203 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006646 {
6647 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006648 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006649 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006650 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006651 ;}
6652 break;
6653
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006654 case 339:
Devang Patele01c06b2008-09-23 23:25:44 +00006655#line 3209 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006656 {
6657 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006658 if (!Ty->isFirstClassType())
6659 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006660 (yyval.InstVal) = PHINode::Create(Ty);
6661 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6662 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6663 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006664 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006665 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6666 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006667 }
Dan Gohman54392c12008-04-19 00:24:39 +00006668 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006669 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006670 ;}
6671 break;
6672
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006673 case 340:
Devang Patele01c06b2008-09-23 23:25:44 +00006674#line 3225 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006675 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006676
6677 // Handle the short syntax
6678 const PointerType *PFTy = 0;
6679 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00006680 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006681 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6682 // Pull out the types of all of the arguments...
6683 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00006684 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006685 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006686 const Type *Ty = I->Val->getType();
6687 if (Ty == Type::VoidTy)
6688 GEN_ERROR("Short call syntax cannot be used with varargs");
6689 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006690 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006691
6692 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6693 GEN_ERROR("Invalid result type for LLVM function");
6694
Dan Gohman54392c12008-04-19 00:24:39 +00006695 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006696 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006697 }
6698
Dan Gohman54392c12008-04-19 00:24:39 +00006699 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006700 CHECK_FOR_ERROR
6701
6702 // Check for call to invalid intrinsic to avoid crashing later.
6703 if (Function *theF = dyn_cast<Function>(V)) {
6704 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6705 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6706 !theF->getIntrinsicID(true))
6707 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6708 theF->getName() + "'");
6709 }
6710
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006711 // Set up the ParamAttrs for the function
Chris Lattner1c8733e2008-03-12 17:45:29 +00006712 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006713 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6714 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006715 // Check the arguments
6716 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00006717 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006718 // Make sure no arguments is a good thing!
6719 if (Ty->getNumParams() != 0)
6720 GEN_ERROR("No arguments passed to a function that "
6721 "expects arguments");
6722 } else { // Has arguments?
6723 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006724 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006725 FunctionType::param_iterator I = Ty->param_begin();
6726 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00006727 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006728 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006729
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006730 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006731 if (ArgI->Val->getType() != *I)
6732 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6733 (*I)->getDescription() + "'");
6734 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00006735 if (ArgI->Attrs != ParamAttr::None)
6736 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006737 }
6738 if (Ty->isVarArg()) {
6739 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006740 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006741 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00006742 if (ArgI->Attrs != ParamAttr::None)
6743 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006744 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006745 } else if (I != E || ArgI != ArgE)
6746 GEN_ERROR("Invalid number of parameters detected");
6747 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006748
6749 // Finish off the ParamAttrs and check them
Chris Lattner1c8733e2008-03-12 17:45:29 +00006750 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006751 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00006752 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006753
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006754 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006755 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00006756 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6757 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006758 CI->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006759 (yyval.InstVal) = CI;
6760 delete (yyvsp[(6) - (8)].ParamList);
6761 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006762 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006763 ;}
6764 break;
6765
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006766 case 341:
Devang Patele01c06b2008-09-23 23:25:44 +00006767#line 3314 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006768 {
6769 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006770 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006771 ;}
6772 break;
6773
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006774 case 342:
Devang Patele01c06b2008-09-23 23:25:44 +00006775#line 3319 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006776 {
6777 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006778 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006779 ;}
6780 break;
6781
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006782 case 343:
Devang Patele01c06b2008-09-23 23:25:44 +00006783#line 3323 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006784 {
6785 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006786 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006787 ;}
6788 break;
6789
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006790 case 344:
Devang Patele01c06b2008-09-23 23:25:44 +00006791#line 3330 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006792 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006793 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006794 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6795 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6796 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006797 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006798 ;}
6799 break;
6800
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006801 case 345:
Devang Patele01c06b2008-09-23 23:25:44 +00006802#line 3337 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006803 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006804 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006805 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006806 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6807 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006808 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006809 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006810 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6811 delete (yyvsp[(2) - (6)].TypeVal);
6812 ;}
6813 break;
6814
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006815 case 346:
Devang Patele01c06b2008-09-23 23:25:44 +00006816#line 3347 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006817 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006818 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006819 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6820 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6821 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006822 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006823 ;}
6824 break;
6825
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006826 case 347:
Devang Patele01c06b2008-09-23 23:25:44 +00006827#line 3354 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006828 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006829 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006830 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006831 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6832 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006833 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006834 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006835 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6836 delete (yyvsp[(2) - (6)].TypeVal);
6837 ;}
6838 break;
6839
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006840 case 348:
Devang Patele01c06b2008-09-23 23:25:44 +00006841#line 3364 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006842 {
6843 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006844 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006845 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6846 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006847 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006848 ;}
6849 break;
6850
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006851 case 349:
Devang Patele01c06b2008-09-23 23:25:44 +00006852#line 3372 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006853 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006854 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006855 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6856 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006857 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006858 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6859 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006860 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006861 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6862 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006863 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006864 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6865 delete (yyvsp[(3) - (5)].TypeVal);
6866 ;}
6867 break;
6868
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006869 case 350:
Devang Patele01c06b2008-09-23 23:25:44 +00006870#line 3386 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006871 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006872 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006873 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6874 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006875 if (!PT)
6876 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006877 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006878 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006879 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6880 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006881 "' into space of type '" + ElTy->getDescription() + "'");
6882
Dan Gohman54392c12008-04-19 00:24:39 +00006883 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006884 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006885 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6886 delete (yyvsp[(5) - (7)].TypeVal);
6887 ;}
6888 break;
6889
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006890 case 351:
Devang Patele01c06b2008-09-23 23:25:44 +00006891#line 3403 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006892 {
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006893 if (!UpRefs.empty())
6894 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6895 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6896 GEN_ERROR("getresult insn requires an aggregate operand");
6897 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6898 GEN_ERROR("Invalid getresult index for type '" +
6899 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6900
6901 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel3b8849c2008-02-19 22:27:01 +00006902 CHECK_FOR_ERROR
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006903 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6904 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006905 ;}
6906 break;
6907
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006908 case 352:
Devang Patele01c06b2008-09-23 23:25:44 +00006909#line 3417 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006910 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006911 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006912 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6913 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006914 GEN_ERROR("getelementptr insn requires pointer operand");
6915
Dan Gohman8055f772008-05-15 19:50:34 +00006916 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006917 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006918 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6919 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006920 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006921 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6922 delete (yyvsp[(2) - (4)].TypeVal);
6923 delete (yyvsp[(4) - (4)].ValueList);
6924 ;}
6925 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006926
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006927 case 353:
Devang Patele01c06b2008-09-23 23:25:44 +00006928#line 3432 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006929 {
6930 if (!UpRefs.empty())
6931 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6932 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6933 GEN_ERROR("extractvalue insn requires an aggregate operand");
6934
Dan Gohmane5febe42008-05-31 00:58:22 +00006935 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006936 GEN_ERROR("Invalid extractvalue indices for type '" +
6937 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6938 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6939 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00006940 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006941 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00006942 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006943 ;}
6944 break;
6945
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00006946 case 354:
Devang Patele01c06b2008-09-23 23:25:44 +00006947#line 3447 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006948 {
6949 if (!UpRefs.empty())
6950 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6951 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6952 GEN_ERROR("extractvalue insn requires an aggregate operand");
6953
Dan Gohmane5febe42008-05-31 00:58:22 +00006954 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006955 GEN_ERROR("Invalid insertvalue indices for type '" +
6956 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6957 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6958 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6959 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00006960 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006961 delete (yyvsp[(2) - (7)].TypeVal);
6962 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00006963 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006964 ;}
6965 break;
6966
Dan Gohman54392c12008-04-19 00:24:39 +00006967
6968/* Line 1267 of yacc.c. */
Devang Patele01c06b2008-09-23 23:25:44 +00006969#line 6970 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00006970 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006971 }
Dan Gohman54392c12008-04-19 00:24:39 +00006972 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6973
6974 YYPOPSTACK (yylen);
6975 yylen = 0;
6976 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006977
6978 *++yyvsp = yyval;
6979
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006980
Dan Gohman54392c12008-04-19 00:24:39 +00006981 /* Now `shift' the result of the reduction. Determine what state
6982 that goes to, based on the state we popped back to and the rule
6983 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006984
6985 yyn = yyr1[yyn];
6986
Dan Gohman54392c12008-04-19 00:24:39 +00006987 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6988 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006989 yystate = yytable[yystate];
6990 else
Dan Gohman54392c12008-04-19 00:24:39 +00006991 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006992
6993 goto yynewstate;
6994
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006995
Dan Gohman54392c12008-04-19 00:24:39 +00006996/*------------------------------------.
6997| yyerrlab -- here on detecting error |
6998`------------------------------------*/
6999yyerrlab:
7000 /* If not already recovering from an error, report this error. */
7001 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007002 {
7003 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00007004#if ! YYERROR_VERBOSE
7005 yyerror (YY_("syntax error"));
7006#else
7007 {
7008 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7009 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7010 {
7011 YYSIZE_T yyalloc = 2 * yysize;
7012 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7013 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7014 if (yymsg != yymsgbuf)
7015 YYSTACK_FREE (yymsg);
7016 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7017 if (yymsg)
7018 yymsg_alloc = yyalloc;
7019 else
7020 {
7021 yymsg = yymsgbuf;
7022 yymsg_alloc = sizeof yymsgbuf;
7023 }
7024 }
Dale Johannesen3afee192007-09-07 21:07:57 +00007025
Dan Gohman54392c12008-04-19 00:24:39 +00007026 if (0 < yysize && yysize <= yymsg_alloc)
7027 {
7028 (void) yysyntax_error (yymsg, yystate, yychar);
7029 yyerror (yymsg);
7030 }
7031 else
7032 {
7033 yyerror (YY_("syntax error"));
7034 if (yysize != 0)
7035 goto yyexhaustedlab;
7036 }
7037 }
7038#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007039 }
7040
Dan Gohman54392c12008-04-19 00:24:39 +00007041
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007042
7043 if (yyerrstatus == 3)
7044 {
Dan Gohman54392c12008-04-19 00:24:39 +00007045 /* If just tried and failed to reuse look-ahead token after an
7046 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007047
Dan Gohman54392c12008-04-19 00:24:39 +00007048 if (yychar <= YYEOF)
7049 {
7050 /* Return failure if at end of input. */
7051 if (yychar == YYEOF)
7052 YYABORT;
7053 }
7054 else
7055 {
7056 yydestruct ("Error: discarding",
7057 yytoken, &yylval);
7058 yychar = YYEMPTY;
7059 }
7060 }
7061
7062 /* Else will try to reuse look-ahead token after shifting the error
7063 token. */
7064 goto yyerrlab1;
7065
7066
7067/*---------------------------------------------------.
7068| yyerrorlab -- error raised explicitly by YYERROR. |
7069`---------------------------------------------------*/
7070yyerrorlab:
7071
7072 /* Pacify compilers like GCC when the user code never invokes
7073 YYERROR and the label yyerrorlab therefore never appears in user
7074 code. */
7075 if (/*CONSTCOND*/ 0)
7076 goto yyerrorlab;
7077
7078 /* Do not reclaim the symbols of the rule which action triggered
7079 this YYERROR. */
7080 YYPOPSTACK (yylen);
7081 yylen = 0;
7082 YY_STACK_PRINT (yyss, yyssp);
7083 yystate = *yyssp;
7084 goto yyerrlab1;
7085
7086
7087/*-------------------------------------------------------------.
7088| yyerrlab1 -- common code for both syntax error and YYERROR. |
7089`-------------------------------------------------------------*/
7090yyerrlab1:
7091 yyerrstatus = 3; /* Each real token shifted decrements this. */
7092
7093 for (;;)
7094 {
7095 yyn = yypact[yystate];
7096 if (yyn != YYPACT_NINF)
7097 {
7098 yyn += YYTERROR;
7099 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7100 {
7101 yyn = yytable[yyn];
7102 if (0 < yyn)
7103 break;
7104 }
7105 }
7106
7107 /* Pop the current state because it cannot handle the error token. */
7108 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007109 YYABORT;
7110
Dale Johannesen3afee192007-09-07 21:07:57 +00007111
Dan Gohman54392c12008-04-19 00:24:39 +00007112 yydestruct ("Error: popping",
7113 yystos[yystate], yyvsp);
7114 YYPOPSTACK (1);
7115 yystate = *yyssp;
7116 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007117 }
7118
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007119 if (yyn == YYFINAL)
7120 YYACCEPT;
7121
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007122 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00007123
7124
7125 /* Shift the error token. */
7126 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00007127
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007128 yystate = yyn;
7129 goto yynewstate;
7130
Gabor Greif89f01162008-04-06 23:07:54 +00007131
Dan Gohman54392c12008-04-19 00:24:39 +00007132/*-------------------------------------.
7133| yyacceptlab -- YYACCEPT comes here. |
7134`-------------------------------------*/
7135yyacceptlab:
7136 yyresult = 0;
7137 goto yyreturn;
7138
7139/*-----------------------------------.
7140| yyabortlab -- YYABORT comes here. |
7141`-----------------------------------*/
7142yyabortlab:
7143 yyresult = 1;
7144 goto yyreturn;
7145
7146#ifndef yyoverflow
7147/*-------------------------------------------------.
7148| yyexhaustedlab -- memory exhaustion comes here. |
7149`-------------------------------------------------*/
7150yyexhaustedlab:
7151 yyerror (YY_("memory exhausted"));
7152 yyresult = 2;
7153 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00007154#endif
Dan Gohman54392c12008-04-19 00:24:39 +00007155
7156yyreturn:
7157 if (yychar != YYEOF && yychar != YYEMPTY)
7158 yydestruct ("Cleanup: discarding lookahead",
7159 yytoken, &yylval);
7160 /* Do not reclaim the symbols of the rule which action triggered
7161 this YYABORT or YYACCEPT. */
7162 YYPOPSTACK (yylen);
7163 YY_STACK_PRINT (yyss, yyssp);
7164 while (yyssp != yyss)
7165 {
7166 yydestruct ("Cleanup: popping",
7167 yystos[*yyssp], yyvsp);
7168 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00007169 }
Dan Gohman54392c12008-04-19 00:24:39 +00007170#ifndef yyoverflow
7171 if (yyss != yyssa)
7172 YYSTACK_FREE (yyss);
7173#endif
7174#if YYERROR_VERBOSE
7175 if (yymsg != yymsgbuf)
7176 YYSTACK_FREE (yymsg);
7177#endif
7178 /* Make sure YYID is used. */
7179 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007180}
Dan Gohman54392c12008-04-19 00:24:39 +00007181
7182
Devang Patele01c06b2008-09-23 23:25:44 +00007183#line 3466 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007184
7185
7186// common code from the two 'RunVMAsmParser' functions
7187static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007188 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007189 // Check to make sure the parser succeeded
7190 if (yyparse()) {
7191 if (ParserResult)
7192 delete ParserResult;
7193 return 0;
7194 }
7195
7196 // Emit an error if there are any unresolved types left.
7197 if (!CurModule.LateResolveTypes.empty()) {
7198 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7199 if (DID.Type == ValID::LocalName) {
7200 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7201 } else {
7202 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7203 }
7204 if (ParserResult)
7205 delete ParserResult;
7206 return 0;
7207 }
7208
7209 // Emit an error if there are any unresolved values left.
7210 if (!CurModule.LateResolveValues.empty()) {
7211 Value *V = CurModule.LateResolveValues.back();
7212 std::map<Value*, std::pair<ValID, int> >::iterator I =
7213 CurModule.PlaceHolderInfo.find(V);
7214
7215 if (I != CurModule.PlaceHolderInfo.end()) {
7216 ValID &DID = I->second.first;
7217 if (DID.Type == ValID::LocalName) {
7218 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7219 } else {
7220 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7221 }
7222 if (ParserResult)
7223 delete ParserResult;
7224 return 0;
7225 }
7226 }
7227
7228 // Check to make sure that parsing produced a result
7229 if (!ParserResult)
7230 return 0;
7231
7232 // Reset ParserResult variable while saving its value for the result.
7233 Module *Result = ParserResult;
7234 ParserResult = 0;
7235
7236 return Result;
7237}
7238
7239void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007240 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007241 // TODO: column number in exception
7242 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007243 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007244 TriggerError = 1;
7245}
7246
7247int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007248 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007249 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007250 if (yychar != YYEMPTY && yychar != 0) {
7251 errMsg += " while reading token: '";
7252 errMsg += std::string(LLLgetTokenStart(),
7253 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7254 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007255 GenerateError(errMsg);
7256 return 0;
7257}
Dan Gohman54392c12008-04-19 00:24:39 +00007258