blob: 564da0917f2741c87a82809a45a5c3e63badcd0b [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. */
Chris Lattner8f5544c2008-10-15 06:03:48 +0000397#line 14 "/Users/sabre/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 &&
Dale Johannesen5ba85fd2008-10-09 23:01:34 +0000815 Ty==Type::FloatTy) {
816 bool ignored;
817 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
818 &ignored);
819 }
Chris Lattner05ba86e2008-04-20 00:41:19 +0000820 return ConstantFP::get(*D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000821
822 case ValID::ConstNullVal: // Is it a null value?
823 if (!isa<PointerType>(Ty)) {
824 GenerateError("Cannot create a a non pointer null");
825 return 0;
826 }
827 return ConstantPointerNull::get(cast<PointerType>(Ty));
828
829 case ValID::ConstUndefVal: // Is it an undef value?
830 return UndefValue::get(Ty);
831
832 case ValID::ConstZeroVal: // Is it a zero value?
833 return Constant::getNullValue(Ty);
Eric Christopher329d2672008-09-24 04:55:49 +0000834
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000835 case ValID::ConstantVal: // Fully resolved constant?
836 if (D.ConstantValue->getType() != Ty) {
837 GenerateError("Constant expression type different from required type");
838 return 0;
839 }
840 return D.ConstantValue;
841
842 case ValID::InlineAsmVal: { // Inline asm expression
843 const PointerType *PTy = dyn_cast<PointerType>(Ty);
844 const FunctionType *FTy =
845 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
846 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
847 GenerateError("Invalid type for asm constraint string");
848 return 0;
849 }
850 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
851 D.IAD->HasSideEffects);
852 D.destroy(); // Free InlineAsmDescriptor.
853 return IA;
854 }
855 default:
856 assert(0 && "Unhandled case!");
857 return 0;
858 } // End of switch
859
860 assert(0 && "Unhandled case!");
861 return 0;
862}
863
864// getVal - This function is identical to getExistingVal, except that if a
865// value is not already defined, it "improvises" by creating a placeholder var
866// that looks and acts just like the requested variable. When the value is
867// defined later, all uses of the placeholder variable are replaced with the
868// real thing.
869//
870static Value *getVal(const Type *Ty, const ValID &ID) {
871 if (Ty == Type::LabelTy) {
872 GenerateError("Cannot use a basic block here");
873 return 0;
874 }
875
876 // See if the value has already been defined.
877 Value *V = getExistingVal(Ty, ID);
878 if (V) return V;
879 if (TriggerError) return 0;
880
881 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000882 GenerateError("Invalid use of a non-first-class type");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000883 return 0;
884 }
885
886 // If we reached here, we referenced either a symbol that we don't know about
887 // or an id number that hasn't been read yet. We may be referencing something
888 // forward, so just create an entry to be resolved later and get to it...
889 //
890 switch (ID.Type) {
891 case ValID::GlobalName:
892 case ValID::GlobalID: {
893 const PointerType *PTy = dyn_cast<PointerType>(Ty);
894 if (!PTy) {
895 GenerateError("Invalid type for reference to global" );
896 return 0;
897 }
898 const Type* ElTy = PTy->getElementType();
899 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000900 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000901 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000902 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
903 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000904 break;
905 }
906 default:
907 V = new Argument(Ty);
908 }
Eric Christopher329d2672008-09-24 04:55:49 +0000909
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000910 // Remember where this forward reference came from. FIXME, shouldn't we try
911 // to recycle these things??
912 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000913 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000914
915 if (inFunctionScope())
916 InsertValue(V, CurFun.LateResolveValues);
917 else
918 InsertValue(V, CurModule.LateResolveValues);
919 return V;
920}
921
922/// defineBBVal - This is a definition of a new basic block with the specified
923/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000924static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000925 assert(inFunctionScope() && "Can't get basic block at global scope!");
926
927 BasicBlock *BB = 0;
928
929 // First, see if this was forward referenced
930
931 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
932 if (BBI != CurFun.BBForwardRefs.end()) {
933 BB = BBI->second;
934 // The forward declaration could have been inserted anywhere in the
935 // function: insert it into the correct place now.
936 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
937 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
938
939 // We're about to erase the entry, save the key so we can clean it up.
940 ValID Tmp = BBI->first;
941
942 // Erase the forward ref from the map as its no longer "forward"
943 CurFun.BBForwardRefs.erase(ID);
944
Eric Christopher329d2672008-09-24 04:55:49 +0000945 // The key has been removed from the map but so we don't want to leave
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000946 // strdup'd memory around so destroy it too.
947 Tmp.destroy();
948
949 // If its a numbered definition, bump the number and set the BB value.
950 if (ID.Type == ValID::LocalID) {
951 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
952 InsertValue(BB);
953 }
Eric Christopher329d2672008-09-24 04:55:49 +0000954 } else {
955 // We haven't seen this BB before and its first mention is a definition.
Devang Patel890cc572008-03-03 18:58:47 +0000956 // Just create it and return it.
957 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000958 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000959 if (ID.Type == ValID::LocalID) {
960 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
961 InsertValue(BB);
962 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000963 }
964
Devang Patel890cc572008-03-03 18:58:47 +0000965 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000966 return BB;
967}
968
969/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher329d2672008-09-24 04:55:49 +0000970///
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000971static BasicBlock *getBBVal(const ValID &ID) {
972 assert(inFunctionScope() && "Can't get basic block at global scope!");
973
974 BasicBlock *BB = 0;
975
976 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
977 if (BBI != CurFun.BBForwardRefs.end()) {
978 BB = BBI->second;
979 } if (ID.Type == ValID::LocalName) {
980 std::string Name = ID.getName();
981 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000982 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000983 if (N->getType()->getTypeID() == Type::LabelTyID)
984 BB = cast<BasicBlock>(N);
985 else
986 GenerateError("Reference to label '" + Name + "' is actually of type '"+
987 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000988 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000989 } else if (ID.Type == ValID::LocalID) {
990 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
991 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
992 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
993 else
Eric Christopher329d2672008-09-24 04:55:49 +0000994 GenerateError("Reference to label '%" + utostr(ID.Num) +
995 "' is actually of type '"+
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000996 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
997 }
998 } else {
999 GenerateError("Illegal label reference " + ID.getName());
1000 return 0;
1001 }
1002
1003 // If its already been defined, return it now.
1004 if (BB) {
1005 ID.destroy(); // Free strdup'd memory.
1006 return BB;
1007 }
1008
1009 // Otherwise, this block has not been seen before, create it.
1010 std::string Name;
1011 if (ID.Type == ValID::LocalName)
1012 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +00001013 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001014
1015 // Insert it in the forward refs map.
1016 CurFun.BBForwardRefs[ID] = BB;
1017
1018 return BB;
1019}
1020
1021
1022//===----------------------------------------------------------------------===//
1023// Code to handle forward references in instructions
1024//===----------------------------------------------------------------------===//
1025//
1026// This code handles the late binding needed with statements that reference
1027// values not defined yet... for example, a forward branch, or the PHI node for
1028// a loop body.
1029//
1030// This keeps a table (CurFun.LateResolveValues) of all such forward references
1031// and back patchs after we are done.
1032//
1033
1034// ResolveDefinitions - If we could not resolve some defs at parsing
1035// time (forward branches, phi functions for loops, etc...) resolve the
1036// defs now...
1037//
Eric Christopher329d2672008-09-24 04:55:49 +00001038static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001039ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1040 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1041 while (!LateResolvers.empty()) {
1042 Value *V = LateResolvers.back();
1043 LateResolvers.pop_back();
1044
1045 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1046 CurModule.PlaceHolderInfo.find(V);
1047 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1048
1049 ValID &DID = PHI->second.first;
1050
1051 Value *TheRealValue = getExistingVal(V->getType(), DID);
1052 if (TriggerError)
1053 return;
1054 if (TheRealValue) {
1055 V->replaceAllUsesWith(TheRealValue);
1056 delete V;
1057 CurModule.PlaceHolderInfo.erase(PHI);
1058 } else if (FutureLateResolvers) {
1059 // Functions have their unresolved items forwarded to the module late
1060 // resolver table
1061 InsertValue(V, *FutureLateResolvers);
1062 } else {
1063 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1064 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1065 "' of type '" + V->getType()->getDescription() + "'",
1066 PHI->second.second);
1067 return;
1068 } else {
1069 GenerateError("Reference to an invalid definition: #" +
1070 itostr(DID.Num) + " of type '" +
1071 V->getType()->getDescription() + "'",
1072 PHI->second.second);
1073 return;
1074 }
1075 }
1076 }
1077 LateResolvers.clear();
1078}
1079
1080// ResolveTypeTo - A brand new type was just declared. This means that (if
1081// name is not null) things referencing Name can be resolved. Otherwise, things
1082// refering to the number can be resolved. Do this now.
1083//
1084static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1085 ValID D;
1086 if (Name)
1087 D = ValID::createLocalName(*Name);
Eric Christopher329d2672008-09-24 04:55:49 +00001088 else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001089 D = ValID::createLocalID(CurModule.Types.size());
1090
1091 std::map<ValID, PATypeHolder>::iterator I =
1092 CurModule.LateResolveTypes.find(D);
1093 if (I != CurModule.LateResolveTypes.end()) {
1094 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1095 CurModule.LateResolveTypes.erase(I);
1096 }
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001097 D.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001098}
1099
1100// setValueName - Set the specified value to the name given. The name may be
1101// null potentially, in which case this is a noop. The string passed in is
1102// assumed to be a malloc'd string buffer, and is free'd by this function.
1103//
1104static void setValueName(Value *V, std::string *NameStr) {
1105 if (!NameStr) return;
1106 std::string Name(*NameStr); // Copy string
1107 delete NameStr; // Free old string
1108
1109 if (V->getType() == Type::VoidTy) {
1110 GenerateError("Can't assign name '" + Name+"' to value with void type");
1111 return;
1112 }
1113
1114 assert(inFunctionScope() && "Must be in function scope!");
1115 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1116 if (ST.lookup(Name)) {
1117 GenerateError("Redefinition of value '" + Name + "' of type '" +
1118 V->getType()->getDescription() + "'");
1119 return;
1120 }
1121
1122 // Set the name.
1123 V->setName(Name);
1124}
1125
1126/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1127/// this is a declaration, otherwise it is a definition.
1128static GlobalVariable *
1129ParseGlobalVariable(std::string *NameStr,
1130 GlobalValue::LinkageTypes Linkage,
1131 GlobalValue::VisibilityTypes Visibility,
1132 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001133 Constant *Initializer, bool IsThreadLocal,
1134 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001135 if (isa<FunctionType>(Ty)) {
1136 GenerateError("Cannot declare global vars of function type");
1137 return 0;
1138 }
Dan Gohmane5febe42008-05-31 00:58:22 +00001139 if (Ty == Type::LabelTy) {
1140 GenerateError("Cannot declare global vars of label type");
1141 return 0;
1142 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001143
Christopher Lamb0a243582007-12-11 09:02:08 +00001144 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001145
1146 std::string Name;
1147 if (NameStr) {
1148 Name = *NameStr; // Copy string
1149 delete NameStr; // Free old string
1150 }
1151
1152 // See if this global value was forward referenced. If so, recycle the
1153 // object.
1154 ValID ID;
1155 if (!Name.empty()) {
1156 ID = ValID::createGlobalName(Name);
1157 } else {
1158 ID = ValID::createGlobalID(CurModule.Values.size());
1159 }
1160
1161 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1162 // Move the global to the end of the list, from whereever it was
1163 // previously inserted.
1164 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1165 CurModule.CurrentModule->getGlobalList().remove(GV);
1166 CurModule.CurrentModule->getGlobalList().push_back(GV);
1167 GV->setInitializer(Initializer);
1168 GV->setLinkage(Linkage);
1169 GV->setVisibility(Visibility);
1170 GV->setConstant(isConstantGlobal);
1171 GV->setThreadLocal(IsThreadLocal);
1172 InsertValue(GV, CurModule.Values);
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001173 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001174 return GV;
1175 }
1176
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001177 ID.destroy();
1178
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001179 // If this global has a name
1180 if (!Name.empty()) {
1181 // if the global we're parsing has an initializer (is a definition) and
1182 // has external linkage.
1183 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1184 // If there is already a global with external linkage with this name
1185 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1186 // If we allow this GVar to get created, it will be renamed in the
1187 // symbol table because it conflicts with an existing GVar. We can't
1188 // allow redefinition of GVars whose linking indicates that their name
1189 // must stay the same. Issue the error.
1190 GenerateError("Redefinition of global variable named '" + Name +
1191 "' of type '" + Ty->getDescription() + "'");
1192 return 0;
1193 }
1194 }
1195
1196 // Otherwise there is no existing GV to use, create one now.
1197 GlobalVariable *GV =
1198 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001199 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001200 GV->setVisibility(Visibility);
1201 InsertValue(GV, CurModule.Values);
1202 return GV;
1203}
1204
1205// setTypeName - Set the specified type to the name given. The name may be
1206// null potentially, in which case this is a noop. The string passed in is
1207// assumed to be a malloc'd string buffer, and is freed by this function.
1208//
1209// This function returns true if the type has already been defined, but is
1210// allowed to be redefined in the specified context. If the name is a new name
1211// for the type plane, it is inserted and false is returned.
1212static bool setTypeName(const Type *T, std::string *NameStr) {
1213 assert(!inFunctionScope() && "Can't give types function-local names!");
1214 if (NameStr == 0) return false;
Eric Christopher329d2672008-09-24 04:55:49 +00001215
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001216 std::string Name(*NameStr); // Copy string
1217 delete NameStr; // Free old string
1218
1219 // We don't allow assigning names to void type
1220 if (T == Type::VoidTy) {
1221 GenerateError("Can't assign name '" + Name + "' to the void type");
1222 return false;
1223 }
1224
1225 // Set the type name, checking for conflicts as we do so.
1226 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1227
1228 if (AlreadyExists) { // Inserting a name that is already defined???
1229 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1230 assert(Existing && "Conflict but no matching type?!");
1231
1232 // There is only one case where this is allowed: when we are refining an
1233 // opaque type. In this case, Existing will be an opaque type.
1234 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1235 // We ARE replacing an opaque type!
1236 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1237 return true;
1238 }
1239
1240 // Otherwise, this is an attempt to redefine a type. That's okay if
1241 // the redefinition is identical to the original. This will be so if
1242 // Existing and T point to the same Type object. In this one case we
1243 // allow the equivalent redefinition.
1244 if (Existing == T) return true; // Yes, it's equal.
1245
1246 // Any other kind of (non-equivalent) redefinition is an error.
1247 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1248 T->getDescription() + "'");
1249 }
1250
1251 return false;
1252}
1253
1254//===----------------------------------------------------------------------===//
1255// Code for handling upreferences in type names...
1256//
1257
1258// TypeContains - Returns true if Ty directly contains E in it.
1259//
1260static bool TypeContains(const Type *Ty, const Type *E) {
1261 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1262 E) != Ty->subtype_end();
1263}
1264
1265namespace {
1266 struct UpRefRecord {
1267 // NestingLevel - The number of nesting levels that need to be popped before
1268 // this type is resolved.
1269 unsigned NestingLevel;
1270
1271 // LastContainedTy - This is the type at the current binding level for the
1272 // type. Every time we reduce the nesting level, this gets updated.
1273 const Type *LastContainedTy;
1274
1275 // UpRefTy - This is the actual opaque type that the upreference is
1276 // represented with.
1277 OpaqueType *UpRefTy;
1278
1279 UpRefRecord(unsigned NL, OpaqueType *URTy)
1280 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1281 };
1282}
1283
1284// UpRefs - A list of the outstanding upreferences that need to be resolved.
1285static std::vector<UpRefRecord> UpRefs;
1286
1287/// HandleUpRefs - Every time we finish a new layer of types, this function is
1288/// called. It loops through the UpRefs vector, which is a list of the
1289/// currently active types. For each type, if the up reference is contained in
1290/// the newly completed type, we decrement the level count. When the level
1291/// count reaches zero, the upreferenced type is the type that is passed in:
1292/// thus we can complete the cycle.
1293///
1294static PATypeHolder HandleUpRefs(const Type *ty) {
1295 // If Ty isn't abstract, or if there are no up-references in it, then there is
1296 // nothing to resolve here.
1297 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher329d2672008-09-24 04:55:49 +00001298
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001299 PATypeHolder Ty(ty);
1300 UR_OUT("Type '" << Ty->getDescription() <<
1301 "' newly formed. Resolving upreferences.\n" <<
1302 UpRefs.size() << " upreferences active!\n");
1303
1304 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1305 // to zero), we resolve them all together before we resolve them to Ty. At
1306 // the end of the loop, if there is anything to resolve to Ty, it will be in
1307 // this variable.
1308 OpaqueType *TypeToResolve = 0;
1309
1310 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1311 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1312 << UpRefs[i].second->getDescription() << ") = "
1313 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1314 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1315 // Decrement level of upreference
1316 unsigned Level = --UpRefs[i].NestingLevel;
1317 UpRefs[i].LastContainedTy = Ty;
1318 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1319 if (Level == 0) { // Upreference should be resolved!
1320 if (!TypeToResolve) {
1321 TypeToResolve = UpRefs[i].UpRefTy;
1322 } else {
1323 UR_OUT(" * Resolving upreference for "
1324 << UpRefs[i].second->getDescription() << "\n";
1325 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1326 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1327 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1328 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1329 }
1330 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1331 --i; // Do not skip the next element...
1332 }
1333 }
1334 }
1335
1336 if (TypeToResolve) {
1337 UR_OUT(" * Resolving upreference for "
1338 << UpRefs[i].second->getDescription() << "\n";
1339 std::string OldName = TypeToResolve->getDescription());
1340 TypeToResolve->refineAbstractTypeTo(Ty);
1341 }
1342
1343 return Ty;
1344}
1345
1346//===----------------------------------------------------------------------===//
1347// RunVMAsmParser - Define an interface to this parser
1348//===----------------------------------------------------------------------===//
1349//
1350static Module* RunParser(Module * M);
1351
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001352Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1353 InitLLLexer(MB);
1354 Module *M = RunParser(new Module(LLLgetFilename()));
1355 FreeLexer();
1356 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001357}
1358
1359
Dan Gohman54392c12008-04-19 00:24:39 +00001360
1361/* Enabling traces. */
1362#ifndef YYDEBUG
1363# define YYDEBUG 0
1364#endif
1365
1366/* Enabling verbose error messages. */
1367#ifdef YYERROR_VERBOSE
1368# undef YYERROR_VERBOSE
1369# define YYERROR_VERBOSE 1
1370#else
1371# define YYERROR_VERBOSE 0
1372#endif
1373
1374/* Enabling the token table. */
1375#ifndef YYTOKEN_TABLE
1376# define YYTOKEN_TABLE 0
1377#endif
1378
1379#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1380typedef union YYSTYPE
Chris Lattner8f5544c2008-10-15 06:03:48 +00001381#line 977 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001382{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001383 llvm::Module *ModuleVal;
1384 llvm::Function *FunctionVal;
1385 llvm::BasicBlock *BasicBlockVal;
1386 llvm::TerminatorInst *TermInstVal;
1387 llvm::Instruction *InstVal;
1388 llvm::Constant *ConstVal;
1389
1390 const llvm::Type *PrimType;
1391 std::list<llvm::PATypeHolder> *TypeList;
1392 llvm::PATypeHolder *TypeVal;
1393 llvm::Value *ValueVal;
1394 std::vector<llvm::Value*> *ValueList;
Dan Gohmane5febe42008-05-31 00:58:22 +00001395 std::vector<unsigned> *ConstantList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001396 llvm::ArgListType *ArgList;
1397 llvm::TypeWithAttrs TypeWithAttrs;
1398 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001399 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001400
1401 // Represent the RHS of PHI node
1402 std::list<std::pair<llvm::Value*,
1403 llvm::BasicBlock*> > *PHIList;
1404 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1405 std::vector<llvm::Constant*> *ConstVector;
1406
1407 llvm::GlobalValue::LinkageTypes Linkage;
1408 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Pateld222f862008-09-25 21:00:45 +00001409 llvm::Attributes Attributes;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001410 llvm::APInt *APIntVal;
1411 int64_t SInt64Val;
1412 uint64_t UInt64Val;
1413 int SIntVal;
1414 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001415 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001416 bool BoolVal;
1417
1418 std::string *StrVal; // This memory must be deleted
1419 llvm::ValID ValIDVal;
1420
1421 llvm::Instruction::BinaryOps BinaryOpVal;
1422 llvm::Instruction::TermOps TermOpVal;
1423 llvm::Instruction::MemoryOps MemOpVal;
1424 llvm::Instruction::CastOps CastOpVal;
1425 llvm::Instruction::OtherOps OtherOpVal;
1426 llvm::ICmpInst::Predicate IPredicate;
1427 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001428}
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00001429/* Line 193 of yacc.c. */
Dale Johannesen5ba85fd2008-10-09 23:01:34 +00001430#line 1431 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001431 YYSTYPE;
1432# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1433# define YYSTYPE_IS_DECLARED 1
1434# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001435#endif
1436
1437
1438
Dan Gohman54392c12008-04-19 00:24:39 +00001439/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001440
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001441
Dan Gohman54392c12008-04-19 00:24:39 +00001442/* Line 216 of yacc.c. */
Dale Johannesen5ba85fd2008-10-09 23:01:34 +00001443#line 1444 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001444
Dan Gohman54392c12008-04-19 00:24:39 +00001445#ifdef short
1446# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001447#endif
1448
Dan Gohman54392c12008-04-19 00:24:39 +00001449#ifdef YYTYPE_UINT8
1450typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001451#else
Dan Gohman54392c12008-04-19 00:24:39 +00001452typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001453#endif
1454
Dan Gohman54392c12008-04-19 00:24:39 +00001455#ifdef YYTYPE_INT8
1456typedef YYTYPE_INT8 yytype_int8;
1457#elif (defined __STDC__ || defined __C99__FUNC__ \
1458 || defined __cplusplus || defined _MSC_VER)
1459typedef signed char yytype_int8;
1460#else
1461typedef short int yytype_int8;
1462#endif
1463
1464#ifdef YYTYPE_UINT16
1465typedef YYTYPE_UINT16 yytype_uint16;
1466#else
1467typedef unsigned short int yytype_uint16;
1468#endif
1469
1470#ifdef YYTYPE_INT16
1471typedef YYTYPE_INT16 yytype_int16;
1472#else
1473typedef short int yytype_int16;
1474#endif
1475
1476#ifndef YYSIZE_T
1477# ifdef __SIZE_TYPE__
1478# define YYSIZE_T __SIZE_TYPE__
1479# elif defined size_t
1480# define YYSIZE_T size_t
1481# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1482 || defined __cplusplus || defined _MSC_VER)
1483# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1484# define YYSIZE_T size_t
1485# else
1486# define YYSIZE_T unsigned int
1487# endif
1488#endif
1489
1490#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1491
1492#ifndef YY_
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00001493# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohman54392c12008-04-19 00:24:39 +00001494# if ENABLE_NLS
1495# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1496# define YY_(msgid) dgettext ("bison-runtime", msgid)
1497# endif
1498# endif
1499# ifndef YY_
1500# define YY_(msgid) msgid
1501# endif
1502#endif
1503
1504/* Suppress unused-variable warnings by "using" E. */
1505#if ! defined lint || defined __GNUC__
1506# define YYUSE(e) ((void) (e))
1507#else
1508# define YYUSE(e) /* empty */
1509#endif
1510
1511/* Identity function, used to suppress warnings about constant conditions. */
1512#ifndef lint
1513# define YYID(n) (n)
1514#else
1515#if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1517static int
1518YYID (int i)
1519#else
1520static int
1521YYID (i)
1522 int i;
1523#endif
1524{
1525 return i;
1526}
1527#endif
1528
1529#if ! defined yyoverflow || YYERROR_VERBOSE
1530
1531/* The parser invokes alloca or malloc; define the necessary symbols. */
1532
1533# ifdef YYSTACK_USE_ALLOCA
1534# if YYSTACK_USE_ALLOCA
1535# ifdef __GNUC__
1536# define YYSTACK_ALLOC __builtin_alloca
1537# elif defined __BUILTIN_VA_ARG_INCR
1538# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1539# elif defined _AIX
1540# define YYSTACK_ALLOC __alloca
1541# elif defined _MSC_VER
1542# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1543# define alloca _alloca
1544# else
1545# define YYSTACK_ALLOC alloca
1546# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1547 || defined __cplusplus || defined _MSC_VER)
1548# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1549# ifndef _STDLIB_H
1550# define _STDLIB_H 1
1551# endif
1552# endif
1553# endif
1554# endif
1555# endif
1556
1557# ifdef YYSTACK_ALLOC
1558 /* Pacify GCC's `empty if-body' warning. */
1559# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1560# ifndef YYSTACK_ALLOC_MAXIMUM
1561 /* The OS might guarantee only one guard page at the bottom of the stack,
1562 and a page size can be as small as 4096 bytes. So we cannot safely
1563 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1564 to allow for a few compiler-allocated temporary stack slots. */
1565# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1566# endif
1567# else
1568# define YYSTACK_ALLOC YYMALLOC
1569# define YYSTACK_FREE YYFREE
1570# ifndef YYSTACK_ALLOC_MAXIMUM
1571# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1572# endif
1573# if (defined __cplusplus && ! defined _STDLIB_H \
1574 && ! ((defined YYMALLOC || defined malloc) \
1575 && (defined YYFREE || defined free)))
1576# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1577# ifndef _STDLIB_H
1578# define _STDLIB_H 1
1579# endif
1580# endif
1581# ifndef YYMALLOC
1582# define YYMALLOC malloc
1583# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1586# endif
1587# endif
1588# ifndef YYFREE
1589# define YYFREE free
1590# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1591 || defined __cplusplus || defined _MSC_VER)
1592void free (void *); /* INFRINGES ON USER NAME SPACE */
1593# endif
1594# endif
1595# endif
1596#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1597
1598
1599#if (! defined yyoverflow \
1600 && (! defined __cplusplus \
1601 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1602
1603/* A type that is properly aligned for any stack member. */
1604union yyalloc
1605{
1606 yytype_int16 yyss;
1607 YYSTYPE yyvs;
1608 };
1609
1610/* The size of the maximum gap between one aligned stack and the next. */
1611# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1612
1613/* The size of an array large to enough to hold all stacks, each with
1614 N elements. */
1615# define YYSTACK_BYTES(N) \
1616 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1617 + YYSTACK_GAP_MAXIMUM)
1618
1619/* Copy COUNT objects from FROM to TO. The source and destination do
1620 not overlap. */
1621# ifndef YYCOPY
1622# if defined __GNUC__ && 1 < __GNUC__
1623# define YYCOPY(To, From, Count) \
1624 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1625# else
1626# define YYCOPY(To, From, Count) \
1627 do \
1628 { \
1629 YYSIZE_T yyi; \
1630 for (yyi = 0; yyi < (Count); yyi++) \
1631 (To)[yyi] = (From)[yyi]; \
1632 } \
1633 while (YYID (0))
1634# endif
1635# endif
1636
1637/* Relocate STACK from its old location to the new one. The
1638 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1639 elements in the stack, and YYPTR gives the new location of the
1640 stack. Advance YYPTR to a properly aligned location for the next
1641 stack. */
1642# define YYSTACK_RELOCATE(Stack) \
1643 do \
1644 { \
1645 YYSIZE_T yynewbytes; \
1646 YYCOPY (&yyptr->Stack, Stack, yysize); \
1647 Stack = &yyptr->Stack; \
1648 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1649 yyptr += yynewbytes / sizeof (*yyptr); \
1650 } \
1651 while (YYID (0))
1652
1653#endif
1654
1655/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001656#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001657/* YYLAST -- Last index in YYTABLE. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00001658#define YYLAST 2334
Dan Gohman54392c12008-04-19 00:24:39 +00001659
1660/* YYNTOKENS -- Number of terminals. */
Devang Patelcd842482008-09-29 20:49:50 +00001661#define YYNTOKENS 173
Dan Gohman54392c12008-04-19 00:24:39 +00001662/* YYNNTS -- Number of nonterminals. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00001663#define YYNNTS 88
Dan Gohman54392c12008-04-19 00:24:39 +00001664/* YYNRULES -- Number of rules. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00001665#define YYNRULES 353
Dan Gohman54392c12008-04-19 00:24:39 +00001666/* YYNRULES -- Number of states. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00001667#define YYNSTATES 715
Dan Gohman54392c12008-04-19 00:24:39 +00001668
1669/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1670#define YYUNDEFTOK 2
Devang Patelcd842482008-09-29 20:49:50 +00001671#define YYMAXUTOK 413
Dan Gohman54392c12008-04-19 00:24:39 +00001672
1673#define YYTRANSLATE(YYX) \
1674 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1675
1676/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1677static const yytype_uint8 yytranslate[] =
1678{
1679 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001683 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001685 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001688 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
Dan Gohman54392c12008-04-19 00:24:39 +00001689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001691 166, 2, 2, 170, 2, 171, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1705 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1706 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1707 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1708 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1709 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1710 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1711 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1712 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1713 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1714 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1715 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1716 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1717 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1718 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001719 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Patelcd842482008-09-29 20:49:50 +00001720 155, 156, 157, 158
Dan Gohman54392c12008-04-19 00:24:39 +00001721};
1722
1723#if YYDEBUG
1724/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1725 YYRHS. */
1726static const yytype_uint16 yyprhs[] =
1727{
1728 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1729 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1730 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1731 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1732 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1733 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001734 119, 121, 123, 125, 127, 128, 133, 134, 137, 138,
1735 141, 143, 145, 147, 148, 151, 153, 155, 157, 159,
1736 161, 163, 165, 167, 169, 170, 172, 174, 176, 177,
1737 179, 181, 182, 184, 186, 188, 190, 191, 193, 195,
1738 196, 198, 200, 202, 204, 206, 209, 211, 213, 215,
1739 217, 219, 221, 223, 225, 227, 230, 231, 234, 236,
1740 238, 240, 241, 244, 246, 248, 250, 252, 254, 256,
1741 258, 260, 262, 264, 265, 268, 269, 272, 273, 276,
1742 277, 281, 284, 285, 287, 288, 292, 294, 297, 299,
1743 301, 303, 305, 307, 309, 311, 313, 315, 319, 321,
1744 324, 330, 336, 342, 348, 352, 355, 361, 366, 369,
1745 371, 373, 375, 379, 381, 385, 387, 388, 390, 394,
1746 399, 403, 407, 412, 417, 421, 428, 434, 437, 440,
1747 443, 446, 449, 452, 455, 458, 461, 464, 467, 470,
1748 477, 483, 492, 499, 506, 514, 522, 530, 538, 545,
1749 554, 563, 569, 577, 581, 583, 585, 587, 589, 590,
1750 593, 600, 602, 603, 605, 608, 609, 613, 614, 618,
1751 622, 626, 630, 631, 640, 641, 651, 652, 662, 668,
1752 671, 675, 677, 681, 685, 689, 693, 695, 696, 702,
1753 706, 708, 712, 714, 715, 727, 729, 731, 736, 738,
1754 740, 743, 747, 748, 750, 752, 754, 756, 758, 760,
1755 762, 764, 766, 768, 770, 774, 778, 781, 784, 788,
1756 791, 797, 802, 804, 810, 812, 814, 816, 818, 820,
1757 822, 825, 827, 831, 834, 837, 841, 845, 848, 849,
1758 851, 854, 857, 861, 871, 881, 890, 906, 908, 910,
1759 917, 923, 926, 929, 936, 944, 949, 954, 961, 968,
1760 969, 970, 974, 977, 981, 984, 986, 992, 998, 1005,
1761 1012, 1019, 1026, 1031, 1038, 1043, 1048, 1055, 1062, 1065,
1762 1075, 1077, 1079, 1080, 1084, 1091, 1095, 1102, 1105, 1111,
1763 1119, 1125, 1130, 1135
Dan Gohman54392c12008-04-19 00:24:39 +00001764};
1765
1766/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1767static const yytype_int16 yyrhs[] =
1768{
Chris Lattner8f5544c2008-10-15 06:03:48 +00001769 221, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenf4581482008-09-26 19:32:34 +00001770 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1771 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1772 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1773 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1774 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1775 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1776 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1777 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1778 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001779 -1, 102, -1, 103, -1, 26, -1, 27, -1, 12,
1780 -1, 13, -1, 16, -1, 15, -1, 14, -1, 19,
1781 -1, 22, -1, 24, -1, 180, -1, -1, 55, 159,
1782 4, 160, -1, -1, 180, 161, -1, -1, 7, 161,
1783 -1, 20, -1, 23, -1, 187, -1, -1, 185, 161,
1784 -1, 42, -1, 44, -1, 43, -1, 45, -1, 47,
1785 -1, 49, -1, 46, -1, 48, -1, 51, -1, -1,
1786 156, -1, 157, -1, 158, -1, -1, 46, -1, 48,
1787 -1, -1, 42, -1, 43, -1, 44, -1, 47, -1,
1788 -1, 44, -1, 42, -1, -1, 63, -1, 64, -1,
1789 65, -1, 66, -1, 67, -1, 62, 4, -1, 142,
1790 -1, 121, -1, 141, -1, 122, -1, 144, -1, 145,
1791 -1, 147, -1, 148, -1, 149, -1, 54, 4, -1,
1792 -1, 196, 195, -1, 144, -1, 142, -1, 141, -1,
1793 -1, 198, 197, -1, 143, -1, 146, -1, 144, -1,
1794 142, -1, 141, -1, 150, -1, 151, -1, 154, -1,
1795 155, -1, 153, -1, -1, 200, 199, -1, -1, 152,
1796 22, -1, -1, 54, 4, -1, -1, 162, 54, 4,
1797 -1, 34, 22, -1, -1, 204, -1, -1, 162, 207,
1798 206, -1, 204, -1, 54, 4, -1, 11, -1, 12,
1799 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
1800 -1, 50, -1, 208, -1, 209, 182, 163, -1, 243,
1801 -1, 164, 4, -1, 209, 159, 213, 160, 200, -1,
1802 10, 159, 213, 160, 200, -1, 165, 4, 166, 209,
1803 167, -1, 168, 4, 166, 209, 169, -1, 170, 214,
1804 171, -1, 170, 171, -1, 168, 170, 214, 171, 169,
1805 -1, 168, 170, 171, 169, -1, 209, 196, -1, 209,
1806 -1, 10, -1, 210, -1, 212, 162, 210, -1, 212,
1807 -1, 212, 162, 39, -1, 39, -1, -1, 209, -1,
1808 214, 162, 209, -1, 209, 165, 217, 167, -1, 209,
1809 165, 167, -1, 209, 172, 22, -1, 209, 168, 217,
1810 169, -1, 209, 170, 217, 171, -1, 209, 170, 171,
1811 -1, 209, 168, 170, 217, 171, 169, -1, 209, 168,
1812 170, 171, 169, -1, 209, 40, -1, 209, 41, -1,
1813 209, 243, -1, 209, 216, -1, 209, 25, -1, 11,
1814 3, -1, 11, 5, -1, 11, 4, -1, 11, 6,
1815 -1, 11, 26, -1, 11, 27, -1, 179, 9, -1,
1816 176, 159, 215, 38, 209, 160, -1, 119, 159, 215,
1817 255, 160, -1, 133, 159, 215, 162, 215, 162, 215,
1818 160, -1, 174, 159, 215, 162, 215, 160, -1, 175,
1819 159, 215, 162, 215, 160, -1, 90, 177, 159, 215,
1820 162, 215, 160, -1, 91, 178, 159, 215, 162, 215,
1821 160, -1, 92, 177, 159, 215, 162, 215, 160, -1,
1822 93, 178, 159, 215, 162, 215, 160, -1, 135, 159,
1823 215, 162, 215, 160, -1, 136, 159, 215, 162, 215,
1824 162, 215, 160, -1, 137, 159, 215, 162, 215, 162,
1825 215, 160, -1, 139, 159, 215, 256, 160, -1, 140,
1826 159, 215, 162, 215, 256, 160, -1, 217, 162, 215,
1827 -1, 215, -1, 32, -1, 33, -1, 37, -1, -1,
1828 211, 243, -1, 125, 159, 220, 38, 209, 160, -1,
1829 222, -1, -1, 223, -1, 222, 223, -1, -1, 31,
1830 224, 239, -1, -1, 30, 225, 240, -1, 60, 59,
1831 229, -1, 183, 18, 209, -1, 183, 18, 10, -1,
1832 -1, 186, 190, 219, 218, 215, 182, 226, 206, -1,
1833 -1, 186, 188, 190, 219, 218, 215, 182, 227, 206,
1834 -1, -1, 186, 189, 190, 219, 218, 209, 182, 228,
1835 206, -1, 186, 190, 35, 193, 220, -1, 52, 230,
1836 -1, 56, 161, 231, -1, 22, -1, 53, 161, 22,
1837 -1, 68, 161, 22, -1, 165, 232, 167, -1, 232,
1838 162, 22, -1, 22, -1, -1, 233, 162, 209, 196,
1839 181, -1, 209, 196, 181, -1, 233, -1, 233, 162,
1840 39, -1, 39, -1, -1, 194, 198, 211, 185, 159,
1841 234, 160, 200, 205, 202, 201, -1, 28, -1, 170,
1842 -1, 192, 190, 235, 236, -1, 29, -1, 171, -1,
1843 247, 238, -1, 191, 190, 235, -1, -1, 61, -1,
1844 3, -1, 4, -1, 5, -1, 6, -1, 9, -1,
1845 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
1846 168, 217, 169, -1, 165, 217, 167, -1, 165, 167,
1847 -1, 172, 22, -1, 170, 217, 171, -1, 170, 171,
1848 -1, 168, 170, 217, 171, 169, -1, 168, 170, 171,
1849 169, -1, 216, -1, 59, 241, 22, 162, 22, -1,
1850 7, -1, 8, -1, 180, -1, 185, -1, 243, -1,
1851 242, -1, 209, 244, -1, 245, -1, 246, 162, 245,
1852 -1, 247, 248, -1, 237, 248, -1, 249, 183, 250,
1853 -1, 249, 184, 250, -1, 249, 252, -1, -1, 21,
1854 -1, 69, 246, -1, 69, 10, -1, 70, 17, 244,
1855 -1, 70, 11, 244, 162, 17, 244, 162, 17, 244,
1856 -1, 71, 11, 244, 162, 17, 244, 165, 251, 167,
1857 -1, 71, 11, 244, 162, 17, 244, 165, 167, -1,
1858 72, 194, 198, 211, 244, 159, 254, 160, 200, 38,
1859 17, 244, 73, 17, 244, -1, 73, -1, 74, -1,
1860 251, 11, 242, 162, 17, 244, -1, 11, 242, 162,
1861 17, 244, -1, 183, 258, -1, 184, 258, -1, 209,
1862 165, 244, 162, 244, 167, -1, 253, 162, 165, 244,
1863 162, 244, 167, -1, 209, 196, 244, 196, -1, 17,
1864 196, 244, 196, -1, 254, 162, 209, 196, 244, 196,
1865 -1, 254, 162, 17, 196, 244, 196, -1, -1, -1,
1866 255, 162, 245, -1, 162, 4, -1, 256, 162, 4,
1867 -1, 58, 57, -1, 57, -1, 174, 209, 244, 162,
1868 244, -1, 175, 209, 244, 162, 244, -1, 90, 177,
1869 209, 244, 162, 244, -1, 91, 178, 209, 244, 162,
1870 244, -1, 92, 177, 209, 244, 162, 244, -1, 93,
1871 178, 209, 244, 162, 244, -1, 176, 245, 38, 209,
1872 -1, 133, 245, 162, 245, 162, 245, -1, 134, 245,
1873 162, 209, -1, 135, 245, 162, 245, -1, 136, 245,
1874 162, 245, 162, 245, -1, 137, 245, 162, 245, 162,
1875 245, -1, 132, 253, -1, 257, 194, 198, 211, 244,
1876 159, 254, 160, 200, -1, 260, -1, 36, -1, -1,
1877 114, 209, 203, -1, 114, 209, 162, 11, 244, 203,
1878 -1, 115, 209, 203, -1, 115, 209, 162, 11, 244,
1879 203, -1, 116, 245, -1, 259, 117, 209, 244, 203,
1880 -1, 259, 118, 245, 162, 209, 244, 203, -1, 138,
1881 209, 244, 162, 4, -1, 119, 209, 244, 255, -1,
1882 139, 209, 244, 256, -1, 140, 209, 244, 162, 209,
1883 244, 256, -1
Dan Gohman54392c12008-04-19 00:24:39 +00001884};
1885
1886/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1887static const yytype_uint16 yyrline[] =
1888{
Dale Johannesen5ba85fd2008-10-09 23:01:34 +00001889 0, 1143, 1143, 1143, 1143, 1143, 1143, 1143, 1143, 1143,
1890 1143, 1144, 1144, 1144, 1144, 1144, 1144, 1145, 1145, 1145,
1891 1145, 1145, 1145, 1146, 1146, 1146, 1146, 1146, 1146, 1149,
1892 1149, 1150, 1150, 1151, 1151, 1152, 1152, 1153, 1153, 1157,
1893 1157, 1158, 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001894 1162, 1163, 1163, 1164, 1165, 1170, 1170, 1170, 1170, 1170,
1895 1172, 1172, 1172, 1173, 1173, 1175, 1176, 1180, 1184, 1189,
1896 1195, 1195, 1197, 1198, 1203, 1209, 1210, 1211, 1212, 1213,
1897 1214, 1218, 1219, 1220, 1224, 1225, 1226, 1227, 1231, 1232,
1898 1233, 1237, 1238, 1239, 1240, 1241, 1245, 1246, 1247, 1250,
1899 1251, 1252, 1253, 1254, 1255, 1256, 1263, 1264, 1265, 1266,
1900 1267, 1268, 1269, 1270, 1271, 1272, 1276, 1277, 1282, 1283,
1901 1284, 1287, 1288, 1294, 1295, 1296, 1297, 1298, 1299, 1300,
1902 1301, 1302, 1303, 1306, 1307, 1313, 1314, 1321, 1322, 1328,
1903 1329, 1338, 1346, 1347, 1352, 1353, 1354, 1359, 1372, 1372,
1904 1372, 1372, 1372, 1372, 1372, 1375, 1379, 1383, 1390, 1395,
1905 1403, 1438, 1469, 1474, 1484, 1494, 1498, 1508, 1515, 1524,
1906 1531, 1536, 1541, 1548, 1549, 1556, 1563, 1571, 1577, 1589,
1907 1617, 1633, 1660, 1688, 1714, 1734, 1760, 1780, 1792, 1799,
1908 1865, 1875, 1885, 1891, 1901, 1907, 1917, 1923, 1929, 1945,
1909 1957, 1978, 1986, 1992, 2003, 2008, 2013, 2018, 2023, 2029,
1910 2035, 2041, 2049, 2060, 2064, 2072, 2072, 2075, 2075, 2078,
1911 2090, 2111, 2116, 2124, 2125, 2129, 2129, 2133, 2133, 2136,
1912 2139, 2163, 2175, 2174, 2186, 2185, 2195, 2194, 2205, 2245,
1913 2248, 2254, 2264, 2268, 2273, 2275, 2280, 2285, 2294, 2304,
1914 2315, 2319, 2328, 2337, 2342, 2491, 2491, 2493, 2502, 2502,
1915 2504, 2509, 2521, 2525, 2530, 2534, 2538, 2543, 2548, 2552,
1916 2556, 2560, 2564, 2568, 2572, 2594, 2616, 2622, 2635, 2647,
1917 2652, 2664, 2670, 2674, 2684, 2688, 2692, 2697, 2704, 2704,
1918 2710, 2719, 2724, 2729, 2733, 2742, 2751, 2764, 2773, 2777,
1919 2785, 2805, 2809, 2814, 2825, 2844, 2853, 2957, 2961, 2968,
1920 2979, 2992, 3001, 3014, 3025, 3035, 3046, 3054, 3064, 3071,
1921 3074, 3075, 3083, 3089, 3098, 3102, 3107, 3123, 3140, 3152,
1922 3164, 3178, 3192, 3204, 3225, 3232, 3238, 3244, 3250, 3265,
1923 3375, 3380, 3384, 3391, 3398, 3408, 3415, 3425, 3433, 3447,
1924 3464, 3478, 3493, 3508
Dan Gohman54392c12008-04-19 00:24:39 +00001925};
1926#endif
1927
1928#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1929/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1930 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1931static const char *const yytname[] =
1932{
1933 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1934 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1935 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1936 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1937 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1938 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1939 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1940 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001941 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001942 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1943 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1944 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesenf4581482008-09-26 19:32:34 +00001945 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1946 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1947 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1948 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1949 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1950 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1951 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1952 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1953 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1954 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1955 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patelcd842482008-09-29 20:49:50 +00001956 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1957 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1958 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1959 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
Chris Lattner8f5544c2008-10-15 06:03:48 +00001960 "FPredicates", "FPType", "LocalName", "OptLocalName", "OptAddrSpace",
1961 "OptLocalAssign", "LocalNumber", "GlobalName", "OptGlobalAssign",
1962 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1963 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1964 "AliasLinkage", "OptCallingConv", "Attribute", "OptAttributes",
1965 "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs", "OptGC",
1966 "OptAlign", "OptCAlign", "SectionString", "OptSection",
Devang Patelcd842482008-09-29 20:49:50 +00001967 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1968 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1969 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1970 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1971 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1972 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1973 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1974 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1975 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1976 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1977 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner906773a2008-08-29 17:20:18 +00001978 "OptVolatile", "MemoryInst", 0
Dan Gohman54392c12008-04-19 00:24:39 +00001979};
1980#endif
1981
1982# ifdef YYPRINT
1983/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1984 token YYLEX-NUM. */
1985static const yytype_uint16 yytoknum[] =
1986{
1987 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1988 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1989 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1990 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1991 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1992 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1993 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1994 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1995 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1996 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1997 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1998 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1999 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2000 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2001 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patelcd842482008-09-29 20:49:50 +00002002 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
2003 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
2004 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00002005};
2006# endif
2007
2008/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002009static const yytype_uint16 yyr1[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002010{
Devang Patelcd842482008-09-29 20:49:50 +00002011 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2012 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2013 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2014 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2015 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002016 178, 178, 178, 178, 178, 179, 179, 179, 179, 179,
2017 180, 180, 180, 181, 181, 182, 182, 183, 183, 184,
2018 185, 185, 186, 186, 187, 188, 188, 188, 188, 188,
2019 188, 189, 189, 189, 190, 190, 190, 190, 191, 191,
2020 191, 192, 192, 192, 192, 192, 193, 193, 193, 194,
2021 194, 194, 194, 194, 194, 194, 195, 195, 195, 195,
2022 195, 195, 195, 195, 195, 195, 196, 196, 197, 197,
2023 197, 198, 198, 199, 199, 199, 199, 199, 199, 199,
2024 199, 199, 199, 200, 200, 201, 201, 202, 202, 203,
2025 203, 204, 205, 205, 206, 206, 207, 207, 208, 208,
2026 208, 208, 208, 208, 208, 209, 209, 209, 209, 209,
2027 209, 209, 209, 209, 209, 209, 209, 209, 210, 211,
2028 211, 212, 212, 213, 213, 213, 213, 214, 214, 215,
2029 215, 215, 215, 215, 215, 215, 215, 215, 215, 215,
2030 215, 215, 215, 215, 215, 215, 215, 215, 215, 216,
Devang Patelcd842482008-09-29 20:49:50 +00002031 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002032 216, 216, 216, 217, 217, 218, 218, 219, 219, 220,
2033 220, 221, 221, 222, 222, 224, 223, 225, 223, 223,
2034 223, 223, 226, 223, 227, 223, 228, 223, 223, 223,
2035 223, 229, 230, 230, 231, 232, 232, 232, 233, 233,
2036 234, 234, 234, 234, 235, 236, 236, 237, 238, 238,
2037 239, 240, 241, 241, 242, 242, 242, 242, 242, 242,
2038 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
2039 242, 242, 242, 242, 243, 243, 243, 243, 244, 244,
2040 245, 246, 246, 247, 247, 248, 248, 249, 249, 249,
2041 250, 250, 250, 250, 250, 250, 250, 250, 250, 251,
2042 251, 252, 252, 253, 253, 254, 254, 254, 254, 254,
2043 255, 255, 256, 256, 257, 257, 258, 258, 258, 258,
2044 258, 258, 258, 258, 258, 258, 258, 258, 258, 258,
2045 258, 259, 259, 260, 260, 260, 260, 260, 260, 260,
2046 260, 260, 260, 260
Dan Gohman54392c12008-04-19 00:24:39 +00002047};
2048
2049/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2050static const yytype_uint8 yyr2[] =
2051{
2052 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002058 1, 1, 1, 1, 0, 4, 0, 2, 0, 2,
2059 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
2060 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2061 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2062 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2063 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2064 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
2065 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
2066 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
2067 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2068 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2069 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2070 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2071 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2072 5, 8, 6, 6, 7, 7, 7, 7, 6, 8,
2073 8, 5, 7, 3, 1, 1, 1, 1, 0, 2,
2074 6, 1, 0, 1, 2, 0, 3, 0, 3, 3,
2075 3, 3, 0, 8, 0, 9, 0, 9, 5, 2,
2076 3, 1, 3, 3, 3, 3, 1, 0, 5, 3,
2077 1, 3, 1, 0, 11, 1, 1, 4, 1, 1,
2078 2, 3, 0, 1, 1, 1, 1, 1, 1, 1,
2079 1, 1, 1, 1, 3, 3, 2, 2, 3, 2,
2080 5, 4, 1, 5, 1, 1, 1, 1, 1, 1,
2081 2, 1, 3, 2, 2, 3, 3, 2, 0, 1,
2082 2, 2, 3, 9, 9, 8, 15, 1, 1, 6,
2083 5, 2, 2, 6, 7, 4, 4, 6, 6, 0,
2084 0, 3, 2, 3, 2, 1, 5, 5, 6, 6,
2085 6, 6, 4, 6, 4, 4, 6, 6, 2, 9,
2086 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
2087 5, 4, 4, 7
Dan Gohman54392c12008-04-19 00:24:39 +00002088};
2089
2090/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2091 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2092 means the default is an error. */
2093static const yytype_uint16 yydefact[] =
2094{
Chris Lattner8f5544c2008-10-15 06:03:48 +00002095 73, 60, 70, 61, 71, 62, 227, 225, 0, 0,
2096 0, 0, 0, 0, 84, 72, 0, 73, 223, 88,
2097 91, 0, 0, 239, 0, 0, 67, 0, 74, 75,
2098 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
2099 87, 84, 84, 218, 1, 224, 89, 90, 84, 228,
2100 92, 93, 94, 95, 84, 298, 226, 298, 0, 0,
2101 247, 240, 241, 229, 284, 285, 231, 148, 149, 150,
2102 153, 152, 151, 154, 155, 0, 0, 0, 0, 286,
2103 287, 156, 230, 158, 218, 218, 96, 217, 0, 99,
2104 99, 299, 294, 68, 258, 259, 260, 293, 242, 243,
2105 246, 0, 176, 159, 0, 0, 0, 0, 165, 177,
2106 0, 0, 176, 0, 0, 0, 98, 97, 0, 215,
2107 216, 0, 0, 100, 101, 102, 103, 104, 121, 261,
2108 0, 0, 342, 342, 297, 0, 244, 175, 116, 171,
2109 173, 0, 0, 0, 0, 0, 0, 164, 0, 0,
2110 157, 0, 0, 170, 0, 169, 0, 238, 148, 149,
2111 150, 153, 152, 151, 0, 66, 66, 105, 0, 255,
2112 256, 257, 69, 341, 325, 0, 0, 0, 0, 99,
2113 307, 308, 2, 3, 4, 5, 6, 7, 8, 9,
2114 10, 14, 15, 16, 11, 12, 13, 0, 0, 0,
2115 0, 0, 0, 0, 0, 17, 18, 19, 20, 21,
2116 22, 23, 24, 25, 26, 27, 28, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 295,
2118 99, 311, 0, 340, 296, 312, 245, 168, 0, 133,
2119 66, 66, 167, 0, 178, 0, 133, 66, 66, 0,
2120 219, 192, 194, 193, 195, 196, 197, 198, 191, 187,
2121 188, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2122 0, 0, 0, 0, 0, 0, 0, 0, 0, 190,
2123 189, 232, 120, 119, 118, 122, 0, 324, 301, 66,
2124 291, 300, 0, 0, 0, 121, 29, 30, 31, 32,
2125 33, 34, 35, 36, 37, 38, 0, 53, 54, 49,
2126 50, 51, 52, 39, 40, 41, 42, 43, 44, 45,
2127 46, 47, 48, 0, 0, 0, 139, 139, 347, 66,
2128 66, 338, 0, 0, 0, 0, 0, 66, 66, 66,
2129 66, 66, 0, 121, 0, 0, 0, 107, 109, 108,
2130 106, 110, 111, 112, 113, 114, 117, 174, 172, 161,
2131 162, 163, 166, 65, 160, 234, 236, 0, 0, 0,
2132 0, 0, 0, 0, 0, 0, 0, 0, 0, 180,
2133 214, 0, 0, 0, 184, 0, 181, 0, 0, 0,
2134 144, 0, 264, 265, 266, 267, 268, 273, 269, 270,
2135 271, 272, 262, 0, 0, 0, 0, 282, 289, 288,
2136 290, 0, 0, 302, 0, 0, 66, 66, 66, 66,
2137 0, 343, 0, 345, 320, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0, 0, 0, 0, 0, 0, 66,
2139 0, 115, 127, 126, 123, 125, 124, 128, 129, 132,
2140 130, 131, 134, 144, 144, 0, 0, 0, 0, 0,
2141 320, 0, 0, 0, 0, 0, 0, 0, 179, 165,
2142 177, 0, 182, 183, 0, 0, 0, 0, 233, 253,
2143 263, 0, 276, 0, 0, 0, 279, 0, 277, 292,
Nate Begeman646fa482008-05-12 19:01:56 +00002144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002145 351, 0, 0, 0, 334, 335, 0, 0, 0, 0,
2146 352, 0, 0, 0, 332, 0, 139, 0, 235, 237,
2147 66, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 213, 186, 0, 0, 0, 0, 0, 0,
2149 146, 144, 252, 116, 250, 0, 0, 275, 165, 0,
2150 274, 278, 0, 0, 0, 0, 0, 0, 0, 139,
2151 140, 139, 0, 0, 0, 0, 0, 0, 350, 322,
2152 0, 66, 326, 327, 0, 0, 348, 66, 220, 0,
2153 0, 0, 0, 200, 0, 0, 0, 0, 211, 0,
2154 185, 0, 0, 66, 141, 147, 145, 64, 0, 133,
2155 0, 281, 0, 0, 0, 319, 328, 329, 330, 331,
2156 344, 346, 321, 0, 0, 333, 336, 337, 323, 0,
2157 319, 139, 0, 0, 0, 0, 0, 208, 0, 0,
2158 0, 202, 203, 199, 63, 249, 251, 116, 142, 283,
2159 280, 0, 0, 116, 116, 0, 313, 0, 353, 0,
2160 349, 204, 205, 206, 207, 0, 0, 0, 212, 64,
2161 143, 137, 0, 0, 305, 0, 0, 0, 133, 0,
2162 314, 133, 201, 209, 210, 248, 0, 135, 303, 0,
2163 0, 304, 107, 109, 116, 116, 0, 116, 116, 339,
2164 138, 0, 254, 0, 0, 316, 315, 0, 0, 0,
2165 136, 0, 0, 0, 116, 116, 310, 0, 0, 318,
2166 317, 309, 0, 0, 306
Dan Gohman54392c12008-04-19 00:24:39 +00002167};
2168
2169/* YYDEFGOTO[NTERM-NUM]. */
2170static const yytype_int16 yydefgoto[] =
2171{
Chris Lattner8f5544c2008-10-15 06:03:48 +00002172 -1, 276, 277, 278, 306, 323, 164, 79, 635, 113,
2173 12, 133, 80, 14, 15, 41, 42, 43, 48, 54,
2174 118, 128, 356, 237, 285, 168, 452, 359, 692, 677,
2175 421, 540, 661, 478, 541, 81, 165, 139, 156, 140,
2176 141, 110, 380, 407, 381, 121, 88, 157, 16, 17,
2177 18, 20, 19, 390, 453, 454, 63, 23, 61, 101,
2178 544, 545, 129, 171, 55, 96, 56, 49, 481, 408,
2179 83, 410, 290, 291, 57, 92, 93, 229, 665, 134,
2180 331, 645, 500, 510, 230, 231, 232, 233
Dan Gohman54392c12008-04-19 00:24:39 +00002181};
2182
2183/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2184 STATE-NUM. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00002185#define YYPACT_NINF -613
Dan Gohman54392c12008-04-19 00:24:39 +00002186static const yytype_int16 yypact[] =
2187{
Chris Lattner8f5544c2008-10-15 06:03:48 +00002188 715, -613, -613, -613, -613, -613, -613, -613, 3, -86,
2189 32, -39, 107, -22, 138, -613, 203, 859, -613, 142,
2190 191, 55, 64, -613, -20, 189, -613, 1862, -613, -613,
2191 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2192 -613, 52, 52, 213, -613, -613, -613, -613, 52, -613,
2193 -613, -613, -613, -613, 52, 216, -613, -10, 237, 246,
2194 249, -613, -613, -613, -613, -613, 119, -613, -613, -613,
2195 -613, -613, -613, -613, -613, 278, 308, 9, 50, -613,
2196 -613, -613, -30, -613, 285, 285, 209, -613, 14, 165,
2197 165, -613, -613, 200, -613, -613, -613, -613, -613, -613,
2198 -613, -21, 1546, -613, 161, 170, 250, 119, -613, -30,
2199 -121, 180, 1546, 182, 14, 14, -613, -613, 1262, -613,
2200 -613, 1906, 344, -613, -613, -613, -613, -613, -613, -613,
2201 -14, 196, 2194, 2194, -613, 331, -613, -613, -30, -613,
2202 198, 201, 1964, 1964, 193, -118, 1964, -613, 363, 218,
2203 -613, 1906, 1964, 119, 210, -30, 351, -613, 79, 367,
2204 370, 374, 375, 378, 379, 1607, 335, -613, 1221, -613,
2205 -613, -613, -613, -613, -613, 336, 2027, 102, 381, 165,
2206 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2207 -613, -613, -613, -613, -613, -613, -613, 431, 598, 431,
2208 598, 1964, 1964, 1964, 1964, -613, -613, -613, -613, -613,
2209 -613, -613, -613, -613, -613, -613, -613, 1964, 1964, 1964,
2210 1964, 1964, 1964, 1964, 1964, 1964, 1964, 1964, 1964, -613,
2211 165, -613, 45, -613, -613, -613, -613, 202, 1741, -613,
2212 -32, -35, -613, 226, -30, 238, -613, 335, -29, 1262,
2213 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2214 -613, 431, 598, 431, 598, 240, 241, 257, 263, 264,
2215 266, 269, 1499, 2045, 318, 386, 271, 272, 273, -613,
2216 -613, -613, -613, -613, -613, -613, 25, -613, 119, 1001,
2217 -613, 235, 1171, 1171, 1171, -613, -613, -613, -613, -613,
2218 -613, -613, -613, -613, -613, -613, 1964, -613, -613, -613,
2219 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2220 -613, -613, -613, 1964, 1964, 1964, -31, -15, -613, 1001,
2221 -16, 247, 248, 274, 275, 276, 279, 1001, 1001, 1001,
2222 1001, 1001, 395, -613, 1964, 1964, 430, -613, -613, -613,
2223 -613, -613, -613, -613, -613, -613, -613, -613, -613, 160,
2224 -613, -613, -613, -613, 160, -613, 182, 397, 281, 283,
2225 284, 286, 1906, 1906, 1906, 1906, 1906, 1906, 1906, -613,
2226 -613, 6, 672, -67, -613, -84, -613, 1906, 1906, 1906,
2227 288, 292, -613, -613, -613, -613, -613, -613, -613, -613,
2228 -613, -613, 391, 1782, 2074, 777, 425, -613, -613, -613,
2229 -613, 1964, 293, -613, 294, 1221, 1001, 1001, 1001, 1001,
2230 1, -613, 27, -613, -613, 1171, 289, 1964, 1964, 1964,
2231 1964, 1964, 295, 299, 301, 309, 310, 1964, 1221, 1001,
2232 311, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2233 -613, -613, -613, 288, 288, 1964, 1906, 1906, 1906, 1906,
2234 -613, 312, 313, 314, 315, 299, 316, 1906, -613, 321,
2235 1453, -74, -613, -613, 322, 325, 454, -12, -613, 1800,
2236 -613, 474, -613, 7, 1051, -55, -613, -73, -613, -613,
2237 480, 481, 1171, 339, 345, 346, 347, 1171, 502, 1171,
2238 350, 353, 1171, 360, -30, -613, 361, 373, 533, 534,
2239 380, 1964, 1171, 1171, -30, 1171, 384, 1964, -613, -613,
2240 -1, 385, 390, 392, 400, 117, 1906, 1906, 1906, 1906,
2241 121, 1906, -613, -613, 394, 1906, 1906, 1964, 531, 562,
2242 -613, 288, -613, -30, 408, 411, 412, -613, 404, -72,
2243 -613, -613, 1171, 1171, 416, 1171, 1171, 1171, 1171, 384,
2244 -613, 384, 1964, 1171, 415, 1964, 1964, 1964, -613, -613,
2245 572, 1001, -613, -613, 419, 527, -613, 1001, -613, 1906,
2246 1906, 1906, 1906, -613, 420, 423, 422, 424, -613, 299,
2247 -613, 427, 433, 46, -613, -613, -613, 372, 1841, -613,
2248 563, -613, 426, 434, 437, 2092, -613, -613, -613, -613,
2249 -613, -613, -613, 438, 1171, -613, -613, -613, -613, 299,
2250 2092, 384, 444, 446, 455, 456, 1906, -613, 1906, 1906,
2251 129, -613, -613, -613, -613, -613, -613, -30, 414, -613,
2252 -613, 600, -3, -6, -30, 145, -613, 459, 380, 192,
2253 -613, -613, -613, -613, -613, 462, 469, 470, -613, 372,
2254 -613, 577, 1171, 1319, -613, -2, 847, 847, -613, 2133,
2255 -613, -613, -613, -613, -613, -613, 628, 482, -613, 471,
2256 1319, -613, 476, 477, -613, -613, 457, -6, -30, 160,
2257 -613, 615, -613, 621, 478, 202, 202, 622, 847, 847,
2258 -613, 1171, 624, 1171, -613, -613, -613, 1171, 569, 202,
2259 202, -613, 627, 1171, -613
Dan Gohman54392c12008-04-19 00:24:39 +00002260};
2261
2262/* YYPGOTO[NTERM-NUM]. */
2263static const yytype_int16 yypgoto[] =
2264{
Chris Lattner8f5544c2008-10-15 06:03:48 +00002265 -613, 34, 122, 184, -167, -141, -613, 0, -8, -139,
2266 554, -613, 4, -613, -613, -613, -613, 365, -613, -613,
2267 -613, -151, -613, -533, -613, -266, -613, -244, -613, -613,
2268 -312, 11, -613, -423, -613, -613, -26, 417, -163, -613,
2269 540, 547, 92, -162, -267, 178, 236, 407, -613, -613,
2270 640, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2271 -613, -613, 568, -613, -613, -613, -613, -613, -613, -612,
2272 -53, 251, -185, -613, -613, 604, -613, 529, -613, -613,
2273 -613, 43, 204, -449, -613, 532, -613, -613
Dan Gohman54392c12008-04-19 00:24:39 +00002274};
2275
2276/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2277 positive, shift that token. If negative, reduce the rule which
2278 number is the opposite. If zero, do what YYDEFACT says.
2279 If YYTABLE_NINF, syntax error. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00002280#define YYTABLE_NINF -223
Dan Gohman54392c12008-04-19 00:24:39 +00002281static const yytype_int16 yytable[] =
2282{
Chris Lattner8f5544c2008-10-15 06:03:48 +00002283 11, 82, 364, 279, 13, 286, 383, 385, 663, 680,
2284 597, 91, 497, 105, 169, 423, 530, 11, 328, 94,
2285 111, 13, 538, 111, 111, 111, 111, 281, 295, 415,
2286 518, 519, 324, 332, 333, 334, 335, 336, 499, 111,
2287 111, 146, 539, 342, 146, 2, 119, 120, 4, -154,
2288 147, 679, 109, 243, 111, 498, 21, 64, 65, 325,
2289 107, 67, 68, 69, 70, 71, 72, 73, 694, 1,
2290 2, 22, 3, 4, 5, 24, 138, 438, 467, 343,
2291 109, 498, 251, 252, 253, 254, 138, 473, 467, 467,
2292 467, 25, 155, 11, 368, 467, 370, 534, 551, 602,
2293 74, 111, 472, 250, 659, 255, 256, 467, 365, 366,
2294 666, 667, 280, 292, 550, 471, 240, 241, 596, 293,
2295 244, 369, 26, 371, 112, 27, 248, 112, 112, 112,
2296 112, 420, -66, -66, 361, 360, 483, 485, 487, 28,
2297 630, 135, 155, 112, 112, 60, 136, 422, -66, 425,
2298 289, 695, 696, -154, 698, 699, 170, -154, 112, 578,
2299 440, 95, 344, 345, 664, 681, 226, 226, 467, 467,
2300 648, 709, 710, 468, 547, 326, 327, 289, 329, 106,
2301 29, 30, 31, 32, 33, 34, 35, 36, 46, 37,
2302 47, 330, 289, 289, 289, 289, 289, 337, 338, 339,
2303 340, 341, 289, 44, 576, 112, 633, 131, 38, 39,
2304 40, 62, 138, 166, 75, 76, 58, 549, 77, 1,
2305 78, 108, 3, 155, 5, 59, 489, 122, 123, 124,
2306 125, 126, 127, 50, 51, 52, 409, 91, 53, 409,
2307 409, 409, 503, 247, 505, 506, 507, 610, 86, 611,
2308 87, 116, 492, 117, 227, 227, 346, 64, 65, 98,
2309 107, 67, 68, 69, 70, 71, 72, 73, 99, 1,
2310 2, 100, 3, 4, 5, 515, 409, 583, 102, 562,
2311 416, 588, 103, 570, 409, 409, 409, 409, 409, 658,
2312 391, 570, 151, 152, 38, 39, 40, 417, 418, 419,
2313 74, 442, 443, 444, 445, 668, 446, 669, 279, 650,
2314 447, 448, 104, 449, 450, 451, 228, 228, 439, 289,
2315 114, 115, 87, 347, 348, 64, 65, 142, 107, 158,
2316 159, 160, 161, 162, 163, 73, 143, 1, 2, 148,
2317 3, 4, 5, 349, 350, 150, 351, 352, 167, 353,
2318 354, 355, 671, 236, 669, 638, 470, 172, 64, 65,
2319 238, 239, 242, 409, 409, 409, 409, 245, 74, 249,
2320 1, 2, 409, 3, 4, 5, -55, 612, 246, -56,
2321 615, 616, 617, -59, -58, 289, 409, -57, 257, 155,
2322 111, 1, 294, 287, 3, 362, 5, 411, 363, 372,
2323 373, 289, 504, 289, 289, 289, 84, 85, 386, 426,
2324 427, 514, 155, 89, 75, 76, 374, 280, 77, 90,
2325 78, 144, 375, 376, 686, 377, 346, 689, 378, 520,
2326 387, 388, 389, 437, 441, 455, 428, 429, 430, 409,
2327 456, 431, 457, 458, 409, 459, 409, 488, 538, 409,
2328 477, 479, 480, 543, 502, 490, 491, 508, 470, 409,
2329 409, 509, 409, 511, 460, 461, 462, 463, 464, 465,
2330 466, 512, 513, 517, 526, 527, 528, 529, 531, 474,
2331 475, 476, 75, 76, 535, 571, 77, 536, 78, 384,
2332 533, 577, 537, 347, 348, 697, 546, 552, 553, 409,
2333 409, 555, 409, 409, 409, 409, 560, 556, 557, 558,
2334 409, 593, 562, 349, 350, 563, 351, 352, 409, 353,
2335 354, 355, 565, 566, 409, 296, 297, 298, 299, 300,
2336 301, 302, 303, 304, 305, 567, 289, 568, 569, 289,
2337 289, 289, 570, 412, 413, 414, 575, 579, 521, 522,
2338 523, 524, 580, 594, 581, 442, 443, 444, 445, 532,
2339 446, 409, 582, 590, 447, 448, 595, 449, 450, 451,
2340 598, 599, 637, 601, 600, 605, 618, 614, 620, 644,
2341 424, 498, 626, 627, 628, 639, 629, 631, 432, 433,
2342 434, 435, 436, 632, 644, 640, 641, 634, 442, 443,
2343 444, 445, 642, 446, 651, 646, 652, 447, 448, 409,
2344 449, 450, 451, 409, 409, 653, 654, 662, 584, 585,
2345 586, 587, 672, 589, 307, 308, 670, 591, 592, 673,
2346 674, 676, 690, 693, 691, -18, -19, 700, 701, 703,
2347 702, 707, 712, 688, 713, 409, 409, 132, 409, 660,
2348 409, 675, 149, 145, 409, 358, 367, 45, 130, 634,
2349 409, 97, 234, 649, 525, 235, 0, 493, 494, 495,
2350 496, 622, 623, 624, 625, 0, 501, 0, 0, 64,
2351 65, 0, 107, 158, 159, 160, 161, 162, 163, 73,
2352 516, 1, 2, 0, 3, 4, 5, 0, 309, 310,
2353 311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
2354 321, 322, 0, 0, 0, -222, 0, 0, 655, 0,
2355 656, 657, 74, 0, 0, 0, 0, 0, 0, 0,
2356 0, 0, 0, -68, 1, 2, 0, 3, 4, 5,
2357 0, 0, 0, 554, 0, 6, 7, 0, 559, 0,
2358 561, 0, 0, 564, 0, 0, 0, 0, 0, 0,
2359 0, 0, 0, 572, 573, 0, 574, 8, 0, 0,
2360 0, 9, 0, 0, 0, 10, 0, 0, 0, 0,
2361 0, 0, 0, 0, 64, 65, 0, 107, 158, 159,
2362 160, 161, 162, 163, 73, 0, 1, 2, 0, 3,
2363 4, 5, 0, 603, 604, 0, 606, 607, 608, 609,
2364 0, 0, 0, 0, 613, 0, 0, 0, 0, 0,
2365 0, 0, 619, 0, 0, 0, 0, 74, 621, 0,
2366 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2367 77, 0, 78, 469, 0, 0, 0, 0, 0, 0,
2368 392, 393, 394, 395, 64, 65, 396, 0, 0, -221,
2369 0, 0, 0, 0, 0, 647, 1, 2, 0, 3,
2370 4, 5, 397, 398, 399, 0, 0, -68, 1, 2,
2371 0, 3, 4, 5, 0, 0, 0, 400, 401, 6,
2372 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2373 0, 346, 0, 0, 0, 0, 402, 0, 0, 0,
2374 0, 8, 0, 678, 0, 9, 0, 684, 685, 10,
2375 0, 0, 182, 183, 184, 185, 186, 187, 188, 189,
2376 190, 191, 192, 193, 194, 195, 196, 261, 262, 263,
2377 264, 75, 76, 0, 0, 77, 0, 78, 486, 704,
2378 705, 0, 706, 0, 708, 0, 0, 0, 711, 0,
2379 0, 0, 0, 0, 714, 0, 265, 205, 682, 683,
2380 208, 209, 210, 211, 212, 213, 214, 215, 216, 0,
2381 266, 0, 267, 268, 269, 0, 270, 271, 349, 350,
2382 0, 351, 352, 0, 353, 354, 355, 0, 0, 0,
2383 0, 0, 0, 0, 392, 393, 394, 395, 64, 65,
2384 396, 0, 403, 0, 0, 404, 0, 405, 0, 406,
2385 1, 2, 0, 3, 4, 5, 397, 398, 399, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002387 0, 400, 401, 0, 0, 0, 0, 0, 0, 0,
2388 0, 0, 0, 0, 0, 0, 111, 0, 64, 65,
2389 402, 107, 158, 159, 160, 161, 162, 163, 73, 0,
2390 1, 2, 0, 3, 4, 5, 182, 183, 184, 185,
2391 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2392 196, 261, 262, 263, 264, 0, 0, 0, 0, 0,
2393 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner906773a2008-08-29 17:20:18 +00002394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002395 265, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2396 214, 215, 216, 0, 266, 0, 267, 268, 269, 0,
2397 270, 271, 0, 0, 0, 0, 0, 0, 0, 0,
2398 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2399 112, 0, 0, 0, 0, 0, 403, 0, 0, 404,
2400 0, 405, 0, 406, 392, 393, 394, 395, 64, 65,
2401 396, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2402 1, 2, 0, 3, 4, 5, 397, 398, 399, 0,
2403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2404 0, 400, 401, 0, 0, 75, 76, 0, 0, 77,
2405 0, 78, 548, 0, 0, 0, 0, 0, 64, 65,
2406 402, 153, 67, 68, 69, 70, 71, 72, 73, 0,
2407 1, 2, 0, 3, 4, 5, 182, 183, 184, 185,
2408 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2409 196, 261, 262, 263, 264, 0, 0, 0, 0, 64,
2410 65, 74, 153, 67, 68, 69, 70, 71, 72, 73,
2411 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2412 265, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2413 214, 215, 216, 0, 266, 0, 267, 268, 269, 0,
2414 270, 271, 74, 0, 0, 0, 0, 0, 0, 0,
2415 0, 0, 392, 393, 394, 395, 0, 0, 396, 0,
2416 0, 0, 0, 0, 0, 0, 403, 0, 0, 404,
2417 0, 405, 0, 406, 397, 398, 399, 0, 0, 0,
2418 0, 0, 0, 0, 0, 0, 0, 0, 0, 400,
2419 401, 0, 282, 283, 0, 284, 0, 0, 0, 0,
2420 0, 0, 0, 0, 0, 0, 0, 0, 402, 0,
2421 0, 0, 0, 0, 0, 75, 76, 154, 0, 77,
2422 0, 78, 0, 0, 182, 183, 184, 185, 186, 187,
2423 188, 189, 190, 191, 192, 193, 194, 195, 196, 261,
2424 262, 263, 264, 0, 0, 0, 0, 0, 0, 0,
2425 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2426 77, 0, 78, 0, 0, 0, 0, 0, 265, 205,
2427 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
2428 216, 0, 266, 0, 267, 268, 269, 0, 270, 271,
2429 64, 65, 0, 0, 0, 0, 0, 0, 0, 0,
2430 0, 0, 1, 2, 0, 3, 4, 5, 258, 0,
2431 0, 0, 0, 0, 403, 0, 0, 404, 0, 405,
2432 0, 406, 0, 259, 260, 0, 0, 0, 0, 0,
2433 0, 0, 0, 0, 0, 0, 64, 65, 111, 107,
Devang Patelcd842482008-09-29 20:49:50 +00002434 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002435 0, 3, 4, 5, 0, 0, 0, 0, 182, 183,
2436 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2437 194, 195, 196, 261, 262, 263, 264, 0, 0, 74,
2438 0, 0, 0, 64, 65, 0, 107, 67, 68, 69,
2439 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2440 5, 0, 265, 205, 206, 207, 208, 209, 210, 211,
2441 212, 213, 214, 215, 216, 137, 266, 0, 267, 268,
2442 269, 0, 270, 271, 0, 0, 74, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002443 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002444 0, 0, 112, 0, 64, 65, -66, 0, 272, 0,
2445 0, 273, 0, 274, 0, 275, 1, 2, 0, 3,
2446 4, 5, 258, 0, 0, 0, 0, 0, 0, 0,
2447 0, 0, 0, 0, 0, 0, 0, 259, 260, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002449 0, 0, 111, 75, 76, 0, 379, 77, 0, 78,
Devang Patelcd842482008-09-29 20:49:50 +00002450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002451 0, 0, 182, 183, 184, 185, 186, 187, 188, 189,
2452 190, 191, 192, 193, 194, 195, 196, 261, 262, 263,
2453 264, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2454 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2455 0, 0, 0, 0, 0, 0, 265, 205, 206, 207,
2456 208, 209, 210, 211, 212, 213, 214, 215, 216, 0,
2457 266, 0, 267, 268, 269, 0, 270, 271, 64, 65,
Devang Patelcd842482008-09-29 20:49:50 +00002458 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002459 1, 2, 0, 3, 4, 5, 112, 0, 0, 0,
2460 0, 0, 272, 0, 0, 273, 0, 274, 0, 275,
2461 357, 0, 0, 0, 0, 0, 0, 0, 0, 64,
Devang Patelcd842482008-09-29 20:49:50 +00002462 65, 74, 107, 158, 159, 160, 161, 162, 163, 73,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002463 0, 1, 2, 0, 3, 4, 5, 64, 65, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002464 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2465 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002466 0, 0, 74, 0, 0, 0, 0, 0, 0, 542,
Devang Patelcd842482008-09-29 20:49:50 +00002467 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2468 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2469 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2470 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002471 636, 1, 2, 0, 3, 4, 5, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002472 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2473 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002474 0, 78, 74, 64, 65, 0, 107, 158, 159, 160,
2475 161, 162, 163, 73, 0, 1, 2, 0, 3, 4,
2476 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2477 0, 0, 0, 0, 0, 0, 75, 76, 0, 482,
2478 77, 0, 78, 0, 0, 0, 74, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002479 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002480 78, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2481 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002482 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2483 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2484 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2485 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002486 77, 0, 78, 0, 64, 65, 0, 288, 67, 68,
2487 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2488 4, 5, 64, 65, 0, 107, 158, 159, 160, 161,
Devang Patelcd842482008-09-29 20:49:50 +00002489 162, 163, 73, 0, 1, 2, 0, 3, 4, 5,
Devang Patelcd842482008-09-29 20:49:50 +00002490 75, 76, 0, 0, 77, 0, 78, 74, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002491 0, 64, 65, 0, 107, 158, 159, 160, 161, 162,
2492 163, 73, 0, 1, 2, 74, 3, 4, 5, 64,
2493 65, 0, 107, 67, 68, 69, 70, 71, 72, 643,
2494 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2495 0, 0, 0, 0, 74, 0, 0, 0, 75, 76,
Devang Patelcd842482008-09-29 20:49:50 +00002496 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002497 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2498 687, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002499 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002500 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2501 0, 0, 0, 74, 0, 0, 0, 0, 0, 0,
2502 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002503 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002504 76, 0, 0, 77, 0, 382, 0, 0, 0, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002505 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002506 173, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2507 0, 0, 77, 0, 484, 0, 0, 0, 0, 0,
2508 0, 174, 175, 0, 0, 0, 75, 76, 0, 0,
2509 77, 0, 78, 176, 177, 178, 179, 180, 181, 182,
2510 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2511 193, 194, 195, 196, 197, 198, 199, 200, 0, 0,
2512 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2513 0, 77, 0, 78, 0, 0, 0, 0, 201, 202,
2514 203, 0, 0, 204, 205, 206, 207, 208, 209, 210,
2515 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
2516 221, 222, 223, 224, 225
Dan Gohman54392c12008-04-19 00:24:39 +00002517};
2518
2519static const yytype_int16 yycheck[] =
2520{
Chris Lattner8f5544c2008-10-15 06:03:48 +00002521 0, 27, 246, 165, 0, 168, 273, 274, 11, 11,
2522 543, 21, 11, 4, 28, 327, 465, 17, 203, 29,
2523 55, 17, 34, 55, 55, 55, 55, 166, 179, 295,
2524 453, 454, 199, 218, 219, 220, 221, 222, 11, 55,
2525 55, 162, 54, 228, 162, 20, 32, 33, 23, 55,
2526 171, 663, 78, 171, 55, 54, 53, 7, 8, 200,
2527 10, 11, 12, 13, 14, 15, 16, 17, 680, 19,
2528 20, 68, 22, 23, 24, 161, 102, 343, 162, 230,
2529 106, 54, 3, 4, 5, 6, 112, 171, 162, 162,
2530 162, 59, 118, 93, 261, 162, 263, 171, 171, 171,
2531 50, 55, 169, 156, 637, 26, 27, 162, 247, 248,
2532 643, 644, 165, 11, 169, 382, 142, 143, 541, 17,
2533 146, 262, 161, 264, 159, 18, 152, 159, 159, 159,
2534 159, 162, 163, 163, 169, 167, 403, 404, 405, 161,
2535 589, 162, 168, 159, 159, 165, 167, 162, 163, 165,
2536 176, 684, 685, 159, 687, 688, 170, 163, 159, 160,
2537 345, 171, 117, 118, 167, 167, 132, 133, 162, 162,
2538 619, 704, 705, 167, 167, 201, 202, 203, 204, 170,
2539 42, 43, 44, 45, 46, 47, 48, 49, 46, 51,
2540 48, 217, 218, 219, 220, 221, 222, 223, 224, 225,
2541 226, 227, 228, 0, 516, 159, 160, 7, 156, 157,
2542 158, 22, 238, 121, 164, 165, 161, 484, 168, 19,
2543 170, 171, 22, 249, 24, 161, 411, 62, 63, 64,
2544 65, 66, 67, 42, 43, 44, 289, 21, 47, 292,
2545 293, 294, 427, 151, 429, 430, 431, 559, 35, 561,
2546 37, 42, 415, 44, 132, 133, 54, 7, 8, 22,
2547 10, 11, 12, 13, 14, 15, 16, 17, 22, 19,
2548 20, 22, 22, 23, 24, 438, 329, 160, 159, 162,
2549 306, 160, 4, 162, 337, 338, 339, 340, 341, 160,
2550 286, 162, 114, 115, 156, 157, 158, 323, 324, 325,
2551 50, 141, 142, 143, 144, 160, 146, 162, 470, 621,
2552 150, 151, 4, 153, 154, 155, 132, 133, 344, 345,
2553 84, 85, 37, 121, 122, 7, 8, 166, 10, 11,
2554 12, 13, 14, 15, 16, 17, 166, 19, 20, 159,
2555 22, 23, 24, 141, 142, 163, 144, 145, 4, 147,
2556 148, 149, 160, 22, 162, 599, 382, 161, 7, 8,
2557 162, 160, 169, 416, 417, 418, 419, 4, 50, 159,
2558 19, 20, 425, 22, 23, 24, 9, 562, 160, 9,
2559 565, 566, 567, 9, 9, 411, 439, 9, 9, 415,
2560 55, 19, 11, 57, 22, 169, 24, 162, 160, 159,
2561 159, 427, 428, 429, 430, 431, 41, 42, 22, 162,
2562 162, 437, 438, 48, 164, 165, 159, 470, 168, 54,
2563 170, 171, 159, 159, 668, 159, 54, 671, 159, 455,
2564 159, 159, 159, 38, 4, 38, 162, 162, 162, 492,
2565 159, 162, 159, 159, 497, 159, 499, 22, 34, 502,
2566 162, 159, 61, 479, 165, 162, 162, 162, 484, 512,
2567 513, 162, 515, 162, 372, 373, 374, 375, 376, 377,
2568 378, 162, 162, 162, 162, 162, 162, 162, 162, 387,
2569 388, 389, 164, 165, 162, 511, 168, 162, 170, 171,
2570 169, 517, 38, 121, 122, 38, 22, 17, 17, 552,
2571 553, 162, 555, 556, 557, 558, 4, 162, 162, 162,
2572 563, 537, 162, 141, 142, 162, 144, 145, 571, 147,
2573 148, 149, 162, 162, 577, 94, 95, 96, 97, 98,
2574 99, 100, 101, 102, 103, 162, 562, 4, 4, 565,
2575 566, 567, 162, 292, 293, 294, 162, 162, 456, 457,
2576 458, 459, 162, 22, 162, 141, 142, 143, 144, 467,
2577 146, 614, 162, 169, 150, 151, 4, 153, 154, 155,
2578 162, 160, 598, 169, 162, 159, 4, 162, 159, 605,
2579 329, 54, 162, 160, 162, 22, 162, 160, 337, 338,
2580 339, 340, 341, 160, 620, 169, 162, 597, 141, 142,
2581 143, 144, 165, 146, 160, 167, 160, 150, 151, 662,
2582 153, 154, 155, 666, 667, 160, 160, 17, 526, 527,
2583 528, 529, 160, 531, 26, 27, 167, 535, 536, 160,
2584 160, 54, 4, 162, 152, 159, 159, 22, 17, 17,
2585 162, 17, 73, 669, 17, 698, 699, 93, 701, 638,
2586 703, 659, 112, 106, 707, 238, 249, 17, 90, 659,
2587 713, 57, 133, 620, 460, 133, -1, 416, 417, 418,
2588 419, 579, 580, 581, 582, -1, 425, -1, -1, 7,
2589 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2590 439, 19, 20, -1, 22, 23, 24, -1, 100, 101,
2591 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2592 112, 113, -1, -1, -1, 0, -1, -1, 626, -1,
2593 628, 629, 50, -1, -1, -1, -1, -1, -1, -1,
2594 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2595 -1, -1, -1, 492, -1, 30, 31, -1, 497, -1,
2596 499, -1, -1, 502, -1, -1, -1, -1, -1, -1,
2597 -1, -1, -1, 512, 513, -1, 515, 52, -1, -1,
2598 -1, 56, -1, -1, -1, 60, -1, -1, -1, -1,
2599 -1, -1, -1, -1, 7, 8, -1, 10, 11, 12,
2600 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2601 23, 24, -1, 552, 553, -1, 555, 556, 557, 558,
2602 -1, -1, -1, -1, 563, -1, -1, -1, -1, -1,
2603 -1, -1, 571, -1, -1, -1, -1, 50, 577, -1,
2604 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2605 168, -1, 170, 171, -1, -1, -1, -1, -1, -1,
2606 3, 4, 5, 6, 7, 8, 9, -1, -1, 0,
2607 -1, -1, -1, -1, -1, 614, 19, 20, -1, 22,
2608 23, 24, 25, 26, 27, -1, -1, 18, 19, 20,
2609 -1, 22, 23, 24, -1, -1, -1, 40, 41, 30,
2610 31, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2611 -1, 54, -1, -1, -1, -1, 59, -1, -1, -1,
2612 -1, 52, -1, 662, -1, 56, -1, 666, 667, 60,
2613 -1, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2614 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2615 93, 164, 165, -1, -1, 168, -1, 170, 171, 698,
2616 699, -1, 701, -1, 703, -1, -1, -1, 707, -1,
2617 -1, -1, -1, -1, 713, -1, 119, 120, 121, 122,
2618 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2619 133, -1, 135, 136, 137, -1, 139, 140, 141, 142,
2620 -1, 144, 145, -1, 147, 148, 149, -1, -1, -1,
2621 -1, -1, -1, -1, 3, 4, 5, 6, 7, 8,
2622 9, -1, 165, -1, -1, 168, -1, 170, -1, 172,
2623 19, 20, -1, 22, 23, 24, 25, 26, 27, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002624 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002625 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2626 -1, -1, -1, -1, -1, -1, 55, -1, 7, 8,
2627 59, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2628 19, 20, -1, 22, 23, 24, 75, 76, 77, 78,
2629 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2630 89, 90, 91, 92, 93, -1, -1, -1, -1, -1,
2631 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002632 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002633 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2634 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
2635 139, 140, -1, -1, -1, -1, -1, -1, -1, -1,
2636 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2637 159, -1, -1, -1, -1, -1, 165, -1, -1, 168,
2638 -1, 170, -1, 172, 3, 4, 5, 6, 7, 8,
2639 9, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2640 19, 20, -1, 22, 23, 24, 25, 26, 27, -1,
2641 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2642 -1, 40, 41, -1, -1, 164, 165, -1, -1, 168,
2643 -1, 170, 171, -1, -1, -1, -1, -1, 7, 8,
2644 59, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2645 19, 20, -1, 22, 23, 24, 75, 76, 77, 78,
2646 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2647 89, 90, 91, 92, 93, -1, -1, -1, -1, 7,
2648 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2649 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2650 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2651 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
2652 139, 140, 50, -1, -1, -1, -1, -1, -1, -1,
2653 -1, -1, 3, 4, 5, 6, -1, -1, 9, -1,
2654 -1, -1, -1, -1, -1, -1, 165, -1, -1, 168,
2655 -1, 170, -1, 172, 25, 26, 27, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002656 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002657 41, -1, 141, 142, -1, 144, -1, -1, -1, -1,
2658 -1, -1, -1, -1, -1, -1, -1, -1, 59, -1,
2659 -1, -1, -1, -1, -1, 164, 165, 125, -1, 168,
2660 -1, 170, -1, -1, 75, 76, 77, 78, 79, 80,
Devang Patelcd842482008-09-29 20:49:50 +00002661 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002662 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
2663 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2664 168, -1, 170, -1, -1, -1, -1, -1, 119, 120,
Devang Patelcd842482008-09-29 20:49:50 +00002665 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2666 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002667 7, 8, -1, -1, -1, -1, -1, -1, -1, -1,
2668 -1, -1, 19, 20, -1, 22, 23, 24, 25, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002669 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002670 -1, 172, -1, 40, 41, -1, -1, -1, -1, -1,
2671 -1, -1, -1, -1, -1, -1, 7, 8, 55, 10,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002672 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002673 -1, 22, 23, 24, -1, -1, -1, -1, 75, 76,
2674 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2675 87, 88, 89, 90, 91, 92, 93, -1, -1, 50,
2676 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2677 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2678 24, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2679 127, 128, 129, 130, 131, 39, 133, -1, 135, 136,
2680 137, -1, 139, 140, -1, -1, 50, -1, -1, -1,
2681 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2682 -1, -1, 159, -1, 7, 8, 163, -1, 165, -1,
2683 -1, 168, -1, 170, -1, 172, 19, 20, -1, 22,
2684 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002685 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
Devang Patel5df692d2008-09-02 20:52:40 +00002686 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002687 -1, -1, 55, 164, 165, -1, 167, 168, -1, 170,
2688 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2689 -1, -1, 75, 76, 77, 78, 79, 80, 81, 82,
Devang Patelcd842482008-09-29 20:49:50 +00002690 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2691 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002692 164, 165, -1, -1, 168, -1, 170, -1, -1, -1,
2693 -1, -1, -1, -1, -1, -1, 119, 120, 121, 122,
Devang Patelcd842482008-09-29 20:49:50 +00002694 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2695 133, -1, 135, 136, 137, -1, 139, 140, 7, 8,
Devang Patelcd842482008-09-29 20:49:50 +00002696 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002697 19, 20, -1, 22, 23, 24, 159, -1, -1, -1,
2698 -1, -1, 165, -1, -1, 168, -1, 170, -1, 172,
2699 39, -1, -1, -1, -1, -1, -1, -1, -1, 7,
Devang Patelcd842482008-09-29 20:49:50 +00002700 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002701 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002702 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2703 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002704 -1, -1, 50, -1, -1, -1, -1, -1, -1, 39,
2705 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2706 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2707 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2708 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2709 39, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2710 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2711 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002712 -1, 170, 50, 7, 8, -1, 10, 11, 12, 13,
2713 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2714 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002715 -1, -1, -1, -1, -1, -1, 164, 165, -1, 167,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002716 168, -1, 170, -1, -1, -1, 50, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002717 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2718 170, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2719 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002720 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002721 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2722 -1, 170, -1, -1, 50, -1, -1, -1, -1, -1,
2723 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002724 168, -1, 170, -1, 7, 8, -1, 10, 11, 12,
Devang Patelcd842482008-09-29 20:49:50 +00002725 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002726 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
Dale Johannesenf4581482008-09-26 19:32:34 +00002727 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Devang Patelcd842482008-09-29 20:49:50 +00002728 164, 165, -1, -1, 168, -1, 170, 50, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002729 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2730 16, 17, -1, 19, 20, 50, 22, 23, 24, 7,
2731 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2732 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2733 -1, -1, -1, -1, 50, -1, -1, -1, 164, 165,
Devang Patelcd842482008-09-29 20:49:50 +00002734 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002735 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2736 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002737 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002738 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2739 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002740 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2741 -1, -1, -1, -1, -1, -1, -1, -1, -1, 164,
2742 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
Chris Lattner906773a2008-08-29 17:20:18 +00002743 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002744 36, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2745 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2746 -1, 57, 58, -1, -1, -1, 164, 165, -1, -1,
2747 168, -1, 170, 69, 70, 71, 72, 73, 74, 75,
2748 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2749 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2750 -1, -1, -1, -1, -1, -1, -1, 164, 165, -1,
2751 -1, 168, -1, 170, -1, -1, -1, -1, 114, 115,
2752 116, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2753 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2754 136, 137, 138, 139, 140
Dan Gohman54392c12008-04-19 00:24:39 +00002755};
2756
2757/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2758 symbol of state STATE-NUM. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002759static const yytype_uint16 yystos[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002760{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002761 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002762 60, 180, 183, 185, 186, 187, 221, 222, 223, 225,
2763 224, 53, 68, 230, 161, 59, 161, 18, 161, 42,
Devang Patelcd842482008-09-29 20:49:50 +00002764 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002765 158, 188, 189, 190, 0, 223, 46, 48, 191, 240,
2766 42, 43, 44, 47, 192, 237, 239, 247, 161, 161,
2767 165, 231, 22, 229, 7, 8, 10, 11, 12, 13,
2768 14, 15, 16, 17, 50, 164, 165, 168, 170, 180,
2769 185, 208, 209, 243, 190, 190, 35, 37, 219, 190,
2770 190, 21, 248, 249, 29, 171, 238, 248, 22, 22,
2771 22, 232, 159, 4, 4, 4, 170, 10, 171, 209,
2772 214, 55, 159, 182, 219, 219, 42, 44, 193, 32,
2773 33, 218, 62, 63, 64, 65, 66, 67, 194, 235,
2774 235, 7, 183, 184, 252, 162, 167, 39, 209, 210,
2775 212, 213, 166, 166, 171, 214, 162, 171, 159, 213,
2776 163, 218, 218, 10, 125, 209, 211, 220, 11, 12,
2777 13, 14, 15, 16, 179, 209, 215, 4, 198, 28,
2778 170, 236, 161, 36, 57, 58, 69, 70, 71, 72,
2779 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2780 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2781 93, 114, 115, 116, 119, 120, 121, 122, 123, 124,
2782 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
2783 135, 136, 137, 138, 139, 140, 174, 175, 176, 250,
2784 257, 258, 259, 260, 250, 258, 22, 196, 162, 160,
2785 209, 209, 169, 171, 209, 4, 160, 215, 209, 159,
2786 243, 3, 4, 5, 6, 26, 27, 9, 25, 40,
2787 41, 90, 91, 92, 93, 119, 133, 135, 136, 137,
2788 139, 140, 165, 168, 170, 172, 174, 175, 176, 216,
2789 243, 182, 141, 142, 144, 197, 211, 57, 10, 209,
2790 245, 246, 11, 17, 11, 194, 94, 95, 96, 97,
2791 98, 99, 100, 101, 102, 103, 177, 26, 27, 100,
2792 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
2793 111, 112, 113, 178, 177, 178, 209, 209, 245, 209,
2794 209, 253, 245, 245, 245, 245, 245, 209, 209, 209,
2795 209, 209, 245, 194, 117, 118, 54, 121, 122, 141,
2796 142, 144, 145, 147, 148, 149, 195, 39, 210, 200,
2797 167, 169, 169, 160, 200, 182, 182, 220, 177, 178,
2798 177, 178, 159, 159, 159, 159, 159, 159, 159, 167,
2799 215, 217, 170, 217, 171, 217, 22, 159, 159, 159,
2800 226, 185, 3, 4, 5, 6, 9, 25, 26, 27,
2801 40, 41, 59, 165, 168, 170, 172, 216, 242, 243,
2802 244, 162, 244, 244, 244, 198, 209, 209, 209, 209,
2803 162, 203, 162, 203, 244, 165, 162, 162, 162, 162,
2804 162, 162, 244, 244, 244, 244, 244, 38, 198, 209,
2805 245, 4, 141, 142, 143, 144, 146, 150, 151, 153,
2806 154, 155, 199, 227, 228, 38, 159, 159, 159, 159,
2807 215, 215, 215, 215, 215, 215, 215, 162, 167, 171,
2808 209, 217, 169, 171, 215, 215, 215, 162, 206, 159,
2809 61, 241, 167, 217, 170, 217, 171, 217, 22, 245,
2810 162, 162, 211, 244, 244, 244, 244, 11, 54, 11,
2811 255, 244, 165, 245, 209, 245, 245, 245, 162, 162,
2812 256, 162, 162, 162, 209, 211, 244, 162, 206, 206,
2813 209, 215, 215, 215, 215, 255, 162, 162, 162, 162,
2814 256, 162, 215, 169, 171, 162, 162, 38, 34, 54,
2815 204, 207, 39, 209, 233, 234, 22, 167, 171, 217,
2816 169, 171, 17, 17, 244, 162, 162, 162, 162, 244,
2817 4, 244, 162, 162, 244, 162, 162, 162, 4, 4,
2818 162, 209, 244, 244, 244, 162, 203, 209, 160, 162,
2819 162, 162, 162, 160, 215, 215, 215, 215, 160, 215,
2820 169, 215, 215, 209, 22, 4, 206, 196, 162, 160,
2821 162, 169, 171, 244, 244, 159, 244, 244, 244, 244,
2822 203, 203, 245, 244, 162, 245, 245, 245, 4, 244,
2823 159, 244, 215, 215, 215, 215, 162, 160, 162, 162,
2824 256, 160, 160, 160, 180, 181, 39, 209, 200, 22,
2825 169, 162, 165, 17, 209, 254, 167, 244, 256, 254,
2826 203, 160, 160, 160, 160, 215, 215, 215, 160, 196,
2827 204, 205, 17, 11, 167, 251, 196, 196, 160, 162,
2828 167, 160, 160, 160, 160, 181, 54, 202, 244, 242,
2829 11, 167, 121, 122, 244, 244, 200, 17, 209, 200,
2830 4, 152, 201, 162, 242, 196, 196, 38, 196, 196,
2831 22, 17, 162, 17, 244, 244, 244, 17, 244, 196,
2832 196, 244, 73, 17, 244
Dan Gohman54392c12008-04-19 00:24:39 +00002833};
David Greene9145dd22007-08-01 03:59:32 +00002834
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002835#define yyerrok (yyerrstatus = 0)
2836#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002837#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002838#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002839
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002840#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002841#define YYABORT goto yyabortlab
2842#define YYERROR goto yyerrorlab
2843
2844
2845/* Like YYERROR except do call yyerror. This remains here temporarily
2846 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002847 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002848
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002849#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002850
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002851#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002852
2853#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002854do \
2855 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002856 { \
2857 yychar = (Token); \
2858 yylval = (Value); \
2859 yytoken = YYTRANSLATE (yychar); \
2860 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002861 goto yybackup; \
2862 } \
2863 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002864 { \
2865 yyerror (YY_("syntax error: cannot back up")); \
2866 YYERROR; \
2867 } \
2868while (YYID (0))
2869
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002870
2871#define YYTERROR 1
2872#define YYERRCODE 256
2873
Dan Gohman54392c12008-04-19 00:24:39 +00002874
2875/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2876 If N is 0, then set CURRENT to the empty location which ends
2877 the previous symbol: RHS[0] (always defined). */
2878
2879#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2880#ifndef YYLLOC_DEFAULT
2881# define YYLLOC_DEFAULT(Current, Rhs, N) \
2882 do \
2883 if (YYID (N)) \
2884 { \
2885 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2886 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2887 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2888 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2889 } \
2890 else \
2891 { \
2892 (Current).first_line = (Current).last_line = \
2893 YYRHSLOC (Rhs, 0).last_line; \
2894 (Current).first_column = (Current).last_column = \
2895 YYRHSLOC (Rhs, 0).last_column; \
2896 } \
2897 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002898#endif
2899
Dan Gohman54392c12008-04-19 00:24:39 +00002900
2901/* YY_LOCATION_PRINT -- Print the location on the stream.
2902 This macro was not mandated originally: define only if we know
2903 we won't break user code: when these are the locations we know. */
2904
2905#ifndef YY_LOCATION_PRINT
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00002906# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohman54392c12008-04-19 00:24:39 +00002907# define YY_LOCATION_PRINT(File, Loc) \
2908 fprintf (File, "%d.%d-%d.%d", \
2909 (Loc).first_line, (Loc).first_column, \
2910 (Loc).last_line, (Loc).last_column)
2911# else
2912# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2913# endif
2914#endif
2915
2916
2917/* YYLEX -- calling `yylex' with the right arguments. */
2918
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002919#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002920# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002921#else
Dan Gohman54392c12008-04-19 00:24:39 +00002922# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002923#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002924
2925/* Enable debugging if requested. */
2926#if YYDEBUG
2927
2928# ifndef YYFPRINTF
2929# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2930# define YYFPRINTF fprintf
2931# endif
2932
2933# define YYDPRINTF(Args) \
2934do { \
2935 if (yydebug) \
2936 YYFPRINTF Args; \
2937} while (YYID (0))
2938
2939# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2940do { \
2941 if (yydebug) \
2942 { \
2943 YYFPRINTF (stderr, "%s ", Title); \
2944 yy_symbol_print (stderr, \
2945 Type, Value); \
2946 YYFPRINTF (stderr, "\n"); \
2947 } \
2948} while (YYID (0))
2949
2950
2951/*--------------------------------.
2952| Print this symbol on YYOUTPUT. |
2953`--------------------------------*/
2954
2955/*ARGSUSED*/
2956#if (defined __STDC__ || defined __C99__FUNC__ \
2957 || defined __cplusplus || defined _MSC_VER)
2958static void
2959yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002960#else
Dan Gohman54392c12008-04-19 00:24:39 +00002961static void
2962yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2963 FILE *yyoutput;
2964 int yytype;
2965 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002966#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002967{
2968 if (!yyvaluep)
2969 return;
2970# ifdef YYPRINT
2971 if (yytype < YYNTOKENS)
2972 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2973# else
2974 YYUSE (yyoutput);
2975# endif
2976 switch (yytype)
2977 {
2978 default:
2979 break;
2980 }
2981}
2982
2983
2984/*--------------------------------.
2985| Print this symbol on YYOUTPUT. |
2986`--------------------------------*/
2987
2988#if (defined __STDC__ || defined __C99__FUNC__ \
2989 || defined __cplusplus || defined _MSC_VER)
2990static void
2991yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2992#else
2993static void
2994yy_symbol_print (yyoutput, yytype, yyvaluep)
2995 FILE *yyoutput;
2996 int yytype;
2997 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002998#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002999{
3000 if (yytype < YYNTOKENS)
3001 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3002 else
3003 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00003004
Dan Gohman54392c12008-04-19 00:24:39 +00003005 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3006 YYFPRINTF (yyoutput, ")");
3007}
Chris Lattner59363a32008-02-19 04:36:25 +00003008
Dan Gohman54392c12008-04-19 00:24:39 +00003009/*------------------------------------------------------------------.
3010| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3011| TOP (included). |
3012`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00003013
Dan Gohman54392c12008-04-19 00:24:39 +00003014#if (defined __STDC__ || defined __C99__FUNC__ \
3015 || defined __cplusplus || defined _MSC_VER)
3016static void
3017yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3018#else
3019static void
3020yy_stack_print (bottom, top)
3021 yytype_int16 *bottom;
3022 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00003023#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003024{
3025 YYFPRINTF (stderr, "Stack now");
3026 for (; bottom <= top; ++bottom)
3027 YYFPRINTF (stderr, " %d", *bottom);
3028 YYFPRINTF (stderr, "\n");
3029}
Chris Lattner59363a32008-02-19 04:36:25 +00003030
Dan Gohman54392c12008-04-19 00:24:39 +00003031# define YY_STACK_PRINT(Bottom, Top) \
3032do { \
3033 if (yydebug) \
3034 yy_stack_print ((Bottom), (Top)); \
3035} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00003036
Dan Gohman54392c12008-04-19 00:24:39 +00003037
3038/*------------------------------------------------.
3039| Report that the YYRULE is going to be reduced. |
3040`------------------------------------------------*/
3041
3042#if (defined __STDC__ || defined __C99__FUNC__ \
3043 || defined __cplusplus || defined _MSC_VER)
3044static void
3045yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3046#else
3047static void
3048yy_reduce_print (yyvsp, yyrule)
3049 YYSTYPE *yyvsp;
3050 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00003051#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003052{
3053 int yynrhs = yyr2[yyrule];
3054 int yyi;
3055 unsigned long int yylno = yyrline[yyrule];
3056 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3057 yyrule - 1, yylno);
3058 /* The symbols being reduced. */
3059 for (yyi = 0; yyi < yynrhs; yyi++)
3060 {
3061 fprintf (stderr, " $%d = ", yyi + 1);
3062 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3063 &(yyvsp[(yyi + 1) - (yynrhs)])
3064 );
3065 fprintf (stderr, "\n");
3066 }
3067}
Scott Michel5a6f17b2008-01-30 02:55:46 +00003068
Dan Gohman54392c12008-04-19 00:24:39 +00003069# define YY_REDUCE_PRINT(Rule) \
3070do { \
3071 if (yydebug) \
3072 yy_reduce_print (yyvsp, Rule); \
3073} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00003074
Dan Gohman54392c12008-04-19 00:24:39 +00003075/* Nonzero means print parse trace. It is left uninitialized so that
3076 multiple parsers can coexist. */
3077int yydebug;
3078#else /* !YYDEBUG */
3079# define YYDPRINTF(Args)
3080# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3081# define YY_STACK_PRINT(Bottom, Top)
3082# define YY_REDUCE_PRINT(Rule)
3083#endif /* !YYDEBUG */
3084
3085
3086/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003087#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003088# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003089#endif
3090
Dan Gohman54392c12008-04-19 00:24:39 +00003091/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3092 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003093
Dan Gohman54392c12008-04-19 00:24:39 +00003094 Do not make this value too large; the results are undefined if
3095 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3096 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00003097
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003098#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003099# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003100#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003101
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003102
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003103
Dan Gohman54392c12008-04-19 00:24:39 +00003104#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003105
Dan Gohman54392c12008-04-19 00:24:39 +00003106# ifndef yystrlen
3107# if defined __GLIBC__ && defined _STRING_H
3108# define yystrlen strlen
3109# else
3110/* Return the length of YYSTR. */
3111#if (defined __STDC__ || defined __C99__FUNC__ \
3112 || defined __cplusplus || defined _MSC_VER)
3113static YYSIZE_T
3114yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00003115#else
Dan Gohman54392c12008-04-19 00:24:39 +00003116static YYSIZE_T
3117yystrlen (yystr)
3118 const char *yystr;
3119#endif
3120{
3121 YYSIZE_T yylen;
3122 for (yylen = 0; yystr[yylen]; yylen++)
3123 continue;
3124 return yylen;
3125}
3126# endif
3127# endif
3128
3129# ifndef yystpcpy
3130# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3131# define yystpcpy stpcpy
3132# else
3133/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3134 YYDEST. */
3135#if (defined __STDC__ || defined __C99__FUNC__ \
3136 || defined __cplusplus || defined _MSC_VER)
3137static char *
3138yystpcpy (char *yydest, const char *yysrc)
3139#else
3140static char *
3141yystpcpy (yydest, yysrc)
3142 char *yydest;
3143 const char *yysrc;
3144#endif
3145{
3146 char *yyd = yydest;
3147 const char *yys = yysrc;
3148
3149 while ((*yyd++ = *yys++) != '\0')
3150 continue;
3151
3152 return yyd - 1;
3153}
3154# endif
3155# endif
3156
3157# ifndef yytnamerr
3158/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3159 quotes and backslashes, so that it's suitable for yyerror. The
3160 heuristic is that double-quoting is unnecessary unless the string
3161 contains an apostrophe, a comma, or backslash (other than
3162 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3163 null, do not copy; instead, return the length of what the result
3164 would have been. */
3165static YYSIZE_T
3166yytnamerr (char *yyres, const char *yystr)
3167{
3168 if (*yystr == '"')
3169 {
3170 YYSIZE_T yyn = 0;
3171 char const *yyp = yystr;
3172
3173 for (;;)
3174 switch (*++yyp)
3175 {
3176 case '\'':
3177 case ',':
3178 goto do_not_strip_quotes;
3179
3180 case '\\':
3181 if (*++yyp != '\\')
3182 goto do_not_strip_quotes;
3183 /* Fall through. */
3184 default:
3185 if (yyres)
3186 yyres[yyn] = *yyp;
3187 yyn++;
3188 break;
3189
3190 case '"':
3191 if (yyres)
3192 yyres[yyn] = '\0';
3193 return yyn;
3194 }
3195 do_not_strip_quotes: ;
3196 }
3197
3198 if (! yyres)
3199 return yystrlen (yystr);
3200
3201 return yystpcpy (yyres, yystr) - yyres;
3202}
3203# endif
3204
3205/* Copy into YYRESULT an error message about the unexpected token
3206 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3207 including the terminating null byte. If YYRESULT is null, do not
3208 copy anything; just return the number of bytes that would be
3209 copied. As a special case, return 0 if an ordinary "syntax error"
3210 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3211 size calculation. */
3212static YYSIZE_T
3213yysyntax_error (char *yyresult, int yystate, int yychar)
3214{
3215 int yyn = yypact[yystate];
3216
3217 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3218 return 0;
3219 else
3220 {
3221 int yytype = YYTRANSLATE (yychar);
3222 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3223 YYSIZE_T yysize = yysize0;
3224 YYSIZE_T yysize1;
3225 int yysize_overflow = 0;
3226 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3227 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3228 int yyx;
3229
3230# if 0
3231 /* This is so xgettext sees the translatable formats that are
3232 constructed on the fly. */
3233 YY_("syntax error, unexpected %s");
3234 YY_("syntax error, unexpected %s, expecting %s");
3235 YY_("syntax error, unexpected %s, expecting %s or %s");
3236 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3237 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3238# endif
3239 char *yyfmt;
3240 char const *yyf;
3241 static char const yyunexpected[] = "syntax error, unexpected %s";
3242 static char const yyexpecting[] = ", expecting %s";
3243 static char const yyor[] = " or %s";
3244 char yyformat[sizeof yyunexpected
3245 + sizeof yyexpecting - 1
3246 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3247 * (sizeof yyor - 1))];
3248 char const *yyprefix = yyexpecting;
3249
3250 /* Start YYX at -YYN if negative to avoid negative indexes in
3251 YYCHECK. */
3252 int yyxbegin = yyn < 0 ? -yyn : 0;
3253
3254 /* Stay within bounds of both yycheck and yytname. */
3255 int yychecklim = YYLAST - yyn + 1;
3256 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3257 int yycount = 1;
3258
3259 yyarg[0] = yytname[yytype];
3260 yyfmt = yystpcpy (yyformat, yyunexpected);
3261
3262 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3263 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3264 {
3265 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3266 {
3267 yycount = 1;
3268 yysize = yysize0;
3269 yyformat[sizeof yyunexpected - 1] = '\0';
3270 break;
3271 }
3272 yyarg[yycount++] = yytname[yyx];
3273 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3274 yysize_overflow |= (yysize1 < yysize);
3275 yysize = yysize1;
3276 yyfmt = yystpcpy (yyfmt, yyprefix);
3277 yyprefix = yyor;
3278 }
3279
3280 yyf = YY_(yyformat);
3281 yysize1 = yysize + yystrlen (yyf);
3282 yysize_overflow |= (yysize1 < yysize);
3283 yysize = yysize1;
3284
3285 if (yysize_overflow)
3286 return YYSIZE_MAXIMUM;
3287
3288 if (yyresult)
3289 {
3290 /* Avoid sprintf, as that infringes on the user's name space.
3291 Don't have undefined behavior even if the translation
3292 produced a string with the wrong number of "%s"s. */
3293 char *yyp = yyresult;
3294 int yyi = 0;
3295 while ((*yyp = *yyf) != '\0')
3296 {
3297 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3298 {
3299 yyp += yytnamerr (yyp, yyarg[yyi++]);
3300 yyf += 2;
3301 }
3302 else
3303 {
3304 yyp++;
3305 yyf++;
3306 }
3307 }
3308 }
3309 return yysize;
3310 }
3311}
3312#endif /* YYERROR_VERBOSE */
3313
3314
3315/*-----------------------------------------------.
3316| Release the memory associated to this symbol. |
3317`-----------------------------------------------*/
3318
3319/*ARGSUSED*/
3320#if (defined __STDC__ || defined __C99__FUNC__ \
3321 || defined __cplusplus || defined _MSC_VER)
3322static void
3323yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3324#else
3325static void
3326yydestruct (yymsg, yytype, yyvaluep)
3327 const char *yymsg;
3328 int yytype;
3329 YYSTYPE *yyvaluep;
3330#endif
3331{
3332 YYUSE (yyvaluep);
3333
3334 if (!yymsg)
3335 yymsg = "Deleting";
3336 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3337
3338 switch (yytype)
3339 {
3340
3341 default:
3342 break;
3343 }
3344}
3345
3346
3347/* Prevent warnings from -Wmissing-prototypes. */
3348
3349#ifdef YYPARSE_PARAM
3350#if defined __STDC__ || defined __cplusplus
3351int yyparse (void *YYPARSE_PARAM);
3352#else
3353int yyparse ();
3354#endif
3355#else /* ! YYPARSE_PARAM */
3356#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003357int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003358#else
Dan Gohman54392c12008-04-19 00:24:39 +00003359int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003360#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003361#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003362
Chris Lattner59363a32008-02-19 04:36:25 +00003363
Dan Gohman54392c12008-04-19 00:24:39 +00003364
3365/* The look-ahead symbol. */
3366int yychar;
3367
3368/* The semantic value of the look-ahead symbol. */
3369YYSTYPE yylval;
3370
3371/* Number of syntax errors so far. */
3372int yynerrs;
3373
3374
3375
3376/*----------.
3377| yyparse. |
3378`----------*/
3379
3380#ifdef YYPARSE_PARAM
3381#if (defined __STDC__ || defined __C99__FUNC__ \
3382 || defined __cplusplus || defined _MSC_VER)
3383int
3384yyparse (void *YYPARSE_PARAM)
3385#else
3386int
3387yyparse (YYPARSE_PARAM)
3388 void *YYPARSE_PARAM;
3389#endif
3390#else /* ! YYPARSE_PARAM */
3391#if (defined __STDC__ || defined __C99__FUNC__ \
3392 || defined __cplusplus || defined _MSC_VER)
3393int
3394yyparse (void)
3395#else
3396int
3397yyparse ()
3398
Gabor Greif89f01162008-04-06 23:07:54 +00003399#endif
3400#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003401{
3402
3403 int yystate;
3404 int yyn;
3405 int yyresult;
3406 /* Number of tokens to shift before error messages enabled. */
3407 int yyerrstatus;
3408 /* Look-ahead token as an internal (translated) token number. */
3409 int yytoken = 0;
3410#if YYERROR_VERBOSE
3411 /* Buffer for error messages, and its allocated size. */
3412 char yymsgbuf[128];
3413 char *yymsg = yymsgbuf;
3414 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003415#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003416
Dan Gohman54392c12008-04-19 00:24:39 +00003417 /* Three stacks and their tools:
3418 `yyss': related to states,
3419 `yyvs': related to semantic values,
3420 `yyls': related to locations.
3421
3422 Refer to the stacks thru separate pointers, to allow yyoverflow
3423 to reallocate them elsewhere. */
3424
3425 /* The state stack. */
3426 yytype_int16 yyssa[YYINITDEPTH];
3427 yytype_int16 *yyss = yyssa;
3428 yytype_int16 *yyssp;
3429
3430 /* The semantic value stack. */
3431 YYSTYPE yyvsa[YYINITDEPTH];
3432 YYSTYPE *yyvs = yyvsa;
3433 YYSTYPE *yyvsp;
3434
3435
3436
3437#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3438
3439 YYSIZE_T yystacksize = YYINITDEPTH;
3440
3441 /* The variables used to return semantic value and location from the
3442 action routines. */
3443 YYSTYPE yyval;
3444
3445
3446 /* The number of symbols on the RHS of the reduced rule.
3447 Keep to zero when no symbol should be popped. */
3448 int yylen = 0;
3449
3450 YYDPRINTF ((stderr, "Starting parse\n"));
3451
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003452 yystate = 0;
3453 yyerrstatus = 0;
3454 yynerrs = 0;
3455 yychar = YYEMPTY; /* Cause a token to be read. */
3456
3457 /* Initialize stack pointers.
3458 Waste one element of value and location stack
3459 so that they stay on the same level as the state stack.
3460 The wasted elements are never initialized. */
3461
Dan Gohman54392c12008-04-19 00:24:39 +00003462 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003463 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003464
Dan Gohman54392c12008-04-19 00:24:39 +00003465 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003466
Dan Gohman54392c12008-04-19 00:24:39 +00003467/*------------------------------------------------------------.
3468| yynewstate -- Push a new state, which is found in yystate. |
3469`------------------------------------------------------------*/
3470 yynewstate:
3471 /* In all cases, when you get here, the value and location stacks
3472 have just been pushed. So pushing a state here evens the stacks. */
3473 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003474
Dan Gohman54392c12008-04-19 00:24:39 +00003475 yysetstate:
3476 *yyssp = yystate;
3477
3478 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003479 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003480 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003481 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003482
3483#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003484 {
3485 /* Give user a chance to reallocate the stack. Use copies of
3486 these so that the &'s don't force the real ones into
3487 memory. */
3488 YYSTYPE *yyvs1 = yyvs;
3489 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003490
Dan Gohman54392c12008-04-19 00:24:39 +00003491
3492 /* Each stack pointer address is followed by the size of the
3493 data in use in that stack, in bytes. This used to be a
3494 conditional around just the two extra args, but that might
3495 be undefined if yyoverflow is a macro. */
3496 yyoverflow (YY_("memory exhausted"),
3497 &yyss1, yysize * sizeof (*yyssp),
3498 &yyvs1, yysize * sizeof (*yyvsp),
3499
3500 &yystacksize);
3501
3502 yyss = yyss1;
3503 yyvs = yyvs1;
3504 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003505#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003506# ifndef YYSTACK_RELOCATE
3507 goto yyexhaustedlab;
3508# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003509 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003510 if (YYMAXDEPTH <= yystacksize)
3511 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003512 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003513 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003514 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003515
3516 {
3517 yytype_int16 *yyss1 = yyss;
3518 union yyalloc *yyptr =
3519 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3520 if (! yyptr)
3521 goto yyexhaustedlab;
3522 YYSTACK_RELOCATE (yyss);
3523 YYSTACK_RELOCATE (yyvs);
3524
3525# undef YYSTACK_RELOCATE
3526 if (yyss1 != yyssa)
3527 YYSTACK_FREE (yyss1);
3528 }
3529# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003530#endif /* no yyoverflow */
3531
Dan Gohman54392c12008-04-19 00:24:39 +00003532 yyssp = yyss + yysize - 1;
3533 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003534
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003535
Dan Gohman54392c12008-04-19 00:24:39 +00003536 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3537 (unsigned long int) yystacksize));
3538
3539 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003540 YYABORT;
3541 }
3542
Dan Gohman54392c12008-04-19 00:24:39 +00003543 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003544
3545 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003546
Dan Gohman54392c12008-04-19 00:24:39 +00003547/*-----------.
3548| yybackup. |
3549`-----------*/
3550yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003551
Dan Gohman54392c12008-04-19 00:24:39 +00003552 /* Do appropriate processing given the current state. Read a
3553 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003554
Dan Gohman54392c12008-04-19 00:24:39 +00003555 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003556 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003557 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003558 goto yydefault;
3559
Dan Gohman54392c12008-04-19 00:24:39 +00003560 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003561
Dan Gohman54392c12008-04-19 00:24:39 +00003562 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003563 if (yychar == YYEMPTY)
3564 {
Dan Gohman54392c12008-04-19 00:24:39 +00003565 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003566 yychar = YYLEX;
3567 }
3568
Dan Gohman54392c12008-04-19 00:24:39 +00003569 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003570 {
Dan Gohman54392c12008-04-19 00:24:39 +00003571 yychar = yytoken = YYEOF;
3572 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003573 }
3574 else
3575 {
Dan Gohman54392c12008-04-19 00:24:39 +00003576 yytoken = YYTRANSLATE (yychar);
3577 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003578 }
3579
Dan Gohman54392c12008-04-19 00:24:39 +00003580 /* If the proper action on seeing token YYTOKEN is to reduce or to
3581 detect an error, take that action. */
3582 yyn += yytoken;
3583 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003584 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003585 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003586 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003587 {
Dan Gohman54392c12008-04-19 00:24:39 +00003588 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003589 goto yyerrlab;
3590 yyn = -yyn;
3591 goto yyreduce;
3592 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003593
3594 if (yyn == YYFINAL)
3595 YYACCEPT;
3596
Dan Gohman54392c12008-04-19 00:24:39 +00003597 /* Count tokens shifted since error; after three, turn off error
3598 status. */
3599 if (yyerrstatus)
3600 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003601
Dan Gohman54392c12008-04-19 00:24:39 +00003602 /* Shift the look-ahead token. */
3603 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003604
Dan Gohman54392c12008-04-19 00:24:39 +00003605 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003606 if (yychar != YYEOF)
3607 yychar = YYEMPTY;
3608
Gabor Greif89f01162008-04-06 23:07:54 +00003609 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003610 *++yyvsp = yylval;
3611
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003612 goto yynewstate;
3613
Gabor Greif89f01162008-04-06 23:07:54 +00003614
Dan Gohman54392c12008-04-19 00:24:39 +00003615/*-----------------------------------------------------------.
3616| yydefault -- do the default action for the current state. |
3617`-----------------------------------------------------------*/
3618yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003619 yyn = yydefact[yystate];
3620 if (yyn == 0)
3621 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003622 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003623
Dan Gohman54392c12008-04-19 00:24:39 +00003624
3625/*-----------------------------.
3626| yyreduce -- Do a reduction. |
3627`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003628yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003629 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003630 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003631
Dan Gohman54392c12008-04-19 00:24:39 +00003632 /* If YYLEN is nonzero, implement the default value of the action:
3633 `$$ = $1'.
3634
3635 Otherwise, the following line sets YYVAL to garbage.
3636 This behavior is undocumented and Bison
3637 users should not rely upon it. Assigning to YYVAL
3638 unconditionally makes the parser a bit smaller, and it avoids a
3639 GCC warning that YYVAL may be used uninitialized. */
3640 yyval = yyvsp[1-yylen];
3641
3642
3643 YY_REDUCE_PRINT (yyn);
3644 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003645 {
Dan Gohman54392c12008-04-19 00:24:39 +00003646 case 29:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003647#line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003648 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3649 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003650
Dan Gohman54392c12008-04-19 00:24:39 +00003651 case 30:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003652#line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003653 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3654 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003655
Dan Gohman54392c12008-04-19 00:24:39 +00003656 case 31:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003657#line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003658 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3659 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003660
Dan Gohman54392c12008-04-19 00:24:39 +00003661 case 32:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003662#line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003663 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3664 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003665
Dan Gohman54392c12008-04-19 00:24:39 +00003666 case 33:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003667#line 1151 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003668 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3669 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003670
Dan Gohman54392c12008-04-19 00:24:39 +00003671 case 34:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003672#line 1151 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003673 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3674 break;
3675
3676 case 35:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003677#line 1152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003678 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3679 break;
3680
3681 case 36:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003682#line 1152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003683 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3684 break;
3685
3686 case 37:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003687#line 1153 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003688 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3689 break;
3690
3691 case 38:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003692#line 1153 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003693 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3694 break;
3695
3696 case 39:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003697#line 1157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003698 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3699 break;
3700
3701 case 40:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003702#line 1157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003703 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3704 break;
3705
3706 case 41:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003707#line 1158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003708 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3709 break;
3710
3711 case 42:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003712#line 1158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003713 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3714 break;
3715
3716 case 43:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003717#line 1159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003718 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3719 break;
3720
3721 case 44:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003722#line 1159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003723 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3724 break;
3725
3726 case 45:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003727#line 1160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003728 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3729 break;
3730
3731 case 46:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003732#line 1160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003733 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3734 break;
3735
3736 case 47:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003737#line 1161 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003738 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3739 break;
3740
3741 case 48:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003742#line 1161 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003743 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3744 break;
3745
3746 case 49:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003747#line 1162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003748 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3749 break;
3750
3751 case 50:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003752#line 1162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003753 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3754 break;
3755
3756 case 51:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003757#line 1163 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003758 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3759 break;
3760
3761 case 52:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003762#line 1163 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003763 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3764 break;
3765
3766 case 53:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003767#line 1164 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003768 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3769 break;
3770
3771 case 54:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003772#line 1165 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003773 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3774 break;
3775
Chris Lattner8f5544c2008-10-15 06:03:48 +00003776 case 64:
3777#line 1173 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003778 { (yyval.StrVal) = 0; ;}
3779 break;
3780
Chris Lattner8f5544c2008-10-15 06:03:48 +00003781 case 65:
3782#line 1175 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003783 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3784 break;
3785
Chris Lattner8f5544c2008-10-15 06:03:48 +00003786 case 66:
3787#line 1176 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003788 { (yyval.UIntVal)=0; ;}
3789 break;
3790
Chris Lattner8f5544c2008-10-15 06:03:48 +00003791 case 67:
3792#line 1180 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003793 {
3794 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003795 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003796 ;}
3797 break;
3798
Chris Lattner8f5544c2008-10-15 06:03:48 +00003799 case 68:
3800#line 1184 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003801 {
3802 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003803 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003804 ;}
3805 break;
3806
Chris Lattner8f5544c2008-10-15 06:03:48 +00003807 case 69:
3808#line 1189 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003809 {
Chris Lattner906773a2008-08-29 17:20:18 +00003810 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3811 CHECK_FOR_ERROR
3812;}
Dan Gohman54392c12008-04-19 00:24:39 +00003813 break;
3814
Chris Lattner8f5544c2008-10-15 06:03:48 +00003815 case 73:
3816#line 1198 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003817 {
3818 (yyval.StrVal) = 0;
3819 CHECK_FOR_ERROR
3820 ;}
3821 break;
3822
Chris Lattner8f5544c2008-10-15 06:03:48 +00003823 case 74:
3824#line 1203 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003825 {
3826 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003827 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003828 ;}
3829 break;
3830
Chris Lattner8f5544c2008-10-15 06:03:48 +00003831 case 75:
3832#line 1209 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003833 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3834 break;
3835
Chris Lattner8f5544c2008-10-15 06:03:48 +00003836 case 76:
3837#line 1210 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003838 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3839 break;
3840
Chris Lattner8f5544c2008-10-15 06:03:48 +00003841 case 77:
3842#line 1211 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003843 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3844 break;
3845
Chris Lattner8f5544c2008-10-15 06:03:48 +00003846 case 78:
3847#line 1212 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003848 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3849 break;
3850
Chris Lattner8f5544c2008-10-15 06:03:48 +00003851 case 79:
3852#line 1213 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003853 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3854 break;
3855
Chris Lattner8f5544c2008-10-15 06:03:48 +00003856 case 80:
3857#line 1214 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003858 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003859 break;
3860
Chris Lattner8f5544c2008-10-15 06:03:48 +00003861 case 81:
3862#line 1218 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003863 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003864 break;
3865
Chris Lattner8f5544c2008-10-15 06:03:48 +00003866 case 82:
3867#line 1219 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003868 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003869 break;
3870
Chris Lattner8f5544c2008-10-15 06:03:48 +00003871 case 83:
3872#line 1220 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003873 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003874 break;
3875
Chris Lattner8f5544c2008-10-15 06:03:48 +00003876 case 84:
3877#line 1224 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3878 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3879 break;
3880
Dan Gohman54392c12008-04-19 00:24:39 +00003881 case 85:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003882#line 1225 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003883 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003884 break;
3885
3886 case 86:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003887#line 1226 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003888 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003889 break;
3890
Chris Lattner8f5544c2008-10-15 06:03:48 +00003891 case 87:
3892#line 1227 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003893 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003894 break;
3895
Chris Lattner8f5544c2008-10-15 06:03:48 +00003896 case 88:
3897#line 1231 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003898 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003899 break;
3900
Chris Lattner8f5544c2008-10-15 06:03:48 +00003901 case 89:
3902#line 1232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003903 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003904 break;
3905
Chris Lattner8f5544c2008-10-15 06:03:48 +00003906 case 90:
3907#line 1233 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003908 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003909 break;
3910
Chris Lattner8f5544c2008-10-15 06:03:48 +00003911 case 91:
3912#line 1237 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00003913 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3914 break;
3915
Chris Lattner8f5544c2008-10-15 06:03:48 +00003916 case 92:
3917#line 1238 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3918 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3919 break;
3920
Chris Lattner906773a2008-08-29 17:20:18 +00003921 case 93:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003922#line 1239 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003923 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3924 break;
3925
Chris Lattner8f5544c2008-10-15 06:03:48 +00003926 case 94:
3927#line 1240 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003928 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3929 break;
3930
Chris Lattner8f5544c2008-10-15 06:03:48 +00003931 case 95:
3932#line 1241 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003933 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3934 break;
3935
Chris Lattner8f5544c2008-10-15 06:03:48 +00003936 case 96:
3937#line 1245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003938 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3939 break;
3940
Chris Lattner8f5544c2008-10-15 06:03:48 +00003941 case 97:
3942#line 1246 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003943 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3944 break;
3945
Chris Lattner8f5544c2008-10-15 06:03:48 +00003946 case 98:
3947#line 1247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003948 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003949 break;
3950
Chris Lattner8f5544c2008-10-15 06:03:48 +00003951 case 99:
3952#line 1250 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3953 { (yyval.UIntVal) = CallingConv::C; ;}
3954 break;
3955
Dan Gohman54392c12008-04-19 00:24:39 +00003956 case 100:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003957#line 1251 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003958 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003959 break;
3960
3961 case 101:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003962#line 1252 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003963 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003964 break;
3965
Chris Lattner8f5544c2008-10-15 06:03:48 +00003966 case 102:
3967#line 1253 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003968 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003969 break;
3970
Chris Lattner8f5544c2008-10-15 06:03:48 +00003971 case 103:
3972#line 1254 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003973 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003974 break;
3975
Chris Lattner8f5544c2008-10-15 06:03:48 +00003976 case 104:
3977#line 1255 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003978 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00003979 break;
3980
Chris Lattner8f5544c2008-10-15 06:03:48 +00003981 case 105:
3982#line 1256 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003983 {
3984 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003985 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00003986 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003987 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003988 ;}
3989 break;
3990
Chris Lattner8f5544c2008-10-15 06:03:48 +00003991 case 106:
3992#line 1263 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3993 { (yyval.Attributes) = Attribute::ZExt; ;}
3994 break;
3995
Dale Johannesenf4581482008-09-26 19:32:34 +00003996 case 107:
Chris Lattner8f5544c2008-10-15 06:03:48 +00003997#line 1264 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00003998 { (yyval.Attributes) = Attribute::ZExt; ;}
3999 break;
4000
Dan Gohman54392c12008-04-19 00:24:39 +00004001 case 108:
Chris Lattner8f5544c2008-10-15 06:03:48 +00004002#line 1265 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4003 { (yyval.Attributes) = Attribute::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004004 break;
4005
4006 case 109:
Chris Lattner8f5544c2008-10-15 06:03:48 +00004007#line 1266 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004008 { (yyval.Attributes) = Attribute::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004009 break;
4010
4011 case 110:
Chris Lattner8f5544c2008-10-15 06:03:48 +00004012#line 1267 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004013 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004014 break;
4015
Chris Lattner8f5544c2008-10-15 06:03:48 +00004016 case 111:
4017#line 1268 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004018 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004019 break;
4020
Chris Lattner8f5544c2008-10-15 06:03:48 +00004021 case 112:
4022#line 1269 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004023 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004024 break;
4025
Chris Lattner8f5544c2008-10-15 06:03:48 +00004026 case 113:
4027#line 1270 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004028 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004029 break;
4030
Chris Lattner8f5544c2008-10-15 06:03:48 +00004031 case 114:
4032#line 1271 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004033 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004034 break;
4035
Chris Lattner8f5544c2008-10-15 06:03:48 +00004036 case 115:
4037#line 1272 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004038 { (yyval.Attributes) =
4039 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004040 break;
4041
Chris Lattner8f5544c2008-10-15 06:03:48 +00004042 case 116:
4043#line 1276 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004044 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004045 break;
4046
Chris Lattner8f5544c2008-10-15 06:03:48 +00004047 case 117:
4048#line 1277 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004049 {
4050 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4051 ;}
4052 break;
4053
Chris Lattner8f5544c2008-10-15 06:03:48 +00004054 case 118:
4055#line 1282 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004056 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004057 break;
4058
Chris Lattner8f5544c2008-10-15 06:03:48 +00004059 case 119:
4060#line 1283 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004061 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004062 break;
4063
Chris Lattner8f5544c2008-10-15 06:03:48 +00004064 case 120:
4065#line 1284 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004066 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004067 break;
4068
Chris Lattner8f5544c2008-10-15 06:03:48 +00004069 case 121:
4070#line 1287 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004071 { (yyval.Attributes) = Attribute::None; ;}
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004072 break;
4073
Chris Lattner8f5544c2008-10-15 06:03:48 +00004074 case 122:
4075#line 1288 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004076 {
4077 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4078 ;}
4079 break;
4080
Chris Lattner8f5544c2008-10-15 06:03:48 +00004081 case 123:
4082#line 1294 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004083 { (yyval.Attributes) = Attribute::NoReturn; ;}
4084 break;
4085
Chris Lattner8f5544c2008-10-15 06:03:48 +00004086 case 124:
4087#line 1295 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004088 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4089 break;
4090
Chris Lattner8f5544c2008-10-15 06:03:48 +00004091 case 125:
4092#line 1296 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004093 { (yyval.Attributes) = Attribute::InReg; ;}
4094 break;
4095
Chris Lattner8f5544c2008-10-15 06:03:48 +00004096 case 126:
4097#line 1297 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004098 { (yyval.Attributes) = Attribute::ZExt; ;}
4099 break;
4100
Chris Lattner8f5544c2008-10-15 06:03:48 +00004101 case 127:
4102#line 1298 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004103 { (yyval.Attributes) = Attribute::SExt; ;}
4104 break;
4105
Chris Lattner8f5544c2008-10-15 06:03:48 +00004106 case 128:
4107#line 1299 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004108 { (yyval.Attributes) = Attribute::ReadNone; ;}
4109 break;
4110
Chris Lattner8f5544c2008-10-15 06:03:48 +00004111 case 129:
4112#line 1300 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004113 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4114 break;
4115
Chris Lattner8f5544c2008-10-15 06:03:48 +00004116 case 130:
4117#line 1301 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00004118 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004119 break;
4120
Chris Lattner8f5544c2008-10-15 06:03:48 +00004121 case 131:
4122#line 1302 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00004123 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004124 break;
4125
Chris Lattner8f5544c2008-10-15 06:03:48 +00004126 case 132:
4127#line 1303 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00004128 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004129 break;
4130
Chris Lattner8f5544c2008-10-15 06:03:48 +00004131 case 133:
4132#line 1306 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004133 { (yyval.Attributes) = Attribute::None; ;}
4134 break;
4135
Chris Lattner8f5544c2008-10-15 06:03:48 +00004136 case 134:
4137#line 1307 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004138 {
Devang Pateld222f862008-09-25 21:00:45 +00004139 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner906773a2008-08-29 17:20:18 +00004140 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004141 break;
4142
Chris Lattner8f5544c2008-10-15 06:03:48 +00004143 case 135:
4144#line 1313 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004145 { (yyval.StrVal) = 0; ;}
4146 break;
4147
Chris Lattner8f5544c2008-10-15 06:03:48 +00004148 case 136:
4149#line 1314 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004150 {
4151 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4152 ;}
4153 break;
4154
Chris Lattner8f5544c2008-10-15 06:03:48 +00004155 case 137:
4156#line 1321 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004157 { (yyval.UIntVal) = 0; ;}
4158 break;
4159
Chris Lattner8f5544c2008-10-15 06:03:48 +00004160 case 138:
4161#line 1322 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004162 {
4163 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4164 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004165 GEN_ERROR("Alignment must be a power of two");
4166 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004167;}
4168 break;
4169
Chris Lattner8f5544c2008-10-15 06:03:48 +00004170 case 139:
4171#line 1328 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004172 { (yyval.UIntVal) = 0; ;}
4173 break;
4174
Chris Lattner8f5544c2008-10-15 06:03:48 +00004175 case 140:
4176#line 1329 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004177 {
4178 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4179 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00004180 GEN_ERROR("Alignment must be a power of two");
4181 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004182;}
4183 break;
4184
Chris Lattner8f5544c2008-10-15 06:03:48 +00004185 case 141:
4186#line 1338 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004187 {
4188 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4189 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004190 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00004191 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004192 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004193;}
4194 break;
4195
Chris Lattner8f5544c2008-10-15 06:03:48 +00004196 case 142:
4197#line 1346 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004198 { (yyval.StrVal) = 0; ;}
4199 break;
4200
Chris Lattner8f5544c2008-10-15 06:03:48 +00004201 case 143:
4202#line 1347 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004203 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4204 break;
4205
Chris Lattner8f5544c2008-10-15 06:03:48 +00004206 case 144:
4207#line 1352 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4208 {;}
4209 break;
4210
Devang Patel5df692d2008-09-02 20:52:40 +00004211 case 145:
Chris Lattner8f5544c2008-10-15 06:03:48 +00004212#line 1353 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004213 {;}
4214 break;
4215
Devang Patel5df692d2008-09-02 20:52:40 +00004216 case 146:
Chris Lattner8f5544c2008-10-15 06:03:48 +00004217#line 1354 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004218 {
4219 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4220 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004221 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004222 ;}
4223 break;
4224
Chris Lattner8f5544c2008-10-15 06:03:48 +00004225 case 147:
4226#line 1359 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004227 {
4228 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004229 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004230 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004231 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004232 ;}
4233 break;
4234
Chris Lattner8f5544c2008-10-15 06:03:48 +00004235 case 155:
4236#line 1375 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004237 {
4238 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004239 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004240 ;}
4241 break;
4242
Chris Lattner8f5544c2008-10-15 06:03:48 +00004243 case 156:
4244#line 1379 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004245 {
4246 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004247 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004248 ;}
4249 break;
4250
Chris Lattner8f5544c2008-10-15 06:03:48 +00004251 case 157:
4252#line 1383 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004253 { // Pointer type?
4254 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004255 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004256 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4257 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004258 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004259 ;}
4260 break;
4261
Chris Lattner8f5544c2008-10-15 06:03:48 +00004262 case 158:
4263#line 1390 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004264 { // Named types are also simple types...
4265 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004266 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004267 (yyval.TypeVal) = new PATypeHolder(tmp);
4268 ;}
4269 break;
4270
Chris Lattner8f5544c2008-10-15 06:03:48 +00004271 case 159:
4272#line 1395 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004273 { // Type UpReference
4274 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004275 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004276 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4277 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004278 UR_OUT("New Upreference!\n");
4279 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004280 ;}
4281 break;
4282
Chris Lattner8f5544c2008-10-15 06:03:48 +00004283 case 160:
4284#line 1403 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004285 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004286 // Allow but ignore attributes on function types; this permits auto-upgrade.
4287 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004288 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4289 if (!FunctionType::isValidReturnType(RetTy))
4290 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00004291
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004292 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004293 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004294 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004295 const Type *Ty = I->Ty->get();
4296 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004297 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004298
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004299 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4300 if (isVarArg) Params.pop_back();
4301
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004302 for (unsigned i = 0; i != Params.size(); ++i)
4303 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4304 GEN_ERROR("Function arguments must be value types!");
4305
4306 CHECK_FOR_ERROR
4307
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004308 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004309 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher329d2672008-09-24 04:55:49 +00004310 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes896f4572008-10-05 16:49:34 +00004311
4312 // Delete the argument list
4313 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4314 delete I->Ty;
4315 }
4316 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4317
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004318 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004319 ;}
4320 break;
4321
Chris Lattner8f5544c2008-10-15 06:03:48 +00004322 case 161:
4323#line 1438 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004324 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004325 // Allow but ignore attributes on function types; this permits auto-upgrade.
4326 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004327 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004328 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004329 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004330 const Type* Ty = I->Ty->get();
4331 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004332 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004333
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004334 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4335 if (isVarArg) Params.pop_back();
4336
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004337 for (unsigned i = 0; i != Params.size(); ++i)
4338 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4339 GEN_ERROR("Function arguments must be value types!");
4340
4341 CHECK_FOR_ERROR
4342
Dan Gohman54392c12008-04-19 00:24:39 +00004343 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher329d2672008-09-24 04:55:49 +00004344 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes896f4572008-10-05 16:49:34 +00004345
4346 // Delete the argument list
4347 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4348 delete I->Ty;
4349 }
4350 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4351
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004352 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004353 ;}
4354 break;
4355
Chris Lattner8f5544c2008-10-15 06:03:48 +00004356 case 162:
4357#line 1469 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004358 { // Sized array type?
Dan Gohmane5febe42008-05-31 00:58:22 +00004359 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohman54392c12008-04-19 00:24:39 +00004360 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004361 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004362 ;}
4363 break;
4364
Chris Lattner8f5544c2008-10-15 06:03:48 +00004365 case 163:
4366#line 1474 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004367 { // Vector type?
4368 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4369 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004370 GEN_ERROR("Unsigned result not equal to signed result");
4371 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4372 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004373 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4374 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004375 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004376 ;}
4377 break;
4378
Chris Lattner8f5544c2008-10-15 06:03:48 +00004379 case 164:
4380#line 1484 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004381 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004382 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004383 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4384 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004385 Elements.push_back(*I);
4386
Dan Gohman54392c12008-04-19 00:24:39 +00004387 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4388 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004389 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004390 ;}
4391 break;
4392
Chris Lattner8f5544c2008-10-15 06:03:48 +00004393 case 165:
4394#line 1494 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004395 { // Empty structure type?
4396 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004397 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004398 ;}
4399 break;
4400
Chris Lattner8f5544c2008-10-15 06:03:48 +00004401 case 166:
4402#line 1498 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004403 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004404 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004405 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4406 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004407 Elements.push_back(*I);
4408
Dan Gohman54392c12008-04-19 00:24:39 +00004409 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4410 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004411 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004412 ;}
4413 break;
4414
Chris Lattner8f5544c2008-10-15 06:03:48 +00004415 case 167:
4416#line 1508 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004417 { // Empty structure type?
4418 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004419 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004420 ;}
4421 break;
4422
Chris Lattner8f5544c2008-10-15 06:03:48 +00004423 case 168:
4424#line 1515 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004425 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004426 // Allow but ignore attributes on function types; this permits auto-upgrade.
4427 // FIXME: remove in LLVM 3.0.
Eric Christopher329d2672008-09-24 04:55:49 +00004428 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Pateld222f862008-09-25 21:00:45 +00004429 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00004430 ;}
4431 break;
4432
Chris Lattner8f5544c2008-10-15 06:03:48 +00004433 case 169:
4434#line 1524 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004435 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004436 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004437 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4438 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004439 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004440 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4441 ;}
4442 break;
4443
Chris Lattner8f5544c2008-10-15 06:03:48 +00004444 case 170:
4445#line 1531 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004446 {
4447 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4448 ;}
4449 break;
4450
Chris Lattner8f5544c2008-10-15 06:03:48 +00004451 case 171:
4452#line 1536 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004453 {
4454 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4455 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004456 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004457 ;}
4458 break;
4459
Chris Lattner8f5544c2008-10-15 06:03:48 +00004460 case 172:
4461#line 1541 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004462 {
4463 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004464 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004465 ;}
4466 break;
4467
Chris Lattner8f5544c2008-10-15 06:03:48 +00004468 case 174:
4469#line 1549 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004470 {
4471 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Pateld222f862008-09-25 21:00:45 +00004472 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004473 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004474 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004475 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004476 ;}
4477 break;
4478
Chris Lattner8f5544c2008-10-15 06:03:48 +00004479 case 175:
4480#line 1556 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004481 {
4482 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Pateld222f862008-09-25 21:00:45 +00004483 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004484 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004485 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004486 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004487 ;}
4488 break;
4489
Chris Lattner8f5544c2008-10-15 06:03:48 +00004490 case 176:
4491#line 1563 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004492 {
4493 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004494 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004495 ;}
4496 break;
4497
Chris Lattner8f5544c2008-10-15 06:03:48 +00004498 case 177:
4499#line 1571 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004500 {
4501 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher329d2672008-09-24 04:55:49 +00004502 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004503 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004504 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004505 ;}
4506 break;
4507
Chris Lattner8f5544c2008-10-15 06:03:48 +00004508 case 178:
4509#line 1577 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004510 {
Eric Christopher329d2672008-09-24 04:55:49 +00004511 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004512 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004513 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004514 ;}
4515 break;
4516
Chris Lattner8f5544c2008-10-15 06:03:48 +00004517 case 179:
4518#line 1589 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004519 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004520 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004521 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4522 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004523 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004524 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004525 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004526 const Type *ETy = ATy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004527 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004528
4529 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004530 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004531 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004532 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004533 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004534
4535 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004536 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4537 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004538 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004539 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004540 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004541 }
4542
Dan Gohman54392c12008-04-19 00:24:39 +00004543 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4544 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004545 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004546 ;}
4547 break;
4548
Chris Lattner8f5544c2008-10-15 06:03:48 +00004549 case 180:
4550#line 1617 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004551 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004552 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004553 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4554 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004555 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004556 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004557 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004558
Dan Gohman7185e4b2008-06-23 18:43:26 +00004559 uint64_t NumElements = ATy->getNumElements();
Eric Christopher329d2672008-09-24 04:55:49 +00004560 if (NumElements != uint64_t(-1) && NumElements != 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004561 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004562 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004563 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4564 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004565 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004566 ;}
4567 break;
4568
Chris Lattner8f5544c2008-10-15 06:03:48 +00004569 case 181:
4570#line 1633 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004571 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004572 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004573 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4574 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004575 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004576 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004577 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004578
Dan Gohman7185e4b2008-06-23 18:43:26 +00004579 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004580 const Type *ETy = ATy->getElementType();
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004581 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher329d2672008-09-24 04:55:49 +00004582 GEN_ERROR("Can't build string constant of size " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004583 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4584 " when array has size " + utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004585 std::vector<Constant*> Vals;
4586 if (ETy == Type::Int8Ty) {
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004587 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohman54392c12008-04-19 00:24:39 +00004588 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004589 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004590 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004591 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4592 }
Dan Gohman54392c12008-04-19 00:24:39 +00004593 delete (yyvsp[(3) - (3)].StrVal);
4594 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4595 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004596 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004597 ;}
4598 break;
4599
Chris Lattner8f5544c2008-10-15 06:03:48 +00004600 case 182:
4601#line 1660 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004602 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004603 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004604 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4605 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004606 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004607 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004608 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004609 const Type *ETy = PTy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004610 unsigned NumElements = PTy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004611
4612 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004613 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004614 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004615 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004616 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004617
4618 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004619 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4620 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004621 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004622 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004623 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004624 }
4625
Dan Gohman54392c12008-04-19 00:24:39 +00004626 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4627 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004628 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004629 ;}
4630 break;
4631
Chris Lattner8f5544c2008-10-15 06:03:48 +00004632 case 183:
4633#line 1688 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004634 {
4635 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004636 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004637 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004638 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004639
Dan Gohman54392c12008-04-19 00:24:39 +00004640 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004641 GEN_ERROR("Illegal number of initializers for structure type");
4642
4643 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004644 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4645 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004646 GEN_ERROR("Expected type '" +
4647 STy->getElementType(i)->getDescription() +
4648 "' for element #" + utostr(i) +
4649 " of structure initializer");
4650
4651 // Check to ensure that Type is not packed
4652 if (STy->isPacked())
4653 GEN_ERROR("Unpacked Initializer to vector type '" +
4654 STy->getDescription() + "'");
4655
Dan Gohman54392c12008-04-19 00:24:39 +00004656 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4657 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004658 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004659 ;}
4660 break;
4661
Chris Lattner8f5544c2008-10-15 06:03:48 +00004662 case 184:
4663#line 1714 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004664 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004665 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004666 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4667 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004668 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004669 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004670 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004671
4672 if (STy->getNumContainedTypes() != 0)
4673 GEN_ERROR("Illegal number of initializers for structure type");
4674
4675 // Check to ensure that Type is not packed
4676 if (STy->isPacked())
4677 GEN_ERROR("Unpacked Initializer to vector type '" +
4678 STy->getDescription() + "'");
4679
Dan Gohman54392c12008-04-19 00:24:39 +00004680 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4681 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004682 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004683 ;}
4684 break;
4685
Chris Lattner8f5544c2008-10-15 06:03:48 +00004686 case 185:
4687#line 1734 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004688 {
4689 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004690 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004691 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004692 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004693
Dan Gohman54392c12008-04-19 00:24:39 +00004694 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004695 GEN_ERROR("Illegal number of initializers for structure type");
4696
4697 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004698 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4699 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004700 GEN_ERROR("Expected type '" +
4701 STy->getElementType(i)->getDescription() +
4702 "' for element #" + utostr(i) +
4703 " of structure initializer");
4704
4705 // Check to ensure that Type is packed
4706 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004707 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004708 STy->getDescription() + "'");
4709
Dan Gohman54392c12008-04-19 00:24:39 +00004710 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4711 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004712 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004713 ;}
4714 break;
4715
Chris Lattner8f5544c2008-10-15 06:03:48 +00004716 case 186:
4717#line 1760 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004718 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004719 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004720 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4721 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004722 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004723 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004724 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004725
4726 if (STy->getNumContainedTypes() != 0)
4727 GEN_ERROR("Illegal number of initializers for structure type");
4728
4729 // Check to ensure that Type is packed
4730 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004731 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004732 STy->getDescription() + "'");
4733
Dan Gohman54392c12008-04-19 00:24:39 +00004734 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4735 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004736 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004737 ;}
4738 break;
4739
Chris Lattner8f5544c2008-10-15 06:03:48 +00004740 case 187:
4741#line 1780 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004742 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004743 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004744 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4745 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004746 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004747 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004748 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004749
Dan Gohman54392c12008-04-19 00:24:39 +00004750 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4751 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004752 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004753 ;}
4754 break;
4755
Chris Lattner8f5544c2008-10-15 06:03:48 +00004756 case 188:
4757#line 1792 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004758 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004759 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004760 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4761 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4762 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004763 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004764 ;}
4765 break;
4766
Chris Lattner8f5544c2008-10-15 06:03:48 +00004767 case 189:
4768#line 1799 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004769 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004770 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004771 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4772 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004773 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004774 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004775
4776 // ConstExprs can exist in the body of a function, thus creating
4777 // GlobalValues whenever they refer to a variable. Because we are in
4778 // the context of a function, getExistingVal will search the functions
4779 // symbol table instead of the module symbol table for the global symbol,
4780 // which throws things all off. To get around this, we just tell
4781 // getExistingVal that we are at global scope here.
4782 //
4783 Function *SavedCurFn = CurFun.CurrentFunction;
4784 CurFun.CurrentFunction = 0;
4785
Dan Gohman54392c12008-04-19 00:24:39 +00004786 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004787 CHECK_FOR_ERROR
4788
4789 CurFun.CurrentFunction = SavedCurFn;
4790
4791 // If this is an initializer for a constant pointer, which is referencing a
4792 // (currently) undefined variable, create a stub now that shall be replaced
4793 // in the future with the right type of variable.
4794 //
4795 if (V == 0) {
4796 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4797 const PointerType *PT = cast<PointerType>(Ty);
4798
4799 // First check to see if the forward references value is already created!
4800 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004801 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher329d2672008-09-24 04:55:49 +00004802
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004803 if (I != CurModule.GlobalRefs.end()) {
4804 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004805 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004806 } else {
4807 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004808 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4809 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4810 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004811 GEN_ERROR("Invalid reference to global");
4812
4813 // Create the forward referenced global.
4814 GlobalValue *GV;
Eric Christopher329d2672008-09-24 04:55:49 +00004815 if (const FunctionType *FTy =
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004816 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004817 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4818 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004819 } else {
4820 GV = new GlobalVariable(PT->getElementType(), false,
4821 GlobalValue::ExternalWeakLinkage, 0,
4822 Name, CurModule.CurrentModule);
4823 }
4824
4825 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004826 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004827 V = GV;
4828 }
4829 }
4830
Dan Gohman54392c12008-04-19 00:24:39 +00004831 (yyval.ConstVal) = cast<GlobalValue>(V);
4832 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004833 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004834 ;}
4835 break;
4836
Chris Lattner8f5544c2008-10-15 06:03:48 +00004837 case 190:
4838#line 1865 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004839 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004840 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004841 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4842 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004843 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004844 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4845 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4846 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004847 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004848 ;}
4849 break;
4850
Chris Lattner8f5544c2008-10-15 06:03:48 +00004851 case 191:
4852#line 1875 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004853 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004854 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004855 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4856 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004857 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4858 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004859 (yyval.ConstVal) = Constant::getNullValue(Ty);
4860 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004861 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004862 ;}
4863 break;
4864
Chris Lattner8f5544c2008-10-15 06:03:48 +00004865 case 192:
4866#line 1885 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004867 { // integral constants
4868 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004869 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004870 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004871 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004872 ;}
4873 break;
4874
Chris Lattner8f5544c2008-10-15 06:03:48 +00004875 case 193:
4876#line 1891 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004877 { // arbitrary precision integer constants
4878 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4879 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004880 GEN_ERROR("Constant value does not fit in type");
4881 }
Dan Gohman54392c12008-04-19 00:24:39 +00004882 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4883 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4884 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004885 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004886 ;}
4887 break;
4888
Chris Lattner8f5544c2008-10-15 06:03:48 +00004889 case 194:
4890#line 1901 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004891 { // integral constants
4892 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004893 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004894 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004895 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004896 ;}
4897 break;
4898
Chris Lattner8f5544c2008-10-15 06:03:48 +00004899 case 195:
4900#line 1907 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004901 { // arbitrary precision integer constants
4902 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4903 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004904 GEN_ERROR("Constant value does not fit in type");
Eric Christopher329d2672008-09-24 04:55:49 +00004905 }
Dan Gohman54392c12008-04-19 00:24:39 +00004906 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4907 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4908 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004909 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004910 ;}
4911 break;
4912
Chris Lattner8f5544c2008-10-15 06:03:48 +00004913 case 196:
4914#line 1917 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004915 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004916 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4917 GEN_ERROR("Constant true must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004918 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004919 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004920 ;}
4921 break;
4922
Chris Lattner8f5544c2008-10-15 06:03:48 +00004923 case 197:
4924#line 1923 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004925 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004926 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4927 GEN_ERROR("Constant false must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004928 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004929 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004930 ;}
4931 break;
4932
Chris Lattner8f5544c2008-10-15 06:03:48 +00004933 case 198:
4934#line 1929 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004935 { // Floating point constants
4936 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004937 GEN_ERROR("Floating point constant invalid for type");
Eric Christopher329d2672008-09-24 04:55:49 +00004938 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004939 // as double. Fix this here. Long double is done right.
Dale Johannesen5ba85fd2008-10-09 23:01:34 +00004940 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) {
4941 bool ignored;
4942 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
4943 &ignored);
4944 }
Chris Lattner05ba86e2008-04-20 00:41:19 +00004945 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004946 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004947 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004948 ;}
4949 break;
4950
Chris Lattner8f5544c2008-10-15 06:03:48 +00004951 case 199:
4952#line 1945 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004953 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004954 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004955 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4956 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4957 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4958 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004959 GEN_ERROR("invalid cast opcode for cast from '" +
4960 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00004961 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004962 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4963 delete (yyvsp[(5) - (6)].TypeVal);
4964 ;}
4965 break;
4966
Chris Lattner8f5544c2008-10-15 06:03:48 +00004967 case 200:
4968#line 1957 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004969 {
4970 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004971 GEN_ERROR("GetElementPtr requires a pointer operand");
4972
4973 const Type *IdxTy =
Dan Gohman8055f772008-05-15 19:50:34 +00004974 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004975 if (!IdxTy)
4976 GEN_ERROR("Index list invalid for constant getelementptr");
4977
4978 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00004979 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4980 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004981 IdxVec.push_back(C);
4982 else
4983 GEN_ERROR("Indices to constant getelementptr must be constants");
4984
Dan Gohman54392c12008-04-19 00:24:39 +00004985 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004986
Dan Gohman54392c12008-04-19 00:24:39 +00004987 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004988 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004989 ;}
4990 break;
4991
Chris Lattner8f5544c2008-10-15 06:03:48 +00004992 case 201:
4993#line 1978 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004994 {
4995 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004996 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00004997 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004998 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004999 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005000 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005001 ;}
5002 break;
5003
Chris Lattner8f5544c2008-10-15 06:03:48 +00005004 case 202:
5005#line 1986 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005006 {
5007 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005008 GEN_ERROR("Binary operator types must match");
5009 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00005010 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5011 ;}
5012 break;
5013
Chris Lattner8f5544c2008-10-15 06:03:48 +00005014 case 203:
5015#line 1992 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005016 {
5017 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005018 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005019 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher329d2672008-09-24 04:55:49 +00005020 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00005021 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005022 GEN_ERROR("Logical operator requires integral operands");
5023 }
Dan Gohman54392c12008-04-19 00:24:39 +00005024 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005025 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005026 ;}
5027 break;
5028
Chris Lattner8f5544c2008-10-15 06:03:48 +00005029 case 204:
5030#line 2003 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005031 {
5032 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005033 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005034 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5035 ;}
5036 break;
5037
Chris Lattner8f5544c2008-10-15 06:03:48 +00005038 case 205:
5039#line 2008 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005040 {
5041 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005042 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005043 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5044 ;}
5045 break;
5046
Chris Lattner8f5544c2008-10-15 06:03:48 +00005047 case 206:
5048#line 2013 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005049 {
5050 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5051 GEN_ERROR("vicmp operand types must match");
5052 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5053 ;}
5054 break;
5055
Chris Lattner8f5544c2008-10-15 06:03:48 +00005056 case 207:
5057#line 2018 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005058 {
5059 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5060 GEN_ERROR("vfcmp operand types must match");
5061 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5062 ;}
5063 break;
5064
Chris Lattner8f5544c2008-10-15 06:03:48 +00005065 case 208:
5066#line 2023 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005067 {
5068 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005069 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005070 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005071 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005072 ;}
5073 break;
5074
Chris Lattner8f5544c2008-10-15 06:03:48 +00005075 case 209:
5076#line 2029 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005077 {
5078 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005079 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005080 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005081 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005082 ;}
5083 break;
5084
Chris Lattner8f5544c2008-10-15 06:03:48 +00005085 case 210:
5086#line 2035 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005087 {
5088 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005089 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005090 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005091 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005092 ;}
5093 break;
5094
Chris Lattner8f5544c2008-10-15 06:03:48 +00005095 case 211:
5096#line 2041 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005097 {
5098 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5099 GEN_ERROR("ExtractValue requires an aggregate operand");
5100
Dan Gohmane5febe42008-05-31 00:58:22 +00005101 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5102 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005103 CHECK_FOR_ERROR
5104 ;}
5105 break;
5106
Chris Lattner8f5544c2008-10-15 06:03:48 +00005107 case 212:
5108#line 2049 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005109 {
5110 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5111 GEN_ERROR("InsertValue requires an aggregate operand");
5112
Dan Gohmane5febe42008-05-31 00:58:22 +00005113 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5114 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005115 CHECK_FOR_ERROR
5116 ;}
5117 break;
5118
Chris Lattner8f5544c2008-10-15 06:03:48 +00005119 case 213:
5120#line 2060 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005121 {
5122 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005123 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005124 ;}
5125 break;
5126
Chris Lattner8f5544c2008-10-15 06:03:48 +00005127 case 214:
5128#line 2064 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005129 {
5130 (yyval.ConstVector) = new std::vector<Constant*>();
5131 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005132 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005133 ;}
5134 break;
5135
Chris Lattner8f5544c2008-10-15 06:03:48 +00005136 case 215:
5137#line 2072 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005138 { (yyval.BoolVal) = false; ;}
Nate Begeman646fa482008-05-12 19:01:56 +00005139 break;
5140
Chris Lattner8f5544c2008-10-15 06:03:48 +00005141 case 216:
5142#line 2072 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5143 { (yyval.BoolVal) = true; ;}
5144 break;
5145
Devang Patel5df692d2008-09-02 20:52:40 +00005146 case 217:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005147#line 2075 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005148 { (yyval.BoolVal) = true; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005149 break;
5150
Devang Patel5df692d2008-09-02 20:52:40 +00005151 case 218:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005152#line 2075 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005153 { (yyval.BoolVal) = false; ;}
5154 break;
5155
Chris Lattner8f5544c2008-10-15 06:03:48 +00005156 case 219:
5157#line 2078 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005158 {
5159 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5160 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00005161 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005162 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5163 if (!Aliasee)
5164 GEN_ERROR("Aliases can be created only to global values");
5165
Dan Gohman54392c12008-04-19 00:24:39 +00005166 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005167 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005168 delete (yyvsp[(1) - (2)].TypeVal);
5169 ;}
5170 break;
5171
Chris Lattner8f5544c2008-10-15 06:03:48 +00005172 case 220:
5173#line 2090 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005174 {
5175 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5176 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5177 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005178 GEN_ERROR("invalid cast opcode for cast from '" +
5179 Val->getType()->getDescription() + "' to '" +
5180 DestTy->getDescription() + "'");
Eric Christopher329d2672008-09-24 04:55:49 +00005181
Dan Gohman54392c12008-04-19 00:24:39 +00005182 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005183 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005184 delete (yyvsp[(5) - (6)].TypeVal);
5185 ;}
5186 break;
5187
Chris Lattner8f5544c2008-10-15 06:03:48 +00005188 case 221:
5189#line 2111 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5190 {
5191 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5192 CurModule.ModuleDone();
5193 CHECK_FOR_ERROR;
5194 ;}
5195 break;
5196
Devang Patel5df692d2008-09-02 20:52:40 +00005197 case 222:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005198#line 2116 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005199 {
5200 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5201 CurModule.ModuleDone();
5202 CHECK_FOR_ERROR;
5203 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005204 break;
5205
Chris Lattner8f5544c2008-10-15 06:03:48 +00005206 case 225:
5207#line 2129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005208 { CurFun.isDeclare = false; ;}
5209 break;
5210
Chris Lattner8f5544c2008-10-15 06:03:48 +00005211 case 226:
5212#line 2129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005213 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005214 CurFun.FunctionDone();
5215 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005216 ;}
5217 break;
5218
Chris Lattner8f5544c2008-10-15 06:03:48 +00005219 case 227:
5220#line 2133 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005221 { CurFun.isDeclare = true; ;}
5222 break;
5223
Chris Lattner8f5544c2008-10-15 06:03:48 +00005224 case 228:
5225#line 2133 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5226 {
5227 CHECK_FOR_ERROR
5228 ;}
5229 break;
5230
Devang Patel5df692d2008-09-02 20:52:40 +00005231 case 229:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005232#line 2136 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005233 {
5234 CHECK_FOR_ERROR
5235 ;}
5236 break;
5237
Devang Patel5df692d2008-09-02 20:52:40 +00005238 case 230:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005239#line 2139 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005240 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005241 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005242 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005243 // Eagerly resolve types. This is not an optimization, this is a
5244 // requirement that is due to the fact that we could have this:
5245 //
5246 // %list = type { %list * }
5247 // %list = type { %list * } ; repeated type decl
5248 //
5249 // If types are not resolved eagerly, then the two types will not be
5250 // determined to be the same type!
5251 //
Dan Gohman54392c12008-04-19 00:24:39 +00005252 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005253
Dan Gohman54392c12008-04-19 00:24:39 +00005254 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005255 CHECK_FOR_ERROR
5256 // If this is a named type that is not a redefinition, add it to the slot
5257 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005258 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005259 }
5260
Dan Gohman54392c12008-04-19 00:24:39 +00005261 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005262 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005263 ;}
5264 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005265
Chris Lattner8f5544c2008-10-15 06:03:48 +00005266 case 231:
5267#line 2163 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005268 {
5269 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5270
5271 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005272 CHECK_FOR_ERROR
5273 // If this is a named type that is not a redefinition, add it to the slot
5274 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005275 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005276 }
5277 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005278 ;}
5279 break;
5280
Chris Lattner8f5544c2008-10-15 06:03:48 +00005281 case 232:
5282#line 2175 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005283 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005284 /* "Externally Visible" Linkage */
Eric Christopher329d2672008-09-24 04:55:49 +00005285 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005286 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005287 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5288 (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 +00005289 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005290 ;}
5291 break;
5292
Chris Lattner8f5544c2008-10-15 06:03:48 +00005293 case 233:
5294#line 2182 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005295 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005296 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005297 ;}
5298 break;
5299
Chris Lattner8f5544c2008-10-15 06:03:48 +00005300 case 234:
5301#line 2186 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005302 {
Eric Christopher329d2672008-09-24 04:55:49 +00005303 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005304 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005305 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 +00005306 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005307 ;}
5308 break;
5309
Chris Lattner8f5544c2008-10-15 06:03:48 +00005310 case 235:
5311#line 2191 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005312 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005313 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005314 ;}
5315 break;
5316
Chris Lattner8f5544c2008-10-15 06:03:48 +00005317 case 236:
5318#line 2195 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005319 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005320 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005321 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5322 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 +00005323 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005324 delete (yyvsp[(6) - (7)].TypeVal);
5325 ;}
5326 break;
5327
Chris Lattner8f5544c2008-10-15 06:03:48 +00005328 case 237:
5329#line 2201 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005330 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005331 CurGV = 0;
5332 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005333 ;}
5334 break;
5335
Chris Lattner8f5544c2008-10-15 06:03:48 +00005336 case 238:
5337#line 2205 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005338 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005339 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005340 if ((yyvsp[(1) - (5)].StrVal)) {
5341 Name = *(yyvsp[(1) - (5)].StrVal);
5342 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005343 }
5344 if (Name.empty())
5345 GEN_ERROR("Alias name cannot be empty");
Eric Christopher329d2672008-09-24 04:55:49 +00005346
Dan Gohman54392c12008-04-19 00:24:39 +00005347 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005348 if (Aliasee == 0)
5349 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5350
Dan Gohman54392c12008-04-19 00:24:39 +00005351 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005352 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005353 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005354 InsertValue(GA, CurModule.Values);
Eric Christopher329d2672008-09-24 04:55:49 +00005355
5356
Chris Lattner5eefce32007-09-10 23:24:14 +00005357 // If there was a forward reference of this alias, resolve it now.
Eric Christopher329d2672008-09-24 04:55:49 +00005358
Chris Lattner5eefce32007-09-10 23:24:14 +00005359 ValID ID;
5360 if (!Name.empty())
5361 ID = ValID::createGlobalName(Name);
5362 else
5363 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher329d2672008-09-24 04:55:49 +00005364
Chris Lattner5eefce32007-09-10 23:24:14 +00005365 if (GlobalValue *FWGV =
5366 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5367 // Replace uses of the fwdref with the actual alias.
5368 FWGV->replaceAllUsesWith(GA);
5369 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5370 GV->eraseFromParent();
5371 else
5372 cast<Function>(FWGV)->eraseFromParent();
5373 }
5374 ID.destroy();
Eric Christopher329d2672008-09-24 04:55:49 +00005375
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005376 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005377 ;}
5378 break;
5379
Chris Lattner8f5544c2008-10-15 06:03:48 +00005380 case 239:
5381#line 2245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5382 {
5383 CHECK_FOR_ERROR
5384 ;}
5385 break;
5386
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005387 case 240:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005388#line 2248 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005389 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005390 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005391 ;}
5392 break;
5393
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00005394 case 241:
Chris Lattner8f5544c2008-10-15 06:03:48 +00005395#line 2254 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005396 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005397 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5398 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005399 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005400 else
Dan Gohman54392c12008-04-19 00:24:39 +00005401 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5402 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005403 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005404;}
5405 break;
5406
Chris Lattner8f5544c2008-10-15 06:03:48 +00005407 case 242:
5408#line 2264 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005409 {
5410 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5411 delete (yyvsp[(3) - (3)].StrVal);
5412 ;}
5413 break;
5414
Chris Lattner8f5544c2008-10-15 06:03:48 +00005415 case 243:
5416#line 2268 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005417 {
5418 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5419 delete (yyvsp[(3) - (3)].StrVal);
5420 ;}
5421 break;
5422
Chris Lattner8f5544c2008-10-15 06:03:48 +00005423 case 245:
5424#line 2275 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005425 {
5426 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5427 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005428 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005429 ;}
5430 break;
5431
Chris Lattner8f5544c2008-10-15 06:03:48 +00005432 case 246:
5433#line 2280 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005434 {
5435 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5436 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005437 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005438 ;}
5439 break;
5440
Chris Lattner8f5544c2008-10-15 06:03:48 +00005441 case 247:
5442#line 2285 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005443 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005444 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005445 ;}
5446 break;
5447
Chris Lattner8f5544c2008-10-15 06:03:48 +00005448 case 248:
5449#line 2294 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005450 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005451 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005453 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5454 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005455 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 +00005456 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5457 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005458 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005459 ;}
5460 break;
5461
Chris Lattner8f5544c2008-10-15 06:03:48 +00005462 case 249:
5463#line 2304 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005464 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005465 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005466 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005467 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5468 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005469 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 +00005470 (yyval.ArgList) = new ArgListType;
5471 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005472 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005473 ;}
5474 break;
5475
Chris Lattner8f5544c2008-10-15 06:03:48 +00005476 case 250:
5477#line 2315 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005478 {
5479 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005480 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005481 ;}
5482 break;
5483
Chris Lattner8f5544c2008-10-15 06:03:48 +00005484 case 251:
5485#line 2319 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005486 {
5487 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005488 struct ArgListEntry E;
5489 E.Ty = new PATypeHolder(Type::VoidTy);
5490 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005491 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005492 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005493 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005494 ;}
5495 break;
5496
Chris Lattner8f5544c2008-10-15 06:03:48 +00005497 case 252:
5498#line 2328 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005499 {
5500 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005501 struct ArgListEntry E;
5502 E.Ty = new PATypeHolder(Type::VoidTy);
5503 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005504 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005505 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005506 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005507 ;}
5508 break;
5509
Chris Lattner8f5544c2008-10-15 06:03:48 +00005510 case 253:
5511#line 2337 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005512 {
5513 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005514 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005515 ;}
5516 break;
5517
Chris Lattner8f5544c2008-10-15 06:03:48 +00005518 case 254:
5519#line 2343 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005520 {
Devang Patelcd842482008-09-29 20:49:50 +00005521 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5522 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher329d2672008-09-24 04:55:49 +00005523
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005524 // Check the function result for abstractness if this is a define. We should
5525 // have no abstract types at this point
Devang Patelcd842482008-09-29 20:49:50 +00005526 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5527 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005528
Devang Patelcd842482008-09-29 20:49:50 +00005529 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00005530 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00005531
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005532 std::vector<const Type*> ParamTypeList;
Devang Pateld222f862008-09-25 21:00:45 +00005533 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005534 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5535 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00005536 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5537 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5538 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005539 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00005540 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005541 }
Devang Patelcd842482008-09-29 20:49:50 +00005542 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005543 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00005544 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005545 }
Devang Patelcd842482008-09-29 20:49:50 +00005546 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005547 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00005548 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005549 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00005550 }
Devang Patelcd842482008-09-29 20:49:50 +00005551 if (RetAttrs != Attribute::None)
5552 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5553 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005554 unsigned index = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005555 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005556 const Type* Ty = I->Ty->get();
5557 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5558 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5559 ParamTypeList.push_back(Ty);
Devang Pateld222f862008-09-25 21:00:45 +00005560 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5561 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005562 }
5563 }
Devang Patelcd842482008-09-29 20:49:50 +00005564 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5565 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005566
5567 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5568 if (isVarArg) ParamTypeList.pop_back();
5569
Devang Pateld222f862008-09-25 21:00:45 +00005570 AttrListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005571 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00005572 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005573
Devang Patelcd842482008-09-29 20:49:50 +00005574 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005575 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patelcd842482008-09-29 20:49:50 +00005576 delete (yyvsp[(3) - (11)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005577
5578 ValID ID;
5579 if (!FunctionName.empty()) {
5580 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5581 } else {
5582 ID = ValID::createGlobalID(CurModule.Values.size());
5583 }
5584
5585 Function *Fn = 0;
5586 // See if this function was forward referenced. If so, recycle the object.
5587 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher329d2672008-09-24 04:55:49 +00005588 // Move the function to the end of the list, from whereever it was
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005589 // previously inserted.
5590 Fn = cast<Function>(FWRef);
Devang Pateld222f862008-09-25 21:00:45 +00005591 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner1c8733e2008-03-12 17:45:29 +00005592 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005593 CurModule.CurrentModule->getFunctionList().remove(Fn);
5594 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5595 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5596 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005597 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005598 // The existing function doesn't have the same type. This is an overload
5599 // error.
5600 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Pateld222f862008-09-25 21:00:45 +00005601 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005602 // The existing function doesn't have the same parameter attributes.
5603 // This is an overload error.
5604 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005605 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5606 // Neither the existing or the current function is a declaration and they
5607 // have the same name and same type. Clearly this is a redefinition.
5608 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005609 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005610 // Make sure to strip off any argument names so we can't get conflicts.
5611 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5612 AI != AE; ++AI)
5613 AI->setName("");
5614 }
5615 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005616 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5617 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005618 InsertValue(Fn, CurModule.Values);
5619 }
5620
Nuno Lopese20dbca2008-10-03 15:45:58 +00005621 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005622 CurFun.FunctionStart(Fn);
5623
5624 if (CurFun.isDeclare) {
5625 // If we have declaration, always overwrite linkage. This will allow us to
5626 // correctly handle cases, when pointer to function is passed as argument to
5627 // another function.
5628 Fn->setLinkage(CurFun.Linkage);
5629 Fn->setVisibility(CurFun.Visibility);
5630 }
Devang Patel5df692d2008-09-02 20:52:40 +00005631 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00005632 Fn->setAttributes(PAL);
Devang Patelcd842482008-09-29 20:49:50 +00005633 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5634 if ((yyvsp[(9) - (11)].StrVal)) {
5635 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5636 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005637 }
Devang Patelcd842482008-09-29 20:49:50 +00005638 if ((yyvsp[(11) - (11)].StrVal)) {
5639 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5640 delete (yyvsp[(11) - (11)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005641 }
5642
5643 // Add all of the arguments we parsed to the function...
Devang Patelcd842482008-09-29 20:49:50 +00005644 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005645 if (isVarArg) { // Nuke the last entry
Devang Patelcd842482008-09-29 20:49:50 +00005646 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005647 "Not a varargs marker!");
Devang Patelcd842482008-09-29 20:49:50 +00005648 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5649 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005650 }
5651 Function::arg_iterator ArgIt = Fn->arg_begin();
5652 Function::arg_iterator ArgEnd = Fn->arg_end();
5653 unsigned Idx = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005654 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5655 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005656 delete I->Ty; // Delete the typeholder...
5657 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5658 CHECK_FOR_ERROR
5659 InsertValue(ArgIt);
5660 Idx++;
5661 }
5662
Devang Patelcd842482008-09-29 20:49:50 +00005663 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005664 }
5665 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005666;}
5667 break;
5668
Chris Lattner8f5544c2008-10-15 06:03:48 +00005669 case 257:
5670#line 2493 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005671 {
5672 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005673
5674 // Make sure that we keep track of the linkage type even if there was a
5675 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005676 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5677 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5678;}
5679 break;
5680
Chris Lattner8f5544c2008-10-15 06:03:48 +00005681 case 260:
5682#line 2504 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005683 {
5684 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005685 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005686;}
5687 break;
5688
Chris Lattner8f5544c2008-10-15 06:03:48 +00005689 case 261:
5690#line 2509 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005691 {
5692 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5693 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5694 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005695 CurFun.FunctionDone();
5696 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005697 ;}
5698 break;
5699
Chris Lattner8f5544c2008-10-15 06:03:48 +00005700 case 262:
5701#line 2521 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005702 {
5703 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005704 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005705 ;}
5706 break;
5707
Chris Lattner8f5544c2008-10-15 06:03:48 +00005708 case 263:
5709#line 2525 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005710 {
5711 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005712 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005713 ;}
5714 break;
5715
Chris Lattner8f5544c2008-10-15 06:03:48 +00005716 case 264:
5717#line 2530 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005718 { // A reference to a direct constant
5719 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005720 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005721 ;}
5722 break;
5723
Chris Lattner8f5544c2008-10-15 06:03:48 +00005724 case 265:
5725#line 2534 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005726 {
5727 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005728 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005729 ;}
5730 break;
5731
Chris Lattner8f5544c2008-10-15 06:03:48 +00005732 case 266:
5733#line 2538 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005734 { // arbitrary precision integer constants
5735 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5736 delete (yyvsp[(1) - (1)].APIntVal);
5737 CHECK_FOR_ERROR
5738 ;}
5739 break;
5740
Chris Lattner8f5544c2008-10-15 06:03:48 +00005741 case 267:
5742#line 2543 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005743 { // arbitrary precision integer constants
5744 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5745 delete (yyvsp[(1) - (1)].APIntVal);
5746 CHECK_FOR_ERROR
5747 ;}
5748 break;
5749
Chris Lattner8f5544c2008-10-15 06:03:48 +00005750 case 268:
5751#line 2548 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005752 { // Perhaps it's an FP constant?
5753 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005754 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005755 ;}
5756 break;
5757
Chris Lattner8f5544c2008-10-15 06:03:48 +00005758 case 269:
5759#line 2552 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005760 {
5761 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005762 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005763 ;}
5764 break;
5765
Chris Lattner8f5544c2008-10-15 06:03:48 +00005766 case 270:
5767#line 2556 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005768 {
5769 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005770 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005771 ;}
5772 break;
5773
Chris Lattner8f5544c2008-10-15 06:03:48 +00005774 case 271:
5775#line 2560 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005776 {
5777 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005778 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005779 ;}
5780 break;
5781
Chris Lattner8f5544c2008-10-15 06:03:48 +00005782 case 272:
5783#line 2564 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005784 {
5785 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005786 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005787 ;}
5788 break;
5789
Chris Lattner8f5544c2008-10-15 06:03:48 +00005790 case 273:
5791#line 2568 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005792 { // A vector zero constant.
5793 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005794 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005795 ;}
5796 break;
5797
Chris Lattner8f5544c2008-10-15 06:03:48 +00005798 case 274:
5799#line 2572 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005800 { // Nonempty unsized packed vector
5801 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005802 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmane5febe42008-05-31 00:58:22 +00005803
5804 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5805 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00005806
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005807 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005808 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher329d2672008-09-24 04:55:49 +00005809
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005810 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005811 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5812 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005813 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005814 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005815 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005816 }
5817
Dan Gohman54392c12008-04-19 00:24:39 +00005818 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5819 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005820 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005821 ;}
5822 break;
5823
Chris Lattner8f5544c2008-10-15 06:03:48 +00005824 case 275:
5825#line 2594 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005826 { // Nonempty unsized arr
5827 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005828 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005829
5830 if (!ETy->isFirstClassType())
5831 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5832
5833 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5834 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5835
5836 // Verify all elements are correct type!
5837 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5838 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005839 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005840 ETy->getDescription() +"' as required!\nIt is of type '"+
5841 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5842 }
5843
5844 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5845 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5846 CHECK_FOR_ERROR
5847 ;}
5848 break;
5849
Chris Lattner8f5544c2008-10-15 06:03:48 +00005850 case 276:
5851#line 2616 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005852 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005853 // Use undef instead of an array because it's inconvenient to determine
5854 // the element type at this point, there being no elements to examine.
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005855 (yyval.ValIDVal) = ValID::createUndef();
5856 CHECK_FOR_ERROR
5857 ;}
5858 break;
5859
Chris Lattner8f5544c2008-10-15 06:03:48 +00005860 case 277:
5861#line 2622 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005862 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005863 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005864 const Type *ETy = Type::Int8Ty;
5865
5866 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5867
5868 std::vector<Constant*> Vals;
5869 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5870 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5871 delete (yyvsp[(2) - (2)].StrVal);
5872 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5873 CHECK_FOR_ERROR
5874 ;}
5875 break;
5876
Chris Lattner8f5544c2008-10-15 06:03:48 +00005877 case 278:
5878#line 2635 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005879 {
5880 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5881 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5882 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5883
5884 const StructType *STy = StructType::get(Elements);
5885 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5886
5887 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5888 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5889 CHECK_FOR_ERROR
5890 ;}
5891 break;
5892
Chris Lattner8f5544c2008-10-15 06:03:48 +00005893 case 279:
5894#line 2647 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005895 {
5896 const StructType *STy = StructType::get(std::vector<const Type*>());
5897 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5898 CHECK_FOR_ERROR
5899 ;}
5900 break;
5901
Chris Lattner8f5544c2008-10-15 06:03:48 +00005902 case 280:
5903#line 2652 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005904 {
5905 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5906 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5907 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5908
5909 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5910 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5911
5912 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5913 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5914 CHECK_FOR_ERROR
5915 ;}
5916 break;
5917
Chris Lattner8f5544c2008-10-15 06:03:48 +00005918 case 281:
5919#line 2664 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005920 {
5921 const StructType *STy = StructType::get(std::vector<const Type*>(),
5922 /*isPacked=*/true);
5923 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5924 CHECK_FOR_ERROR
5925 ;}
5926 break;
5927
Chris Lattner8f5544c2008-10-15 06:03:48 +00005928 case 282:
5929#line 2670 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005930 {
5931 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005932 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005933 ;}
5934 break;
5935
Chris Lattner8f5544c2008-10-15 06:03:48 +00005936 case 283:
5937#line 2674 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005938 {
5939 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5940 delete (yyvsp[(3) - (5)].StrVal);
5941 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005942 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005943 ;}
5944 break;
5945
Chris Lattner8f5544c2008-10-15 06:03:48 +00005946 case 284:
5947#line 2684 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005948 { // Is it an integer reference...?
5949 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005950 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005951 ;}
5952 break;
5953
Chris Lattner8f5544c2008-10-15 06:03:48 +00005954 case 285:
5955#line 2688 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005956 {
5957 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005958 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005959 ;}
5960 break;
5961
Chris Lattner8f5544c2008-10-15 06:03:48 +00005962 case 286:
5963#line 2692 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005964 { // Is it a named reference...?
5965 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5966 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005967 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005968 ;}
5969 break;
5970
Chris Lattner8f5544c2008-10-15 06:03:48 +00005971 case 287:
5972#line 2697 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005973 { // Is it a named reference...?
5974 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5975 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005976 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005977 ;}
5978 break;
5979
Chris Lattner8f5544c2008-10-15 06:03:48 +00005980 case 290:
5981#line 2710 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005982 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005983 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005984 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00005985 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00005986 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005987 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005988 ;}
5989 break;
5990
Chris Lattner8f5544c2008-10-15 06:03:48 +00005991 case 291:
5992#line 2719 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005993 {
5994 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher329d2672008-09-24 04:55:49 +00005995 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005996 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005997 ;}
5998 break;
5999
Chris Lattner8f5544c2008-10-15 06:03:48 +00006000 case 292:
6001#line 2724 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006002 {
Eric Christopher329d2672008-09-24 04:55:49 +00006003 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00006004 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006005 ;}
6006 break;
6007
Chris Lattner8f5544c2008-10-15 06:03:48 +00006008 case 293:
6009#line 2729 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006010 {
6011 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006012 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006013 ;}
6014 break;
6015
Chris Lattner8f5544c2008-10-15 06:03:48 +00006016 case 294:
6017#line 2733 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006018 { // Do not allow functions with 0 basic blocks
Dan Gohman54392c12008-04-19 00:24:39 +00006019 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006020 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006021 ;}
6022 break;
6023
Chris Lattner8f5544c2008-10-15 06:03:48 +00006024 case 295:
6025#line 2742 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006026 {
6027 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006028 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006029 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6030 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6031 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006032 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006033 ;}
6034 break;
6035
Chris Lattner8f5544c2008-10-15 06:03:48 +00006036 case 296:
6037#line 2751 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006038 {
6039 CHECK_FOR_ERROR
6040 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6041 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6042 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6043 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher329d2672008-09-24 04:55:49 +00006044
Chris Lattner906773a2008-08-29 17:20:18 +00006045 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6046 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6047 CHECK_FOR_ERROR
6048;}
6049 break;
6050
Chris Lattner8f5544c2008-10-15 06:03:48 +00006051 case 297:
6052#line 2764 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006053 {
6054 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006055 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6056 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00006057 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6058 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6059 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006060 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006061 ;}
6062 break;
Chris Lattner59363a32008-02-19 04:36:25 +00006063
Chris Lattner8f5544c2008-10-15 06:03:48 +00006064 case 298:
6065#line 2773 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006066 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00006067 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00006068 CHECK_FOR_ERROR
6069 ;}
6070 break;
6071
Chris Lattner8f5544c2008-10-15 06:03:48 +00006072 case 299:
6073#line 2777 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00006074 { // Labelled (named) basic block
6075 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6076 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006077 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00006078
Dan Gohman54392c12008-04-19 00:24:39 +00006079 ;}
6080 break;
6081
Chris Lattner8f5544c2008-10-15 06:03:48 +00006082 case 300:
6083#line 2785 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006084 { // Return with a result...
6085 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6086 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006087 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6088 if (VL.size() > 1 ||
6089 (isa<StructType>(ReturnType) &&
6090 (VL.empty() || VL[0]->getType() != ReturnType))) {
6091 Value *RV = UndefValue::get(ReturnType);
6092 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6093 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6094 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6095 RV = I;
6096 }
6097 (yyval.TermInstVal) = ReturnInst::Create(RV);
6098 } else {
6099 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6100 }
Dan Gohman54392c12008-04-19 00:24:39 +00006101 delete (yyvsp[(2) - (2)].ValueList);
6102 CHECK_FOR_ERROR
6103 ;}
6104 break;
6105
Chris Lattner8f5544c2008-10-15 06:03:48 +00006106 case 301:
6107#line 2805 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006108 { // Return with no result...
6109 (yyval.TermInstVal) = ReturnInst::Create();
6110 CHECK_FOR_ERROR
6111 ;}
6112 break;
6113
Chris Lattner8f5544c2008-10-15 06:03:48 +00006114 case 302:
6115#line 2809 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006116 { // Unconditional Branch...
6117 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6118 CHECK_FOR_ERROR
6119 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6120 ;}
6121 break;
6122
Chris Lattner8f5544c2008-10-15 06:03:48 +00006123 case 303:
6124#line 2814 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006125 {
Dan Gohmane5febe42008-05-31 00:58:22 +00006126 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6127 GEN_ERROR("Branch condition must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00006128 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6129 CHECK_FOR_ERROR
6130 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6131 CHECK_FOR_ERROR
6132 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6133 CHECK_FOR_ERROR
6134 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6135 ;}
6136 break;
6137
Chris Lattner8f5544c2008-10-15 06:03:48 +00006138 case 304:
6139#line 2825 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006140 {
6141 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6142 CHECK_FOR_ERROR
6143 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6144 CHECK_FOR_ERROR
6145 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6146 (yyval.TermInstVal) = S;
6147
6148 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6149 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006150 for (; I != E; ++I) {
6151 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6152 S->addCase(CI, I->second);
6153 else
6154 GEN_ERROR("Switch case is constant, but not a simple integer");
6155 }
Dan Gohman54392c12008-04-19 00:24:39 +00006156 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006157 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006158 ;}
6159 break;
6160
Chris Lattner8f5544c2008-10-15 06:03:48 +00006161 case 305:
6162#line 2844 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006163 {
6164 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006165 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006166 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006167 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00006168 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00006169 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006170 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006171 ;}
6172 break;
6173
Chris Lattner8f5544c2008-10-15 06:03:48 +00006174 case 306:
6175#line 2854 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006176 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006177
6178 // Handle the short syntax
6179 const PointerType *PFTy = 0;
6180 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006181 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006182 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6183 // Pull out the types of all of the arguments...
6184 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006185 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006186 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006187 const Type *Ty = I->Val->getType();
6188 if (Ty == Type::VoidTy)
6189 GEN_ERROR("Short call syntax cannot be used with varargs");
6190 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006191 }
Eric Christopher329d2672008-09-24 04:55:49 +00006192
Devang Patelcd842482008-09-29 20:49:50 +00006193 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006194 GEN_ERROR("Invalid result type for LLVM function");
6195
Devang Patelcd842482008-09-29 20:49:50 +00006196 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006197 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006198 }
6199
Devang Patelcd842482008-09-29 20:49:50 +00006200 delete (yyvsp[(4) - (15)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006201
Devang Patelcd842482008-09-29 20:49:50 +00006202 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006203 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006204 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006205 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006206 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006207 CHECK_FOR_ERROR
6208
Devang Pateld222f862008-09-25 21:00:45 +00006209 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006210 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6211 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006212 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6213 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6214 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006215 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006216 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006217 }
Devang Patelcd842482008-09-29 20:49:50 +00006218 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006219 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006220 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006221 }
Devang Patelcd842482008-09-29 20:49:50 +00006222 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006223 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006224 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006225 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006226 }
Devang Patelcd842482008-09-29 20:49:50 +00006227 if (RetAttrs != Attribute::None)
6228 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006229
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006230 // Check the arguments
6231 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006232 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006233 // Make sure no arguments is a good thing!
6234 if (Ty->getNumParams() != 0)
6235 GEN_ERROR("No arguments passed to a function that "
6236 "expects arguments");
6237 } else { // Has arguments?
6238 // Loop through FunctionType's arguments and ensure they are specified
6239 // correctly!
6240 FunctionType::param_iterator I = Ty->param_begin();
6241 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006242 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006243 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006244
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006245 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006246 if (ArgI->Val->getType() != *I)
6247 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6248 (*I)->getDescription() + "'");
6249 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006250 if (ArgI->Attrs != Attribute::None)
6251 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006252 }
6253
6254 if (Ty->isVarArg()) {
6255 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006256 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006257 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006258 if (ArgI->Attrs != Attribute::None)
6259 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006260 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006261 } else if (I != E || ArgI != ArgE)
6262 GEN_ERROR("Invalid number of parameters detected");
6263 }
Devang Patelcd842482008-09-29 20:49:50 +00006264 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6265 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Pateld222f862008-09-25 21:00:45 +00006266 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006267 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006268 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006269
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006270 // Create the InvokeInst
Dan Gohman8055f772008-05-15 19:50:34 +00006271 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6272 Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006273 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006274 II->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006275 (yyval.TermInstVal) = II;
Devang Patelcd842482008-09-29 20:49:50 +00006276 delete (yyvsp[(7) - (15)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006277 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006278 ;}
6279 break;
6280
Chris Lattner8f5544c2008-10-15 06:03:48 +00006281 case 307:
6282#line 2957 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006283 {
6284 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006285 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006286 ;}
6287 break;
6288
Chris Lattner8f5544c2008-10-15 06:03:48 +00006289 case 308:
6290#line 2961 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006291 {
6292 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006293 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006294 ;}
6295 break;
6296
Chris Lattner8f5544c2008-10-15 06:03:48 +00006297 case 309:
6298#line 2968 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006299 {
6300 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6301 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006302 CHECK_FOR_ERROR
6303 if (V == 0)
6304 GEN_ERROR("May only switch on a constant pool value");
6305
Dan Gohman54392c12008-04-19 00:24:39 +00006306 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006307 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006308 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6309 ;}
6310 break;
6311
Chris Lattner8f5544c2008-10-15 06:03:48 +00006312 case 310:
6313#line 2979 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006314 {
6315 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6316 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006317 CHECK_FOR_ERROR
6318
6319 if (V == 0)
6320 GEN_ERROR("May only switch on a constant pool value");
6321
Dan Gohman54392c12008-04-19 00:24:39 +00006322 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006323 CHECK_FOR_ERROR
Eric Christopher329d2672008-09-24 04:55:49 +00006324 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohman54392c12008-04-19 00:24:39 +00006325 ;}
6326 break;
6327
Chris Lattner8f5544c2008-10-15 06:03:48 +00006328 case 311:
6329#line 2992 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006330 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006331 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00006332 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006333 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006334 InsertValue((yyvsp[(2) - (2)].InstVal));
6335 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006336 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006337 ;}
6338 break;
6339
Chris Lattner8f5544c2008-10-15 06:03:48 +00006340 case 312:
6341#line 3001 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006342 {
6343 CHECK_FOR_ERROR
6344 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher329d2672008-09-24 04:55:49 +00006345
Chris Lattner906773a2008-08-29 17:20:18 +00006346 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6347 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6348 " is incorrect, expected %" + utostr((unsigned)ValNum));
6349
6350 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6351 CHECK_FOR_ERROR
6352 ;}
6353 break;
6354
Chris Lattner8f5544c2008-10-15 06:03:48 +00006355 case 313:
6356#line 3014 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006357 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006358 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006359 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6360 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6361 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006362 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006363 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006364 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006365 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6366 delete (yyvsp[(1) - (6)].TypeVal);
6367 ;}
6368 break;
6369
Chris Lattner8f5544c2008-10-15 06:03:48 +00006370 case 314:
6371#line 3025 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006372 {
6373 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6374 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006375 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006376 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006377 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006378 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6379 ;}
6380 break;
6381
Chris Lattner8f5544c2008-10-15 06:03:48 +00006382 case 315:
6383#line 3035 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006384 {
Devang Pateld222f862008-09-25 21:00:45 +00006385 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006386 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006388 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00006389 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006390 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 +00006391 (yyval.ParamList)->push_back(E);
6392 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006393 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006394 ;}
6395 break;
6396
Chris Lattner8f5544c2008-10-15 06:03:48 +00006397 case 316:
6398#line 3046 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006399 {
Devang Pateld222f862008-09-25 21:00:45 +00006400 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00006401 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00006402 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006403 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 +00006404 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006405 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006406 ;}
6407 break;
6408
Chris Lattner8f5544c2008-10-15 06:03:48 +00006409 case 317:
6410#line 3054 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006411 {
Devang Pateld222f862008-09-25 21:00:45 +00006412 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006413 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006414 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6415 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006416 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 +00006417 (yyval.ParamList)->push_back(E);
6418 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006419 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006420 ;}
6421 break;
6422
Chris Lattner8f5544c2008-10-15 06:03:48 +00006423 case 318:
6424#line 3064 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006425 {
Devang Pateld222f862008-09-25 21:00:45 +00006426 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00006427 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006428 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 +00006429 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00006430 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006431 ;}
6432 break;
6433
Chris Lattner8f5544c2008-10-15 06:03:48 +00006434 case 319:
6435#line 3071 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006436 { (yyval.ParamList) = new ParamList(); ;}
6437 break;
6438
Chris Lattner8f5544c2008-10-15 06:03:48 +00006439 case 320:
6440#line 3074 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006441 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6442 break;
6443
Chris Lattner8f5544c2008-10-15 06:03:48 +00006444 case 321:
6445#line 3075 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006446 {
6447 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6448 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006449 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006450 ;}
6451 break;
6452
Chris Lattner8f5544c2008-10-15 06:03:48 +00006453 case 322:
6454#line 3083 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006455 {
6456 (yyval.ConstantList) = new std::vector<unsigned>();
6457 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6458 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6459 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6460 ;}
6461 break;
6462
Chris Lattner8f5544c2008-10-15 06:03:48 +00006463 case 323:
6464#line 3089 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006465 {
6466 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6467 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6468 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6469 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6470 CHECK_FOR_ERROR
6471 ;}
6472 break;
6473
Chris Lattner8f5544c2008-10-15 06:03:48 +00006474 case 324:
6475#line 3098 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006476 {
6477 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006478 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006479 ;}
6480 break;
6481
Chris Lattner8f5544c2008-10-15 06:03:48 +00006482 case 325:
6483#line 3102 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006484 {
6485 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006486 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006487 ;}
6488 break;
6489
Chris Lattner8f5544c2008-10-15 06:03:48 +00006490 case 326:
6491#line 3107 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006492 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006493 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006494 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00006495 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohman54392c12008-04-19 00:24:39 +00006496 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006497 GEN_ERROR(
6498 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher329d2672008-09-24 04:55:49 +00006499 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006500 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006501 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006502 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006503 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohman54392c12008-04-19 00:24:39 +00006504 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006505 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006506 delete (yyvsp[(2) - (5)].TypeVal);
6507 ;}
6508 break;
6509
Chris Lattner8f5544c2008-10-15 06:03:48 +00006510 case 327:
6511#line 3123 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006512 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006513 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6515 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begemanbb1ce942008-07-29 15:49:41 +00006516 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00006517 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006518 GEN_ERROR("Logical operator requires integral operands");
6519 }
Dan Gohman54392c12008-04-19 00:24:39 +00006520 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006521 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006522 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006523 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006524 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006525 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006526 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006527 delete (yyvsp[(2) - (5)].TypeVal);
6528 ;}
6529 break;
6530
Chris Lattner8f5544c2008-10-15 06:03:48 +00006531 case 328:
6532#line 3140 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006533 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006534 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006535 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006536 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006537 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006538 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006539 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006540 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006541 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006542 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006543 delete (yyvsp[(3) - (6)].TypeVal);
6544 ;}
6545 break;
6546
Chris Lattner8f5544c2008-10-15 06:03:48 +00006547 case 329:
6548#line 3152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006549 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006550 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006551 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006552 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006553 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006554 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006555 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006556 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006557 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006558 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006559 delete (yyvsp[(3) - (6)].TypeVal);
6560 ;}
6561 break;
6562
Chris Lattner8f5544c2008-10-15 06:03:48 +00006563 case 330:
6564#line 3164 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006565 {
6566 if (!UpRefs.empty())
6567 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6568 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6569 GEN_ERROR("Scalar types not supported by vicmp instruction");
6570 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6571 CHECK_FOR_ERROR
6572 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6573 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006574 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006575 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006576 GEN_ERROR("vicmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006577 delete (yyvsp[(3) - (6)].TypeVal);
6578 ;}
6579 break;
6580
Chris Lattner8f5544c2008-10-15 06:03:48 +00006581 case 331:
6582#line 3178 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006583 {
6584 if (!UpRefs.empty())
6585 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6586 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6587 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6588 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6589 CHECK_FOR_ERROR
6590 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6591 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006592 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006593 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006594 GEN_ERROR("vfcmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006595 delete (yyvsp[(3) - (6)].TypeVal);
6596 ;}
6597 break;
6598
Chris Lattner8f5544c2008-10-15 06:03:48 +00006599 case 332:
6600#line 3192 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006601 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006602 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006603 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6604 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6605 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6606 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006607 GEN_ERROR("invalid cast opcode for cast from '" +
6608 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00006609 DestTy->getDescription() + "'");
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006610 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohman54392c12008-04-19 00:24:39 +00006611 delete (yyvsp[(4) - (4)].TypeVal);
6612 ;}
6613 break;
6614
Chris Lattner8f5544c2008-10-15 06:03:48 +00006615 case 333:
6616#line 3204 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006617 {
Dan Gohman181f4e42008-09-09 01:13:24 +00006618 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6619 // vector select
6620 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6621 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6622 GEN_ERROR("vector select value types must be vector types");
6623 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6624 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6625 if (cond_type->getElementType() != Type::Int1Ty)
6626 GEN_ERROR("vector select condition element type must be boolean");
6627 if (cond_type->getNumElements() != select_type->getNumElements())
6628 GEN_ERROR("vector select number of elements must be the same");
6629 } else {
6630 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6631 GEN_ERROR("select condition must be boolean");
6632 }
Dan Gohman54392c12008-04-19 00:24:39 +00006633 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohman181f4e42008-09-09 01:13:24 +00006634 GEN_ERROR("select value types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00006635 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006636 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006637 ;}
6638 break;
6639
Chris Lattner8f5544c2008-10-15 06:03:48 +00006640 case 334:
6641#line 3225 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006642 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006643 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006644 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6645 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6646 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006647 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006648 ;}
6649 break;
6650
Chris Lattner8f5544c2008-10-15 06:03:48 +00006651 case 335:
6652#line 3232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006653 {
6654 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006655 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006656 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006657 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006658 ;}
6659 break;
6660
Chris Lattner8f5544c2008-10-15 06:03:48 +00006661 case 336:
6662#line 3238 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006663 {
6664 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006665 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006666 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006667 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006668 ;}
6669 break;
6670
Chris Lattner8f5544c2008-10-15 06:03:48 +00006671 case 337:
6672#line 3244 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006673 {
6674 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006675 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006676 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006677 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006678 ;}
6679 break;
6680
Chris Lattner8f5544c2008-10-15 06:03:48 +00006681 case 338:
6682#line 3250 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006683 {
6684 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006685 if (!Ty->isFirstClassType())
6686 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006687 (yyval.InstVal) = PHINode::Create(Ty);
6688 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6689 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher329d2672008-09-24 04:55:49 +00006690 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006691 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006692 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6693 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006694 }
Dan Gohman54392c12008-04-19 00:24:39 +00006695 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006696 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006697 ;}
6698 break;
6699
Chris Lattner8f5544c2008-10-15 06:03:48 +00006700 case 339:
6701#line 3266 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006702 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006703
6704 // Handle the short syntax
6705 const PointerType *PFTy = 0;
6706 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006707 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006708 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6709 // Pull out the types of all of the arguments...
6710 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006711 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006712 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006713 const Type *Ty = I->Val->getType();
6714 if (Ty == Type::VoidTy)
6715 GEN_ERROR("Short call syntax cannot be used with varargs");
6716 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006717 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006718
Devang Patelcd842482008-09-29 20:49:50 +00006719 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006720 GEN_ERROR("Invalid result type for LLVM function");
6721
Devang Patelcd842482008-09-29 20:49:50 +00006722 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006723 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006724 }
6725
Devang Patelcd842482008-09-29 20:49:50 +00006726 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006727 CHECK_FOR_ERROR
6728
6729 // Check for call to invalid intrinsic to avoid crashing later.
6730 if (Function *theF = dyn_cast<Function>(V)) {
6731 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6732 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6733 !theF->getIntrinsicID(true))
6734 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6735 theF->getName() + "'");
6736 }
6737
Devang Pateld222f862008-09-25 21:00:45 +00006738 // Set up the Attributes for the function
6739 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006740 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6741 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006742 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6743 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6744 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006745 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006746 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006747 }
Devang Patelcd842482008-09-29 20:49:50 +00006748 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006749 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006750 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006751 }
Devang Patelcd842482008-09-29 20:49:50 +00006752 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006753 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006754 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006755 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006756 }
Devang Patelcd842482008-09-29 20:49:50 +00006757 if (RetAttrs != Attribute::None)
6758 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006759
Eric Christopher329d2672008-09-24 04:55:49 +00006760 // Check the arguments
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006761 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006762 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006763 // Make sure no arguments is a good thing!
6764 if (Ty->getNumParams() != 0)
6765 GEN_ERROR("No arguments passed to a function that "
6766 "expects arguments");
6767 } else { // Has arguments?
6768 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006769 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006770 FunctionType::param_iterator I = Ty->param_begin();
6771 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006772 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006773 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006774
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006775 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006776 if (ArgI->Val->getType() != *I)
6777 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6778 (*I)->getDescription() + "'");
6779 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006780 if (ArgI->Attrs != Attribute::None)
6781 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006782 }
6783 if (Ty->isVarArg()) {
6784 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006785 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006786 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006787 if (ArgI->Attrs != Attribute::None)
6788 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006789 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006790 } else if (I != E || ArgI != ArgE)
6791 GEN_ERROR("Invalid number of parameters detected");
6792 }
Devang Patelcd842482008-09-29 20:49:50 +00006793 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6794 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006795
Devang Pateld222f862008-09-25 21:00:45 +00006796 // Finish off the Attributes and check them
6797 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006798 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006799 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006800
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006801 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006802 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006803 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6804 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006805 CI->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006806 (yyval.InstVal) = CI;
Devang Patelcd842482008-09-29 20:49:50 +00006807 delete (yyvsp[(7) - (9)].ParamList);
6808 delete (yyvsp[(4) - (9)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006809 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006810 ;}
6811 break;
6812
Chris Lattner8f5544c2008-10-15 06:03:48 +00006813 case 340:
6814#line 3375 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006815 {
6816 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006817 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006818 ;}
6819 break;
6820
Chris Lattner8f5544c2008-10-15 06:03:48 +00006821 case 341:
6822#line 3380 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006823 {
6824 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006825 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006826 ;}
6827 break;
6828
Chris Lattner8f5544c2008-10-15 06:03:48 +00006829 case 342:
6830#line 3384 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006831 {
6832 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006833 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006834 ;}
6835 break;
6836
Chris Lattner8f5544c2008-10-15 06:03:48 +00006837 case 343:
6838#line 3391 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006839 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006840 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006841 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6842 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6843 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006844 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006845 ;}
6846 break;
6847
Chris Lattner8f5544c2008-10-15 06:03:48 +00006848 case 344:
6849#line 3398 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006850 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006851 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006852 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006853 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6854 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006855 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006856 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006857 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6858 delete (yyvsp[(2) - (6)].TypeVal);
6859 ;}
6860 break;
6861
Chris Lattner8f5544c2008-10-15 06:03:48 +00006862 case 345:
6863#line 3408 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006864 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006865 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006866 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6867 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6868 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006869 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006870 ;}
6871 break;
6872
Chris Lattner8f5544c2008-10-15 06:03:48 +00006873 case 346:
6874#line 3415 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006875 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006876 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006877 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006878 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6879 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006880 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006881 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006882 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6883 delete (yyvsp[(2) - (6)].TypeVal);
6884 ;}
6885 break;
6886
Chris Lattner8f5544c2008-10-15 06:03:48 +00006887 case 347:
6888#line 3425 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006889 {
6890 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher329d2672008-09-24 04:55:49 +00006891 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006892 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6893 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006894 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006895 ;}
6896 break;
6897
Chris Lattner8f5544c2008-10-15 06:03:48 +00006898 case 348:
6899#line 3433 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006900 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006901 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006902 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6903 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006904 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006905 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6906 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006907 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006908 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6909 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006910 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006911 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6912 delete (yyvsp[(3) - (5)].TypeVal);
6913 ;}
6914 break;
6915
Chris Lattner8f5544c2008-10-15 06:03:48 +00006916 case 349:
6917#line 3447 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006918 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006919 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006920 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6921 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006922 if (!PT)
6923 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006924 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006925 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006926 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6927 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006928 "' into space of type '" + ElTy->getDescription() + "'");
6929
Dan Gohman54392c12008-04-19 00:24:39 +00006930 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006931 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006932 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6933 delete (yyvsp[(5) - (7)].TypeVal);
6934 ;}
6935 break;
6936
Chris Lattner8f5544c2008-10-15 06:03:48 +00006937 case 350:
6938#line 3464 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006939 {
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006940 if (!UpRefs.empty())
6941 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6942 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6943 GEN_ERROR("getresult insn requires an aggregate operand");
6944 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6945 GEN_ERROR("Invalid getresult index for type '" +
6946 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6947
6948 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel3b8849c2008-02-19 22:27:01 +00006949 CHECK_FOR_ERROR
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006950 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6951 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006952 ;}
6953 break;
6954
Chris Lattner8f5544c2008-10-15 06:03:48 +00006955 case 351:
6956#line 3478 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006957 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006958 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006959 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6960 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006961 GEN_ERROR("getelementptr insn requires pointer operand");
6962
Dan Gohman8055f772008-05-15 19:50:34 +00006963 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006964 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006965 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6966 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006967 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006968 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00006969 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006970 delete (yyvsp[(4) - (4)].ValueList);
6971 ;}
6972 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006973
Chris Lattner8f5544c2008-10-15 06:03:48 +00006974 case 352:
6975#line 3493 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006976 {
6977 if (!UpRefs.empty())
6978 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6979 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6980 GEN_ERROR("extractvalue insn requires an aggregate operand");
6981
Dan Gohmane5febe42008-05-31 00:58:22 +00006982 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006983 GEN_ERROR("Invalid extractvalue indices for type '" +
6984 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6985 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6986 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00006987 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00006988 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00006989 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006990 ;}
6991 break;
6992
Chris Lattner8f5544c2008-10-15 06:03:48 +00006993 case 353:
6994#line 3508 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006995 {
6996 if (!UpRefs.empty())
6997 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6998 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6999 GEN_ERROR("extractvalue insn requires an aggregate operand");
7000
Dan Gohmane5febe42008-05-31 00:58:22 +00007001 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 +00007002 GEN_ERROR("Invalid insertvalue indices for type '" +
7003 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7004 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7005 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7006 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00007007 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007008 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007009 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00007010 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007011 ;}
7012 break;
7013
Dan Gohman54392c12008-04-19 00:24:39 +00007014
7015/* Line 1267 of yacc.c. */
Chris Lattner8f5544c2008-10-15 06:03:48 +00007016#line 7017 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00007017 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00007018 }
Dan Gohman54392c12008-04-19 00:24:39 +00007019 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7020
7021 YYPOPSTACK (yylen);
7022 yylen = 0;
7023 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007024
7025 *++yyvsp = yyval;
7026
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007027
Dan Gohman54392c12008-04-19 00:24:39 +00007028 /* Now `shift' the result of the reduction. Determine what state
7029 that goes to, based on the state we popped back to and the rule
7030 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007031
7032 yyn = yyr1[yyn];
7033
Dan Gohman54392c12008-04-19 00:24:39 +00007034 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7035 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007036 yystate = yytable[yystate];
7037 else
Dan Gohman54392c12008-04-19 00:24:39 +00007038 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007039
7040 goto yynewstate;
7041
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007042
Dan Gohman54392c12008-04-19 00:24:39 +00007043/*------------------------------------.
7044| yyerrlab -- here on detecting error |
7045`------------------------------------*/
7046yyerrlab:
7047 /* If not already recovering from an error, report this error. */
7048 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007049 {
7050 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00007051#if ! YYERROR_VERBOSE
7052 yyerror (YY_("syntax error"));
7053#else
7054 {
7055 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7056 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7057 {
7058 YYSIZE_T yyalloc = 2 * yysize;
7059 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7060 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7061 if (yymsg != yymsgbuf)
7062 YYSTACK_FREE (yymsg);
7063 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7064 if (yymsg)
7065 yymsg_alloc = yyalloc;
7066 else
7067 {
7068 yymsg = yymsgbuf;
7069 yymsg_alloc = sizeof yymsgbuf;
7070 }
7071 }
Dale Johannesen3afee192007-09-07 21:07:57 +00007072
Dan Gohman54392c12008-04-19 00:24:39 +00007073 if (0 < yysize && yysize <= yymsg_alloc)
7074 {
7075 (void) yysyntax_error (yymsg, yystate, yychar);
7076 yyerror (yymsg);
7077 }
7078 else
7079 {
7080 yyerror (YY_("syntax error"));
7081 if (yysize != 0)
7082 goto yyexhaustedlab;
7083 }
7084 }
7085#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007086 }
7087
Dan Gohman54392c12008-04-19 00:24:39 +00007088
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007089
7090 if (yyerrstatus == 3)
7091 {
Dan Gohman54392c12008-04-19 00:24:39 +00007092 /* If just tried and failed to reuse look-ahead token after an
7093 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007094
Dan Gohman54392c12008-04-19 00:24:39 +00007095 if (yychar <= YYEOF)
7096 {
7097 /* Return failure if at end of input. */
7098 if (yychar == YYEOF)
7099 YYABORT;
7100 }
7101 else
7102 {
7103 yydestruct ("Error: discarding",
7104 yytoken, &yylval);
7105 yychar = YYEMPTY;
7106 }
7107 }
7108
7109 /* Else will try to reuse look-ahead token after shifting the error
7110 token. */
7111 goto yyerrlab1;
7112
7113
7114/*---------------------------------------------------.
7115| yyerrorlab -- error raised explicitly by YYERROR. |
7116`---------------------------------------------------*/
7117yyerrorlab:
7118
7119 /* Pacify compilers like GCC when the user code never invokes
7120 YYERROR and the label yyerrorlab therefore never appears in user
7121 code. */
7122 if (/*CONSTCOND*/ 0)
7123 goto yyerrorlab;
7124
7125 /* Do not reclaim the symbols of the rule which action triggered
7126 this YYERROR. */
7127 YYPOPSTACK (yylen);
7128 yylen = 0;
7129 YY_STACK_PRINT (yyss, yyssp);
7130 yystate = *yyssp;
7131 goto yyerrlab1;
7132
7133
7134/*-------------------------------------------------------------.
7135| yyerrlab1 -- common code for both syntax error and YYERROR. |
7136`-------------------------------------------------------------*/
7137yyerrlab1:
7138 yyerrstatus = 3; /* Each real token shifted decrements this. */
7139
7140 for (;;)
7141 {
7142 yyn = yypact[yystate];
7143 if (yyn != YYPACT_NINF)
7144 {
7145 yyn += YYTERROR;
7146 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7147 {
7148 yyn = yytable[yyn];
7149 if (0 < yyn)
7150 break;
7151 }
7152 }
7153
7154 /* Pop the current state because it cannot handle the error token. */
7155 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007156 YYABORT;
7157
Dale Johannesen3afee192007-09-07 21:07:57 +00007158
Dan Gohman54392c12008-04-19 00:24:39 +00007159 yydestruct ("Error: popping",
7160 yystos[yystate], yyvsp);
7161 YYPOPSTACK (1);
7162 yystate = *yyssp;
7163 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007164 }
7165
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007166 if (yyn == YYFINAL)
7167 YYACCEPT;
7168
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007169 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00007170
7171
7172 /* Shift the error token. */
7173 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00007174
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007175 yystate = yyn;
7176 goto yynewstate;
7177
Gabor Greif89f01162008-04-06 23:07:54 +00007178
Dan Gohman54392c12008-04-19 00:24:39 +00007179/*-------------------------------------.
7180| yyacceptlab -- YYACCEPT comes here. |
7181`-------------------------------------*/
7182yyacceptlab:
7183 yyresult = 0;
7184 goto yyreturn;
7185
7186/*-----------------------------------.
7187| yyabortlab -- YYABORT comes here. |
7188`-----------------------------------*/
7189yyabortlab:
7190 yyresult = 1;
7191 goto yyreturn;
7192
7193#ifndef yyoverflow
7194/*-------------------------------------------------.
7195| yyexhaustedlab -- memory exhaustion comes here. |
7196`-------------------------------------------------*/
7197yyexhaustedlab:
7198 yyerror (YY_("memory exhausted"));
7199 yyresult = 2;
7200 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00007201#endif
Dan Gohman54392c12008-04-19 00:24:39 +00007202
7203yyreturn:
7204 if (yychar != YYEOF && yychar != YYEMPTY)
7205 yydestruct ("Cleanup: discarding lookahead",
7206 yytoken, &yylval);
7207 /* Do not reclaim the symbols of the rule which action triggered
7208 this YYABORT or YYACCEPT. */
7209 YYPOPSTACK (yylen);
7210 YY_STACK_PRINT (yyss, yyssp);
7211 while (yyssp != yyss)
7212 {
7213 yydestruct ("Cleanup: popping",
7214 yystos[*yyssp], yyvsp);
7215 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00007216 }
Dan Gohman54392c12008-04-19 00:24:39 +00007217#ifndef yyoverflow
7218 if (yyss != yyssa)
7219 YYSTACK_FREE (yyss);
7220#endif
7221#if YYERROR_VERBOSE
7222 if (yymsg != yymsgbuf)
7223 YYSTACK_FREE (yymsg);
7224#endif
7225 /* Make sure YYID is used. */
7226 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007227}
Dan Gohman54392c12008-04-19 00:24:39 +00007228
7229
Chris Lattner8f5544c2008-10-15 06:03:48 +00007230#line 3527 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007231
7232
7233// common code from the two 'RunVMAsmParser' functions
7234static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007235 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007236 // Check to make sure the parser succeeded
7237 if (yyparse()) {
7238 if (ParserResult)
7239 delete ParserResult;
7240 return 0;
7241 }
7242
7243 // Emit an error if there are any unresolved types left.
7244 if (!CurModule.LateResolveTypes.empty()) {
7245 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7246 if (DID.Type == ValID::LocalName) {
7247 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7248 } else {
7249 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7250 }
7251 if (ParserResult)
7252 delete ParserResult;
7253 return 0;
7254 }
7255
7256 // Emit an error if there are any unresolved values left.
7257 if (!CurModule.LateResolveValues.empty()) {
7258 Value *V = CurModule.LateResolveValues.back();
7259 std::map<Value*, std::pair<ValID, int> >::iterator I =
7260 CurModule.PlaceHolderInfo.find(V);
7261
7262 if (I != CurModule.PlaceHolderInfo.end()) {
7263 ValID &DID = I->second.first;
7264 if (DID.Type == ValID::LocalName) {
7265 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7266 } else {
7267 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7268 }
7269 if (ParserResult)
7270 delete ParserResult;
7271 return 0;
7272 }
7273 }
7274
7275 // Check to make sure that parsing produced a result
7276 if (!ParserResult)
7277 return 0;
7278
7279 // Reset ParserResult variable while saving its value for the result.
7280 Module *Result = ParserResult;
7281 ParserResult = 0;
7282
7283 return Result;
7284}
7285
7286void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007287 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007288 // TODO: column number in exception
7289 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007290 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007291 TriggerError = 1;
7292}
7293
7294int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007295 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007296 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007297 if (yychar != YYEMPTY && yychar != 0) {
7298 errMsg += " while reading token: '";
Eric Christopher329d2672008-09-24 04:55:49 +00007299 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007300 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7301 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007302 GenerateError(errMsg);
7303 return 0;
7304}
Dan Gohman54392c12008-04-19 00:24:39 +00007305