blob: 04ea82684495363389741ef96d8c3db3bc84b706 [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 Johannesenf4581482008-09-26 19:32:34 +0000142 DATALAYOUT = 323,
143 RET = 324,
144 BR = 325,
145 SWITCH = 326,
146 INVOKE = 327,
147 UNWIND = 328,
148 UNREACHABLE = 329,
149 ADD = 330,
150 SUB = 331,
151 MUL = 332,
152 UDIV = 333,
153 SDIV = 334,
154 FDIV = 335,
155 UREM = 336,
156 SREM = 337,
157 FREM = 338,
158 AND = 339,
159 OR = 340,
160 XOR = 341,
161 SHL = 342,
162 LSHR = 343,
163 ASHR = 344,
164 ICMP = 345,
165 FCMP = 346,
166 VICMP = 347,
167 VFCMP = 348,
168 EQ = 349,
169 NE = 350,
170 SLT = 351,
171 SGT = 352,
172 SLE = 353,
173 SGE = 354,
174 ULT = 355,
175 UGT = 356,
176 ULE = 357,
177 UGE = 358,
178 OEQ = 359,
179 ONE = 360,
180 OLT = 361,
181 OGT = 362,
182 OLE = 363,
183 OGE = 364,
184 ORD = 365,
185 UNO = 366,
186 UEQ = 367,
187 UNE = 368,
188 MALLOC = 369,
189 ALLOCA = 370,
190 FREE = 371,
191 LOAD = 372,
192 STORE = 373,
193 GETELEMENTPTR = 374,
194 TRUNC = 375,
195 ZEXT = 376,
196 SEXT = 377,
197 FPTRUNC = 378,
198 FPEXT = 379,
199 BITCAST = 380,
200 UITOFP = 381,
201 SITOFP = 382,
202 FPTOUI = 383,
203 FPTOSI = 384,
204 INTTOPTR = 385,
205 PTRTOINT = 386,
206 PHI_TOK = 387,
207 SELECT = 388,
208 VAARG = 389,
209 EXTRACTELEMENT = 390,
210 INSERTELEMENT = 391,
211 SHUFFLEVECTOR = 392,
212 GETRESULT = 393,
213 EXTRACTVALUE = 394,
214 INSERTVALUE = 395,
215 SIGNEXT = 396,
216 ZEROEXT = 397,
217 NORETURN = 398,
218 INREG = 399,
219 SRET = 400,
220 NOUNWIND = 401,
221 NOALIAS = 402,
222 BYVAL = 403,
223 NEST = 404,
224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
Devang Patelcd842482008-09-29 20:49:50 +0000227 OPTSIZE = 408,
228 NOINLINE = 409,
229 ALWAYSINLINE = 410,
230 DEFAULT = 411,
231 HIDDEN = 412,
232 PROTECTED = 413
Dan Gohman54392c12008-04-19 00:24:39 +0000233 };
234#endif
235/* Tokens. */
236#define ESINT64VAL 258
237#define EUINT64VAL 259
238#define ESAPINTVAL 260
239#define EUAPINTVAL 261
240#define LOCALVAL_ID 262
241#define GLOBALVAL_ID 263
242#define FPVAL 264
243#define VOID 265
244#define INTTYPE 266
245#define FLOAT 267
246#define DOUBLE 268
247#define X86_FP80 269
248#define FP128 270
249#define PPC_FP128 271
250#define LABEL 272
251#define TYPE 273
252#define LOCALVAR 274
253#define GLOBALVAR 275
254#define LABELSTR 276
255#define STRINGCONSTANT 277
256#define ATSTRINGCONSTANT 278
257#define PCTSTRINGCONSTANT 279
258#define ZEROINITIALIZER 280
259#define TRUETOK 281
260#define FALSETOK 282
261#define BEGINTOK 283
262#define ENDTOK 284
263#define DECLARE 285
264#define DEFINE 286
265#define GLOBAL 287
266#define CONSTANT 288
267#define SECTION 289
268#define ALIAS 290
269#define VOLATILE 291
270#define THREAD_LOCAL 292
271#define TO 293
272#define DOTDOTDOT 294
273#define NULL_TOK 295
274#define UNDEF 296
275#define INTERNAL 297
276#define LINKONCE 298
277#define WEAK 299
278#define APPENDING 300
279#define DLLIMPORT 301
280#define DLLEXPORT 302
281#define EXTERN_WEAK 303
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000282#define COMMON 304
283#define OPAQUE 305
284#define EXTERNAL 306
285#define TARGET 307
286#define TRIPLE 308
287#define ALIGN 309
288#define ADDRSPACE 310
289#define DEPLIBS 311
290#define CALL 312
291#define TAIL 313
292#define ASM_TOK 314
293#define MODULE 315
294#define SIDEEFFECT 316
295#define CC_TOK 317
296#define CCC_TOK 318
297#define FASTCC_TOK 319
298#define COLDCC_TOK 320
299#define X86_STDCALLCC_TOK 321
300#define X86_FASTCALLCC_TOK 322
Dale Johannesenf4581482008-09-26 19:32:34 +0000301#define DATALAYOUT 323
302#define RET 324
303#define BR 325
304#define SWITCH 326
305#define INVOKE 327
306#define UNWIND 328
307#define UNREACHABLE 329
308#define ADD 330
309#define SUB 331
310#define MUL 332
311#define UDIV 333
312#define SDIV 334
313#define FDIV 335
314#define UREM 336
315#define SREM 337
316#define FREM 338
317#define AND 339
318#define OR 340
319#define XOR 341
320#define SHL 342
321#define LSHR 343
322#define ASHR 344
323#define ICMP 345
324#define FCMP 346
325#define VICMP 347
326#define VFCMP 348
327#define EQ 349
328#define NE 350
329#define SLT 351
330#define SGT 352
331#define SLE 353
332#define SGE 354
333#define ULT 355
334#define UGT 356
335#define ULE 357
336#define UGE 358
337#define OEQ 359
338#define ONE 360
339#define OLT 361
340#define OGT 362
341#define OLE 363
342#define OGE 364
343#define ORD 365
344#define UNO 366
345#define UEQ 367
346#define UNE 368
347#define MALLOC 369
348#define ALLOCA 370
349#define FREE 371
350#define LOAD 372
351#define STORE 373
352#define GETELEMENTPTR 374
353#define TRUNC 375
354#define ZEXT 376
355#define SEXT 377
356#define FPTRUNC 378
357#define FPEXT 379
358#define BITCAST 380
359#define UITOFP 381
360#define SITOFP 382
361#define FPTOUI 383
362#define FPTOSI 384
363#define INTTOPTR 385
364#define PTRTOINT 386
365#define PHI_TOK 387
366#define SELECT 388
367#define VAARG 389
368#define EXTRACTELEMENT 390
369#define INSERTELEMENT 391
370#define SHUFFLEVECTOR 392
371#define GETRESULT 393
372#define EXTRACTVALUE 394
373#define INSERTVALUE 395
374#define SIGNEXT 396
375#define ZEROEXT 397
376#define NORETURN 398
377#define INREG 399
378#define SRET 400
379#define NOUNWIND 401
380#define NOALIAS 402
381#define BYVAL 403
382#define NEST 404
383#define READNONE 405
384#define READONLY 406
385#define GC 407
Devang Patelcd842482008-09-29 20:49:50 +0000386#define OPTSIZE 408
387#define NOINLINE 409
388#define ALWAYSINLINE 410
389#define DEFAULT 411
390#define HIDDEN 412
391#define PROTECTED 413
Dan Gohman54392c12008-04-19 00:24:39 +0000392
393
394
395
396/* Copy the first part of user declarations. */
Nuno Lopese20dbca2008-10-03 15:45:58 +0000397#line 14 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000398
399#include "ParserInternals.h"
400#include "llvm/CallingConv.h"
401#include "llvm/InlineAsm.h"
402#include "llvm/Instructions.h"
403#include "llvm/Module.h"
404#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000405#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000406#include "llvm/Support/GetElementPtrTypeIterator.h"
407#include "llvm/Support/CommandLine.h"
408#include "llvm/ADT/SmallVector.h"
409#include "llvm/ADT/STLExtras.h"
410#include "llvm/Support/MathExtras.h"
411#include "llvm/Support/Streams.h"
412#include <algorithm>
413#include <list>
414#include <map>
415#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000416
417// The following is a gross hack. In order to rid the libAsmParser library of
418// exceptions, we have to have a way of getting the yyparse function to go into
419// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher329d2672008-09-24 04:55:49 +0000420// function (see bottom of file) sets TriggerError. Then, at the end of each
421// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
422// (a goto) to put YACC in error state. Furthermore, several calls to
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000423// GenerateError are made from inside productions and they must simulate the
424// previous exception behavior by exiting the production immediately. We have
425// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher329d2672008-09-24 04:55:49 +0000426// immediately invokes YYERROR. This would be so much cleaner if it was a
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000427// recursive descent parser.
428static bool TriggerError = false;
429#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
430#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
431
432int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
433int yylex(); // declaration" of xxx warnings.
434int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000435using namespace llvm;
436
437static Module *ParserResult;
438
439// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
440// relating to upreferences in the input stream.
441//
442//#define DEBUG_UPREFS 1
443#ifdef DEBUG_UPREFS
444#define UR_OUT(X) cerr << X
445#else
446#define UR_OUT(X)
447#endif
448
449#define YYERROR_VERBOSE 1
450
451static GlobalVariable *CurGV;
452
453
454// This contains info used when building the body of a function. It is
455// destroyed when the function is completed.
456//
457typedef std::vector<Value *> ValueList; // Numbered defs
458
Eric Christopher329d2672008-09-24 04:55:49 +0000459static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000460ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
461
462static struct PerModuleInfo {
463 Module *CurrentModule;
464 ValueList Values; // Module level numbered definitions
465 ValueList LateResolveValues;
466 std::vector<PATypeHolder> Types;
467 std::map<ValID, PATypeHolder> LateResolveTypes;
468
469 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
470 /// how they were referenced and on which line of the input they came from so
471 /// that we can resolve them later and print error messages as appropriate.
472 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
473
474 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
475 // references to global values. Global values may be referenced before they
476 // are defined, and if so, the temporary object that they represent is held
477 // here. This is used for forward references of GlobalValues.
478 //
479 typedef std::map<std::pair<const PointerType *,
480 ValID>, GlobalValue*> GlobalRefsType;
481 GlobalRefsType GlobalRefs;
482
483 void ModuleDone() {
484 // If we could not resolve some functions at function compilation time
485 // (calls to functions before they are defined), resolve them now... Types
486 // are resolved when the constant pool has been completely parsed.
487 //
488 ResolveDefinitions(LateResolveValues);
489 if (TriggerError)
490 return;
491
492 // Check to make sure that all global value forward references have been
493 // resolved!
494 //
495 if (!GlobalRefs.empty()) {
496 std::string UndefinedReferences = "Unresolved global references exist:\n";
497
498 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
499 I != E; ++I) {
500 UndefinedReferences += " " + I->first.first->getDescription() + " " +
501 I->first.second.getName() + "\n";
502 }
503 GenerateError(UndefinedReferences);
504 return;
505 }
506
Chandler Carruth563d4a42007-08-04 01:56:21 +0000507 // Look for intrinsic functions and CallInst that need to be upgraded
508 for (Module::iterator FI = CurrentModule->begin(),
509 FE = CurrentModule->end(); FI != FE; )
510 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
511
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000512 Values.clear(); // Clear out function local definitions
513 Types.clear();
514 CurrentModule = 0;
515 }
516
517 // GetForwardRefForGlobal - Check to see if there is a forward reference
518 // for this global. If so, remove it from the GlobalRefs map and return it.
519 // If not, just return null.
520 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
521 // Check to see if there is a forward reference to this global variable...
522 // if there is, eliminate it and patch the reference to use the new def'n.
523 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
524 GlobalValue *Ret = 0;
525 if (I != GlobalRefs.end()) {
526 Ret = I->second;
527 GlobalRefs.erase(I);
528 }
529 return Ret;
530 }
531
532 bool TypeIsUnresolved(PATypeHolder* PATy) {
533 // If it isn't abstract, its resolved
534 const Type* Ty = PATy->get();
535 if (!Ty->isAbstract())
536 return false;
537 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher329d2672008-09-24 04:55:49 +0000538 // we don't need to traverse that leg of the type.
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000539 std::vector<const Type*> WorkList, SeenList;
540 WorkList.push_back(Ty);
541 while (!WorkList.empty()) {
542 const Type* Ty = WorkList.back();
543 SeenList.push_back(Ty);
544 WorkList.pop_back();
545 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
546 // Check to see if this is an unresolved type
547 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
548 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
549 for ( ; I != E; ++I) {
550 if (I->second.get() == OpTy)
551 return true;
552 }
553 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
554 const Type* TheTy = SeqTy->getElementType();
555 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher329d2672008-09-24 04:55:49 +0000556 std::vector<const Type*>::iterator I = SeenList.begin(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000557 E = SeenList.end();
558 for ( ; I != E; ++I)
559 if (*I == TheTy)
560 break;
561 if (I == E)
562 WorkList.push_back(TheTy);
563 }
564 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
565 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
566 const Type* TheTy = StrTy->getElementType(i);
567 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher329d2672008-09-24 04:55:49 +0000568 std::vector<const Type*>::iterator I = SeenList.begin(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000569 E = SeenList.end();
570 for ( ; I != E; ++I)
571 if (*I == TheTy)
572 break;
573 if (I == E)
574 WorkList.push_back(TheTy);
575 }
576 }
577 }
578 }
579 return false;
580 }
581} CurModule;
582
583static struct PerFunctionInfo {
584 Function *CurrentFunction; // Pointer to current function being created
585
586 ValueList Values; // Keep track of #'d definitions
587 unsigned NextValNum;
588 ValueList LateResolveValues;
589 bool isDeclare; // Is this function a forward declararation?
590 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
591 GlobalValue::VisibilityTypes Visibility;
592
593 /// BBForwardRefs - When we see forward references to basic blocks, keep
594 /// track of them here.
595 std::map<ValID, BasicBlock*> BBForwardRefs;
596
597 inline PerFunctionInfo() {
598 CurrentFunction = 0;
599 isDeclare = false;
600 Linkage = GlobalValue::ExternalLinkage;
601 Visibility = GlobalValue::DefaultVisibility;
602 }
603
604 inline void FunctionStart(Function *M) {
605 CurrentFunction = M;
606 NextValNum = 0;
607 }
608
609 void FunctionDone() {
610 // Any forward referenced blocks left?
611 if (!BBForwardRefs.empty()) {
612 GenerateError("Undefined reference to label " +
613 BBForwardRefs.begin()->second->getName());
614 return;
615 }
616
617 // Resolve all forward references now.
618 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
619
620 Values.clear(); // Clear out function local definitions
621 BBForwardRefs.clear();
622 CurrentFunction = 0;
623 isDeclare = false;
624 Linkage = GlobalValue::ExternalLinkage;
625 Visibility = GlobalValue::DefaultVisibility;
626 }
627} CurFun; // Info for the current function...
628
629static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
630
631
632//===----------------------------------------------------------------------===//
633// Code to handle definitions of all the types
634//===----------------------------------------------------------------------===//
635
Chris Lattner906773a2008-08-29 17:20:18 +0000636/// InsertValue - Insert a value into the value table. If it is named, this
637/// returns -1, otherwise it returns the slot number for the value.
638static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000639 // Things that have names or are void typed don't get slot numbers
640 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner906773a2008-08-29 17:20:18 +0000641 return -1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000642
643 // In the case of function values, we have to allow for the forward reference
644 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher329d2672008-09-24 04:55:49 +0000645 // track of the next insertion location with NextValNum. When a BB gets
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000646 // inserted, it could change the size of the CurFun.Values vector.
647 if (&ValueTab == &CurFun.Values) {
648 if (ValueTab.size() <= CurFun.NextValNum)
649 ValueTab.resize(CurFun.NextValNum+1);
650 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner906773a2008-08-29 17:20:18 +0000651 return CurFun.NextValNum-1;
Eric Christopher329d2672008-09-24 04:55:49 +0000652 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000653 // For all other lists, its okay to just tack it on the back of the vector.
654 ValueTab.push_back(V);
Chris Lattner906773a2008-08-29 17:20:18 +0000655 return ValueTab.size()-1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000656}
657
658static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
659 switch (D.Type) {
660 case ValID::LocalID: // Is it a numbered definition?
661 // Module constants occupy the lowest numbered slots...
662 if (D.Num < CurModule.Types.size())
663 return CurModule.Types[D.Num];
664 break;
665 case ValID::LocalName: // Is it a named definition?
666 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
667 D.destroy(); // Free old strdup'd memory...
668 return N;
669 }
670 break;
671 default:
672 GenerateError("Internal parser error: Invalid symbol type reference");
673 return 0;
674 }
675
676 // If we reached here, we referenced either a symbol that we don't know about
677 // or an id number that hasn't been read yet. We may be referencing something
678 // forward, so just create an entry to be resolved later and get to it...
679 //
680 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
681
682
683 if (inFunctionScope()) {
684 if (D.Type == ValID::LocalName) {
685 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
686 return 0;
687 } else {
688 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
689 return 0;
690 }
691 }
692
693 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
694 if (I != CurModule.LateResolveTypes.end())
695 return I->second;
696
697 Type *Typ = OpaqueType::get();
698 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
699 return Typ;
700 }
701
702// getExistingVal - Look up the value specified by the provided type and
703// the provided ValID. If the value exists and has already been defined, return
704// it. Otherwise return null.
705//
706static Value *getExistingVal(const Type *Ty, const ValID &D) {
707 if (isa<FunctionType>(Ty)) {
708 GenerateError("Functions are not values and "
709 "must be referenced as pointers");
710 return 0;
711 }
712
713 switch (D.Type) {
714 case ValID::LocalID: { // Is it a numbered definition?
715 // Check that the number is within bounds.
Eric Christopher329d2672008-09-24 04:55:49 +0000716 if (D.Num >= CurFun.Values.size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000717 return 0;
718 Value *Result = CurFun.Values[D.Num];
719 if (Ty != Result->getType()) {
720 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher329d2672008-09-24 04:55:49 +0000721 Result->getType()->getDescription() + "' does not match "
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000722 "expected type, '" + Ty->getDescription() + "'");
723 return 0;
724 }
725 return Result;
726 }
727 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher329d2672008-09-24 04:55:49 +0000728 if (D.Num >= CurModule.Values.size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000729 return 0;
730 Value *Result = CurModule.Values[D.Num];
731 if (Ty != Result->getType()) {
732 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher329d2672008-09-24 04:55:49 +0000733 Result->getType()->getDescription() + "' does not match "
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000734 "expected type, '" + Ty->getDescription() + "'");
735 return 0;
736 }
737 return Result;
738 }
Eric Christopher329d2672008-09-24 04:55:49 +0000739
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000740 case ValID::LocalName: { // Is it a named definition?
Eric Christopher329d2672008-09-24 04:55:49 +0000741 if (!inFunctionScope())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000742 return 0;
743 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
744 Value *N = SymTab.lookup(D.getName());
Eric Christopher329d2672008-09-24 04:55:49 +0000745 if (N == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000746 return 0;
747 if (N->getType() != Ty)
748 return 0;
Eric Christopher329d2672008-09-24 04:55:49 +0000749
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000750 D.destroy(); // Free old strdup'd memory...
751 return N;
752 }
753 case ValID::GlobalName: { // Is it a named definition?
754 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
755 Value *N = SymTab.lookup(D.getName());
Eric Christopher329d2672008-09-24 04:55:49 +0000756 if (N == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000757 return 0;
758 if (N->getType() != Ty)
759 return 0;
760
761 D.destroy(); // Free old strdup'd memory...
762 return N;
763 }
764
765 // Check to make sure that "Ty" is an integral type, and that our
766 // value will fit into the specified type...
767 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000768 if (!isa<IntegerType>(Ty) ||
769 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000770 GenerateError("Signed integral constant '" +
771 itostr(D.ConstPool64) + "' is invalid for type '" +
772 Ty->getDescription() + "'");
773 return 0;
774 }
775 return ConstantInt::get(Ty, D.ConstPool64, true);
776
777 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000778 if (isa<IntegerType>(Ty) &&
779 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000780 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000781
782 if (!isa<IntegerType>(Ty) ||
783 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
784 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
785 "' is invalid or out of range for type '" +
786 Ty->getDescription() + "'");
787 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000788 }
Chris Lattner59363a32008-02-19 04:36:25 +0000789 // This is really a signed reference. Transmogrify.
790 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000791
Chris Lattnerf3d40022008-07-11 00:30:39 +0000792 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
793 if (!isa<IntegerType>(Ty)) {
794 GenerateError("Integral constant '" + D.getName() +
795 "' is invalid or out of range for type '" +
796 Ty->getDescription() + "'");
797 return 0;
798 }
Eric Christopher329d2672008-09-24 04:55:49 +0000799
Chris Lattnerf3d40022008-07-11 00:30:39 +0000800 {
801 APSInt Tmp = *D.ConstPoolInt;
802 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
803 return ConstantInt::get(Tmp);
804 }
Eric Christopher329d2672008-09-24 04:55:49 +0000805
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000806 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000807 if (!Ty->isFloatingPoint() ||
808 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000809 GenerateError("FP constant invalid for type");
810 return 0;
811 }
Eric Christopher329d2672008-09-24 04:55:49 +0000812 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000813 // as double. Fix this here. Long double does not need this.
814 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
815 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000816 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +0000817 return ConstantFP::get(*D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000818
819 case ValID::ConstNullVal: // Is it a null value?
820 if (!isa<PointerType>(Ty)) {
821 GenerateError("Cannot create a a non pointer null");
822 return 0;
823 }
824 return ConstantPointerNull::get(cast<PointerType>(Ty));
825
826 case ValID::ConstUndefVal: // Is it an undef value?
827 return UndefValue::get(Ty);
828
829 case ValID::ConstZeroVal: // Is it a zero value?
830 return Constant::getNullValue(Ty);
Eric Christopher329d2672008-09-24 04:55:49 +0000831
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000832 case ValID::ConstantVal: // Fully resolved constant?
833 if (D.ConstantValue->getType() != Ty) {
834 GenerateError("Constant expression type different from required type");
835 return 0;
836 }
837 return D.ConstantValue;
838
839 case ValID::InlineAsmVal: { // Inline asm expression
840 const PointerType *PTy = dyn_cast<PointerType>(Ty);
841 const FunctionType *FTy =
842 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
843 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
844 GenerateError("Invalid type for asm constraint string");
845 return 0;
846 }
847 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
848 D.IAD->HasSideEffects);
849 D.destroy(); // Free InlineAsmDescriptor.
850 return IA;
851 }
852 default:
853 assert(0 && "Unhandled case!");
854 return 0;
855 } // End of switch
856
857 assert(0 && "Unhandled case!");
858 return 0;
859}
860
861// getVal - This function is identical to getExistingVal, except that if a
862// value is not already defined, it "improvises" by creating a placeholder var
863// that looks and acts just like the requested variable. When the value is
864// defined later, all uses of the placeholder variable are replaced with the
865// real thing.
866//
867static Value *getVal(const Type *Ty, const ValID &ID) {
868 if (Ty == Type::LabelTy) {
869 GenerateError("Cannot use a basic block here");
870 return 0;
871 }
872
873 // See if the value has already been defined.
874 Value *V = getExistingVal(Ty, ID);
875 if (V) return V;
876 if (TriggerError) return 0;
877
878 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000879 GenerateError("Invalid use of a non-first-class type");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000880 return 0;
881 }
882
883 // If we reached here, we referenced either a symbol that we don't know about
884 // or an id number that hasn't been read yet. We may be referencing something
885 // forward, so just create an entry to be resolved later and get to it...
886 //
887 switch (ID.Type) {
888 case ValID::GlobalName:
889 case ValID::GlobalID: {
890 const PointerType *PTy = dyn_cast<PointerType>(Ty);
891 if (!PTy) {
892 GenerateError("Invalid type for reference to global" );
893 return 0;
894 }
895 const Type* ElTy = PTy->getElementType();
896 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000897 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000898 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000899 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
900 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000901 break;
902 }
903 default:
904 V = new Argument(Ty);
905 }
Eric Christopher329d2672008-09-24 04:55:49 +0000906
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000907 // Remember where this forward reference came from. FIXME, shouldn't we try
908 // to recycle these things??
909 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000910 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000911
912 if (inFunctionScope())
913 InsertValue(V, CurFun.LateResolveValues);
914 else
915 InsertValue(V, CurModule.LateResolveValues);
916 return V;
917}
918
919/// defineBBVal - This is a definition of a new basic block with the specified
920/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000921static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000922 assert(inFunctionScope() && "Can't get basic block at global scope!");
923
924 BasicBlock *BB = 0;
925
926 // First, see if this was forward referenced
927
928 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
929 if (BBI != CurFun.BBForwardRefs.end()) {
930 BB = BBI->second;
931 // The forward declaration could have been inserted anywhere in the
932 // function: insert it into the correct place now.
933 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
934 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
935
936 // We're about to erase the entry, save the key so we can clean it up.
937 ValID Tmp = BBI->first;
938
939 // Erase the forward ref from the map as its no longer "forward"
940 CurFun.BBForwardRefs.erase(ID);
941
Eric Christopher329d2672008-09-24 04:55:49 +0000942 // The key has been removed from the map but so we don't want to leave
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000943 // strdup'd memory around so destroy it too.
944 Tmp.destroy();
945
946 // If its a numbered definition, bump the number and set the BB value.
947 if (ID.Type == ValID::LocalID) {
948 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
949 InsertValue(BB);
950 }
Eric Christopher329d2672008-09-24 04:55:49 +0000951 } else {
952 // We haven't seen this BB before and its first mention is a definition.
Devang Patel890cc572008-03-03 18:58:47 +0000953 // Just create it and return it.
954 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000955 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000956 if (ID.Type == ValID::LocalID) {
957 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
958 InsertValue(BB);
959 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000960 }
961
Devang Patel890cc572008-03-03 18:58:47 +0000962 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000963 return BB;
964}
965
966/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher329d2672008-09-24 04:55:49 +0000967///
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000968static BasicBlock *getBBVal(const ValID &ID) {
969 assert(inFunctionScope() && "Can't get basic block at global scope!");
970
971 BasicBlock *BB = 0;
972
973 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
974 if (BBI != CurFun.BBForwardRefs.end()) {
975 BB = BBI->second;
976 } if (ID.Type == ValID::LocalName) {
977 std::string Name = ID.getName();
978 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000979 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000980 if (N->getType()->getTypeID() == Type::LabelTyID)
981 BB = cast<BasicBlock>(N);
982 else
983 GenerateError("Reference to label '" + Name + "' is actually of type '"+
984 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000985 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000986 } else if (ID.Type == ValID::LocalID) {
987 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
988 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
989 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
990 else
Eric Christopher329d2672008-09-24 04:55:49 +0000991 GenerateError("Reference to label '%" + utostr(ID.Num) +
992 "' is actually of type '"+
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000993 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
994 }
995 } else {
996 GenerateError("Illegal label reference " + ID.getName());
997 return 0;
998 }
999
1000 // If its already been defined, return it now.
1001 if (BB) {
1002 ID.destroy(); // Free strdup'd memory.
1003 return BB;
1004 }
1005
1006 // Otherwise, this block has not been seen before, create it.
1007 std::string Name;
1008 if (ID.Type == ValID::LocalName)
1009 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +00001010 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001011
1012 // Insert it in the forward refs map.
1013 CurFun.BBForwardRefs[ID] = BB;
1014
1015 return BB;
1016}
1017
1018
1019//===----------------------------------------------------------------------===//
1020// Code to handle forward references in instructions
1021//===----------------------------------------------------------------------===//
1022//
1023// This code handles the late binding needed with statements that reference
1024// values not defined yet... for example, a forward branch, or the PHI node for
1025// a loop body.
1026//
1027// This keeps a table (CurFun.LateResolveValues) of all such forward references
1028// and back patchs after we are done.
1029//
1030
1031// ResolveDefinitions - If we could not resolve some defs at parsing
1032// time (forward branches, phi functions for loops, etc...) resolve the
1033// defs now...
1034//
Eric Christopher329d2672008-09-24 04:55:49 +00001035static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001036ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1037 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1038 while (!LateResolvers.empty()) {
1039 Value *V = LateResolvers.back();
1040 LateResolvers.pop_back();
1041
1042 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1043 CurModule.PlaceHolderInfo.find(V);
1044 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1045
1046 ValID &DID = PHI->second.first;
1047
1048 Value *TheRealValue = getExistingVal(V->getType(), DID);
1049 if (TriggerError)
1050 return;
1051 if (TheRealValue) {
1052 V->replaceAllUsesWith(TheRealValue);
1053 delete V;
1054 CurModule.PlaceHolderInfo.erase(PHI);
1055 } else if (FutureLateResolvers) {
1056 // Functions have their unresolved items forwarded to the module late
1057 // resolver table
1058 InsertValue(V, *FutureLateResolvers);
1059 } else {
1060 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1061 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1062 "' of type '" + V->getType()->getDescription() + "'",
1063 PHI->second.second);
1064 return;
1065 } else {
1066 GenerateError("Reference to an invalid definition: #" +
1067 itostr(DID.Num) + " of type '" +
1068 V->getType()->getDescription() + "'",
1069 PHI->second.second);
1070 return;
1071 }
1072 }
1073 }
1074 LateResolvers.clear();
1075}
1076
1077// ResolveTypeTo - A brand new type was just declared. This means that (if
1078// name is not null) things referencing Name can be resolved. Otherwise, things
1079// refering to the number can be resolved. Do this now.
1080//
1081static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1082 ValID D;
1083 if (Name)
1084 D = ValID::createLocalName(*Name);
Eric Christopher329d2672008-09-24 04:55:49 +00001085 else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001086 D = ValID::createLocalID(CurModule.Types.size());
1087
1088 std::map<ValID, PATypeHolder>::iterator I =
1089 CurModule.LateResolveTypes.find(D);
1090 if (I != CurModule.LateResolveTypes.end()) {
1091 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1092 CurModule.LateResolveTypes.erase(I);
1093 }
1094}
1095
1096// setValueName - Set the specified value to the name given. The name may be
1097// null potentially, in which case this is a noop. The string passed in is
1098// assumed to be a malloc'd string buffer, and is free'd by this function.
1099//
1100static void setValueName(Value *V, std::string *NameStr) {
1101 if (!NameStr) return;
1102 std::string Name(*NameStr); // Copy string
1103 delete NameStr; // Free old string
1104
1105 if (V->getType() == Type::VoidTy) {
1106 GenerateError("Can't assign name '" + Name+"' to value with void type");
1107 return;
1108 }
1109
1110 assert(inFunctionScope() && "Must be in function scope!");
1111 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1112 if (ST.lookup(Name)) {
1113 GenerateError("Redefinition of value '" + Name + "' of type '" +
1114 V->getType()->getDescription() + "'");
1115 return;
1116 }
1117
1118 // Set the name.
1119 V->setName(Name);
1120}
1121
1122/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1123/// this is a declaration, otherwise it is a definition.
1124static GlobalVariable *
1125ParseGlobalVariable(std::string *NameStr,
1126 GlobalValue::LinkageTypes Linkage,
1127 GlobalValue::VisibilityTypes Visibility,
1128 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001129 Constant *Initializer, bool IsThreadLocal,
1130 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001131 if (isa<FunctionType>(Ty)) {
1132 GenerateError("Cannot declare global vars of function type");
1133 return 0;
1134 }
Dan Gohmane5febe42008-05-31 00:58:22 +00001135 if (Ty == Type::LabelTy) {
1136 GenerateError("Cannot declare global vars of label type");
1137 return 0;
1138 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001139
Christopher Lamb0a243582007-12-11 09:02:08 +00001140 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001141
1142 std::string Name;
1143 if (NameStr) {
1144 Name = *NameStr; // Copy string
1145 delete NameStr; // Free old string
1146 }
1147
1148 // See if this global value was forward referenced. If so, recycle the
1149 // object.
1150 ValID ID;
1151 if (!Name.empty()) {
1152 ID = ValID::createGlobalName(Name);
1153 } else {
1154 ID = ValID::createGlobalID(CurModule.Values.size());
1155 }
1156
1157 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1158 // Move the global to the end of the list, from whereever it was
1159 // previously inserted.
1160 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1161 CurModule.CurrentModule->getGlobalList().remove(GV);
1162 CurModule.CurrentModule->getGlobalList().push_back(GV);
1163 GV->setInitializer(Initializer);
1164 GV->setLinkage(Linkage);
1165 GV->setVisibility(Visibility);
1166 GV->setConstant(isConstantGlobal);
1167 GV->setThreadLocal(IsThreadLocal);
1168 InsertValue(GV, CurModule.Values);
1169 return GV;
1170 }
1171
1172 // If this global has a name
1173 if (!Name.empty()) {
1174 // if the global we're parsing has an initializer (is a definition) and
1175 // has external linkage.
1176 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1177 // If there is already a global with external linkage with this name
1178 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1179 // If we allow this GVar to get created, it will be renamed in the
1180 // symbol table because it conflicts with an existing GVar. We can't
1181 // allow redefinition of GVars whose linking indicates that their name
1182 // must stay the same. Issue the error.
1183 GenerateError("Redefinition of global variable named '" + Name +
1184 "' of type '" + Ty->getDescription() + "'");
1185 return 0;
1186 }
1187 }
1188
1189 // Otherwise there is no existing GV to use, create one now.
1190 GlobalVariable *GV =
1191 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001192 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001193 GV->setVisibility(Visibility);
1194 InsertValue(GV, CurModule.Values);
1195 return GV;
1196}
1197
1198// setTypeName - Set the specified type to the name given. The name may be
1199// null potentially, in which case this is a noop. The string passed in is
1200// assumed to be a malloc'd string buffer, and is freed by this function.
1201//
1202// This function returns true if the type has already been defined, but is
1203// allowed to be redefined in the specified context. If the name is a new name
1204// for the type plane, it is inserted and false is returned.
1205static bool setTypeName(const Type *T, std::string *NameStr) {
1206 assert(!inFunctionScope() && "Can't give types function-local names!");
1207 if (NameStr == 0) return false;
Eric Christopher329d2672008-09-24 04:55:49 +00001208
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001209 std::string Name(*NameStr); // Copy string
1210 delete NameStr; // Free old string
1211
1212 // We don't allow assigning names to void type
1213 if (T == Type::VoidTy) {
1214 GenerateError("Can't assign name '" + Name + "' to the void type");
1215 return false;
1216 }
1217
1218 // Set the type name, checking for conflicts as we do so.
1219 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1220
1221 if (AlreadyExists) { // Inserting a name that is already defined???
1222 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1223 assert(Existing && "Conflict but no matching type?!");
1224
1225 // There is only one case where this is allowed: when we are refining an
1226 // opaque type. In this case, Existing will be an opaque type.
1227 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1228 // We ARE replacing an opaque type!
1229 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1230 return true;
1231 }
1232
1233 // Otherwise, this is an attempt to redefine a type. That's okay if
1234 // the redefinition is identical to the original. This will be so if
1235 // Existing and T point to the same Type object. In this one case we
1236 // allow the equivalent redefinition.
1237 if (Existing == T) return true; // Yes, it's equal.
1238
1239 // Any other kind of (non-equivalent) redefinition is an error.
1240 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1241 T->getDescription() + "'");
1242 }
1243
1244 return false;
1245}
1246
1247//===----------------------------------------------------------------------===//
1248// Code for handling upreferences in type names...
1249//
1250
1251// TypeContains - Returns true if Ty directly contains E in it.
1252//
1253static bool TypeContains(const Type *Ty, const Type *E) {
1254 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1255 E) != Ty->subtype_end();
1256}
1257
1258namespace {
1259 struct UpRefRecord {
1260 // NestingLevel - The number of nesting levels that need to be popped before
1261 // this type is resolved.
1262 unsigned NestingLevel;
1263
1264 // LastContainedTy - This is the type at the current binding level for the
1265 // type. Every time we reduce the nesting level, this gets updated.
1266 const Type *LastContainedTy;
1267
1268 // UpRefTy - This is the actual opaque type that the upreference is
1269 // represented with.
1270 OpaqueType *UpRefTy;
1271
1272 UpRefRecord(unsigned NL, OpaqueType *URTy)
1273 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1274 };
1275}
1276
1277// UpRefs - A list of the outstanding upreferences that need to be resolved.
1278static std::vector<UpRefRecord> UpRefs;
1279
1280/// HandleUpRefs - Every time we finish a new layer of types, this function is
1281/// called. It loops through the UpRefs vector, which is a list of the
1282/// currently active types. For each type, if the up reference is contained in
1283/// the newly completed type, we decrement the level count. When the level
1284/// count reaches zero, the upreferenced type is the type that is passed in:
1285/// thus we can complete the cycle.
1286///
1287static PATypeHolder HandleUpRefs(const Type *ty) {
1288 // If Ty isn't abstract, or if there are no up-references in it, then there is
1289 // nothing to resolve here.
1290 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher329d2672008-09-24 04:55:49 +00001291
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001292 PATypeHolder Ty(ty);
1293 UR_OUT("Type '" << Ty->getDescription() <<
1294 "' newly formed. Resolving upreferences.\n" <<
1295 UpRefs.size() << " upreferences active!\n");
1296
1297 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1298 // to zero), we resolve them all together before we resolve them to Ty. At
1299 // the end of the loop, if there is anything to resolve to Ty, it will be in
1300 // this variable.
1301 OpaqueType *TypeToResolve = 0;
1302
1303 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1304 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1305 << UpRefs[i].second->getDescription() << ") = "
1306 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1307 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1308 // Decrement level of upreference
1309 unsigned Level = --UpRefs[i].NestingLevel;
1310 UpRefs[i].LastContainedTy = Ty;
1311 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1312 if (Level == 0) { // Upreference should be resolved!
1313 if (!TypeToResolve) {
1314 TypeToResolve = UpRefs[i].UpRefTy;
1315 } else {
1316 UR_OUT(" * Resolving upreference for "
1317 << UpRefs[i].second->getDescription() << "\n";
1318 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1319 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1320 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1321 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1322 }
1323 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1324 --i; // Do not skip the next element...
1325 }
1326 }
1327 }
1328
1329 if (TypeToResolve) {
1330 UR_OUT(" * Resolving upreference for "
1331 << UpRefs[i].second->getDescription() << "\n";
1332 std::string OldName = TypeToResolve->getDescription());
1333 TypeToResolve->refineAbstractTypeTo(Ty);
1334 }
1335
1336 return Ty;
1337}
1338
1339//===----------------------------------------------------------------------===//
1340// RunVMAsmParser - Define an interface to this parser
1341//===----------------------------------------------------------------------===//
1342//
1343static Module* RunParser(Module * M);
1344
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001345Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1346 InitLLLexer(MB);
1347 Module *M = RunParser(new Module(LLLgetFilename()));
1348 FreeLexer();
1349 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001350}
1351
1352
Dan Gohman54392c12008-04-19 00:24:39 +00001353
1354/* Enabling traces. */
1355#ifndef YYDEBUG
1356# define YYDEBUG 0
1357#endif
1358
1359/* Enabling verbose error messages. */
1360#ifdef YYERROR_VERBOSE
1361# undef YYERROR_VERBOSE
1362# define YYERROR_VERBOSE 1
1363#else
1364# define YYERROR_VERBOSE 0
1365#endif
1366
1367/* Enabling the token table. */
1368#ifndef YYTOKEN_TABLE
1369# define YYTOKEN_TABLE 0
1370#endif
1371
1372#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1373typedef union YYSTYPE
Nuno Lopese20dbca2008-10-03 15:45:58 +00001374#line 970 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001375{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001376 llvm::Module *ModuleVal;
1377 llvm::Function *FunctionVal;
1378 llvm::BasicBlock *BasicBlockVal;
1379 llvm::TerminatorInst *TermInstVal;
1380 llvm::Instruction *InstVal;
1381 llvm::Constant *ConstVal;
1382
1383 const llvm::Type *PrimType;
1384 std::list<llvm::PATypeHolder> *TypeList;
1385 llvm::PATypeHolder *TypeVal;
1386 llvm::Value *ValueVal;
1387 std::vector<llvm::Value*> *ValueList;
Dan Gohmane5febe42008-05-31 00:58:22 +00001388 std::vector<unsigned> *ConstantList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001389 llvm::ArgListType *ArgList;
1390 llvm::TypeWithAttrs TypeWithAttrs;
1391 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001392 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001393
1394 // Represent the RHS of PHI node
1395 std::list<std::pair<llvm::Value*,
1396 llvm::BasicBlock*> > *PHIList;
1397 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1398 std::vector<llvm::Constant*> *ConstVector;
1399
1400 llvm::GlobalValue::LinkageTypes Linkage;
1401 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Pateld222f862008-09-25 21:00:45 +00001402 llvm::Attributes Attributes;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001403 llvm::APInt *APIntVal;
1404 int64_t SInt64Val;
1405 uint64_t UInt64Val;
1406 int SIntVal;
1407 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001408 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409 bool BoolVal;
1410
1411 std::string *StrVal; // This memory must be deleted
1412 llvm::ValID ValIDVal;
1413
1414 llvm::Instruction::BinaryOps BinaryOpVal;
1415 llvm::Instruction::TermOps TermOpVal;
1416 llvm::Instruction::MemoryOps MemOpVal;
1417 llvm::Instruction::CastOps CastOpVal;
1418 llvm::Instruction::OtherOps OtherOpVal;
1419 llvm::ICmpInst::Predicate IPredicate;
1420 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001421}
Nuno Lopese20dbca2008-10-03 15:45:58 +00001422/* Line 187 of yacc.c. */
Devang Patelcd842482008-09-29 20:49:50 +00001423#line 1424 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001424 YYSTYPE;
1425# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1426# define YYSTYPE_IS_DECLARED 1
1427# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001428#endif
1429
1430
1431
Dan Gohman54392c12008-04-19 00:24:39 +00001432/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001433
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001434
Dan Gohman54392c12008-04-19 00:24:39 +00001435/* Line 216 of yacc.c. */
Devang Patelcd842482008-09-29 20:49:50 +00001436#line 1437 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001437
Dan Gohman54392c12008-04-19 00:24:39 +00001438#ifdef short
1439# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001440#endif
1441
Dan Gohman54392c12008-04-19 00:24:39 +00001442#ifdef YYTYPE_UINT8
1443typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001444#else
Dan Gohman54392c12008-04-19 00:24:39 +00001445typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001446#endif
1447
Dan Gohman54392c12008-04-19 00:24:39 +00001448#ifdef YYTYPE_INT8
1449typedef YYTYPE_INT8 yytype_int8;
1450#elif (defined __STDC__ || defined __C99__FUNC__ \
1451 || defined __cplusplus || defined _MSC_VER)
1452typedef signed char yytype_int8;
1453#else
1454typedef short int yytype_int8;
1455#endif
1456
1457#ifdef YYTYPE_UINT16
1458typedef YYTYPE_UINT16 yytype_uint16;
1459#else
1460typedef unsigned short int yytype_uint16;
1461#endif
1462
1463#ifdef YYTYPE_INT16
1464typedef YYTYPE_INT16 yytype_int16;
1465#else
1466typedef short int yytype_int16;
1467#endif
1468
1469#ifndef YYSIZE_T
1470# ifdef __SIZE_TYPE__
1471# define YYSIZE_T __SIZE_TYPE__
1472# elif defined size_t
1473# define YYSIZE_T size_t
1474# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1475 || defined __cplusplus || defined _MSC_VER)
1476# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1477# define YYSIZE_T size_t
1478# else
1479# define YYSIZE_T unsigned int
1480# endif
1481#endif
1482
1483#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1484
1485#ifndef YY_
Nuno Lopese20dbca2008-10-03 15:45:58 +00001486# if YYENABLE_NLS
Dan Gohman54392c12008-04-19 00:24:39 +00001487# if ENABLE_NLS
1488# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1489# define YY_(msgid) dgettext ("bison-runtime", msgid)
1490# endif
1491# endif
1492# ifndef YY_
1493# define YY_(msgid) msgid
1494# endif
1495#endif
1496
1497/* Suppress unused-variable warnings by "using" E. */
1498#if ! defined lint || defined __GNUC__
1499# define YYUSE(e) ((void) (e))
1500#else
1501# define YYUSE(e) /* empty */
1502#endif
1503
1504/* Identity function, used to suppress warnings about constant conditions. */
1505#ifndef lint
1506# define YYID(n) (n)
1507#else
1508#if (defined __STDC__ || defined __C99__FUNC__ \
1509 || defined __cplusplus || defined _MSC_VER)
1510static int
1511YYID (int i)
1512#else
1513static int
1514YYID (i)
1515 int i;
1516#endif
1517{
1518 return i;
1519}
1520#endif
1521
1522#if ! defined yyoverflow || YYERROR_VERBOSE
1523
1524/* The parser invokes alloca or malloc; define the necessary symbols. */
1525
1526# ifdef YYSTACK_USE_ALLOCA
1527# if YYSTACK_USE_ALLOCA
1528# ifdef __GNUC__
1529# define YYSTACK_ALLOC __builtin_alloca
1530# elif defined __BUILTIN_VA_ARG_INCR
1531# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1532# elif defined _AIX
1533# define YYSTACK_ALLOC __alloca
1534# elif defined _MSC_VER
1535# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1536# define alloca _alloca
1537# else
1538# define YYSTACK_ALLOC alloca
1539# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1540 || defined __cplusplus || defined _MSC_VER)
1541# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1542# ifndef _STDLIB_H
1543# define _STDLIB_H 1
1544# endif
1545# endif
1546# endif
1547# endif
1548# endif
1549
1550# ifdef YYSTACK_ALLOC
1551 /* Pacify GCC's `empty if-body' warning. */
1552# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1553# ifndef YYSTACK_ALLOC_MAXIMUM
1554 /* The OS might guarantee only one guard page at the bottom of the stack,
1555 and a page size can be as small as 4096 bytes. So we cannot safely
1556 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1557 to allow for a few compiler-allocated temporary stack slots. */
1558# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1559# endif
1560# else
1561# define YYSTACK_ALLOC YYMALLOC
1562# define YYSTACK_FREE YYFREE
1563# ifndef YYSTACK_ALLOC_MAXIMUM
1564# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1565# endif
1566# if (defined __cplusplus && ! defined _STDLIB_H \
1567 && ! ((defined YYMALLOC || defined malloc) \
1568 && (defined YYFREE || defined free)))
1569# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1570# ifndef _STDLIB_H
1571# define _STDLIB_H 1
1572# endif
1573# endif
1574# ifndef YYMALLOC
1575# define YYMALLOC malloc
1576# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1577 || defined __cplusplus || defined _MSC_VER)
1578void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1579# endif
1580# endif
1581# ifndef YYFREE
1582# define YYFREE free
1583# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585void free (void *); /* INFRINGES ON USER NAME SPACE */
1586# endif
1587# endif
1588# endif
1589#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1590
1591
1592#if (! defined yyoverflow \
1593 && (! defined __cplusplus \
1594 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1595
1596/* A type that is properly aligned for any stack member. */
1597union yyalloc
1598{
1599 yytype_int16 yyss;
1600 YYSTYPE yyvs;
1601 };
1602
1603/* The size of the maximum gap between one aligned stack and the next. */
1604# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1605
1606/* The size of an array large to enough to hold all stacks, each with
1607 N elements. */
1608# define YYSTACK_BYTES(N) \
1609 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1610 + YYSTACK_GAP_MAXIMUM)
1611
1612/* Copy COUNT objects from FROM to TO. The source and destination do
1613 not overlap. */
1614# ifndef YYCOPY
1615# if defined __GNUC__ && 1 < __GNUC__
1616# define YYCOPY(To, From, Count) \
1617 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1618# else
1619# define YYCOPY(To, From, Count) \
1620 do \
1621 { \
1622 YYSIZE_T yyi; \
1623 for (yyi = 0; yyi < (Count); yyi++) \
1624 (To)[yyi] = (From)[yyi]; \
1625 } \
1626 while (YYID (0))
1627# endif
1628# endif
1629
1630/* Relocate STACK from its old location to the new one. The
1631 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1632 elements in the stack, and YYPTR gives the new location of the
1633 stack. Advance YYPTR to a properly aligned location for the next
1634 stack. */
1635# define YYSTACK_RELOCATE(Stack) \
1636 do \
1637 { \
1638 YYSIZE_T yynewbytes; \
1639 YYCOPY (&yyptr->Stack, Stack, yysize); \
1640 Stack = &yyptr->Stack; \
1641 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1642 yyptr += yynewbytes / sizeof (*yyptr); \
1643 } \
1644 while (YYID (0))
1645
1646#endif
1647
1648/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001649#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001650/* YYLAST -- Last index in YYTABLE. */
Devang Patelcd842482008-09-29 20:49:50 +00001651#define YYLAST 2439
Dan Gohman54392c12008-04-19 00:24:39 +00001652
1653/* YYNTOKENS -- Number of terminals. */
Devang Patelcd842482008-09-29 20:49:50 +00001654#define YYNTOKENS 173
Dan Gohman54392c12008-04-19 00:24:39 +00001655/* YYNNTS -- Number of nonterminals. */
Devang Patelcd842482008-09-29 20:49:50 +00001656#define YYNNTS 89
Dan Gohman54392c12008-04-19 00:24:39 +00001657/* YYNRULES -- Number of rules. */
Devang Patelcd842482008-09-29 20:49:50 +00001658#define YYNRULES 354
Dan Gohman54392c12008-04-19 00:24:39 +00001659/* YYNRULES -- Number of states. */
Devang Patelcd842482008-09-29 20:49:50 +00001660#define YYNSTATES 717
Dan Gohman54392c12008-04-19 00:24:39 +00001661
1662/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1663#define YYUNDEFTOK 2
Devang Patelcd842482008-09-29 20:49:50 +00001664#define YYMAXUTOK 413
Dan Gohman54392c12008-04-19 00:24:39 +00001665
1666#define YYTRANSLATE(YYX) \
1667 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1668
1669/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1670static const yytype_uint8 yytranslate[] =
1671{
1672 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1674 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001676 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001677 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001678 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001681 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
Dan Gohman54392c12008-04-19 00:24:39 +00001682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001684 166, 2, 2, 170, 2, 171, 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,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1691 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, 1, 2, 3, 4,
1698 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1699 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1700 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1701 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1702 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1703 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1704 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1705 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1706 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1707 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1708 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1709 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1710 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1711 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001712 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Patelcd842482008-09-29 20:49:50 +00001713 155, 156, 157, 158
Dan Gohman54392c12008-04-19 00:24:39 +00001714};
1715
1716#if YYDEBUG
1717/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1718 YYRHS. */
1719static const yytype_uint16 yyprhs[] =
1720{
1721 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1722 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1723 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1724 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1725 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1726 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1727 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
Chris Lattner906773a2008-08-29 17:20:18 +00001728 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1729 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1730 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
Dale Johannesenf4581482008-09-26 19:32:34 +00001731 197, 198, 200, 202, 204, 206, 208, 211, 213, 215,
1732 217, 219, 221, 223, 225, 227, 229, 232, 233, 236,
Devang Patelcd842482008-09-29 20:49:50 +00001733 238, 240, 242, 243, 246, 248, 250, 252, 254, 256,
1734 258, 260, 262, 264, 266, 267, 270, 271, 274, 275,
1735 278, 279, 283, 286, 287, 289, 290, 294, 296, 299,
1736 301, 303, 305, 307, 309, 311, 313, 315, 317, 321,
1737 323, 326, 332, 338, 344, 350, 354, 357, 363, 368,
1738 371, 373, 375, 377, 381, 383, 387, 389, 390, 392,
1739 396, 401, 405, 409, 414, 419, 423, 430, 436, 439,
1740 442, 445, 448, 451, 454, 457, 460, 463, 466, 469,
1741 472, 479, 485, 494, 501, 508, 516, 524, 532, 540,
1742 547, 556, 565, 571, 579, 583, 585, 587, 589, 591,
1743 592, 595, 602, 604, 605, 607, 610, 611, 615, 616,
1744 620, 624, 628, 632, 633, 642, 643, 653, 654, 664,
1745 670, 673, 677, 679, 683, 687, 691, 695, 697, 698,
1746 704, 708, 710, 714, 716, 717, 729, 731, 733, 738,
1747 740, 742, 745, 749, 750, 752, 754, 756, 758, 760,
1748 762, 764, 766, 768, 770, 772, 776, 780, 783, 786,
1749 790, 793, 799, 804, 806, 812, 814, 816, 818, 820,
1750 822, 824, 827, 829, 833, 836, 839, 843, 847, 850,
1751 851, 853, 856, 859, 863, 873, 883, 892, 908, 910,
1752 912, 919, 925, 928, 931, 938, 946, 951, 956, 963,
1753 970, 971, 972, 976, 979, 983, 986, 988, 994, 1000,
1754 1007, 1014, 1021, 1028, 1033, 1040, 1045, 1050, 1057, 1064,
1755 1067, 1077, 1079, 1081, 1082, 1086, 1093, 1097, 1104, 1107,
1756 1113, 1121, 1127, 1132, 1137
Dan Gohman54392c12008-04-19 00:24:39 +00001757};
1758
1759/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1760static const yytype_int16 yyrhs[] =
1761{
Devang Patelcd842482008-09-29 20:49:50 +00001762 222, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenf4581482008-09-26 19:32:34 +00001763 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1764 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1765 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1766 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1767 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1768 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1769 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1770 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1771 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1772 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohman54392c12008-04-19 00:24:39 +00001773 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patelcd842482008-09-29 20:49:50 +00001774 -1, 19, -1, 22, -1, 24, -1, 181, -1, -1,
1775 55, 159, 4, 160, -1, -1, 181, 161, -1, -1,
1776 7, 161, -1, 20, -1, 23, -1, 188, -1, -1,
1777 186, 161, -1, 42, -1, 44, -1, 43, -1, 45,
Chris Lattner906773a2008-08-29 17:20:18 +00001778 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
Devang Patelcd842482008-09-29 20:49:50 +00001779 -1, -1, 156, -1, 157, -1, 158, -1, -1, 46,
Chris Lattner906773a2008-08-29 17:20:18 +00001780 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1781 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00001782 64, -1, 65, -1, 66, -1, 67, -1, 62, 4,
1783 -1, 142, -1, 121, -1, 141, -1, 122, -1, 144,
1784 -1, 145, -1, 147, -1, 148, -1, 149, -1, 54,
Devang Patelcd842482008-09-29 20:49:50 +00001785 4, -1, -1, 197, 196, -1, 144, -1, 142, -1,
1786 141, -1, -1, 199, 198, -1, 143, -1, 146, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00001787 144, -1, 142, -1, 141, -1, 150, -1, 151, -1,
Devang Patelcd842482008-09-29 20:49:50 +00001788 154, -1, 155, -1, 153, -1, -1, 201, 200, -1,
1789 -1, 152, 22, -1, -1, 54, 4, -1, -1, 162,
1790 54, 4, -1, 34, 22, -1, -1, 205, -1, -1,
1791 162, 208, 207, -1, 205, -1, 54, 4, -1, 11,
1792 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1793 -1, 17, -1, 50, -1, 209, -1, 210, 183, 163,
1794 -1, 244, -1, 164, 4, -1, 210, 159, 214, 160,
1795 201, -1, 10, 159, 214, 160, 201, -1, 165, 4,
1796 166, 210, 167, -1, 168, 4, 166, 210, 169, -1,
1797 170, 215, 171, -1, 170, 171, -1, 168, 170, 215,
1798 171, 169, -1, 168, 170, 171, 169, -1, 210, 197,
1799 -1, 210, -1, 10, -1, 211, -1, 213, 162, 211,
1800 -1, 213, -1, 213, 162, 39, -1, 39, -1, -1,
1801 210, -1, 215, 162, 210, -1, 210, 165, 218, 167,
1802 -1, 210, 165, 167, -1, 210, 172, 22, -1, 210,
1803 168, 218, 169, -1, 210, 170, 218, 171, -1, 210,
1804 170, 171, -1, 210, 168, 170, 218, 171, 169, -1,
1805 210, 168, 170, 171, 169, -1, 210, 40, -1, 210,
1806 41, -1, 210, 244, -1, 210, 217, -1, 210, 25,
1807 -1, 179, 3, -1, 179, 5, -1, 179, 4, -1,
1808 179, 6, -1, 11, 26, -1, 11, 27, -1, 180,
1809 9, -1, 176, 159, 216, 38, 210, 160, -1, 119,
1810 159, 216, 256, 160, -1, 133, 159, 216, 162, 216,
1811 162, 216, 160, -1, 174, 159, 216, 162, 216, 160,
1812 -1, 175, 159, 216, 162, 216, 160, -1, 90, 177,
1813 159, 216, 162, 216, 160, -1, 91, 178, 159, 216,
1814 162, 216, 160, -1, 92, 177, 159, 216, 162, 216,
1815 160, -1, 93, 178, 159, 216, 162, 216, 160, -1,
1816 135, 159, 216, 162, 216, 160, -1, 136, 159, 216,
1817 162, 216, 162, 216, 160, -1, 137, 159, 216, 162,
1818 216, 162, 216, 160, -1, 139, 159, 216, 257, 160,
1819 -1, 140, 159, 216, 162, 216, 257, 160, -1, 218,
1820 162, 216, -1, 216, -1, 32, -1, 33, -1, 37,
1821 -1, -1, 212, 244, -1, 125, 159, 221, 38, 210,
1822 160, -1, 223, -1, -1, 224, -1, 223, 224, -1,
1823 -1, 31, 225, 240, -1, -1, 30, 226, 241, -1,
1824 60, 59, 230, -1, 184, 18, 210, -1, 184, 18,
1825 10, -1, -1, 187, 191, 220, 219, 216, 183, 227,
1826 207, -1, -1, 187, 189, 191, 220, 219, 216, 183,
1827 228, 207, -1, -1, 187, 190, 191, 220, 219, 210,
1828 183, 229, 207, -1, 187, 191, 35, 194, 221, -1,
1829 52, 231, -1, 56, 161, 232, -1, 22, -1, 53,
1830 161, 22, -1, 68, 161, 22, -1, 165, 233, 167,
1831 -1, 233, 162, 22, -1, 22, -1, -1, 234, 162,
1832 210, 197, 182, -1, 210, 197, 182, -1, 234, -1,
1833 234, 162, 39, -1, 39, -1, -1, 195, 199, 212,
1834 186, 159, 235, 160, 201, 206, 203, 202, -1, 28,
1835 -1, 170, -1, 193, 191, 236, 237, -1, 29, -1,
1836 171, -1, 248, 239, -1, 192, 191, 236, -1, -1,
1837 61, -1, 3, -1, 4, -1, 5, -1, 6, -1,
1838 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1839 25, -1, 168, 218, 169, -1, 165, 218, 167, -1,
1840 165, 167, -1, 172, 22, -1, 170, 218, 171, -1,
1841 170, 171, -1, 168, 170, 218, 171, 169, -1, 168,
1842 170, 171, 169, -1, 217, -1, 59, 242, 22, 162,
1843 22, -1, 7, -1, 8, -1, 181, -1, 186, -1,
1844 244, -1, 243, -1, 210, 245, -1, 246, -1, 247,
1845 162, 246, -1, 248, 249, -1, 238, 249, -1, 250,
1846 184, 251, -1, 250, 185, 251, -1, 250, 253, -1,
1847 -1, 21, -1, 69, 247, -1, 69, 10, -1, 70,
1848 17, 245, -1, 70, 11, 245, 162, 17, 245, 162,
1849 17, 245, -1, 71, 179, 245, 162, 17, 245, 165,
1850 252, 167, -1, 71, 179, 245, 162, 17, 245, 165,
1851 167, -1, 72, 195, 199, 212, 245, 159, 255, 160,
1852 201, 38, 17, 245, 73, 17, 245, -1, 73, -1,
1853 74, -1, 252, 179, 243, 162, 17, 245, -1, 179,
1854 243, 162, 17, 245, -1, 184, 259, -1, 185, 259,
1855 -1, 210, 165, 245, 162, 245, 167, -1, 254, 162,
1856 165, 245, 162, 245, 167, -1, 210, 197, 245, 197,
1857 -1, 17, 197, 245, 197, -1, 255, 162, 210, 197,
1858 245, 197, -1, 255, 162, 17, 197, 245, 197, -1,
1859 -1, -1, 256, 162, 246, -1, 162, 4, -1, 257,
1860 162, 4, -1, 58, 57, -1, 57, -1, 174, 210,
1861 245, 162, 245, -1, 175, 210, 245, 162, 245, -1,
1862 90, 177, 210, 245, 162, 245, -1, 91, 178, 210,
1863 245, 162, 245, -1, 92, 177, 210, 245, 162, 245,
1864 -1, 93, 178, 210, 245, 162, 245, -1, 176, 246,
1865 38, 210, -1, 133, 246, 162, 246, 162, 246, -1,
1866 134, 246, 162, 210, -1, 135, 246, 162, 246, -1,
1867 136, 246, 162, 246, 162, 246, -1, 137, 246, 162,
1868 246, 162, 246, -1, 132, 254, -1, 258, 195, 199,
1869 212, 245, 159, 255, 160, 201, -1, 261, -1, 36,
1870 -1, -1, 114, 210, 204, -1, 114, 210, 162, 11,
1871 245, 204, -1, 115, 210, 204, -1, 115, 210, 162,
1872 11, 245, 204, -1, 116, 246, -1, 260, 117, 210,
1873 245, 204, -1, 260, 118, 246, 162, 210, 245, 204,
1874 -1, 138, 210, 245, 162, 4, -1, 119, 210, 245,
1875 256, -1, 139, 210, 245, 257, -1, 140, 210, 245,
1876 162, 210, 245, 257, -1
Dan Gohman54392c12008-04-19 00:24:39 +00001877};
1878
1879/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1880static const yytype_uint16 yyrline[] =
1881{
Devang Patelcd842482008-09-29 20:49:50 +00001882 0, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136,
1883 1136, 1137, 1137, 1137, 1137, 1137, 1137, 1138, 1138, 1138,
1884 1138, 1138, 1138, 1139, 1139, 1139, 1139, 1139, 1139, 1142,
1885 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1150,
1886 1150, 1151, 1151, 1152, 1152, 1153, 1153, 1154, 1154, 1155,
1887 1155, 1156, 1156, 1157, 1158, 1163, 1164, 1164, 1164, 1164,
1888 1164, 1166, 1166, 1166, 1167, 1167, 1169, 1170, 1174, 1178,
1889 1183, 1189, 1189, 1191, 1192, 1197, 1203, 1204, 1205, 1206,
1890 1207, 1208, 1212, 1213, 1214, 1218, 1219, 1220, 1221, 1225,
1891 1226, 1227, 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1241,
1892 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1257, 1258, 1259,
1893 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1270, 1271, 1276,
1894 1277, 1278, 1281, 1282, 1288, 1289, 1290, 1291, 1292, 1293,
1895 1294, 1295, 1296, 1297, 1300, 1301, 1307, 1308, 1315, 1316,
1896 1322, 1323, 1332, 1340, 1341, 1346, 1347, 1348, 1353, 1366,
1897 1366, 1366, 1366, 1366, 1366, 1366, 1369, 1373, 1377, 1384,
1898 1389, 1397, 1426, 1451, 1456, 1466, 1476, 1480, 1490, 1497,
1899 1506, 1513, 1518, 1523, 1530, 1531, 1538, 1545, 1553, 1559,
1900 1571, 1599, 1615, 1642, 1670, 1696, 1716, 1742, 1762, 1774,
1901 1781, 1847, 1857, 1867, 1873, 1883, 1889, 1899, 1905, 1911,
1902 1924, 1936, 1957, 1965, 1971, 1982, 1987, 1992, 1997, 2002,
1903 2008, 2014, 2020, 2028, 2039, 2043, 2051, 2051, 2054, 2054,
1904 2057, 2069, 2090, 2095, 2103, 2104, 2108, 2108, 2112, 2112,
1905 2115, 2118, 2142, 2154, 2153, 2165, 2164, 2174, 2173, 2184,
1906 2224, 2227, 2233, 2243, 2247, 2252, 2254, 2259, 2264, 2273,
Nuno Lopese20dbca2008-10-03 15:45:58 +00001907 2283, 2294, 2298, 2307, 2316, 2321, 2470, 2470, 2472, 2481,
1908 2481, 2483, 2488, 2500, 2504, 2509, 2513, 2517, 2522, 2527,
1909 2531, 2535, 2539, 2543, 2547, 2551, 2573, 2595, 2601, 2614,
1910 2626, 2631, 2643, 2649, 2653, 2663, 2667, 2671, 2676, 2683,
1911 2683, 2689, 2698, 2703, 2708, 2712, 2721, 2730, 2743, 2752,
1912 2756, 2764, 2784, 2788, 2793, 2804, 2823, 2832, 2936, 2940,
1913 2947, 2958, 2971, 2980, 2993, 3004, 3014, 3025, 3033, 3043,
1914 3050, 3053, 3054, 3062, 3068, 3077, 3081, 3086, 3102, 3119,
1915 3131, 3143, 3157, 3171, 3183, 3204, 3211, 3217, 3223, 3229,
1916 3244, 3354, 3359, 3363, 3370, 3377, 3387, 3394, 3404, 3412,
1917 3426, 3443, 3457, 3472, 3487
Dan Gohman54392c12008-04-19 00:24:39 +00001918};
1919#endif
1920
1921#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1922/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1923 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1924static const char *const yytname[] =
1925{
1926 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1927 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1928 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1929 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1930 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1931 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1932 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1933 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001934 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001935 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1936 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1937 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesenf4581482008-09-26 19:32:34 +00001938 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1939 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1940 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1941 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1942 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1943 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1944 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1945 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1946 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1947 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1948 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patelcd842482008-09-29 20:49:50 +00001949 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1950 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1951 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1952 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1953 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1954 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1955 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Devang Patel5df692d2008-09-02 20:52:40 +00001956 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
Devang Pateld222f862008-09-25 21:00:45 +00001957 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
Devang Patelcd842482008-09-29 20:49:50 +00001958 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1959 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1960 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1961 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1962 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1963 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1964 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1965 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1966 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1967 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1968 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1969 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1970 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner906773a2008-08-29 17:20:18 +00001971 "OptVolatile", "MemoryInst", 0
Dan Gohman54392c12008-04-19 00:24:39 +00001972};
1973#endif
1974
1975# ifdef YYPRINT
1976/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1977 token YYLEX-NUM. */
1978static const yytype_uint16 yytoknum[] =
1979{
1980 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1981 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1982 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1983 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1984 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1985 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1986 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1987 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1988 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1989 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1990 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1991 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1992 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1993 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1994 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patelcd842482008-09-29 20:49:50 +00001995 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
1996 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
1997 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00001998};
1999# endif
2000
2001/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002002static const yytype_uint16 yyr1[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002003{
Devang Patelcd842482008-09-29 20:49:50 +00002004 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2005 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2006 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2007 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2008 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
2009 178, 178, 178, 178, 178, 179, 180, 180, 180, 180,
2010 180, 181, 181, 181, 182, 182, 183, 183, 184, 184,
2011 185, 186, 186, 187, 187, 188, 189, 189, 189, 189,
2012 189, 189, 190, 190, 190, 191, 191, 191, 191, 192,
2013 192, 192, 193, 193, 193, 193, 193, 194, 194, 194,
2014 195, 195, 195, 195, 195, 195, 195, 196, 196, 196,
2015 196, 196, 196, 196, 196, 196, 196, 197, 197, 198,
2016 198, 198, 199, 199, 200, 200, 200, 200, 200, 200,
2017 200, 200, 200, 200, 201, 201, 202, 202, 203, 203,
2018 204, 204, 205, 206, 206, 207, 207, 208, 208, 209,
2019 209, 209, 209, 209, 209, 209, 210, 210, 210, 210,
2020 210, 210, 210, 210, 210, 210, 210, 210, 210, 211,
2021 212, 212, 213, 213, 214, 214, 214, 214, 215, 215,
2022 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2023 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2024 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
2025 217, 217, 217, 217, 218, 218, 219, 219, 220, 220,
2026 221, 221, 222, 222, 223, 223, 225, 224, 226, 224,
2027 224, 224, 224, 227, 224, 228, 224, 229, 224, 224,
2028 224, 224, 230, 231, 231, 232, 233, 233, 233, 234,
2029 234, 235, 235, 235, 235, 236, 237, 237, 238, 239,
2030 239, 240, 241, 242, 242, 243, 243, 243, 243, 243,
2031 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2032 243, 243, 243, 243, 243, 244, 244, 244, 244, 245,
2033 245, 246, 247, 247, 248, 248, 249, 249, 250, 250,
2034 250, 251, 251, 251, 251, 251, 251, 251, 251, 251,
2035 252, 252, 253, 253, 254, 254, 255, 255, 255, 255,
2036 255, 256, 256, 257, 257, 258, 258, 259, 259, 259,
2037 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
2038 259, 259, 260, 260, 261, 261, 261, 261, 261, 261,
2039 261, 261, 261, 261, 261
Dan Gohman54392c12008-04-19 00:24:39 +00002040};
2041
2042/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2043static const yytype_uint8 yyr2[] =
2044{
2045 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2046 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2047 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2048 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2049 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2050 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2051 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002052 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2054 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002055 0, 1, 1, 1, 1, 1, 2, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 2, 0, 2, 1,
Devang Patelcd842482008-09-29 20:49:50 +00002057 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2059 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2060 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2061 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2062 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2063 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2064 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2065 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2066 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2067 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2068 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2069 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2070 3, 1, 3, 1, 0, 11, 1, 1, 4, 1,
2071 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2072 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2073 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2074 1, 2, 1, 3, 2, 2, 3, 3, 2, 0,
2075 1, 2, 2, 3, 9, 9, 8, 15, 1, 1,
2076 6, 5, 2, 2, 6, 7, 4, 4, 6, 6,
2077 0, 0, 3, 2, 3, 2, 1, 5, 5, 6,
2078 6, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2079 9, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2080 7, 5, 4, 4, 7
Dan Gohman54392c12008-04-19 00:24:39 +00002081};
2082
2083/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2084 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2085 means the default is an error. */
2086static const yytype_uint16 yydefact[] =
2087{
Devang Patelcd842482008-09-29 20:49:50 +00002088 74, 61, 71, 62, 72, 63, 228, 226, 0, 0,
2089 0, 0, 0, 0, 85, 73, 0, 74, 224, 89,
2090 92, 0, 0, 240, 0, 0, 68, 0, 75, 76,
Chris Lattner906773a2008-08-29 17:20:18 +00002091 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
Devang Patelcd842482008-09-29 20:49:50 +00002092 88, 85, 85, 219, 1, 225, 90, 91, 85, 229,
2093 93, 94, 95, 96, 85, 299, 227, 299, 0, 0,
2094 248, 241, 242, 230, 285, 286, 232, 149, 150, 151,
2095 154, 153, 152, 155, 156, 0, 0, 0, 0, 287,
2096 288, 157, 231, 159, 219, 219, 97, 218, 0, 100,
2097 100, 300, 295, 69, 259, 260, 261, 294, 243, 244,
2098 247, 0, 177, 160, 0, 0, 0, 0, 166, 178,
2099 0, 0, 177, 0, 0, 0, 99, 98, 0, 216,
2100 217, 0, 0, 101, 102, 103, 104, 105, 122, 262,
2101 0, 0, 343, 343, 298, 0, 245, 176, 117, 172,
2102 174, 0, 0, 0, 0, 0, 0, 165, 0, 0,
2103 158, 0, 0, 171, 0, 170, 0, 239, 149, 150,
2104 151, 154, 153, 152, 0, 0, 67, 67, 106, 0,
2105 256, 257, 258, 70, 342, 326, 0, 0, 0, 0,
2106 100, 308, 309, 2, 3, 4, 5, 6, 7, 8,
Dale Johannesenf4581482008-09-26 19:32:34 +00002107 9, 10, 14, 15, 16, 11, 12, 13, 0, 0,
2108 0, 0, 0, 0, 0, 0, 17, 18, 19, 20,
2109 21, 22, 23, 24, 25, 26, 27, 28, 0, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002111 296, 100, 312, 0, 341, 297, 313, 246, 169, 0,
2112 134, 67, 67, 168, 0, 179, 0, 134, 67, 67,
2113 0, 220, 197, 198, 193, 195, 194, 196, 199, 192,
2114 188, 189, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002116 191, 190, 233, 121, 120, 119, 123, 0, 325, 302,
2117 67, 292, 301, 0, 0, 55, 0, 122, 29, 30,
2118 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
2119 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
2120 44, 45, 46, 47, 48, 0, 0, 0, 140, 140,
2121 348, 67, 67, 339, 0, 0, 0, 0, 0, 67,
2122 67, 67, 67, 67, 0, 122, 0, 0, 0, 108,
2123 110, 109, 107, 111, 112, 113, 114, 115, 118, 175,
2124 173, 162, 163, 164, 167, 66, 161, 235, 237, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002126 0, 181, 215, 0, 0, 0, 185, 0, 182, 0,
2127 0, 0, 145, 0, 265, 266, 267, 268, 269, 274,
2128 270, 271, 272, 273, 263, 0, 0, 0, 0, 283,
2129 290, 289, 291, 0, 0, 303, 0, 0, 67, 67,
2130 67, 67, 0, 344, 0, 346, 321, 0, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 67, 0, 116, 128, 127, 124, 126, 125, 129,
2133 130, 133, 131, 132, 135, 145, 145, 0, 0, 0,
2134 0, 0, 321, 0, 0, 0, 0, 0, 0, 0,
2135 180, 166, 178, 0, 183, 184, 0, 0, 0, 0,
2136 234, 254, 264, 0, 277, 0, 0, 0, 280, 0,
2137 278, 293, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 352, 0, 0, 0, 335, 336, 0, 0,
2139 0, 0, 353, 0, 0, 0, 333, 0, 140, 0,
2140 236, 238, 67, 0, 0, 0, 0, 0, 0, 0,
2141 0, 0, 0, 0, 214, 187, 0, 0, 0, 0,
2142 0, 0, 147, 145, 253, 117, 251, 0, 0, 276,
2143 166, 0, 275, 279, 0, 0, 0, 0, 0, 0,
2144 0, 140, 141, 140, 0, 0, 0, 0, 0, 0,
2145 351, 323, 0, 67, 327, 328, 0, 0, 349, 67,
2146 221, 0, 0, 0, 0, 201, 0, 0, 0, 0,
2147 212, 0, 186, 0, 0, 67, 142, 148, 146, 65,
2148 0, 134, 0, 282, 0, 0, 0, 320, 329, 330,
2149 331, 332, 345, 347, 322, 0, 0, 334, 337, 338,
2150 324, 0, 320, 140, 0, 0, 0, 0, 0, 209,
2151 0, 0, 0, 203, 204, 200, 64, 250, 252, 117,
2152 143, 284, 281, 0, 0, 117, 117, 0, 314, 0,
2153 354, 0, 350, 205, 206, 207, 208, 0, 0, 0,
2154 213, 65, 144, 138, 0, 306, 0, 0, 0, 0,
2155 134, 0, 315, 134, 202, 210, 211, 249, 0, 136,
2156 304, 0, 305, 0, 108, 110, 117, 117, 0, 117,
2157 117, 340, 139, 0, 255, 0, 0, 317, 316, 0,
2158 0, 0, 137, 0, 0, 0, 117, 117, 311, 0,
2159 0, 319, 318, 310, 0, 0, 307
Dan Gohman54392c12008-04-19 00:24:39 +00002160};
2161
2162/* YYDEFGOTO[NTERM-NUM]. */
2163static const yytype_int16 yydefgoto[] =
2164{
Devang Patelcd842482008-09-29 20:49:50 +00002165 -1, 277, 278, 279, 308, 325, 164, 165, 79, 637,
Dale Johannesenf4581482008-09-26 19:32:34 +00002166 113, 12, 133, 80, 14, 15, 41, 42, 43, 48,
Devang Patelcd842482008-09-29 20:49:50 +00002167 54, 118, 128, 358, 238, 286, 169, 454, 361, 694,
2168 679, 423, 542, 663, 480, 543, 81, 166, 139, 156,
2169 140, 141, 110, 382, 409, 383, 121, 88, 157, 16,
2170 17, 18, 20, 19, 392, 455, 456, 63, 23, 61,
2171 101, 546, 547, 129, 172, 55, 96, 56, 49, 483,
2172 410, 83, 412, 291, 292, 57, 92, 93, 230, 667,
2173 134, 333, 647, 502, 512, 231, 232, 233, 234
Dan Gohman54392c12008-04-19 00:24:39 +00002174};
2175
2176/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2177 STATE-NUM. */
Devang Patelcd842482008-09-29 20:49:50 +00002178#define YYPACT_NINF -620
Dan Gohman54392c12008-04-19 00:24:39 +00002179static const yytype_int16 yypact[] =
2180{
Devang Patelcd842482008-09-29 20:49:50 +00002181 484, -620, -620, -620, -620, -620, -620, -620, -14, -116,
2182 -6, -83, 104, -31, 24, -620, 161, 528, -620, 238,
2183 204, 43, 49, -620, 5, 196, -620, 1912, -620, -620,
2184 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2185 -620, 173, 173, 227, -620, -620, -620, -620, 173, -620,
2186 -620, -620, -620, -620, 173, 202, -620, -9, 234, 243,
2187 246, -620, -620, -620, -620, -620, 67, -620, -620, -620,
2188 -620, -620, -620, -620, -620, 273, 285, 3, 624, -620,
2189 -620, -620, 4, -620, 201, 201, 253, -620, 81, 240,
2190 240, -620, -620, 39, -620, -620, -620, -620, -620, -620,
2191 -620, -59, 1564, -620, 128, 132, 643, 67, -620, 4,
2192 -114, 165, 1564, 145, 81, 81, -620, -620, 1605, -620,
2193 -620, 2014, 324, -620, -620, -620, -620, -620, -620, -620,
2194 -13, 188, 2299, 2299, -620, 328, -620, -620, 4, -620,
2195 189, 194, 2076, 2076, 186, -111, 2076, -620, 352, 205,
2196 -620, 2014, 2076, 67, 208, 4, 247, -620, 216, 351,
2197 355, 359, 365, 368, 269, 372, 1625, 306, -620, 1517,
2198 -620, -620, -620, -620, -620, -620, 325, 2094, 38, 373,
2199 240, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2200 -620, -620, -620, -620, -620, -620, -620, -620, 298, 336,
2201 298, 336, 2076, 2076, 2076, 2076, -620, -620, -620, -620,
2202 -620, -620, -620, -620, -620, -620, -620, -620, 2076, 2076,
2203 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076,
2204 -620, 240, -620, 66, -620, -620, -620, -620, 231, 1791,
2205 -620, -17, -21, -620, 214, 4, 225, -620, 306, -5,
2206 1605, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2207 -620, -620, 298, 336, 298, 336, 229, 230, 249, 250,
2208 251, 252, 256, 1809, 2117, 690, 364, 257, 259, 261,
2209 -620, -620, -620, -620, -620, -620, -620, 114, -620, 67,
2210 1019, -620, 262, 1189, 1189, -620, 1189, -620, -620, -620,
2211 -620, -620, -620, -620, -620, -620, -620, -620, 2076, -620,
2212 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2213 -620, -620, -620, -620, -620, 2076, 2076, 2076, -23, 28,
2214 -620, 1019, -18, 265, 266, 268, 272, 288, 289, 1019,
2215 1019, 1019, 1019, 1019, 383, -620, 2076, 2076, 398, -620,
2216 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2217 -620, 137, -620, -620, -620, -620, 137, -620, 145, 385,
2218 293, 294, 295, 297, 2014, 2014, 2014, 2014, 2014, 2014,
2219 2014, -620, -620, -56, 1069, -74, -620, -80, -620, 2014,
2220 2014, 2014, 296, 300, -620, -620, -620, -620, -620, -620,
2221 -620, -620, -620, -620, 396, 1832, 2135, 1239, 403, -620,
2222 -620, -620, -620, 2076, 299, -620, 301, 1517, 1019, 1019,
2223 1019, 1019, 8, -620, 33, -620, -620, 1189, 303, 2076,
2224 2076, 2076, 2076, 2076, 302, 304, 307, 308, 309, 2076,
2225 1517, 1019, 312, -620, -620, -620, -620, -620, -620, -620,
2226 -620, -620, -620, -620, -620, 296, 296, 2076, 2014, 2014,
2227 2014, 2014, -620, 317, 318, 319, 320, 304, 323, 2014,
2228 -620, 326, 1471, -77, -620, -620, 327, 330, 424, 2,
2229 -620, 1850, -620, 443, -620, -52, 1280, -73, -620, -72,
2230 -620, -620, 469, 471, 1189, 332, 334, 337, 338, 1189,
2231 494, 1189, 339, 343, 1189, 347, 4, -620, 348, 349,
2232 508, 519, 362, 2076, 1189, 1189, 4, 1189, 363, 2076,
2233 -620, -620, 26, 367, 375, 377, 387, 149, 2014, 2014,
2234 2014, 2014, 157, 2014, -620, -620, 357, 2014, 2014, 2076,
2235 505, 526, -620, 296, -620, 4, 391, 394, 393, -620,
2236 366, -62, -620, -620, 1189, 1189, 386, 1189, 1189, 1189,
2237 1189, 363, -620, 363, 2076, 1189, 395, 2076, 2076, 2076,
2238 -620, -620, 552, 1019, -620, -620, 405, 511, -620, 1019,
2239 -620, 2014, 2014, 2014, 2014, -620, 400, 406, 407, 408,
2240 -620, 304, -620, 411, 412, 57, -620, -620, -620, 11,
2241 1891, -620, 545, -620, 399, 413, 414, 2179, -620, -620,
2242 -620, -620, -620, -620, -620, 409, 1189, -620, -620, -620,
2243 -620, 304, 2179, 363, 417, 418, 423, 425, 2014, -620,
2244 2014, 2014, 180, -620, -620, -620, -620, -620, -620, 4,
2245 172, -620, -620, 556, -3, 46, 4, 181, -620, 422,
2246 362, 184, -620, -620, -620, -620, -620, 430, 431, 432,
2247 -620, 11, -620, 539, 1189, -620, 1337, -1, 865, 865,
2248 -620, 2197, -620, -620, -620, -620, -620, -620, 590, 445,
2249 -620, 433, -620, 1337, 446, 453, -620, -620, 86, 46,
2250 4, 137, -620, 582, -620, 596, 452, 231, 231, 598,
2251 865, 865, -620, 1189, 599, 1189, -620, -620, -620, 1189,
2252 544, 231, 231, -620, 603, 1189, -620
Dan Gohman54392c12008-04-19 00:24:39 +00002253};
2254
2255/* YYPGOTO[NTERM-NUM]. */
2256static const yytype_int16 yypgoto[] =
2257{
Devang Patelcd842482008-09-29 20:49:50 +00002258 -620, 42, 112, 200, -160, -158, -177, -620, 0, -39,
2259 -151, 531, -620, 9, -620, -620, -620, -620, 77, -620,
2260 -620, -620, -152, -620, -518, -620, -268, -620, -244, -620,
2261 -620, -311, -15, -620, -414, -620, -620, -26, 389, -164,
2262 -620, 514, 523, 142, -162, -261, 220, 263, 380, -620,
2263 -620, 625, -620, -620, -620, -620, -620, -620, -620, -620,
2264 -620, -620, -620, 559, -620, -620, -620, -620, -620, -620,
2265 -619, -82, 267, -198, -620, -620, 595, -620, 535, -620,
2266 -620, -620, 47, 215, -456, -620, 543, -620, -620
Dan Gohman54392c12008-04-19 00:24:39 +00002267};
2268
2269/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2270 positive, shift that token. If negative, reduce the rule which
2271 number is the opposite. If zero, do what YYDEFACT says.
2272 If YYTABLE_NINF, syntax error. */
Devang Patelcd842482008-09-29 20:49:50 +00002273#define YYTABLE_NINF -224
Dan Gohman54392c12008-04-19 00:24:39 +00002274static const yytype_int16 yytable[] =
2275{
Devang Patelcd842482008-09-29 20:49:50 +00002276 11, 82, 296, 366, 280, 287, 330, 105, 295, 13,
2277 295, 532, 91, 385, 387, 170, 282, 11, 425, 499,
2278 94, 334, 335, 336, 337, 338, 13, 599, 297, 417,
2279 1, 344, 111, 3, 111, 5, 540, 111, 111, 21,
2280 326, 520, 521, 327, 501, 24, 131, 681, 146, 293,
2281 111, 146, 109, 25, 22, 294, 541, 147, 1, 111,
2282 244, 3, 500, 5, 696, 348, 29, 30, 31, 32,
2283 33, 34, 35, 36, 251, 37, 138, 440, 26, 345,
2284 109, 111, 469, 111, 281, 469, 138, 500, 469, 469,
2285 469, 475, 155, 11, 536, 474, 552, 367, 368, 553,
2286 469, -155, 370, 135, 372, 371, 469, 373, 136, 604,
2287 469, 470, 111, 119, 120, 549, 241, 242, 84, 85,
2288 245, 661, 27, 473, 699, 89, 249, 668, 669, 598,
2289 28, 90, 349, 350, 2, 632, 112, 4, 112, 422,
2290 -67, 112, 112, 155, 485, 487, 489, 427, 363, 442,
2291 362, 290, 351, 352, 112, 353, 354, 171, 355, 356,
2292 357, 44, 95, 112, 665, 650, 682, -67, 697, 698,
2293 60, 700, 701, 106, 227, 227, 328, 329, 290, 331,
2294 38, 39, 40, 346, 347, 112, 580, 112, 711, 712,
2295 424, -67, 332, 290, 290, 290, 290, 290, 339, 340,
2296 341, 342, 343, 290, 58, -155, 540, 578, 411, -155,
2297 59, 411, 411, 138, 411, 491, 112, 635, 62, -55,
2298 -55, -55, -55, 91, 155, 551, 102, 444, 445, 446,
2299 447, 505, 448, 507, 508, 509, 449, 450, 87, 451,
2300 452, 453, 252, 253, 228, 228, 50, 51, 52, 411,
2301 612, 53, 613, 494, 64, 65, 98, 411, 411, 411,
2302 411, 411, 86, 167, 87, 99, 1, 2, 100, 3,
2303 4, 5, 254, 255, 256, 257, 517, 103, 444, 445,
2304 446, 447, 418, 448, 46, 348, 47, 449, 450, 104,
2305 451, 452, 453, 248, 142, 116, 393, 117, 143, 419,
2306 420, 421, 122, 123, 124, 125, 126, 127, 150, 585,
2307 280, 564, 652, 444, 445, 446, 447, 590, 448, 572,
2308 441, 290, 449, 450, 148, 451, 452, 453, 168, 38,
2309 39, 40, 229, 229, 151, 152, 411, 411, 411, 411,
2310 660, 670, 572, 671, 673, 411, 671, 114, 115, 173,
2311 237, 239, 349, 350, 240, 243, 246, 640, 472, 411,
2312 -56, 111, 309, 310, -57, 247, 614, 250, -60, 617,
2313 618, 619, 351, 352, -59, 353, 354, -58, 355, 356,
2314 357, 258, 288, 364, 295, 365, 388, 290, 374, 375,
2315 281, 155, 298, 299, 300, 301, 302, 303, 304, 305,
2316 306, 307, 443, 290, 506, 290, 290, 290, 376, 377,
2317 378, 379, 411, 516, 155, 380, 389, 411, 390, 411,
2318 391, 439, 411, 457, 413, 490, 688, 428, 429, 691,
2319 430, 522, 411, 411, 431, 411, 311, 312, 313, 314,
2320 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2321 432, 433, 458, 459, 460, 545, 461, 482, 479, 481,
2322 472, 492, 539, 493, 510, 548, 511, 666, 504, 513,
2323 514, 515, 411, 411, 519, 411, 411, 411, 411, 528,
2324 529, 530, 531, 411, -223, 533, 554, 573, 555, 537,
2325 683, 411, 538, 579, 557, 535, 558, 411, 562, 559,
2326 560, 564, -69, 1, 2, 565, 3, 4, 5, 567,
2327 568, 569, 570, 595, 6, 7, 462, 463, 464, 465,
2328 466, 467, 468, 571, 572, 577, 592, 596, -222, 581,
2329 597, 476, 477, 478, 411, 603, 8, 582, 290, 583,
2330 9, 290, 290, 290, 10, 607, -69, 1, 2, 584,
2331 3, 4, 5, 600, 601, 602, 620, 616, 6, 7,
2332 414, 415, 628, 416, 622, 500, 629, 641, 642, 630,
2333 631, 633, 634, 664, 639, 643, 648, 653, 654, 644,
2334 8, 646, 411, 655, 9, 656, 411, 411, 10, 672,
2335 674, 675, 676, 678, 692, 695, 646, 693, 426, 636,
2336 523, 524, 525, 526, 702, -18, 434, 435, 436, 437,
2337 438, 534, -19, 703, 704, 705, 709, 714, 411, 411,
2338 715, 411, 677, 411, 132, 662, 149, 411, 360, 145,
2339 369, 64, 65, 411, 107, 67, 68, 69, 70, 71,
2340 72, 73, 45, 1, 2, 690, 3, 4, 5, 130,
2341 64, 65, 97, 107, 67, 68, 69, 70, 71, 72,
2342 73, 636, 1, 2, 0, 3, 4, 5, 235, 651,
2343 586, 587, 588, 589, 74, 591, 236, 527, 0, 593,
2344 594, 0, 0, 0, 0, 495, 496, 497, 498, 0,
2345 0, 0, 0, 74, 503, 0, 0, 64, 65, 0,
2346 107, 158, 159, 160, 161, 162, 163, 73, 518, 1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002347 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002348 0, 0, 0, 624, 625, 626, 627, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002350 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002351 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002352 0, 556, 0, 0, 0, 0, 561, 0, 563, 0,
2353 657, 566, 658, 659, 0, 0, 0, 0, 0, 0,
2354 0, 574, 575, 0, 576, 0, 0, 0, 75, 76,
2355 0, 0, 77, 0, 78, 108, 0, 0, 0, 0,
2356 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2357 0, 77, 0, 78, 144, 0, 0, 0, 0, 0,
2358 0, 605, 606, 0, 608, 609, 610, 611, 0, 0,
2359 0, 0, 615, 0, 0, 0, 0, 0, 0, 0,
2360 621, 0, 0, 0, 0, 0, 623, 0, 0, 0,
2361 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2362 78, 386, 0, 0, 0, 0, 0, 0, 394, 395,
2363 396, 397, 64, 65, 398, 0, 0, 0, 0, 0,
2364 0, 0, 0, 649, 1, 2, 0, 3, 4, 5,
2365 399, 400, 401, 0, 0, 0, 0, 0, 0, 0,
2366 0, 0, 0, 0, 0, 402, 403, 0, 0, 0,
2367 0, 0, 0, 0, 0, 0, 0, 0, 0, 348,
2368 0, 0, 0, 0, 404, 0, 0, 0, 0, 0,
2369 0, 680, 0, 0, 0, 686, 687, 0, 0, 0,
2370 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2371 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2372 0, 0, 0, 0, 0, 0, 0, 706, 707, 0,
2373 708, 0, 710, 0, 0, 0, 713, 0, 0, 0,
2374 0, 0, 716, 0, 266, 206, 684, 685, 209, 210,
2375 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2376 268, 269, 270, 0, 271, 272, 351, 352, 0, 353,
2377 354, 0, 355, 356, 357, 0, 0, 0, 0, 0,
2378 0, 0, 394, 395, 396, 397, 64, 65, 398, 0,
2379 405, 0, 0, 406, 0, 407, 0, 408, 1, 2,
2380 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2382 403, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2383 0, 0, 0, 0, 111, 0, 64, 65, 404, 107,
2384 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2385 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2386 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2387 263, 264, 265, 0, 0, 0, 0, 0, 0, 74,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002388 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002389 0, 0, 0, 0, 0, 0, 0, 0, 266, 206,
2390 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2391 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
Dale Johannesenf4581482008-09-26 19:32:34 +00002392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002393 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2394 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2395 0, 408, 394, 395, 396, 397, 64, 65, 398, 0,
2396 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2397 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2398 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2399 403, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2400 471, 0, 0, 0, 0, 0, 64, 65, 404, 107,
2401 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2402 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2403 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2404 263, 264, 265, 0, 0, 0, 0, 64, 65, 74,
2405 107, 158, 159, 160, 161, 162, 163, 73, 0, 1,
2406 2, 0, 3, 4, 5, 0, 0, 0, 266, 206,
2407 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2408 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
2409 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2410 394, 395, 396, 397, 0, 0, 398, 0, 0, 0,
2411 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2412 0, 408, 399, 400, 401, 0, 0, 0, 0, 0,
2413 0, 0, 0, 0, 0, 0, 0, 402, 403, 0,
2414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 0, 0, 0, 0, 0, 404, 0, 0, 0,
2416 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2417 488, 0, 183, 184, 185, 186, 187, 188, 189, 190,
2418 191, 192, 193, 194, 195, 196, 197, 262, 263, 264,
2419 265, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2420 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2421 78, 550, 0, 0, 0, 0, 266, 206, 207, 208,
2422 209, 210, 211, 212, 213, 214, 215, 216, 217, 0,
2423 267, 0, 268, 269, 270, 0, 271, 272, 64, 65,
2424 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2425 1, 2, 0, 3, 4, 5, 259, 0, 0, 0,
2426 0, 0, 405, 0, 0, 406, 0, 407, 0, 408,
2427 0, 260, 261, 0, 0, 0, 0, 0, 0, 0,
2428 0, 0, 0, 0, 64, 65, 111, 153, 67, 68,
2429 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2430 4, 5, 0, 0, 0, 0, 183, 184, 185, 186,
2431 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
2432 197, 262, 263, 264, 265, 0, 0, 74, 0, 0,
2433 0, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2434 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2435 266, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2436 215, 216, 217, 137, 267, 0, 268, 269, 270, 0,
2437 271, 272, 64, 65, 74, 153, 67, 68, 69, 70,
2438 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2439 112, 0, 64, 65, -67, 0, 273, 0, 0, 274,
2440 0, 275, 0, 276, 1, 2, 0, 3, 4, 5,
2441 259, 0, 0, 0, 0, 74, 0, 0, 283, 284,
2442 0, 285, 0, 0, 0, 260, 261, 0, 0, 0,
2443 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2444 111, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2446 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2447 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2448 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2449 154, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2450 0, 0, 0, 0, 266, 206, 207, 208, 209, 210,
2451 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2452 268, 269, 270, 0, 271, 272, 0, 0, 0, 75,
2453 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2454 0, 0, 0, 0, 112, 0, 0, 0, 0, 0,
2455 273, 0, 0, 274, 0, 275, 0, 276, 64, 65,
2456 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2457 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2458 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2459 359, 3, 4, 5, 0, 0, 0, 0, 0, 64,
2460 65, 74, 107, 158, 159, 160, 161, 162, 163, 73,
2461 0, 1, 2, 0, 3, 4, 5, 64, 65, 74,
2462 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2463 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2464 0, 0, 74, 0, 0, 0, 0, 0, 0, 544,
2465 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2466 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2467 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2468 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
2469 638, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2470 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2471 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2472 0, 78, 74, 0, 0, 0, 0, 0, 0, 0,
2473 0, 0, 0, 75, 76, 0, 381, 77, 0, 78,
2474 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2475 0, 0, 0, 0, 0, 0, 75, 76, 0, 484,
2476 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2477 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2478 78, 64, 65, 0, 107, 158, 159, 160, 161, 162,
2479 163, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2480 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2481 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2482 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2483 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2484 77, 0, 78, 64, 65, 0, 107, 67, 68, 69,
2485 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2486 5, 64, 65, 0, 289, 67, 68, 69, 70, 71,
2487 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2488 0, 0, 0, 0, 64, 65, 74, 107, 158, 159,
2489 160, 161, 162, 163, 73, 0, 1, 2, 0, 3,
2490 4, 5, 64, 65, 74, 107, 158, 159, 160, 161,
2491 162, 163, 73, 0, 1, 2, 0, 3, 4, 5,
2492 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2493 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2494 0, 0, 77, 0, 78, 74, 64, 65, 0, 107,
2495 67, 68, 69, 70, 71, 72, 645, 0, 1, 2,
2496 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
2497 69, 70, 71, 72, 689, 0, 1, 2, 0, 3,
2498 4, 5, 0, 0, 0, 0, 0, 0, 0, 74,
2499 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2500 75, 76, 0, 0, 77, 0, 78, 74, 0, 0,
2501 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2502 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2503 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2504 0, 75, 76, 0, 0, 77, 0, 384, 0, 0,
2505 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2506 76, 0, 0, 77, 0, 486, 0, 0, 0, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002507 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2508 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002509 0, 0, 0, 0, 0, 174, 0, 0, 0, 0,
2510 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2511 0, 0, 0, 0, 0, 0, 175, 176, 0, 0,
2512 0, 75, 76, 0, 0, 77, 0, 78, 177, 178,
2513 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2514 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2515 199, 200, 201, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002516 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002517 0, 0, 0, 202, 203, 204, 0, 0, 205, 206,
2518 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2519 217, 218, 219, 220, 221, 222, 223, 224, 225, 226
Dan Gohman54392c12008-04-19 00:24:39 +00002520};
2521
2522static const yytype_int16 yycheck[] =
2523{
Devang Patelcd842482008-09-29 20:49:50 +00002524 0, 27, 179, 247, 166, 169, 204, 4, 11, 0,
2525 11, 467, 21, 274, 275, 28, 167, 17, 329, 11,
2526 29, 219, 220, 221, 222, 223, 17, 545, 180, 297,
2527 19, 229, 55, 22, 55, 24, 34, 55, 55, 53,
2528 200, 455, 456, 201, 11, 161, 7, 666, 162, 11,
2529 55, 162, 78, 59, 68, 17, 54, 171, 19, 55,
2530 171, 22, 54, 24, 683, 54, 42, 43, 44, 45,
2531 46, 47, 48, 49, 156, 51, 102, 345, 161, 231,
2532 106, 55, 162, 55, 166, 162, 112, 54, 162, 162,
2533 162, 171, 118, 93, 171, 169, 169, 248, 249, 171,
2534 162, 55, 262, 162, 264, 263, 162, 265, 167, 171,
2535 162, 167, 55, 32, 33, 167, 142, 143, 41, 42,
2536 146, 639, 18, 384, 38, 48, 152, 645, 646, 543,
2537 161, 54, 121, 122, 20, 591, 159, 23, 159, 162,
2538 163, 159, 159, 169, 405, 406, 407, 165, 169, 347,
2539 167, 177, 141, 142, 159, 144, 145, 170, 147, 148,
2540 149, 0, 171, 159, 167, 621, 167, 163, 686, 687,
2541 165, 689, 690, 170, 132, 133, 202, 203, 204, 205,
2542 156, 157, 158, 117, 118, 159, 160, 159, 706, 707,
2543 162, 163, 218, 219, 220, 221, 222, 223, 224, 225,
2544 226, 227, 228, 229, 161, 159, 34, 518, 290, 163,
2545 161, 293, 294, 239, 296, 413, 159, 160, 22, 3,
2546 4, 5, 6, 21, 250, 486, 159, 141, 142, 143,
2547 144, 429, 146, 431, 432, 433, 150, 151, 37, 153,
2548 154, 155, 26, 27, 132, 133, 42, 43, 44, 331,
2549 561, 47, 563, 417, 7, 8, 22, 339, 340, 341,
2550 342, 343, 35, 121, 37, 22, 19, 20, 22, 22,
2551 23, 24, 3, 4, 5, 6, 440, 4, 141, 142,
2552 143, 144, 308, 146, 46, 54, 48, 150, 151, 4,
2553 153, 154, 155, 151, 166, 42, 287, 44, 166, 325,
2554 326, 327, 62, 63, 64, 65, 66, 67, 163, 160,
2555 472, 162, 623, 141, 142, 143, 144, 160, 146, 162,
2556 346, 347, 150, 151, 159, 153, 154, 155, 4, 156,
2557 157, 158, 132, 133, 114, 115, 418, 419, 420, 421,
2558 160, 160, 162, 162, 160, 427, 162, 84, 85, 161,
2559 22, 162, 121, 122, 160, 169, 4, 601, 384, 441,
2560 9, 55, 26, 27, 9, 160, 564, 159, 9, 567,
2561 568, 569, 141, 142, 9, 144, 145, 9, 147, 148,
2562 149, 9, 57, 169, 11, 160, 22, 413, 159, 159,
2563 472, 417, 94, 95, 96, 97, 98, 99, 100, 101,
2564 102, 103, 4, 429, 430, 431, 432, 433, 159, 159,
2565 159, 159, 494, 439, 440, 159, 159, 499, 159, 501,
2566 159, 38, 504, 38, 162, 22, 670, 162, 162, 673,
2567 162, 457, 514, 515, 162, 517, 100, 101, 102, 103,
2568 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
2569 162, 162, 159, 159, 159, 481, 159, 61, 162, 159,
2570 486, 162, 38, 162, 162, 22, 162, 644, 165, 162,
2571 162, 162, 554, 555, 162, 557, 558, 559, 560, 162,
2572 162, 162, 162, 565, 0, 162, 17, 513, 17, 162,
2573 667, 573, 162, 519, 162, 169, 162, 579, 4, 162,
2574 162, 162, 18, 19, 20, 162, 22, 23, 24, 162,
2575 162, 162, 4, 539, 30, 31, 374, 375, 376, 377,
2576 378, 379, 380, 4, 162, 162, 169, 22, 0, 162,
2577 4, 389, 390, 391, 616, 169, 52, 162, 564, 162,
2578 56, 567, 568, 569, 60, 159, 18, 19, 20, 162,
2579 22, 23, 24, 162, 160, 162, 4, 162, 30, 31,
2580 293, 294, 162, 296, 159, 54, 160, 22, 169, 162,
2581 162, 160, 160, 17, 600, 162, 167, 160, 160, 165,
2582 52, 607, 664, 160, 56, 160, 668, 669, 60, 167,
2583 160, 160, 160, 54, 4, 162, 622, 152, 331, 599,
2584 458, 459, 460, 461, 22, 159, 339, 340, 341, 342,
2585 343, 469, 159, 17, 162, 17, 17, 73, 700, 701,
2586 17, 703, 661, 705, 93, 640, 112, 709, 239, 106,
2587 250, 7, 8, 715, 10, 11, 12, 13, 14, 15,
2588 16, 17, 17, 19, 20, 671, 22, 23, 24, 90,
2589 7, 8, 57, 10, 11, 12, 13, 14, 15, 16,
2590 17, 661, 19, 20, -1, 22, 23, 24, 133, 622,
2591 528, 529, 530, 531, 50, 533, 133, 462, -1, 537,
2592 538, -1, -1, -1, -1, 418, 419, 420, 421, -1,
2593 -1, -1, -1, 50, 427, -1, -1, 7, 8, -1,
2594 10, 11, 12, 13, 14, 15, 16, 17, 441, 19,
Dale Johannesenf4581482008-09-26 19:32:34 +00002595 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002596 -1, -1, -1, 581, 582, 583, 584, -1, -1, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002597 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002598 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002599 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002600 -1, 494, -1, -1, -1, -1, 499, -1, 501, -1,
2601 628, 504, 630, 631, -1, -1, -1, -1, -1, -1,
2602 -1, 514, 515, -1, 517, -1, -1, -1, 164, 165,
2603 -1, -1, 168, -1, 170, 171, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, -1, -1, 164, 165, -1,
2605 -1, 168, -1, 170, 171, -1, -1, -1, -1, -1,
2606 -1, 554, 555, -1, 557, 558, 559, 560, -1, -1,
2607 -1, -1, 565, -1, -1, -1, -1, -1, -1, -1,
2608 573, -1, -1, -1, -1, -1, 579, -1, -1, -1,
2609 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2610 170, 171, -1, -1, -1, -1, -1, -1, 3, 4,
2611 5, 6, 7, 8, 9, -1, -1, -1, -1, -1,
2612 -1, -1, -1, 616, 19, 20, -1, 22, 23, 24,
2613 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2614 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2615 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2616 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2617 -1, 664, -1, -1, -1, 668, 669, -1, -1, -1,
2618 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2619 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2620 -1, -1, -1, -1, -1, -1, -1, 700, 701, -1,
2621 703, -1, 705, -1, -1, -1, 709, -1, -1, -1,
2622 -1, -1, 715, -1, 119, 120, 121, 122, 123, 124,
2623 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2624 135, 136, 137, -1, 139, 140, 141, 142, -1, 144,
2625 145, -1, 147, 148, 149, -1, -1, -1, -1, -1,
2626 -1, -1, 3, 4, 5, 6, 7, 8, 9, -1,
2627 165, -1, -1, 168, -1, 170, -1, 172, 19, 20,
2628 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2629 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2630 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2631 -1, -1, -1, -1, 55, -1, 7, 8, 59, 10,
Devang Patel5df692d2008-09-02 20:52:40 +00002632 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Devang Patelcd842482008-09-29 20:49:50 +00002633 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2634 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2635 91, 92, 93, -1, -1, -1, -1, -1, -1, 50,
Devang Patel5df692d2008-09-02 20:52:40 +00002636 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002637 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2638 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2639 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2640 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2641 -1, -1, -1, -1, -1, -1, -1, -1, 159, -1,
2642 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2643 -1, 172, 3, 4, 5, 6, 7, 8, 9, -1,
2644 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2645 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2646 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2647 41, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2648 171, -1, -1, -1, -1, -1, 7, 8, 59, 10,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002649 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Devang Patelcd842482008-09-29 20:49:50 +00002650 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2651 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2652 91, 92, 93, -1, -1, -1, -1, 7, 8, 50,
Devang Patel5df692d2008-09-02 20:52:40 +00002653 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Devang Patelcd842482008-09-29 20:49:50 +00002654 20, -1, 22, 23, 24, -1, -1, -1, 119, 120,
2655 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2656 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2657 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2658 3, 4, 5, 6, -1, -1, 9, -1, -1, -1,
2659 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2660 -1, 172, 25, 26, 27, -1, -1, -1, -1, -1,
2661 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002662 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002663 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2664 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2665 171, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2666 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2667 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2668 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2669 170, 171, -1, -1, -1, -1, 119, 120, 121, 122,
2670 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2671 133, -1, 135, 136, 137, -1, 139, 140, 7, 8,
2672 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2673 19, 20, -1, 22, 23, 24, 25, -1, -1, -1,
2674 -1, -1, 165, -1, -1, 168, -1, 170, -1, 172,
2675 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2676 -1, -1, -1, -1, 7, 8, 55, 10, 11, 12,
2677 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2678 23, 24, -1, -1, -1, -1, 75, 76, 77, 78,
2679 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2680 89, 90, 91, 92, 93, -1, -1, 50, -1, -1,
2681 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2682 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2683 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2684 129, 130, 131, 39, 133, -1, 135, 136, 137, -1,
2685 139, 140, 7, 8, 50, 10, 11, 12, 13, 14,
2686 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2687 159, -1, 7, 8, 163, -1, 165, -1, -1, 168,
2688 -1, 170, -1, 172, 19, 20, -1, 22, 23, 24,
2689 25, -1, -1, -1, -1, 50, -1, -1, 141, 142,
2690 -1, 144, -1, -1, -1, 40, 41, -1, -1, -1,
2691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 55, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2693 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2694 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2695 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2696 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2697 125, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2698 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2699 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2700 135, 136, 137, -1, 139, 140, -1, -1, -1, 164,
2701 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
2702 -1, -1, -1, -1, 159, -1, -1, -1, -1, -1,
2703 165, -1, -1, 168, -1, 170, -1, 172, 7, 8,
2704 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002705 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2706 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Devang Patelcd842482008-09-29 20:49:50 +00002707 39, 22, 23, 24, -1, -1, -1, -1, -1, 7,
2708 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2709 -1, 19, 20, -1, 22, 23, 24, 7, 8, 50,
Dale Johannesenf4581482008-09-26 19:32:34 +00002710 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2711 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002712 -1, -1, 50, -1, -1, -1, -1, -1, -1, 39,
2713 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2714 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2715 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2716 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2717 39, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2718 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2719 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2720 -1, 170, 50, -1, -1, -1, -1, -1, -1, -1,
2721 -1, -1, -1, 164, 165, -1, 167, 168, -1, 170,
Chris Lattner906773a2008-08-29 17:20:18 +00002722 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002723 -1, -1, -1, -1, -1, -1, 164, 165, -1, 167,
2724 168, -1, 170, -1, -1, -1, -1, -1, -1, -1,
2725 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2726 170, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2727 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002728 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002729 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2730 -1, 170, -1, -1, 50, -1, -1, -1, -1, -1,
2731 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2732 168, -1, 170, 7, 8, -1, 10, 11, 12, 13,
Dale Johannesenf4581482008-09-26 19:32:34 +00002733 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2734 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2735 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002736 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2737 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2738 23, 24, 7, 8, 50, 10, 11, 12, 13, 14,
Dale Johannesenf4581482008-09-26 19:32:34 +00002739 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Devang Patelcd842482008-09-29 20:49:50 +00002740 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2741 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2742 -1, -1, 168, -1, 170, 50, 7, 8, -1, 10,
2743 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2744 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2745 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2746 23, 24, -1, -1, -1, -1, -1, -1, -1, 50,
Dale Johannesenf4581482008-09-26 19:32:34 +00002747 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002748 164, 165, -1, -1, 168, -1, 170, 50, -1, -1,
2749 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2750 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2751 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2752 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2753 -1, -1, -1, -1, -1, -1, -1, -1, -1, 164,
2754 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
Chris Lattner906773a2008-08-29 17:20:18 +00002755 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002756 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002757 -1, -1, -1, -1, -1, 36, -1, -1, -1, -1,
2758 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2759 -1, -1, -1, -1, -1, -1, 57, 58, -1, -1,
2760 -1, 164, 165, -1, -1, 168, -1, 170, 69, 70,
2761 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2762 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2763 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002765 -1, -1, -1, 114, 115, 116, -1, -1, 119, 120,
2766 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2767 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
Dan Gohman54392c12008-04-19 00:24:39 +00002768};
2769
2770/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2771 symbol of state STATE-NUM. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002772static const yytype_uint16 yystos[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002773{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002774 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Devang Patelcd842482008-09-29 20:49:50 +00002775 60, 181, 184, 186, 187, 188, 222, 223, 224, 226,
2776 225, 53, 68, 231, 161, 59, 161, 18, 161, 42,
2777 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
2778 158, 189, 190, 191, 0, 224, 46, 48, 192, 241,
2779 42, 43, 44, 47, 193, 238, 240, 248, 161, 161,
2780 165, 232, 22, 230, 7, 8, 10, 11, 12, 13,
2781 14, 15, 16, 17, 50, 164, 165, 168, 170, 181,
2782 186, 209, 210, 244, 191, 191, 35, 37, 220, 191,
2783 191, 21, 249, 250, 29, 171, 239, 249, 22, 22,
2784 22, 233, 159, 4, 4, 4, 170, 10, 171, 210,
2785 215, 55, 159, 183, 220, 220, 42, 44, 194, 32,
2786 33, 219, 62, 63, 64, 65, 66, 67, 195, 236,
2787 236, 7, 184, 185, 253, 162, 167, 39, 210, 211,
2788 213, 214, 166, 166, 171, 215, 162, 171, 159, 214,
2789 163, 219, 219, 10, 125, 210, 212, 221, 11, 12,
2790 13, 14, 15, 16, 179, 180, 210, 216, 4, 199,
2791 28, 170, 237, 161, 36, 57, 58, 69, 70, 71,
Chris Lattner906773a2008-08-29 17:20:18 +00002792 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2793 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
Dale Johannesenf4581482008-09-26 19:32:34 +00002794 92, 93, 114, 115, 116, 119, 120, 121, 122, 123,
Chris Lattner906773a2008-08-29 17:20:18 +00002795 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
Devang Patelcd842482008-09-29 20:49:50 +00002796 134, 135, 136, 137, 138, 139, 140, 174, 175, 176,
2797 251, 258, 259, 260, 261, 251, 259, 22, 197, 162,
2798 160, 210, 210, 169, 171, 210, 4, 160, 216, 210,
2799 159, 244, 26, 27, 3, 4, 5, 6, 9, 25,
Dale Johannesenf4581482008-09-26 19:32:34 +00002800 40, 41, 90, 91, 92, 93, 119, 133, 135, 136,
Devang Patelcd842482008-09-29 20:49:50 +00002801 137, 139, 140, 165, 168, 170, 172, 174, 175, 176,
2802 217, 244, 183, 141, 142, 144, 198, 212, 57, 10,
2803 210, 246, 247, 11, 17, 11, 179, 195, 94, 95,
2804 96, 97, 98, 99, 100, 101, 102, 103, 177, 26,
2805 27, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2806 109, 110, 111, 112, 113, 178, 177, 178, 210, 210,
2807 246, 210, 210, 254, 246, 246, 246, 246, 246, 210,
2808 210, 210, 210, 210, 246, 195, 117, 118, 54, 121,
2809 122, 141, 142, 144, 145, 147, 148, 149, 196, 39,
2810 211, 201, 167, 169, 169, 160, 201, 183, 183, 221,
2811 177, 178, 177, 178, 159, 159, 159, 159, 159, 159,
2812 159, 167, 216, 218, 170, 218, 171, 218, 22, 159,
2813 159, 159, 227, 186, 3, 4, 5, 6, 9, 25,
2814 26, 27, 40, 41, 59, 165, 168, 170, 172, 217,
2815 243, 244, 245, 162, 245, 245, 245, 199, 210, 210,
2816 210, 210, 162, 204, 162, 204, 245, 165, 162, 162,
2817 162, 162, 162, 162, 245, 245, 245, 245, 245, 38,
2818 199, 210, 246, 4, 141, 142, 143, 144, 146, 150,
2819 151, 153, 154, 155, 200, 228, 229, 38, 159, 159,
2820 159, 159, 216, 216, 216, 216, 216, 216, 216, 162,
2821 167, 171, 210, 218, 169, 171, 216, 216, 216, 162,
2822 207, 159, 61, 242, 167, 218, 170, 218, 171, 218,
2823 22, 246, 162, 162, 212, 245, 245, 245, 245, 11,
2824 54, 11, 256, 245, 165, 246, 210, 246, 246, 246,
2825 162, 162, 257, 162, 162, 162, 210, 212, 245, 162,
2826 207, 207, 210, 216, 216, 216, 216, 256, 162, 162,
2827 162, 162, 257, 162, 216, 169, 171, 162, 162, 38,
2828 34, 54, 205, 208, 39, 210, 234, 235, 22, 167,
2829 171, 218, 169, 171, 17, 17, 245, 162, 162, 162,
2830 162, 245, 4, 245, 162, 162, 245, 162, 162, 162,
2831 4, 4, 162, 210, 245, 245, 245, 162, 204, 210,
2832 160, 162, 162, 162, 162, 160, 216, 216, 216, 216,
2833 160, 216, 169, 216, 216, 210, 22, 4, 207, 197,
2834 162, 160, 162, 169, 171, 245, 245, 159, 245, 245,
2835 245, 245, 204, 204, 246, 245, 162, 246, 246, 246,
2836 4, 245, 159, 245, 216, 216, 216, 216, 162, 160,
2837 162, 162, 257, 160, 160, 160, 181, 182, 39, 210,
2838 201, 22, 169, 162, 165, 17, 210, 255, 167, 245,
2839 257, 255, 204, 160, 160, 160, 160, 216, 216, 216,
2840 160, 197, 205, 206, 17, 167, 179, 252, 197, 197,
2841 160, 162, 167, 160, 160, 160, 160, 182, 54, 203,
2842 245, 243, 167, 179, 121, 122, 245, 245, 201, 17,
2843 210, 201, 4, 152, 202, 162, 243, 197, 197, 38,
2844 197, 197, 22, 17, 162, 17, 245, 245, 245, 17,
2845 245, 197, 197, 245, 73, 17, 245
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
Nuno Lopese20dbca2008-10-03 15:45:58 +00002919# if 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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003660#line 1142 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003665#line 1142 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003670#line 1143 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003675#line 1143 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003680#line 1144 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003685#line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003686 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3687 break;
3688
3689 case 35:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003690#line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003691 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3692 break;
3693
3694 case 36:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003695#line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003696 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3697 break;
3698
3699 case 37:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003700#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003701 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3702 break;
3703
3704 case 38:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003705#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003706 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3707 break;
3708
3709 case 39:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003710#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003711 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3712 break;
3713
3714 case 40:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003715#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003716 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3717 break;
3718
3719 case 41:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003720#line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003721 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3722 break;
3723
3724 case 42:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003725#line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003726 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3727 break;
3728
3729 case 43:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003730#line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003731 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3732 break;
3733
3734 case 44:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003735#line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003736 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3737 break;
3738
3739 case 45:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003740#line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003741 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3742 break;
3743
3744 case 46:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003745#line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003746 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3747 break;
3748
3749 case 47:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003750#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003751 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3752 break;
3753
3754 case 48:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003755#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003756 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3757 break;
3758
3759 case 49:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003760#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003761 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3762 break;
3763
3764 case 50:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003765#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003766 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3767 break;
3768
3769 case 51:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003770#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003771 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3772 break;
3773
3774 case 52:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003775#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003776 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3777 break;
3778
3779 case 53:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003780#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003781 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3782 break;
3783
3784 case 54:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003785#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003786 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3787 break;
3788
3789 case 65:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003790#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003791 { (yyval.StrVal) = 0; ;}
3792 break;
3793
3794 case 66:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003795#line 1169 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003800#line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003801 { (yyval.UIntVal)=0; ;}
3802 break;
3803
3804 case 68:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003805#line 1174 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003813#line 1178 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003821#line 1183 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003829#line 1192 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003837#line 1197 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003845#line 1203 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003850#line 1204 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003855#line 1205 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003860#line 1206 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003865#line 1207 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003870#line 1208 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003875#line 1212 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003880#line 1213 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003885#line 1214 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003890#line 1218 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003895#line 1219 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003900#line 1220 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003905#line 1221 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003910#line 1225 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003915#line 1226 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003920#line 1227 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003925#line 1231 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003930#line 1232 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003935#line 1233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003936 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3937 break;
3938
3939 case 95:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003940#line 1234 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003941 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3942 break;
3943
3944 case 96:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003945#line 1235 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003946 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3947 break;
3948
3949 case 97:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003950#line 1239 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003951 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3952 break;
3953
3954 case 98:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003955#line 1240 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003960#line 1241 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003965#line 1244 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003970#line 1245 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003975#line 1246 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003980#line 1247 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003985#line 1248 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003990#line 1249 "/cvs/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:
Nuno Lopese20dbca2008-10-03 15:45:58 +00003995#line 1250 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003996 {
3997 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003998 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00003999 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004000 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004001 ;}
4002 break;
4003
Dale Johannesenf4581482008-09-26 19:32:34 +00004004 case 107:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004005#line 1257 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004006 { (yyval.Attributes) = Attribute::ZExt; ;}
4007 break;
4008
Dan Gohman54392c12008-04-19 00:24:39 +00004009 case 108:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004010#line 1258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004011 { (yyval.Attributes) = Attribute::ZExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004012 break;
4013
4014 case 109:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004015#line 1259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004016 { (yyval.Attributes) = Attribute::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004017 break;
4018
4019 case 110:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004020#line 1260 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004021 { (yyval.Attributes) = Attribute::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004022 break;
4023
4024 case 111:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004025#line 1261 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004026 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004027 break;
4028
Dale Johannesenf4581482008-09-26 19:32:34 +00004029 case 112:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004030#line 1262 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004031 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004032 break;
4033
Dale Johannesenf4581482008-09-26 19:32:34 +00004034 case 113:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004035#line 1263 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004036 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004037 break;
4038
Dale Johannesenf4581482008-09-26 19:32:34 +00004039 case 114:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004040#line 1264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004041 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004042 break;
4043
Dale Johannesenf4581482008-09-26 19:32:34 +00004044 case 115:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004045#line 1265 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004046 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004047 break;
4048
Dale Johannesenf4581482008-09-26 19:32:34 +00004049 case 116:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004050#line 1266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004051 { (yyval.Attributes) =
4052 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004053 break;
4054
Dale Johannesenf4581482008-09-26 19:32:34 +00004055 case 117:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004056#line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004057 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004058 break;
4059
Dale Johannesenf4581482008-09-26 19:32:34 +00004060 case 118:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004061#line 1271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004062 {
4063 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4064 ;}
4065 break;
4066
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004067 case 119:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004068#line 1276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004069 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004070 break;
4071
Devang Patelcd842482008-09-29 20:49:50 +00004072 case 120:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004073#line 1277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004074 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004075 break;
4076
Devang Patelcd842482008-09-29 20:49:50 +00004077 case 121:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004078#line 1278 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004079 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004080 break;
4081
Devang Patelcd842482008-09-29 20:49:50 +00004082 case 122:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004083#line 1281 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004084 { (yyval.Attributes) = Attribute::None; ;}
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004085 break;
4086
Devang Patelcd842482008-09-29 20:49:50 +00004087 case 123:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004088#line 1282 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004089 {
4090 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4091 ;}
4092 break;
4093
4094 case 124:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004095#line 1288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004096 { (yyval.Attributes) = Attribute::NoReturn; ;}
4097 break;
4098
4099 case 125:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004100#line 1289 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004101 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4102 break;
4103
4104 case 126:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004105#line 1290 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004106 { (yyval.Attributes) = Attribute::InReg; ;}
4107 break;
4108
Dale Johannesenf4581482008-09-26 19:32:34 +00004109 case 127:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004110#line 1291 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004111 { (yyval.Attributes) = Attribute::ZExt; ;}
4112 break;
4113
4114 case 128:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004115#line 1292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004116 { (yyval.Attributes) = Attribute::SExt; ;}
4117 break;
4118
4119 case 129:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004120#line 1293 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004121 { (yyval.Attributes) = Attribute::ReadNone; ;}
4122 break;
4123
4124 case 130:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004125#line 1294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004126 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4127 break;
4128
4129 case 131:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004130#line 1295 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004131 { (yyval.Attributes) = Attribute::NoInline ;}
4132 break;
4133
4134 case 132:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004135#line 1296 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004136 { (yyval.Attributes) = Attribute::AlwaysInline ;}
4137 break;
4138
4139 case 133:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004140#line 1297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004141 { (yyval.Attributes) = Attribute::OptimizeForSize ;}
4142 break;
4143
4144 case 134:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004145#line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004146 { (yyval.Attributes) = Attribute::None; ;}
4147 break;
4148
4149 case 135:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004150#line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004151 {
Devang Pateld222f862008-09-25 21:00:45 +00004152 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner906773a2008-08-29 17:20:18 +00004153 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004154 break;
4155
Devang Patelcd842482008-09-29 20:49:50 +00004156 case 136:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004157#line 1307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004158 { (yyval.StrVal) = 0; ;}
4159 break;
4160
Devang Patelcd842482008-09-29 20:49:50 +00004161 case 137:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004162#line 1308 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004163 {
4164 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4165 ;}
4166 break;
4167
Devang Patelcd842482008-09-29 20:49:50 +00004168 case 138:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004169#line 1315 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004170 { (yyval.UIntVal) = 0; ;}
4171 break;
4172
Devang Patelcd842482008-09-29 20:49:50 +00004173 case 139:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004174#line 1316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004175 {
4176 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4177 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004178 GEN_ERROR("Alignment must be a power of two");
4179 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004180;}
4181 break;
4182
Devang Patelcd842482008-09-29 20:49:50 +00004183 case 140:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004184#line 1322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004185 { (yyval.UIntVal) = 0; ;}
4186 break;
4187
Devang Patelcd842482008-09-29 20:49:50 +00004188 case 141:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004189#line 1323 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004190 {
4191 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4192 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00004193 GEN_ERROR("Alignment must be a power of two");
4194 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004195;}
4196 break;
4197
Devang Patelcd842482008-09-29 20:49:50 +00004198 case 142:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004199#line 1332 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004200 {
4201 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4202 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004203 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00004204 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004205 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004206;}
4207 break;
4208
Devang Patelcd842482008-09-29 20:49:50 +00004209 case 143:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004210#line 1340 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004211 { (yyval.StrVal) = 0; ;}
4212 break;
4213
Devang Patelcd842482008-09-29 20:49:50 +00004214 case 144:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004215#line 1341 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004216 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4217 break;
4218
Devang Patel5df692d2008-09-02 20:52:40 +00004219 case 145:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004220#line 1346 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004221 {;}
4222 break;
4223
Devang Patel5df692d2008-09-02 20:52:40 +00004224 case 146:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004225#line 1347 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004226 {;}
4227 break;
4228
4229 case 147:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004230#line 1348 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004231 {
4232 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4233 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004234 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004235 ;}
4236 break;
4237
Devang Patelcd842482008-09-29 20:49:50 +00004238 case 148:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004239#line 1353 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004240 {
4241 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004242 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004243 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004244 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004245 ;}
4246 break;
4247
Devang Patelcd842482008-09-29 20:49:50 +00004248 case 156:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004249#line 1369 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004250 {
4251 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004252 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004253 ;}
4254 break;
4255
Devang Patelcd842482008-09-29 20:49:50 +00004256 case 157:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004257#line 1373 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004258 {
4259 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004260 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004261 ;}
4262 break;
4263
Devang Patelcd842482008-09-29 20:49:50 +00004264 case 158:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004265#line 1377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004266 { // Pointer type?
4267 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004268 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004269 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4270 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004271 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004272 ;}
4273 break;
4274
Devang Patelcd842482008-09-29 20:49:50 +00004275 case 159:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004276#line 1384 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004277 { // Named types are also simple types...
4278 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004279 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004280 (yyval.TypeVal) = new PATypeHolder(tmp);
4281 ;}
4282 break;
4283
Devang Patelcd842482008-09-29 20:49:50 +00004284 case 160:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004285#line 1389 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004286 { // Type UpReference
4287 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004288 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004289 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4290 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004291 UR_OUT("New Upreference!\n");
4292 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004293 ;}
4294 break;
4295
Devang Patelcd842482008-09-29 20:49:50 +00004296 case 161:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004297#line 1397 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004298 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004299 // Allow but ignore attributes on function types; this permits auto-upgrade.
4300 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004301 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4302 if (!FunctionType::isValidReturnType(RetTy))
4303 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00004304
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004305 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004306 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004307 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004308 const Type *Ty = I->Ty->get();
4309 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004310 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004311
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004312 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4313 if (isVarArg) Params.pop_back();
4314
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004315 for (unsigned i = 0; i != Params.size(); ++i)
4316 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4317 GEN_ERROR("Function arguments must be value types!");
4318
4319 CHECK_FOR_ERROR
4320
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004321 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004322 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4323 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher329d2672008-09-24 04:55:49 +00004324 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004325 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004326 ;}
4327 break;
4328
Devang Patelcd842482008-09-29 20:49:50 +00004329 case 162:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004330#line 1426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004331 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004332 // Allow but ignore attributes on function types; this permits auto-upgrade.
4333 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004334 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004335 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004336 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004337 const Type* Ty = I->Ty->get();
4338 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004339 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004340
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004341 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4342 if (isVarArg) Params.pop_back();
4343
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004344 for (unsigned i = 0; i != Params.size(); ++i)
4345 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4346 GEN_ERROR("Function arguments must be value types!");
4347
4348 CHECK_FOR_ERROR
4349
Dan Gohman54392c12008-04-19 00:24:39 +00004350 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4351 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
Eric Christopher329d2672008-09-24 04:55:49 +00004352 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004353 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004354 ;}
4355 break;
4356
Devang Patelcd842482008-09-29 20:49:50 +00004357 case 163:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004358#line 1451 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004359 { // Sized array type?
Dan Gohmane5febe42008-05-31 00:58:22 +00004360 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohman54392c12008-04-19 00:24:39 +00004361 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004362 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004363 ;}
4364 break;
4365
Devang Patelcd842482008-09-29 20:49:50 +00004366 case 164:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004367#line 1456 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004368 { // Vector type?
4369 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4370 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004371 GEN_ERROR("Unsigned result not equal to signed result");
4372 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4373 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004374 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4375 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004376 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004377 ;}
4378 break;
4379
Devang Patelcd842482008-09-29 20:49:50 +00004380 case 165:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004381#line 1466 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004382 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004383 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004384 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4385 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004386 Elements.push_back(*I);
4387
Dan Gohman54392c12008-04-19 00:24:39 +00004388 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4389 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004390 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004391 ;}
4392 break;
4393
Devang Patelcd842482008-09-29 20:49:50 +00004394 case 166:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004395#line 1476 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004396 { // Empty structure type?
4397 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004398 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004399 ;}
4400 break;
4401
Devang Patelcd842482008-09-29 20:49:50 +00004402 case 167:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004403#line 1480 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004404 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004405 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004406 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4407 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004408 Elements.push_back(*I);
4409
Dan Gohman54392c12008-04-19 00:24:39 +00004410 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4411 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004412 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004413 ;}
4414 break;
4415
Devang Patelcd842482008-09-29 20:49:50 +00004416 case 168:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004417#line 1490 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004418 { // Empty structure type?
4419 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004420 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004421 ;}
4422 break;
4423
Devang Patelcd842482008-09-29 20:49:50 +00004424 case 169:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004425#line 1497 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004426 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004427 // Allow but ignore attributes on function types; this permits auto-upgrade.
4428 // FIXME: remove in LLVM 3.0.
Eric Christopher329d2672008-09-24 04:55:49 +00004429 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Pateld222f862008-09-25 21:00:45 +00004430 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00004431 ;}
4432 break;
4433
Devang Patelcd842482008-09-29 20:49:50 +00004434 case 170:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004435#line 1506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004436 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004437 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004438 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4439 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004440 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004441 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4442 ;}
4443 break;
4444
Devang Patelcd842482008-09-29 20:49:50 +00004445 case 171:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004446#line 1513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004447 {
4448 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4449 ;}
4450 break;
4451
Devang Patelcd842482008-09-29 20:49:50 +00004452 case 172:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004453#line 1518 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004454 {
4455 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4456 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004457 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004458 ;}
4459 break;
4460
Devang Patelcd842482008-09-29 20:49:50 +00004461 case 173:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004462#line 1523 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004463 {
4464 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004465 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004466 ;}
4467 break;
4468
Devang Patelcd842482008-09-29 20:49:50 +00004469 case 175:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004470#line 1531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004471 {
4472 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Pateld222f862008-09-25 21:00:45 +00004473 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004474 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004475 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004476 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004477 ;}
4478 break;
4479
Devang Patelcd842482008-09-29 20:49:50 +00004480 case 176:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004481#line 1538 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004482 {
4483 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Pateld222f862008-09-25 21:00:45 +00004484 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004485 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004486 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004487 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004488 ;}
4489 break;
4490
Devang Patelcd842482008-09-29 20:49:50 +00004491 case 177:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004492#line 1545 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004493 {
4494 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004495 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004496 ;}
4497 break;
4498
Devang Patelcd842482008-09-29 20:49:50 +00004499 case 178:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004500#line 1553 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004501 {
4502 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher329d2672008-09-24 04:55:49 +00004503 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004504 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004505 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004506 ;}
4507 break;
4508
Devang Patelcd842482008-09-29 20:49:50 +00004509 case 179:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004510#line 1559 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004511 {
Eric Christopher329d2672008-09-24 04:55:49 +00004512 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004513 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004514 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004515 ;}
4516 break;
4517
Devang Patelcd842482008-09-29 20:49:50 +00004518 case 180:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004519#line 1571 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004520 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004521 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004522 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4523 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004524 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004525 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004526 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004527 const Type *ETy = ATy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004528 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004529
4530 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004531 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004532 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004533 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004534 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004535
4536 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004537 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4538 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004539 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004540 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004541 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004542 }
4543
Dan Gohman54392c12008-04-19 00:24:39 +00004544 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4545 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004546 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004547 ;}
4548 break;
4549
Devang Patelcd842482008-09-29 20:49:50 +00004550 case 181:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004551#line 1599 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004552 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004553 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004554 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4555 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004556 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004557 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004558 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004559
Dan Gohman7185e4b2008-06-23 18:43:26 +00004560 uint64_t NumElements = ATy->getNumElements();
Eric Christopher329d2672008-09-24 04:55:49 +00004561 if (NumElements != uint64_t(-1) && NumElements != 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004562 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004563 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004564 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4565 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004566 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004567 ;}
4568 break;
4569
Devang Patelcd842482008-09-29 20:49:50 +00004570 case 182:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004571#line 1615 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004572 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004573 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4575 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004576 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004577 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004578 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004579
Dan Gohman7185e4b2008-06-23 18:43:26 +00004580 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004581 const Type *ETy = ATy->getElementType();
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004582 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher329d2672008-09-24 04:55:49 +00004583 GEN_ERROR("Can't build string constant of size " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004584 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4585 " when array has size " + utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004586 std::vector<Constant*> Vals;
4587 if (ETy == Type::Int8Ty) {
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004588 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohman54392c12008-04-19 00:24:39 +00004589 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004590 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004591 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004592 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4593 }
Dan Gohman54392c12008-04-19 00:24:39 +00004594 delete (yyvsp[(3) - (3)].StrVal);
4595 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4596 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004597 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004598 ;}
4599 break;
4600
Devang Patelcd842482008-09-29 20:49:50 +00004601 case 183:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004602#line 1642 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004603 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004604 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004605 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4606 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004607 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004608 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004609 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004610 const Type *ETy = PTy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004611 unsigned NumElements = PTy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004612
4613 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004614 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004615 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004616 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004617 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004618
4619 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004620 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4621 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004622 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004623 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004624 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004625 }
4626
Dan Gohman54392c12008-04-19 00:24:39 +00004627 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4628 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004629 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004630 ;}
4631 break;
4632
Devang Patelcd842482008-09-29 20:49:50 +00004633 case 184:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004634#line 1670 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004635 {
4636 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004637 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004638 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004639 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004640
Dan Gohman54392c12008-04-19 00:24:39 +00004641 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004642 GEN_ERROR("Illegal number of initializers for structure type");
4643
4644 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004645 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4646 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004647 GEN_ERROR("Expected type '" +
4648 STy->getElementType(i)->getDescription() +
4649 "' for element #" + utostr(i) +
4650 " of structure initializer");
4651
4652 // Check to ensure that Type is not packed
4653 if (STy->isPacked())
4654 GEN_ERROR("Unpacked Initializer to vector type '" +
4655 STy->getDescription() + "'");
4656
Dan Gohman54392c12008-04-19 00:24:39 +00004657 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4658 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004659 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004660 ;}
4661 break;
4662
Devang Patelcd842482008-09-29 20:49:50 +00004663 case 185:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004664#line 1696 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004665 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004666 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004667 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4668 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004669 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004670 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004671 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004672
4673 if (STy->getNumContainedTypes() != 0)
4674 GEN_ERROR("Illegal number of initializers for structure type");
4675
4676 // Check to ensure that Type is not packed
4677 if (STy->isPacked())
4678 GEN_ERROR("Unpacked Initializer to vector type '" +
4679 STy->getDescription() + "'");
4680
Dan Gohman54392c12008-04-19 00:24:39 +00004681 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4682 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004683 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004684 ;}
4685 break;
4686
Devang Patelcd842482008-09-29 20:49:50 +00004687 case 186:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004688#line 1716 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004689 {
4690 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004691 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004692 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004693 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004694
Dan Gohman54392c12008-04-19 00:24:39 +00004695 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004696 GEN_ERROR("Illegal number of initializers for structure type");
4697
4698 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004699 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4700 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004701 GEN_ERROR("Expected type '" +
4702 STy->getElementType(i)->getDescription() +
4703 "' for element #" + utostr(i) +
4704 " of structure initializer");
4705
4706 // Check to ensure that Type is packed
4707 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004708 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004709 STy->getDescription() + "'");
4710
Dan Gohman54392c12008-04-19 00:24:39 +00004711 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4712 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004713 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004714 ;}
4715 break;
4716
Devang Patelcd842482008-09-29 20:49:50 +00004717 case 187:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004718#line 1742 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004719 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004720 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004721 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4722 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004723 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004724 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004725 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004726
4727 if (STy->getNumContainedTypes() != 0)
4728 GEN_ERROR("Illegal number of initializers for structure type");
4729
4730 // Check to ensure that Type is packed
4731 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004732 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004733 STy->getDescription() + "'");
4734
Dan Gohman54392c12008-04-19 00:24:39 +00004735 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4736 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004737 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004738 ;}
4739 break;
4740
Devang Patelcd842482008-09-29 20:49:50 +00004741 case 188:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004742#line 1762 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004743 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004744 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004745 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4746 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004747 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004748 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004749 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004750
Dan Gohman54392c12008-04-19 00:24:39 +00004751 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4752 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004753 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004754 ;}
4755 break;
4756
Devang Patelcd842482008-09-29 20:49:50 +00004757 case 189:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004758#line 1774 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004759 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004760 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004761 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4762 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4763 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004764 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004765 ;}
4766 break;
4767
Devang Patelcd842482008-09-29 20:49:50 +00004768 case 190:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004769#line 1781 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004770 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004771 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004772 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4773 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004774 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004775 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004776
4777 // ConstExprs can exist in the body of a function, thus creating
4778 // GlobalValues whenever they refer to a variable. Because we are in
4779 // the context of a function, getExistingVal will search the functions
4780 // symbol table instead of the module symbol table for the global symbol,
4781 // which throws things all off. To get around this, we just tell
4782 // getExistingVal that we are at global scope here.
4783 //
4784 Function *SavedCurFn = CurFun.CurrentFunction;
4785 CurFun.CurrentFunction = 0;
4786
Dan Gohman54392c12008-04-19 00:24:39 +00004787 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004788 CHECK_FOR_ERROR
4789
4790 CurFun.CurrentFunction = SavedCurFn;
4791
4792 // If this is an initializer for a constant pointer, which is referencing a
4793 // (currently) undefined variable, create a stub now that shall be replaced
4794 // in the future with the right type of variable.
4795 //
4796 if (V == 0) {
4797 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4798 const PointerType *PT = cast<PointerType>(Ty);
4799
4800 // First check to see if the forward references value is already created!
4801 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004802 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher329d2672008-09-24 04:55:49 +00004803
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004804 if (I != CurModule.GlobalRefs.end()) {
4805 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004806 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004807 } else {
4808 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004809 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4810 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4811 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004812 GEN_ERROR("Invalid reference to global");
4813
4814 // Create the forward referenced global.
4815 GlobalValue *GV;
Eric Christopher329d2672008-09-24 04:55:49 +00004816 if (const FunctionType *FTy =
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004817 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004818 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4819 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004820 } else {
4821 GV = new GlobalVariable(PT->getElementType(), false,
4822 GlobalValue::ExternalWeakLinkage, 0,
4823 Name, CurModule.CurrentModule);
4824 }
4825
4826 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004827 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004828 V = GV;
4829 }
4830 }
4831
Dan Gohman54392c12008-04-19 00:24:39 +00004832 (yyval.ConstVal) = cast<GlobalValue>(V);
4833 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004834 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004835 ;}
4836 break;
4837
Devang Patelcd842482008-09-29 20:49:50 +00004838 case 191:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004839#line 1847 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004840 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004841 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004842 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4843 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004844 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004845 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4846 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4847 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004848 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004849 ;}
4850 break;
4851
Devang Patelcd842482008-09-29 20:49:50 +00004852 case 192:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004853#line 1857 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004854 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004855 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004856 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4857 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004858 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4859 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004860 (yyval.ConstVal) = Constant::getNullValue(Ty);
4861 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004862 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004863 ;}
4864 break;
4865
Devang Patelcd842482008-09-29 20:49:50 +00004866 case 193:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004867#line 1867 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004868 { // integral constants
4869 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004870 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004871 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004872 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004873 ;}
4874 break;
4875
Devang Patelcd842482008-09-29 20:49:50 +00004876 case 194:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004877#line 1873 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004878 { // arbitrary precision integer constants
4879 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4880 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004881 GEN_ERROR("Constant value does not fit in type");
4882 }
Dan Gohman54392c12008-04-19 00:24:39 +00004883 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4884 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4885 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004886 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004887 ;}
4888 break;
4889
Devang Patelcd842482008-09-29 20:49:50 +00004890 case 195:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004891#line 1883 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004892 { // integral constants
4893 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004894 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004895 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004896 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004897 ;}
4898 break;
4899
Devang Patelcd842482008-09-29 20:49:50 +00004900 case 196:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004901#line 1889 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004902 { // arbitrary precision integer constants
4903 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4904 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004905 GEN_ERROR("Constant value does not fit in type");
Eric Christopher329d2672008-09-24 04:55:49 +00004906 }
Dan Gohman54392c12008-04-19 00:24:39 +00004907 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4908 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4909 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004910 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004911 ;}
4912 break;
4913
Devang Patelcd842482008-09-29 20:49:50 +00004914 case 197:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004915#line 1899 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004916 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004917 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4918 GEN_ERROR("Constant true must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004919 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004920 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004921 ;}
4922 break;
4923
Devang Patelcd842482008-09-29 20:49:50 +00004924 case 198:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004925#line 1905 "/cvs/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 false must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004929 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004930 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004931 ;}
4932 break;
4933
Devang Patelcd842482008-09-29 20:49:50 +00004934 case 199:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004935#line 1911 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004936 { // Floating point constants
4937 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004938 GEN_ERROR("Floating point constant invalid for type");
Eric Christopher329d2672008-09-24 04:55:49 +00004939 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004940 // as double. Fix this here. Long double is done right.
Dan Gohman54392c12008-04-19 00:24:39 +00004941 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4942 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +00004943 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004944 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004945 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004946 ;}
4947 break;
4948
Devang Patelcd842482008-09-29 20:49:50 +00004949 case 200:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004950#line 1924 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004951 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004952 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004953 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4954 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4955 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4956 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004957 GEN_ERROR("invalid cast opcode for cast from '" +
4958 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00004959 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004960 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4961 delete (yyvsp[(5) - (6)].TypeVal);
4962 ;}
4963 break;
4964
Devang Patelcd842482008-09-29 20:49:50 +00004965 case 201:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004966#line 1936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004967 {
4968 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004969 GEN_ERROR("GetElementPtr requires a pointer operand");
4970
4971 const Type *IdxTy =
Dan Gohman8055f772008-05-15 19:50:34 +00004972 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004973 if (!IdxTy)
4974 GEN_ERROR("Index list invalid for constant getelementptr");
4975
4976 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00004977 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4978 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004979 IdxVec.push_back(C);
4980 else
4981 GEN_ERROR("Indices to constant getelementptr must be constants");
4982
Dan Gohman54392c12008-04-19 00:24:39 +00004983 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004984
Dan Gohman54392c12008-04-19 00:24:39 +00004985 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004986 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004987 ;}
4988 break;
4989
Devang Patelcd842482008-09-29 20:49:50 +00004990 case 202:
Nuno Lopese20dbca2008-10-03 15:45:58 +00004991#line 1957 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004992 {
4993 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004994 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00004995 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004996 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004997 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004998 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004999 ;}
5000 break;
5001
Devang Patelcd842482008-09-29 20:49:50 +00005002 case 203:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005003#line 1965 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005004 {
5005 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005006 GEN_ERROR("Binary operator types must match");
5007 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00005008 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5009 ;}
5010 break;
5011
Devang Patelcd842482008-09-29 20:49:50 +00005012 case 204:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005013#line 1971 "/cvs/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("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005017 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher329d2672008-09-24 04:55:49 +00005018 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00005019 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005020 GEN_ERROR("Logical operator requires integral operands");
5021 }
Dan Gohman54392c12008-04-19 00:24:39 +00005022 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005023 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005024 ;}
5025 break;
5026
Devang Patelcd842482008-09-29 20:49:50 +00005027 case 205:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005028#line 1982 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005029 {
5030 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005031 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005032 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5033 ;}
5034 break;
5035
Devang Patelcd842482008-09-29 20:49:50 +00005036 case 206:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005037#line 1987 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005038 {
5039 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005040 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005041 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5042 ;}
5043 break;
5044
Devang Patelcd842482008-09-29 20:49:50 +00005045 case 207:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005046#line 1992 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005047 {
5048 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5049 GEN_ERROR("vicmp operand types must match");
5050 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5051 ;}
5052 break;
5053
Devang Patelcd842482008-09-29 20:49:50 +00005054 case 208:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005055#line 1997 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005056 {
5057 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5058 GEN_ERROR("vfcmp operand types must match");
5059 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5060 ;}
5061 break;
5062
Devang Patelcd842482008-09-29 20:49:50 +00005063 case 209:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005064#line 2002 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005065 {
5066 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005067 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005068 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005069 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005070 ;}
5071 break;
5072
Devang Patelcd842482008-09-29 20:49:50 +00005073 case 210:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005074#line 2008 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005075 {
5076 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005077 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005078 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005079 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005080 ;}
5081 break;
5082
Devang Patelcd842482008-09-29 20:49:50 +00005083 case 211:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005084#line 2014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005085 {
5086 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005087 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005088 (yyval.ConstVal) = ConstantExpr::getShuffleVector((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
Devang Patelcd842482008-09-29 20:49:50 +00005093 case 212:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005094#line 2020 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005095 {
5096 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5097 GEN_ERROR("ExtractValue requires an aggregate operand");
5098
Dan Gohmane5febe42008-05-31 00:58:22 +00005099 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5100 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005101 CHECK_FOR_ERROR
5102 ;}
5103 break;
5104
Devang Patelcd842482008-09-29 20:49:50 +00005105 case 213:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005106#line 2028 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005107 {
5108 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5109 GEN_ERROR("InsertValue requires an aggregate operand");
5110
Dan Gohmane5febe42008-05-31 00:58:22 +00005111 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5112 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005113 CHECK_FOR_ERROR
5114 ;}
5115 break;
5116
Devang Patelcd842482008-09-29 20:49:50 +00005117 case 214:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005118#line 2039 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005119 {
5120 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005121 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005122 ;}
5123 break;
5124
Devang Patelcd842482008-09-29 20:49:50 +00005125 case 215:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005126#line 2043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005127 {
5128 (yyval.ConstVector) = new std::vector<Constant*>();
5129 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005130 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005131 ;}
5132 break;
5133
Devang Patelcd842482008-09-29 20:49:50 +00005134 case 216:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005135#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005136 { (yyval.BoolVal) = false; ;}
Nate Begeman646fa482008-05-12 19:01:56 +00005137 break;
5138
Devang Patel5df692d2008-09-02 20:52:40 +00005139 case 217:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005140#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005141 { (yyval.BoolVal) = true; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005142 break;
5143
Devang Patel5df692d2008-09-02 20:52:40 +00005144 case 218:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005145#line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005146 { (yyval.BoolVal) = true; ;}
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005147 break;
5148
Dale Johannesenf4581482008-09-26 19:32:34 +00005149 case 219:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005150#line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005151 { (yyval.BoolVal) = false; ;}
5152 break;
5153
5154 case 220:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005155#line 2057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005156 {
5157 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5158 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00005159 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005160 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5161 if (!Aliasee)
5162 GEN_ERROR("Aliases can be created only to global values");
5163
Dan Gohman54392c12008-04-19 00:24:39 +00005164 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005165 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005166 delete (yyvsp[(1) - (2)].TypeVal);
5167 ;}
5168 break;
5169
Devang Patelcd842482008-09-29 20:49:50 +00005170 case 221:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005171#line 2069 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005172 {
5173 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5174 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5175 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005176 GEN_ERROR("invalid cast opcode for cast from '" +
5177 Val->getType()->getDescription() + "' to '" +
5178 DestTy->getDescription() + "'");
Eric Christopher329d2672008-09-24 04:55:49 +00005179
Dan Gohman54392c12008-04-19 00:24:39 +00005180 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005181 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005182 delete (yyvsp[(5) - (6)].TypeVal);
5183 ;}
5184 break;
5185
Devang Patel5df692d2008-09-02 20:52:40 +00005186 case 222:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005187#line 2090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005188 {
5189 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5190 CurModule.ModuleDone();
5191 CHECK_FOR_ERROR;
5192 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005193 break;
5194
Devang Patelcd842482008-09-29 20:49:50 +00005195 case 223:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005196#line 2095 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005197 {
5198 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5199 CurModule.ModuleDone();
5200 CHECK_FOR_ERROR;
5201 ;}
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005202 break;
5203
Dale Johannesenf4581482008-09-26 19:32:34 +00005204 case 226:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005205#line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005206 { CurFun.isDeclare = false; ;}
5207 break;
5208
5209 case 227:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005210#line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005211 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005212 CurFun.FunctionDone();
5213 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005214 ;}
5215 break;
5216
Devang Patelcd842482008-09-29 20:49:50 +00005217 case 228:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005218#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005219 { CurFun.isDeclare = true; ;}
5220 break;
5221
Devang Patel5df692d2008-09-02 20:52:40 +00005222 case 229:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005223#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005224 {
5225 CHECK_FOR_ERROR
5226 ;}
5227 break;
5228
Devang Patel5df692d2008-09-02 20:52:40 +00005229 case 230:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005230#line 2115 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005231 {
5232 CHECK_FOR_ERROR
5233 ;}
5234 break;
5235
5236 case 231:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005237#line 2118 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005238 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005239 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005240 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005241 // Eagerly resolve types. This is not an optimization, this is a
5242 // requirement that is due to the fact that we could have this:
5243 //
5244 // %list = type { %list * }
5245 // %list = type { %list * } ; repeated type decl
5246 //
5247 // If types are not resolved eagerly, then the two types will not be
5248 // determined to be the same type!
5249 //
Dan Gohman54392c12008-04-19 00:24:39 +00005250 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005251
Dan Gohman54392c12008-04-19 00:24:39 +00005252 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005253 CHECK_FOR_ERROR
5254 // If this is a named type that is not a redefinition, add it to the slot
5255 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005256 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005257 }
5258
Dan Gohman54392c12008-04-19 00:24:39 +00005259 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005260 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005261 ;}
5262 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005263
Devang Patelcd842482008-09-29 20:49:50 +00005264 case 232:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005265#line 2142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005266 {
5267 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5268
5269 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005270 CHECK_FOR_ERROR
5271 // If this is a named type that is not a redefinition, add it to the slot
5272 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005273 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005274 }
5275 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005276 ;}
5277 break;
5278
Devang Patelcd842482008-09-29 20:49:50 +00005279 case 233:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005280#line 2154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005281 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005282 /* "Externally Visible" Linkage */
Eric Christopher329d2672008-09-24 04:55:49 +00005283 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005284 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005285 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5286 (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 +00005287 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005288 ;}
5289 break;
5290
Devang Patelcd842482008-09-29 20:49:50 +00005291 case 234:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005292#line 2161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005293 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005294 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005295 ;}
5296 break;
5297
Devang Patelcd842482008-09-29 20:49:50 +00005298 case 235:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005299#line 2165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005300 {
Eric Christopher329d2672008-09-24 04:55:49 +00005301 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005302 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005303 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 +00005304 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005305 ;}
5306 break;
5307
Devang Patelcd842482008-09-29 20:49:50 +00005308 case 236:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005309#line 2170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005310 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005311 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005312 ;}
5313 break;
5314
Devang Patelcd842482008-09-29 20:49:50 +00005315 case 237:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005316#line 2174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005317 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005318 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005319 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5320 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 +00005321 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005322 delete (yyvsp[(6) - (7)].TypeVal);
5323 ;}
5324 break;
5325
Devang Patelcd842482008-09-29 20:49:50 +00005326 case 238:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005327#line 2180 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005328 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005329 CurGV = 0;
5330 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005331 ;}
5332 break;
5333
Devang Patelcd842482008-09-29 20:49:50 +00005334 case 239:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005335#line 2184 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005336 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005337 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005338 if ((yyvsp[(1) - (5)].StrVal)) {
5339 Name = *(yyvsp[(1) - (5)].StrVal);
5340 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005341 }
5342 if (Name.empty())
5343 GEN_ERROR("Alias name cannot be empty");
Eric Christopher329d2672008-09-24 04:55:49 +00005344
Dan Gohman54392c12008-04-19 00:24:39 +00005345 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005346 if (Aliasee == 0)
5347 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5348
Dan Gohman54392c12008-04-19 00:24:39 +00005349 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005350 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005351 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005352 InsertValue(GA, CurModule.Values);
Eric Christopher329d2672008-09-24 04:55:49 +00005353
5354
Chris Lattner5eefce32007-09-10 23:24:14 +00005355 // If there was a forward reference of this alias, resolve it now.
Eric Christopher329d2672008-09-24 04:55:49 +00005356
Chris Lattner5eefce32007-09-10 23:24:14 +00005357 ValID ID;
5358 if (!Name.empty())
5359 ID = ValID::createGlobalName(Name);
5360 else
5361 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher329d2672008-09-24 04:55:49 +00005362
Chris Lattner5eefce32007-09-10 23:24:14 +00005363 if (GlobalValue *FWGV =
5364 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5365 // Replace uses of the fwdref with the actual alias.
5366 FWGV->replaceAllUsesWith(GA);
5367 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5368 GV->eraseFromParent();
5369 else
5370 cast<Function>(FWGV)->eraseFromParent();
5371 }
5372 ID.destroy();
Eric Christopher329d2672008-09-24 04:55:49 +00005373
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005374 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005375 ;}
5376 break;
5377
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005378 case 240:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005379#line 2224 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005380 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005381 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005382 ;}
5383 break;
5384
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005385 case 241:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005386#line 2227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005387 {
5388 CHECK_FOR_ERROR
5389 ;}
5390 break;
5391
5392 case 242:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005393#line 2233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005394 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005395 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5396 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005397 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005398 else
Dan Gohman54392c12008-04-19 00:24:39 +00005399 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5400 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005401 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005402;}
5403 break;
5404
Devang Patelcd842482008-09-29 20:49:50 +00005405 case 243:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005406#line 2243 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005407 {
5408 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5409 delete (yyvsp[(3) - (3)].StrVal);
5410 ;}
5411 break;
5412
Devang Patelcd842482008-09-29 20:49:50 +00005413 case 244:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005414#line 2247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005415 {
5416 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5417 delete (yyvsp[(3) - (3)].StrVal);
5418 ;}
5419 break;
5420
Devang Patelcd842482008-09-29 20:49:50 +00005421 case 246:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005422#line 2254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005423 {
5424 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5425 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005426 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005427 ;}
5428 break;
5429
Devang Patelcd842482008-09-29 20:49:50 +00005430 case 247:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005431#line 2259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005432 {
5433 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5434 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005435 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005436 ;}
5437 break;
5438
Devang Patelcd842482008-09-29 20:49:50 +00005439 case 248:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005440#line 2264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005441 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005442 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005443 ;}
5444 break;
5445
Devang Patelcd842482008-09-29 20:49:50 +00005446 case 249:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005447#line 2273 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005448 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005449 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005450 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005451 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5452 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005453 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].Attributes); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00005454 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5455 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005456 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005457 ;}
5458 break;
5459
Devang Patelcd842482008-09-29 20:49:50 +00005460 case 250:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005461#line 2283 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005462 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005463 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005464 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005465 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5466 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005467 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].Attributes); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00005468 (yyval.ArgList) = new ArgListType;
5469 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005470 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005471 ;}
5472 break;
5473
Devang Patelcd842482008-09-29 20:49:50 +00005474 case 251:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005475#line 2294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005476 {
5477 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005478 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005479 ;}
5480 break;
5481
Devang Patelcd842482008-09-29 20:49:50 +00005482 case 252:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005483#line 2298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005484 {
5485 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005486 struct ArgListEntry E;
5487 E.Ty = new PATypeHolder(Type::VoidTy);
5488 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005489 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005490 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005491 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005492 ;}
5493 break;
5494
Devang Patelcd842482008-09-29 20:49:50 +00005495 case 253:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005496#line 2307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005497 {
5498 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005499 struct ArgListEntry E;
5500 E.Ty = new PATypeHolder(Type::VoidTy);
5501 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005502 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005503 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005504 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005505 ;}
5506 break;
5507
Devang Patelcd842482008-09-29 20:49:50 +00005508 case 254:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005509#line 2316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005510 {
5511 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005512 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005513 ;}
5514 break;
5515
Devang Patelcd842482008-09-29 20:49:50 +00005516 case 255:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005517#line 2322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005518 {
Devang Patelcd842482008-09-29 20:49:50 +00005519 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5520 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher329d2672008-09-24 04:55:49 +00005521
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005522 // Check the function result for abstractness if this is a define. We should
5523 // have no abstract types at this point
Devang Patelcd842482008-09-29 20:49:50 +00005524 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5525 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005526
Devang Patelcd842482008-09-29 20:49:50 +00005527 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00005528 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00005529
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005530 std::vector<const Type*> ParamTypeList;
Devang Pateld222f862008-09-25 21:00:45 +00005531 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005532 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5533 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00005534 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5535 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5536 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005537 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00005538 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005539 }
Devang Patelcd842482008-09-29 20:49:50 +00005540 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005541 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00005542 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005543 }
Devang Patelcd842482008-09-29 20:49:50 +00005544 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005545 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00005546 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005547 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00005548 }
Devang Patelcd842482008-09-29 20:49:50 +00005549 if (RetAttrs != Attribute::None)
5550 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5551 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005552 unsigned index = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005553 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005554 const Type* Ty = I->Ty->get();
5555 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5556 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5557 ParamTypeList.push_back(Ty);
Devang Pateld222f862008-09-25 21:00:45 +00005558 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5559 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005560 }
5561 }
Devang Patelcd842482008-09-29 20:49:50 +00005562 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5563 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005564
5565 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5566 if (isVarArg) ParamTypeList.pop_back();
5567
Devang Pateld222f862008-09-25 21:00:45 +00005568 AttrListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005569 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00005570 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005571
Devang Patelcd842482008-09-29 20:49:50 +00005572 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005573 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patelcd842482008-09-29 20:49:50 +00005574 delete (yyvsp[(3) - (11)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005575
5576 ValID ID;
5577 if (!FunctionName.empty()) {
5578 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5579 } else {
5580 ID = ValID::createGlobalID(CurModule.Values.size());
5581 }
5582
5583 Function *Fn = 0;
5584 // See if this function was forward referenced. If so, recycle the object.
5585 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher329d2672008-09-24 04:55:49 +00005586 // Move the function to the end of the list, from whereever it was
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005587 // previously inserted.
5588 Fn = cast<Function>(FWRef);
Devang Pateld222f862008-09-25 21:00:45 +00005589 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner1c8733e2008-03-12 17:45:29 +00005590 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005591 CurModule.CurrentModule->getFunctionList().remove(Fn);
5592 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5593 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5594 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005595 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005596 // The existing function doesn't have the same type. This is an overload
5597 // error.
5598 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Pateld222f862008-09-25 21:00:45 +00005599 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005600 // The existing function doesn't have the same parameter attributes.
5601 // This is an overload error.
5602 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005603 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5604 // Neither the existing or the current function is a declaration and they
5605 // have the same name and same type. Clearly this is a redefinition.
5606 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005607 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005608 // Make sure to strip off any argument names so we can't get conflicts.
5609 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5610 AI != AE; ++AI)
5611 AI->setName("");
5612 }
5613 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005614 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5615 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005616 InsertValue(Fn, CurModule.Values);
5617 }
5618
Nuno Lopese20dbca2008-10-03 15:45:58 +00005619 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005620 CurFun.FunctionStart(Fn);
5621
5622 if (CurFun.isDeclare) {
5623 // If we have declaration, always overwrite linkage. This will allow us to
5624 // correctly handle cases, when pointer to function is passed as argument to
5625 // another function.
5626 Fn->setLinkage(CurFun.Linkage);
5627 Fn->setVisibility(CurFun.Visibility);
5628 }
Devang Patel5df692d2008-09-02 20:52:40 +00005629 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00005630 Fn->setAttributes(PAL);
Devang Patelcd842482008-09-29 20:49:50 +00005631 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5632 if ((yyvsp[(9) - (11)].StrVal)) {
5633 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5634 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005635 }
Devang Patelcd842482008-09-29 20:49:50 +00005636 if ((yyvsp[(11) - (11)].StrVal)) {
5637 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5638 delete (yyvsp[(11) - (11)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005639 }
5640
5641 // Add all of the arguments we parsed to the function...
Devang Patelcd842482008-09-29 20:49:50 +00005642 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005643 if (isVarArg) { // Nuke the last entry
Devang Patelcd842482008-09-29 20:49:50 +00005644 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005645 "Not a varargs marker!");
Devang Patelcd842482008-09-29 20:49:50 +00005646 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5647 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005648 }
5649 Function::arg_iterator ArgIt = Fn->arg_begin();
5650 Function::arg_iterator ArgEnd = Fn->arg_end();
5651 unsigned Idx = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005652 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5653 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005654 delete I->Ty; // Delete the typeholder...
5655 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5656 CHECK_FOR_ERROR
5657 InsertValue(ArgIt);
5658 Idx++;
5659 }
5660
Devang Patelcd842482008-09-29 20:49:50 +00005661 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005662 }
5663 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005664;}
5665 break;
5666
Devang Patelcd842482008-09-29 20:49:50 +00005667 case 258:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005668#line 2472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005669 {
5670 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005671
5672 // Make sure that we keep track of the linkage type even if there was a
5673 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005674 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5675 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5676;}
5677 break;
5678
Devang Patelcd842482008-09-29 20:49:50 +00005679 case 261:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005680#line 2483 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005681 {
5682 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005683 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005684;}
5685 break;
5686
Devang Patelcd842482008-09-29 20:49:50 +00005687 case 262:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005688#line 2488 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005689 {
5690 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5691 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5692 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005693 CurFun.FunctionDone();
5694 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005695 ;}
5696 break;
5697
Devang Patelcd842482008-09-29 20:49:50 +00005698 case 263:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005699#line 2500 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005700 {
5701 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005702 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005703 ;}
5704 break;
5705
Devang Patelcd842482008-09-29 20:49:50 +00005706 case 264:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005707#line 2504 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005708 {
5709 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005710 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005711 ;}
5712 break;
5713
Devang Patelcd842482008-09-29 20:49:50 +00005714 case 265:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005715#line 2509 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005716 { // A reference to a direct constant
5717 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005718 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005719 ;}
5720 break;
5721
Devang Patelcd842482008-09-29 20:49:50 +00005722 case 266:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005723#line 2513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005724 {
5725 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005726 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005727 ;}
5728 break;
5729
Devang Patelcd842482008-09-29 20:49:50 +00005730 case 267:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005731#line 2517 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005732 { // arbitrary precision integer constants
5733 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5734 delete (yyvsp[(1) - (1)].APIntVal);
5735 CHECK_FOR_ERROR
5736 ;}
5737 break;
5738
Devang Patelcd842482008-09-29 20:49:50 +00005739 case 268:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005740#line 2522 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005741 { // arbitrary precision integer constants
5742 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5743 delete (yyvsp[(1) - (1)].APIntVal);
5744 CHECK_FOR_ERROR
5745 ;}
5746 break;
5747
Devang Patelcd842482008-09-29 20:49:50 +00005748 case 269:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005749#line 2527 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005750 { // Perhaps it's an FP constant?
5751 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005752 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005753 ;}
5754 break;
5755
Devang Patelcd842482008-09-29 20:49:50 +00005756 case 270:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005757#line 2531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005758 {
5759 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005760 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005761 ;}
5762 break;
5763
Devang Patelcd842482008-09-29 20:49:50 +00005764 case 271:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005765#line 2535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005766 {
5767 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005768 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005769 ;}
5770 break;
5771
Devang Patelcd842482008-09-29 20:49:50 +00005772 case 272:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005773#line 2539 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005774 {
5775 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005776 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005777 ;}
5778 break;
5779
Devang Patelcd842482008-09-29 20:49:50 +00005780 case 273:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005781#line 2543 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005782 {
5783 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005784 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005785 ;}
5786 break;
5787
Devang Patelcd842482008-09-29 20:49:50 +00005788 case 274:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005789#line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005790 { // A vector zero constant.
5791 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005792 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005793 ;}
5794 break;
5795
Devang Patelcd842482008-09-29 20:49:50 +00005796 case 275:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005797#line 2551 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005798 { // Nonempty unsized packed vector
5799 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005800 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmane5febe42008-05-31 00:58:22 +00005801
5802 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5803 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00005804
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005805 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005806 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher329d2672008-09-24 04:55:49 +00005807
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005808 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005809 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5810 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005811 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005812 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005813 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005814 }
5815
Dan Gohman54392c12008-04-19 00:24:39 +00005816 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5817 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005818 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005819 ;}
5820 break;
5821
Devang Patelcd842482008-09-29 20:49:50 +00005822 case 276:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005823#line 2573 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005824 { // Nonempty unsized arr
5825 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005826 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005827
5828 if (!ETy->isFirstClassType())
5829 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5830
5831 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5832 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5833
5834 // Verify all elements are correct type!
5835 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5836 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005837 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005838 ETy->getDescription() +"' as required!\nIt is of type '"+
5839 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5840 }
5841
5842 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5843 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5844 CHECK_FOR_ERROR
5845 ;}
5846 break;
5847
Devang Patelcd842482008-09-29 20:49:50 +00005848 case 277:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005849#line 2595 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005850 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005851 // Use undef instead of an array because it's inconvenient to determine
5852 // the element type at this point, there being no elements to examine.
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005853 (yyval.ValIDVal) = ValID::createUndef();
5854 CHECK_FOR_ERROR
5855 ;}
5856 break;
5857
Devang Patelcd842482008-09-29 20:49:50 +00005858 case 278:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005859#line 2601 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005860 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005861 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005862 const Type *ETy = Type::Int8Ty;
5863
5864 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5865
5866 std::vector<Constant*> Vals;
5867 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5868 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5869 delete (yyvsp[(2) - (2)].StrVal);
5870 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5871 CHECK_FOR_ERROR
5872 ;}
5873 break;
5874
Devang Patelcd842482008-09-29 20:49:50 +00005875 case 279:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005876#line 2614 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005877 {
5878 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5879 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5880 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5881
5882 const StructType *STy = StructType::get(Elements);
5883 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5884
5885 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5886 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5887 CHECK_FOR_ERROR
5888 ;}
5889 break;
5890
Devang Patelcd842482008-09-29 20:49:50 +00005891 case 280:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005892#line 2626 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005893 {
5894 const StructType *STy = StructType::get(std::vector<const Type*>());
5895 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5896 CHECK_FOR_ERROR
5897 ;}
5898 break;
5899
Devang Patelcd842482008-09-29 20:49:50 +00005900 case 281:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005901#line 2631 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005902 {
5903 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5904 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5905 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5906
5907 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5908 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5909
5910 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5911 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5912 CHECK_FOR_ERROR
5913 ;}
5914 break;
5915
Devang Patelcd842482008-09-29 20:49:50 +00005916 case 282:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005917#line 2643 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005918 {
5919 const StructType *STy = StructType::get(std::vector<const Type*>(),
5920 /*isPacked=*/true);
5921 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5922 CHECK_FOR_ERROR
5923 ;}
5924 break;
5925
Devang Patelcd842482008-09-29 20:49:50 +00005926 case 283:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005927#line 2649 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005928 {
5929 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005930 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005931 ;}
5932 break;
5933
Devang Patelcd842482008-09-29 20:49:50 +00005934 case 284:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005935#line 2653 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005936 {
5937 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5938 delete (yyvsp[(3) - (5)].StrVal);
5939 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005940 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005941 ;}
5942 break;
5943
Devang Patelcd842482008-09-29 20:49:50 +00005944 case 285:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005945#line 2663 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005946 { // Is it an integer reference...?
5947 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005948 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005949 ;}
5950 break;
5951
Devang Patelcd842482008-09-29 20:49:50 +00005952 case 286:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005953#line 2667 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005954 {
5955 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005956 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005957 ;}
5958 break;
5959
Devang Patelcd842482008-09-29 20:49:50 +00005960 case 287:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005961#line 2671 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005962 { // Is it a named reference...?
5963 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5964 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005965 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005966 ;}
5967 break;
5968
Devang Patelcd842482008-09-29 20:49:50 +00005969 case 288:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005970#line 2676 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005971 { // Is it a named reference...?
5972 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5973 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005974 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005975 ;}
5976 break;
5977
Devang Patelcd842482008-09-29 20:49:50 +00005978 case 291:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005979#line 2689 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005980 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005981 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005982 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00005983 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00005984 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005985 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005986 ;}
5987 break;
5988
Devang Patelcd842482008-09-29 20:49:50 +00005989 case 292:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005990#line 2698 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005991 {
5992 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher329d2672008-09-24 04:55:49 +00005993 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005994 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005995 ;}
5996 break;
5997
Devang Patelcd842482008-09-29 20:49:50 +00005998 case 293:
Nuno Lopese20dbca2008-10-03 15:45:58 +00005999#line 2703 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006000 {
Eric Christopher329d2672008-09-24 04:55:49 +00006001 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00006002 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006003 ;}
6004 break;
6005
Devang Patelcd842482008-09-29 20:49:50 +00006006 case 294:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006007#line 2708 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006008 {
6009 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006010 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006011 ;}
6012 break;
6013
Devang Patelcd842482008-09-29 20:49:50 +00006014 case 295:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006015#line 2712 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006016 { // Do not allow functions with 0 basic blocks
Dan Gohman54392c12008-04-19 00:24:39 +00006017 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006018 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006019 ;}
6020 break;
6021
Devang Patelcd842482008-09-29 20:49:50 +00006022 case 296:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006023#line 2721 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006024 {
6025 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006026 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006027 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6028 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6029 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006030 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006031 ;}
6032 break;
6033
Devang Patelcd842482008-09-29 20:49:50 +00006034 case 297:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006035#line 2730 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006036 {
6037 CHECK_FOR_ERROR
6038 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6039 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6040 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6041 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher329d2672008-09-24 04:55:49 +00006042
Chris Lattner906773a2008-08-29 17:20:18 +00006043 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6044 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6045 CHECK_FOR_ERROR
6046;}
6047 break;
6048
Devang Patelcd842482008-09-29 20:49:50 +00006049 case 298:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006050#line 2743 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006051 {
6052 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006053 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6054 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00006055 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6056 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6057 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006058 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006059 ;}
6060 break;
Chris Lattner59363a32008-02-19 04:36:25 +00006061
Devang Patelcd842482008-09-29 20:49:50 +00006062 case 299:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006063#line 2752 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006064 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00006065 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00006066 CHECK_FOR_ERROR
6067 ;}
6068 break;
6069
Devang Patelcd842482008-09-29 20:49:50 +00006070 case 300:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006071#line 2756 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00006072 { // Labelled (named) basic block
6073 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6074 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006075 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00006076
Dan Gohman54392c12008-04-19 00:24:39 +00006077 ;}
6078 break;
6079
Devang Patelcd842482008-09-29 20:49:50 +00006080 case 301:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006081#line 2764 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006082 { // Return with a result...
6083 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6084 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006085 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6086 if (VL.size() > 1 ||
6087 (isa<StructType>(ReturnType) &&
6088 (VL.empty() || VL[0]->getType() != ReturnType))) {
6089 Value *RV = UndefValue::get(ReturnType);
6090 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6091 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6092 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6093 RV = I;
6094 }
6095 (yyval.TermInstVal) = ReturnInst::Create(RV);
6096 } else {
6097 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6098 }
Dan Gohman54392c12008-04-19 00:24:39 +00006099 delete (yyvsp[(2) - (2)].ValueList);
6100 CHECK_FOR_ERROR
6101 ;}
6102 break;
6103
Devang Patelcd842482008-09-29 20:49:50 +00006104 case 302:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006105#line 2784 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006106 { // Return with no result...
6107 (yyval.TermInstVal) = ReturnInst::Create();
6108 CHECK_FOR_ERROR
6109 ;}
6110 break;
6111
Devang Patelcd842482008-09-29 20:49:50 +00006112 case 303:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006113#line 2788 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006114 { // Unconditional Branch...
6115 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6116 CHECK_FOR_ERROR
6117 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6118 ;}
6119 break;
6120
Devang Patelcd842482008-09-29 20:49:50 +00006121 case 304:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006122#line 2793 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006123 {
Dan Gohmane5febe42008-05-31 00:58:22 +00006124 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6125 GEN_ERROR("Branch condition must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00006126 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6127 CHECK_FOR_ERROR
6128 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6129 CHECK_FOR_ERROR
6130 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6131 CHECK_FOR_ERROR
6132 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6133 ;}
6134 break;
6135
Devang Patelcd842482008-09-29 20:49:50 +00006136 case 305:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006137#line 2804 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006138 {
6139 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6140 CHECK_FOR_ERROR
6141 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6142 CHECK_FOR_ERROR
6143 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6144 (yyval.TermInstVal) = S;
6145
6146 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6147 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006148 for (; I != E; ++I) {
6149 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6150 S->addCase(CI, I->second);
6151 else
6152 GEN_ERROR("Switch case is constant, but not a simple integer");
6153 }
Dan Gohman54392c12008-04-19 00:24:39 +00006154 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006155 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006156 ;}
6157 break;
6158
Devang Patelcd842482008-09-29 20:49:50 +00006159 case 306:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006160#line 2823 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006161 {
6162 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006163 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006164 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006165 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00006166 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00006167 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006168 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006169 ;}
6170 break;
6171
Devang Patelcd842482008-09-29 20:49:50 +00006172 case 307:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006173#line 2833 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006174 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006175
6176 // Handle the short syntax
6177 const PointerType *PFTy = 0;
6178 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006179 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006180 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6181 // Pull out the types of all of the arguments...
6182 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006183 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006184 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006185 const Type *Ty = I->Val->getType();
6186 if (Ty == Type::VoidTy)
6187 GEN_ERROR("Short call syntax cannot be used with varargs");
6188 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006189 }
Eric Christopher329d2672008-09-24 04:55:49 +00006190
Devang Patelcd842482008-09-29 20:49:50 +00006191 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006192 GEN_ERROR("Invalid result type for LLVM function");
6193
Devang Patelcd842482008-09-29 20:49:50 +00006194 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006195 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006196 }
6197
Devang Patelcd842482008-09-29 20:49:50 +00006198 delete (yyvsp[(4) - (15)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006199
Devang Patelcd842482008-09-29 20:49:50 +00006200 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006201 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006202 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006203 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006204 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006205 CHECK_FOR_ERROR
6206
Devang Pateld222f862008-09-25 21:00:45 +00006207 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006208 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6209 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006210 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6211 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6212 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006213 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006214 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006215 }
Devang Patelcd842482008-09-29 20:49:50 +00006216 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006217 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006218 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006219 }
Devang Patelcd842482008-09-29 20:49:50 +00006220 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006221 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006222 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006223 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006224 }
Devang Patelcd842482008-09-29 20:49:50 +00006225 if (RetAttrs != Attribute::None)
6226 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006227
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006228 // Check the arguments
6229 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006230 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006231 // Make sure no arguments is a good thing!
6232 if (Ty->getNumParams() != 0)
6233 GEN_ERROR("No arguments passed to a function that "
6234 "expects arguments");
6235 } else { // Has arguments?
6236 // Loop through FunctionType's arguments and ensure they are specified
6237 // correctly!
6238 FunctionType::param_iterator I = Ty->param_begin();
6239 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006240 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006241 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006242
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006243 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006244 if (ArgI->Val->getType() != *I)
6245 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6246 (*I)->getDescription() + "'");
6247 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006248 if (ArgI->Attrs != Attribute::None)
6249 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006250 }
6251
6252 if (Ty->isVarArg()) {
6253 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006254 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006255 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006256 if (ArgI->Attrs != Attribute::None)
6257 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006258 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006259 } else if (I != E || ArgI != ArgE)
6260 GEN_ERROR("Invalid number of parameters detected");
6261 }
Devang Patelcd842482008-09-29 20:49:50 +00006262 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6263 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Pateld222f862008-09-25 21:00:45 +00006264 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006265 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006266 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006267
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006268 // Create the InvokeInst
Dan Gohman8055f772008-05-15 19:50:34 +00006269 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6270 Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006271 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006272 II->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006273 (yyval.TermInstVal) = II;
Devang Patelcd842482008-09-29 20:49:50 +00006274 delete (yyvsp[(7) - (15)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006275 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006276 ;}
6277 break;
6278
Devang Patelcd842482008-09-29 20:49:50 +00006279 case 308:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006280#line 2936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006281 {
6282 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006283 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006284 ;}
6285 break;
6286
Devang Patelcd842482008-09-29 20:49:50 +00006287 case 309:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006288#line 2940 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006289 {
6290 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006291 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006292 ;}
6293 break;
6294
Devang Patelcd842482008-09-29 20:49:50 +00006295 case 310:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006296#line 2947 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006297 {
6298 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6299 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006300 CHECK_FOR_ERROR
6301 if (V == 0)
6302 GEN_ERROR("May only switch on a constant pool value");
6303
Dan Gohman54392c12008-04-19 00:24:39 +00006304 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006305 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006306 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6307 ;}
6308 break;
6309
Devang Patelcd842482008-09-29 20:49:50 +00006310 case 311:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006311#line 2958 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006312 {
6313 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6314 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006315 CHECK_FOR_ERROR
6316
6317 if (V == 0)
6318 GEN_ERROR("May only switch on a constant pool value");
6319
Dan Gohman54392c12008-04-19 00:24:39 +00006320 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006321 CHECK_FOR_ERROR
Eric Christopher329d2672008-09-24 04:55:49 +00006322 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohman54392c12008-04-19 00:24:39 +00006323 ;}
6324 break;
6325
Devang Patelcd842482008-09-29 20:49:50 +00006326 case 312:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006327#line 2971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006328 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00006330 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006331 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006332 InsertValue((yyvsp[(2) - (2)].InstVal));
6333 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006334 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006335 ;}
6336 break;
6337
Devang Patelcd842482008-09-29 20:49:50 +00006338 case 313:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006339#line 2980 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006340 {
6341 CHECK_FOR_ERROR
6342 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher329d2672008-09-24 04:55:49 +00006343
Chris Lattner906773a2008-08-29 17:20:18 +00006344 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6345 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6346 " is incorrect, expected %" + utostr((unsigned)ValNum));
6347
6348 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6349 CHECK_FOR_ERROR
6350 ;}
6351 break;
6352
Devang Patelcd842482008-09-29 20:49:50 +00006353 case 314:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006354#line 2993 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006355 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006356 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006357 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6358 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6359 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006360 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006361 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006362 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006363 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6364 delete (yyvsp[(1) - (6)].TypeVal);
6365 ;}
6366 break;
6367
Devang Patelcd842482008-09-29 20:49:50 +00006368 case 315:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006369#line 3004 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006370 {
6371 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6372 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006373 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006374 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006375 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006376 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6377 ;}
6378 break;
6379
Devang Patelcd842482008-09-29 20:49:50 +00006380 case 316:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006381#line 3014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006382 {
Devang Pateld222f862008-09-25 21:00:45 +00006383 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006384 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006385 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006386 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00006387 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006388 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00006389 (yyval.ParamList)->push_back(E);
6390 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006391 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006392 ;}
6393 break;
6394
Devang Patelcd842482008-09-29 20:49:50 +00006395 case 317:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006396#line 3025 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006397 {
Devang Pateld222f862008-09-25 21:00:45 +00006398 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00006399 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00006400 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006401 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00006402 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006403 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006404 ;}
6405 break;
6406
Devang Patelcd842482008-09-29 20:49:50 +00006407 case 318:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006408#line 3033 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006409 {
Devang Pateld222f862008-09-25 21:00:45 +00006410 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006411 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006412 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6413 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006414 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00006415 (yyval.ParamList)->push_back(E);
6416 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006417 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006418 ;}
6419 break;
6420
Devang Patelcd842482008-09-29 20:49:50 +00006421 case 319:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006422#line 3043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006423 {
Devang Pateld222f862008-09-25 21:00:45 +00006424 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00006425 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006426 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00006427 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00006428 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006429 ;}
6430 break;
6431
Devang Patelcd842482008-09-29 20:49:50 +00006432 case 320:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006433#line 3050 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006434 { (yyval.ParamList) = new ParamList(); ;}
6435 break;
6436
Devang Patelcd842482008-09-29 20:49:50 +00006437 case 321:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006438#line 3053 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006439 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6440 break;
6441
Devang Patelcd842482008-09-29 20:49:50 +00006442 case 322:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006443#line 3054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006444 {
6445 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6446 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006447 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006448 ;}
6449 break;
6450
Devang Patelcd842482008-09-29 20:49:50 +00006451 case 323:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006452#line 3062 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006453 {
6454 (yyval.ConstantList) = new std::vector<unsigned>();
6455 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6456 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6457 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6458 ;}
6459 break;
6460
Devang Patelcd842482008-09-29 20:49:50 +00006461 case 324:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006462#line 3068 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006463 {
6464 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6465 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6466 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6467 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6468 CHECK_FOR_ERROR
6469 ;}
6470 break;
6471
Devang Patelcd842482008-09-29 20:49:50 +00006472 case 325:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006473#line 3077 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006474 {
6475 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006476 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006477 ;}
6478 break;
6479
Devang Patelcd842482008-09-29 20:49:50 +00006480 case 326:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006481#line 3081 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006482 {
6483 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006484 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006485 ;}
6486 break;
6487
Devang Patelcd842482008-09-29 20:49:50 +00006488 case 327:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006489#line 3086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006490 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006491 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006492 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00006493 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohman54392c12008-04-19 00:24:39 +00006494 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006495 GEN_ERROR(
6496 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher329d2672008-09-24 04:55:49 +00006497 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006498 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006499 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006500 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006501 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohman54392c12008-04-19 00:24:39 +00006502 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006503 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006504 delete (yyvsp[(2) - (5)].TypeVal);
6505 ;}
6506 break;
6507
Devang Patelcd842482008-09-29 20:49:50 +00006508 case 328:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006509#line 3102 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006510 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006511 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006512 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6513 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begemanbb1ce942008-07-29 15:49:41 +00006514 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00006515 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006516 GEN_ERROR("Logical operator requires integral operands");
6517 }
Dan Gohman54392c12008-04-19 00:24:39 +00006518 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006519 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006520 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006521 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006522 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006523 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006524 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006525 delete (yyvsp[(2) - (5)].TypeVal);
6526 ;}
6527 break;
6528
Devang Patelcd842482008-09-29 20:49:50 +00006529 case 329:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006530#line 3119 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006531 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006532 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006533 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006534 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006535 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006536 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006537 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006538 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006539 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006540 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006541 delete (yyvsp[(3) - (6)].TypeVal);
6542 ;}
6543 break;
6544
Devang Patelcd842482008-09-29 20:49:50 +00006545 case 330:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006546#line 3131 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006547 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006548 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006549 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006550 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006551 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006552 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006553 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006554 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006555 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006556 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006557 delete (yyvsp[(3) - (6)].TypeVal);
6558 ;}
6559 break;
6560
Devang Patelcd842482008-09-29 20:49:50 +00006561 case 331:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006562#line 3143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006563 {
6564 if (!UpRefs.empty())
6565 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6566 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6567 GEN_ERROR("Scalar types not supported by vicmp instruction");
6568 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6569 CHECK_FOR_ERROR
6570 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6571 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006572 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006573 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006574 GEN_ERROR("vicmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006575 delete (yyvsp[(3) - (6)].TypeVal);
6576 ;}
6577 break;
6578
Devang Patelcd842482008-09-29 20:49:50 +00006579 case 332:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006580#line 3157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006581 {
6582 if (!UpRefs.empty())
6583 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6584 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6585 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6586 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6587 CHECK_FOR_ERROR
6588 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6589 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006590 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006591 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006592 GEN_ERROR("vfcmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006593 delete (yyvsp[(3) - (6)].TypeVal);
6594 ;}
6595 break;
6596
Devang Patelcd842482008-09-29 20:49:50 +00006597 case 333:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006598#line 3171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006599 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006600 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006601 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6602 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6603 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6604 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006605 GEN_ERROR("invalid cast opcode for cast from '" +
6606 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00006607 DestTy->getDescription() + "'");
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006608 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohman54392c12008-04-19 00:24:39 +00006609 delete (yyvsp[(4) - (4)].TypeVal);
6610 ;}
6611 break;
6612
Devang Patelcd842482008-09-29 20:49:50 +00006613 case 334:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006614#line 3183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006615 {
Dan Gohman181f4e42008-09-09 01:13:24 +00006616 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6617 // vector select
6618 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6619 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6620 GEN_ERROR("vector select value types must be vector types");
6621 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6622 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6623 if (cond_type->getElementType() != Type::Int1Ty)
6624 GEN_ERROR("vector select condition element type must be boolean");
6625 if (cond_type->getNumElements() != select_type->getNumElements())
6626 GEN_ERROR("vector select number of elements must be the same");
6627 } else {
6628 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6629 GEN_ERROR("select condition must be boolean");
6630 }
Dan Gohman54392c12008-04-19 00:24:39 +00006631 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohman181f4e42008-09-09 01:13:24 +00006632 GEN_ERROR("select value types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00006633 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006634 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006635 ;}
6636 break;
6637
Devang Patelcd842482008-09-29 20:49:50 +00006638 case 335:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006639#line 3204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006640 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006641 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006642 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6643 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6644 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006645 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006646 ;}
6647 break;
6648
Devang Patelcd842482008-09-29 20:49:50 +00006649 case 336:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006650#line 3211 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006651 {
6652 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006653 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006654 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006655 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006656 ;}
6657 break;
6658
Devang Patelcd842482008-09-29 20:49:50 +00006659 case 337:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006660#line 3217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006661 {
6662 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006663 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006664 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006665 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006666 ;}
6667 break;
6668
Devang Patelcd842482008-09-29 20:49:50 +00006669 case 338:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006670#line 3223 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006671 {
6672 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006673 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006674 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006675 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006676 ;}
6677 break;
6678
Devang Patelcd842482008-09-29 20:49:50 +00006679 case 339:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006680#line 3229 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006681 {
6682 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006683 if (!Ty->isFirstClassType())
6684 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006685 (yyval.InstVal) = PHINode::Create(Ty);
6686 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6687 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher329d2672008-09-24 04:55:49 +00006688 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006689 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006690 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6691 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006692 }
Dan Gohman54392c12008-04-19 00:24:39 +00006693 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006694 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006695 ;}
6696 break;
6697
Devang Patelcd842482008-09-29 20:49:50 +00006698 case 340:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006699#line 3245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006700 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006701
6702 // Handle the short syntax
6703 const PointerType *PFTy = 0;
6704 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006705 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006706 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6707 // Pull out the types of all of the arguments...
6708 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006709 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006710 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006711 const Type *Ty = I->Val->getType();
6712 if (Ty == Type::VoidTy)
6713 GEN_ERROR("Short call syntax cannot be used with varargs");
6714 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006715 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006716
Devang Patelcd842482008-09-29 20:49:50 +00006717 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006718 GEN_ERROR("Invalid result type for LLVM function");
6719
Devang Patelcd842482008-09-29 20:49:50 +00006720 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006721 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006722 }
6723
Devang Patelcd842482008-09-29 20:49:50 +00006724 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006725 CHECK_FOR_ERROR
6726
6727 // Check for call to invalid intrinsic to avoid crashing later.
6728 if (Function *theF = dyn_cast<Function>(V)) {
6729 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6730 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6731 !theF->getIntrinsicID(true))
6732 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6733 theF->getName() + "'");
6734 }
6735
Devang Pateld222f862008-09-25 21:00:45 +00006736 // Set up the Attributes for the function
6737 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006738 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6739 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006740 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6741 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6742 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006743 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006744 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006745 }
Devang Patelcd842482008-09-29 20:49:50 +00006746 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006747 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006748 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006749 }
Devang Patelcd842482008-09-29 20:49:50 +00006750 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006751 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006752 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006753 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006754 }
Devang Patelcd842482008-09-29 20:49:50 +00006755 if (RetAttrs != Attribute::None)
6756 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006757
Eric Christopher329d2672008-09-24 04:55:49 +00006758 // Check the arguments
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006759 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006760 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006761 // Make sure no arguments is a good thing!
6762 if (Ty->getNumParams() != 0)
6763 GEN_ERROR("No arguments passed to a function that "
6764 "expects arguments");
6765 } else { // Has arguments?
6766 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006767 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006768 FunctionType::param_iterator I = Ty->param_begin();
6769 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006770 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006771 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006772
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006773 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006774 if (ArgI->Val->getType() != *I)
6775 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6776 (*I)->getDescription() + "'");
6777 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006778 if (ArgI->Attrs != Attribute::None)
6779 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006780 }
6781 if (Ty->isVarArg()) {
6782 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006783 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006784 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006785 if (ArgI->Attrs != Attribute::None)
6786 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006787 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006788 } else if (I != E || ArgI != ArgE)
6789 GEN_ERROR("Invalid number of parameters detected");
6790 }
Devang Patelcd842482008-09-29 20:49:50 +00006791 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6792 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006793
Devang Pateld222f862008-09-25 21:00:45 +00006794 // Finish off the Attributes and check them
6795 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006796 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006797 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006798
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006799 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006800 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006801 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6802 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006803 CI->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006804 (yyval.InstVal) = CI;
Devang Patelcd842482008-09-29 20:49:50 +00006805 delete (yyvsp[(7) - (9)].ParamList);
6806 delete (yyvsp[(4) - (9)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006807 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006808 ;}
6809 break;
6810
Devang Patelcd842482008-09-29 20:49:50 +00006811 case 341:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006812#line 3354 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006813 {
6814 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006815 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006816 ;}
6817 break;
6818
Devang Patelcd842482008-09-29 20:49:50 +00006819 case 342:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006820#line 3359 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006821 {
6822 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006823 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006824 ;}
6825 break;
6826
Devang Patelcd842482008-09-29 20:49:50 +00006827 case 343:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006828#line 3363 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006829 {
6830 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006831 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006832 ;}
6833 break;
6834
Devang Patelcd842482008-09-29 20:49:50 +00006835 case 344:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006836#line 3370 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006837 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006838 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006839 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6840 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6841 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006842 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006843 ;}
6844 break;
6845
Devang Patelcd842482008-09-29 20:49:50 +00006846 case 345:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006847#line 3377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006848 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006849 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006850 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006851 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6852 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006853 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006854 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006855 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6856 delete (yyvsp[(2) - (6)].TypeVal);
6857 ;}
6858 break;
6859
Devang Patelcd842482008-09-29 20:49:50 +00006860 case 346:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006861#line 3387 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006862 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006863 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006864 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6865 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6866 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006867 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006868 ;}
6869 break;
6870
Devang Patelcd842482008-09-29 20:49:50 +00006871 case 347:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006872#line 3394 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006873 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006874 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006876 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6877 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006878 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006879 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006880 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6881 delete (yyvsp[(2) - (6)].TypeVal);
6882 ;}
6883 break;
6884
Devang Patelcd842482008-09-29 20:49:50 +00006885 case 348:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006886#line 3404 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006887 {
6888 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher329d2672008-09-24 04:55:49 +00006889 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006890 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6891 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006892 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006893 ;}
6894 break;
6895
Devang Patelcd842482008-09-29 20:49:50 +00006896 case 349:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006897#line 3412 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006898 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006899 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006900 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6901 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006902 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006903 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6904 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006905 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006906 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6907 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006908 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006909 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6910 delete (yyvsp[(3) - (5)].TypeVal);
6911 ;}
6912 break;
6913
Devang Patelcd842482008-09-29 20:49:50 +00006914 case 350:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006915#line 3426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006916 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006917 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006918 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6919 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006920 if (!PT)
6921 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006922 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006923 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006924 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6925 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006926 "' into space of type '" + ElTy->getDescription() + "'");
6927
Dan Gohman54392c12008-04-19 00:24:39 +00006928 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006929 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006930 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6931 delete (yyvsp[(5) - (7)].TypeVal);
6932 ;}
6933 break;
6934
Devang Patelcd842482008-09-29 20:49:50 +00006935 case 351:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006936#line 3443 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006937 {
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006938 if (!UpRefs.empty())
6939 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6940 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6941 GEN_ERROR("getresult insn requires an aggregate operand");
6942 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6943 GEN_ERROR("Invalid getresult index for type '" +
6944 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6945
6946 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel3b8849c2008-02-19 22:27:01 +00006947 CHECK_FOR_ERROR
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006948 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6949 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006950 ;}
6951 break;
6952
Devang Patelcd842482008-09-29 20:49:50 +00006953 case 352:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006954#line 3457 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006955 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006956 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006957 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6958 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006959 GEN_ERROR("getelementptr insn requires pointer operand");
6960
Dan Gohman8055f772008-05-15 19:50:34 +00006961 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006962 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006963 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6964 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006965 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006966 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00006967 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006968 delete (yyvsp[(4) - (4)].ValueList);
6969 ;}
6970 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006971
Devang Patelcd842482008-09-29 20:49:50 +00006972 case 353:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006973#line 3472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006974 {
6975 if (!UpRefs.empty())
6976 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6977 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6978 GEN_ERROR("extractvalue insn requires an aggregate operand");
6979
Dan Gohmane5febe42008-05-31 00:58:22 +00006980 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006981 GEN_ERROR("Invalid extractvalue indices for type '" +
6982 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6983 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6984 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00006985 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00006986 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00006987 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006988 ;}
6989 break;
6990
Devang Patelcd842482008-09-29 20:49:50 +00006991 case 354:
Nuno Lopese20dbca2008-10-03 15:45:58 +00006992#line 3487 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006993 {
6994 if (!UpRefs.empty())
6995 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6996 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6997 GEN_ERROR("extractvalue insn requires an aggregate operand");
6998
Dan Gohmane5febe42008-05-31 00:58:22 +00006999 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 +00007000 GEN_ERROR("Invalid insertvalue indices for type '" +
7001 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7002 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7003 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7004 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00007005 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007006 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007007 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00007008 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007009 ;}
7010 break;
7011
Dan Gohman54392c12008-04-19 00:24:39 +00007012
7013/* Line 1267 of yacc.c. */
Nuno Lopese20dbca2008-10-03 15:45:58 +00007014#line 7015 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00007015 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00007016 }
Dan Gohman54392c12008-04-19 00:24:39 +00007017 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7018
7019 YYPOPSTACK (yylen);
7020 yylen = 0;
7021 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007022
7023 *++yyvsp = yyval;
7024
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007025
Dan Gohman54392c12008-04-19 00:24:39 +00007026 /* Now `shift' the result of the reduction. Determine what state
7027 that goes to, based on the state we popped back to and the rule
7028 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007029
7030 yyn = yyr1[yyn];
7031
Dan Gohman54392c12008-04-19 00:24:39 +00007032 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7033 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007034 yystate = yytable[yystate];
7035 else
Dan Gohman54392c12008-04-19 00:24:39 +00007036 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007037
7038 goto yynewstate;
7039
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007040
Dan Gohman54392c12008-04-19 00:24:39 +00007041/*------------------------------------.
7042| yyerrlab -- here on detecting error |
7043`------------------------------------*/
7044yyerrlab:
7045 /* If not already recovering from an error, report this error. */
7046 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007047 {
7048 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00007049#if ! YYERROR_VERBOSE
7050 yyerror (YY_("syntax error"));
7051#else
7052 {
7053 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7054 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7055 {
7056 YYSIZE_T yyalloc = 2 * yysize;
7057 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7058 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7059 if (yymsg != yymsgbuf)
7060 YYSTACK_FREE (yymsg);
7061 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7062 if (yymsg)
7063 yymsg_alloc = yyalloc;
7064 else
7065 {
7066 yymsg = yymsgbuf;
7067 yymsg_alloc = sizeof yymsgbuf;
7068 }
7069 }
Dale Johannesen3afee192007-09-07 21:07:57 +00007070
Dan Gohman54392c12008-04-19 00:24:39 +00007071 if (0 < yysize && yysize <= yymsg_alloc)
7072 {
7073 (void) yysyntax_error (yymsg, yystate, yychar);
7074 yyerror (yymsg);
7075 }
7076 else
7077 {
7078 yyerror (YY_("syntax error"));
7079 if (yysize != 0)
7080 goto yyexhaustedlab;
7081 }
7082 }
7083#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007084 }
7085
Dan Gohman54392c12008-04-19 00:24:39 +00007086
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007087
7088 if (yyerrstatus == 3)
7089 {
Dan Gohman54392c12008-04-19 00:24:39 +00007090 /* If just tried and failed to reuse look-ahead token after an
7091 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007092
Dan Gohman54392c12008-04-19 00:24:39 +00007093 if (yychar <= YYEOF)
7094 {
7095 /* Return failure if at end of input. */
7096 if (yychar == YYEOF)
7097 YYABORT;
7098 }
7099 else
7100 {
7101 yydestruct ("Error: discarding",
7102 yytoken, &yylval);
7103 yychar = YYEMPTY;
7104 }
7105 }
7106
7107 /* Else will try to reuse look-ahead token after shifting the error
7108 token. */
7109 goto yyerrlab1;
7110
7111
7112/*---------------------------------------------------.
7113| yyerrorlab -- error raised explicitly by YYERROR. |
7114`---------------------------------------------------*/
7115yyerrorlab:
7116
7117 /* Pacify compilers like GCC when the user code never invokes
7118 YYERROR and the label yyerrorlab therefore never appears in user
7119 code. */
7120 if (/*CONSTCOND*/ 0)
7121 goto yyerrorlab;
7122
7123 /* Do not reclaim the symbols of the rule which action triggered
7124 this YYERROR. */
7125 YYPOPSTACK (yylen);
7126 yylen = 0;
7127 YY_STACK_PRINT (yyss, yyssp);
7128 yystate = *yyssp;
7129 goto yyerrlab1;
7130
7131
7132/*-------------------------------------------------------------.
7133| yyerrlab1 -- common code for both syntax error and YYERROR. |
7134`-------------------------------------------------------------*/
7135yyerrlab1:
7136 yyerrstatus = 3; /* Each real token shifted decrements this. */
7137
7138 for (;;)
7139 {
7140 yyn = yypact[yystate];
7141 if (yyn != YYPACT_NINF)
7142 {
7143 yyn += YYTERROR;
7144 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7145 {
7146 yyn = yytable[yyn];
7147 if (0 < yyn)
7148 break;
7149 }
7150 }
7151
7152 /* Pop the current state because it cannot handle the error token. */
7153 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007154 YYABORT;
7155
Dale Johannesen3afee192007-09-07 21:07:57 +00007156
Dan Gohman54392c12008-04-19 00:24:39 +00007157 yydestruct ("Error: popping",
7158 yystos[yystate], yyvsp);
7159 YYPOPSTACK (1);
7160 yystate = *yyssp;
7161 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007162 }
7163
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007164 if (yyn == YYFINAL)
7165 YYACCEPT;
7166
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007167 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00007168
7169
7170 /* Shift the error token. */
7171 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00007172
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007173 yystate = yyn;
7174 goto yynewstate;
7175
Gabor Greif89f01162008-04-06 23:07:54 +00007176
Dan Gohman54392c12008-04-19 00:24:39 +00007177/*-------------------------------------.
7178| yyacceptlab -- YYACCEPT comes here. |
7179`-------------------------------------*/
7180yyacceptlab:
7181 yyresult = 0;
7182 goto yyreturn;
7183
7184/*-----------------------------------.
7185| yyabortlab -- YYABORT comes here. |
7186`-----------------------------------*/
7187yyabortlab:
7188 yyresult = 1;
7189 goto yyreturn;
7190
7191#ifndef yyoverflow
7192/*-------------------------------------------------.
7193| yyexhaustedlab -- memory exhaustion comes here. |
7194`-------------------------------------------------*/
7195yyexhaustedlab:
7196 yyerror (YY_("memory exhausted"));
7197 yyresult = 2;
7198 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00007199#endif
Dan Gohman54392c12008-04-19 00:24:39 +00007200
7201yyreturn:
7202 if (yychar != YYEOF && yychar != YYEMPTY)
7203 yydestruct ("Cleanup: discarding lookahead",
7204 yytoken, &yylval);
7205 /* Do not reclaim the symbols of the rule which action triggered
7206 this YYABORT or YYACCEPT. */
7207 YYPOPSTACK (yylen);
7208 YY_STACK_PRINT (yyss, yyssp);
7209 while (yyssp != yyss)
7210 {
7211 yydestruct ("Cleanup: popping",
7212 yystos[*yyssp], yyvsp);
7213 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00007214 }
Dan Gohman54392c12008-04-19 00:24:39 +00007215#ifndef yyoverflow
7216 if (yyss != yyssa)
7217 YYSTACK_FREE (yyss);
7218#endif
7219#if YYERROR_VERBOSE
7220 if (yymsg != yymsgbuf)
7221 YYSTACK_FREE (yymsg);
7222#endif
7223 /* Make sure YYID is used. */
7224 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007225}
Dan Gohman54392c12008-04-19 00:24:39 +00007226
7227
Nuno Lopese20dbca2008-10-03 15:45:58 +00007228#line 3506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007229
7230
7231// common code from the two 'RunVMAsmParser' functions
7232static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007233 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007234 // Check to make sure the parser succeeded
7235 if (yyparse()) {
7236 if (ParserResult)
7237 delete ParserResult;
7238 return 0;
7239 }
7240
7241 // Emit an error if there are any unresolved types left.
7242 if (!CurModule.LateResolveTypes.empty()) {
7243 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7244 if (DID.Type == ValID::LocalName) {
7245 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7246 } else {
7247 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7248 }
7249 if (ParserResult)
7250 delete ParserResult;
7251 return 0;
7252 }
7253
7254 // Emit an error if there are any unresolved values left.
7255 if (!CurModule.LateResolveValues.empty()) {
7256 Value *V = CurModule.LateResolveValues.back();
7257 std::map<Value*, std::pair<ValID, int> >::iterator I =
7258 CurModule.PlaceHolderInfo.find(V);
7259
7260 if (I != CurModule.PlaceHolderInfo.end()) {
7261 ValID &DID = I->second.first;
7262 if (DID.Type == ValID::LocalName) {
7263 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7264 } else {
7265 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7266 }
7267 if (ParserResult)
7268 delete ParserResult;
7269 return 0;
7270 }
7271 }
7272
7273 // Check to make sure that parsing produced a result
7274 if (!ParserResult)
7275 return 0;
7276
7277 // Reset ParserResult variable while saving its value for the result.
7278 Module *Result = ParserResult;
7279 ParserResult = 0;
7280
7281 return Result;
7282}
7283
7284void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007285 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007286 // TODO: column number in exception
7287 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007288 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007289 TriggerError = 1;
7290}
7291
7292int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007293 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007294 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007295 if (yychar != YYEMPTY && yychar != 0) {
7296 errMsg += " while reading token: '";
Eric Christopher329d2672008-09-24 04:55:49 +00007297 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007298 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7299 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007300 GenerateError(errMsg);
7301 return 0;
7302}
Dan Gohman54392c12008-04-19 00:24:39 +00007303