blob: 63670a76cac97e4fc76342e4cb1e7ee9fb74ddb9 [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,
Bill Wendling1ba18d32008-12-17 20:59:57 +0000222 BYVAL = 403,
223 NEST = 404,
Dale Johannesenf4581482008-09-26 19:32:34 +0000224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
Devang Patelcd842482008-09-29 20:49:50 +0000227 OPTSIZE = 408,
228 NOINLINE = 409,
229 ALWAYSINLINE = 410,
Bill Wendling60f02fc2008-11-13 01:03:00 +0000230 SSP = 411,
231 SSPREQ = 412,
Bill Wendling1ba18d32008-12-17 20:59:57 +0000232 DEFAULT = 413,
233 HIDDEN = 414,
234 PROTECTED = 415
Dan Gohman54392c12008-04-19 00:24:39 +0000235 };
236#endif
237/* Tokens. */
238#define ESINT64VAL 258
239#define EUINT64VAL 259
240#define ESAPINTVAL 260
241#define EUAPINTVAL 261
242#define LOCALVAL_ID 262
243#define GLOBALVAL_ID 263
244#define FPVAL 264
245#define VOID 265
246#define INTTYPE 266
247#define FLOAT 267
248#define DOUBLE 268
249#define X86_FP80 269
250#define FP128 270
251#define PPC_FP128 271
252#define LABEL 272
253#define TYPE 273
254#define LOCALVAR 274
255#define GLOBALVAR 275
256#define LABELSTR 276
257#define STRINGCONSTANT 277
258#define ATSTRINGCONSTANT 278
259#define PCTSTRINGCONSTANT 279
260#define ZEROINITIALIZER 280
261#define TRUETOK 281
262#define FALSETOK 282
263#define BEGINTOK 283
264#define ENDTOK 284
265#define DECLARE 285
266#define DEFINE 286
267#define GLOBAL 287
268#define CONSTANT 288
269#define SECTION 289
270#define ALIAS 290
271#define VOLATILE 291
272#define THREAD_LOCAL 292
273#define TO 293
274#define DOTDOTDOT 294
275#define NULL_TOK 295
276#define UNDEF 296
277#define INTERNAL 297
278#define LINKONCE 298
279#define WEAK 299
280#define APPENDING 300
281#define DLLIMPORT 301
282#define DLLEXPORT 302
283#define EXTERN_WEAK 303
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000284#define COMMON 304
285#define OPAQUE 305
286#define EXTERNAL 306
287#define TARGET 307
288#define TRIPLE 308
289#define ALIGN 309
290#define ADDRSPACE 310
291#define DEPLIBS 311
292#define CALL 312
293#define TAIL 313
294#define ASM_TOK 314
295#define MODULE 315
296#define SIDEEFFECT 316
297#define CC_TOK 317
298#define CCC_TOK 318
299#define FASTCC_TOK 319
300#define COLDCC_TOK 320
301#define X86_STDCALLCC_TOK 321
302#define X86_FASTCALLCC_TOK 322
Dale Johannesenf4581482008-09-26 19:32:34 +0000303#define DATALAYOUT 323
304#define RET 324
305#define BR 325
306#define SWITCH 326
307#define INVOKE 327
308#define UNWIND 328
309#define UNREACHABLE 329
310#define ADD 330
311#define SUB 331
312#define MUL 332
313#define UDIV 333
314#define SDIV 334
315#define FDIV 335
316#define UREM 336
317#define SREM 337
318#define FREM 338
319#define AND 339
320#define OR 340
321#define XOR 341
322#define SHL 342
323#define LSHR 343
324#define ASHR 344
325#define ICMP 345
326#define FCMP 346
327#define VICMP 347
328#define VFCMP 348
329#define EQ 349
330#define NE 350
331#define SLT 351
332#define SGT 352
333#define SLE 353
334#define SGE 354
335#define ULT 355
336#define UGT 356
337#define ULE 357
338#define UGE 358
339#define OEQ 359
340#define ONE 360
341#define OLT 361
342#define OGT 362
343#define OLE 363
344#define OGE 364
345#define ORD 365
346#define UNO 366
347#define UEQ 367
348#define UNE 368
349#define MALLOC 369
350#define ALLOCA 370
351#define FREE 371
352#define LOAD 372
353#define STORE 373
354#define GETELEMENTPTR 374
355#define TRUNC 375
356#define ZEXT 376
357#define SEXT 377
358#define FPTRUNC 378
359#define FPEXT 379
360#define BITCAST 380
361#define UITOFP 381
362#define SITOFP 382
363#define FPTOUI 383
364#define FPTOSI 384
365#define INTTOPTR 385
366#define PTRTOINT 386
367#define PHI_TOK 387
368#define SELECT 388
369#define VAARG 389
370#define EXTRACTELEMENT 390
371#define INSERTELEMENT 391
372#define SHUFFLEVECTOR 392
373#define GETRESULT 393
374#define EXTRACTVALUE 394
375#define INSERTVALUE 395
376#define SIGNEXT 396
377#define ZEROEXT 397
378#define NORETURN 398
379#define INREG 399
380#define SRET 400
381#define NOUNWIND 401
382#define NOALIAS 402
Bill Wendling1ba18d32008-12-17 20:59:57 +0000383#define BYVAL 403
384#define NEST 404
Dale Johannesenf4581482008-09-26 19:32:34 +0000385#define READNONE 405
386#define READONLY 406
387#define GC 407
Devang Patelcd842482008-09-29 20:49:50 +0000388#define OPTSIZE 408
389#define NOINLINE 409
390#define ALWAYSINLINE 410
Bill Wendling60f02fc2008-11-13 01:03:00 +0000391#define SSP 411
392#define SSPREQ 412
Bill Wendling1ba18d32008-12-17 20:59:57 +0000393#define DEFAULT 413
394#define HIDDEN 414
395#define PROTECTED 415
Dan Gohman54392c12008-04-19 00:24:39 +0000396
397
398
399
400/* Copy the first part of user declarations. */
Nick Lewyckyff384472008-11-24 03:41:24 +0000401#line 14 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000402
403#include "ParserInternals.h"
404#include "llvm/CallingConv.h"
405#include "llvm/InlineAsm.h"
406#include "llvm/Instructions.h"
407#include "llvm/Module.h"
408#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000409#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000410#include "llvm/Support/GetElementPtrTypeIterator.h"
411#include "llvm/Support/CommandLine.h"
412#include "llvm/ADT/SmallVector.h"
413#include "llvm/ADT/STLExtras.h"
414#include "llvm/Support/MathExtras.h"
415#include "llvm/Support/Streams.h"
416#include <algorithm>
417#include <list>
418#include <map>
419#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000420
421// The following is a gross hack. In order to rid the libAsmParser library of
422// exceptions, we have to have a way of getting the yyparse function to go into
423// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher329d2672008-09-24 04:55:49 +0000424// function (see bottom of file) sets TriggerError. Then, at the end of each
425// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
426// (a goto) to put YACC in error state. Furthermore, several calls to
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000427// GenerateError are made from inside productions and they must simulate the
428// previous exception behavior by exiting the production immediately. We have
429// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher329d2672008-09-24 04:55:49 +0000430// immediately invokes YYERROR. This would be so much cleaner if it was a
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000431// recursive descent parser.
432static bool TriggerError = false;
433#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
434#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
435
436int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
437int yylex(); // declaration" of xxx warnings.
438int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000439using namespace llvm;
440
441static Module *ParserResult;
442
443// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
444// relating to upreferences in the input stream.
445//
446//#define DEBUG_UPREFS 1
447#ifdef DEBUG_UPREFS
448#define UR_OUT(X) cerr << X
449#else
450#define UR_OUT(X)
451#endif
452
453#define YYERROR_VERBOSE 1
454
455static GlobalVariable *CurGV;
456
457
458// This contains info used when building the body of a function. It is
459// destroyed when the function is completed.
460//
461typedef std::vector<Value *> ValueList; // Numbered defs
462
Eric Christopher329d2672008-09-24 04:55:49 +0000463static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000464ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
465
466static struct PerModuleInfo {
467 Module *CurrentModule;
468 ValueList Values; // Module level numbered definitions
469 ValueList LateResolveValues;
470 std::vector<PATypeHolder> Types;
471 std::map<ValID, PATypeHolder> LateResolveTypes;
472
473 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
474 /// how they were referenced and on which line of the input they came from so
475 /// that we can resolve them later and print error messages as appropriate.
476 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
477
478 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
479 // references to global values. Global values may be referenced before they
480 // are defined, and if so, the temporary object that they represent is held
481 // here. This is used for forward references of GlobalValues.
482 //
483 typedef std::map<std::pair<const PointerType *,
484 ValID>, GlobalValue*> GlobalRefsType;
485 GlobalRefsType GlobalRefs;
486
487 void ModuleDone() {
488 // If we could not resolve some functions at function compilation time
489 // (calls to functions before they are defined), resolve them now... Types
490 // are resolved when the constant pool has been completely parsed.
491 //
492 ResolveDefinitions(LateResolveValues);
493 if (TriggerError)
494 return;
495
496 // Check to make sure that all global value forward references have been
497 // resolved!
498 //
499 if (!GlobalRefs.empty()) {
500 std::string UndefinedReferences = "Unresolved global references exist:\n";
501
502 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
503 I != E; ++I) {
504 UndefinedReferences += " " + I->first.first->getDescription() + " " +
505 I->first.second.getName() + "\n";
506 }
507 GenerateError(UndefinedReferences);
508 return;
509 }
510
Chandler Carruth563d4a42007-08-04 01:56:21 +0000511 // Look for intrinsic functions and CallInst that need to be upgraded
512 for (Module::iterator FI = CurrentModule->begin(),
513 FE = CurrentModule->end(); FI != FE; )
514 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
515
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000516 Values.clear(); // Clear out function local definitions
517 Types.clear();
518 CurrentModule = 0;
519 }
520
521 // GetForwardRefForGlobal - Check to see if there is a forward reference
522 // for this global. If so, remove it from the GlobalRefs map and return it.
523 // If not, just return null.
524 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
525 // Check to see if there is a forward reference to this global variable...
526 // if there is, eliminate it and patch the reference to use the new def'n.
527 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
528 GlobalValue *Ret = 0;
529 if (I != GlobalRefs.end()) {
530 Ret = I->second;
Nuno Lopes363e49d2008-10-15 12:05:02 +0000531 I->first.second.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000532 GlobalRefs.erase(I);
533 }
534 return Ret;
535 }
536
537 bool TypeIsUnresolved(PATypeHolder* PATy) {
538 // If it isn't abstract, its resolved
539 const Type* Ty = PATy->get();
540 if (!Ty->isAbstract())
541 return false;
542 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher329d2672008-09-24 04:55:49 +0000543 // we don't need to traverse that leg of the type.
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000544 std::vector<const Type*> WorkList, SeenList;
545 WorkList.push_back(Ty);
546 while (!WorkList.empty()) {
547 const Type* Ty = WorkList.back();
548 SeenList.push_back(Ty);
549 WorkList.pop_back();
550 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
551 // Check to see if this is an unresolved type
552 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
553 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
554 for ( ; I != E; ++I) {
555 if (I->second.get() == OpTy)
556 return true;
557 }
558 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
559 const Type* TheTy = SeqTy->getElementType();
560 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher329d2672008-09-24 04:55:49 +0000561 std::vector<const Type*>::iterator I = SeenList.begin(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000562 E = SeenList.end();
563 for ( ; I != E; ++I)
564 if (*I == TheTy)
565 break;
566 if (I == E)
567 WorkList.push_back(TheTy);
568 }
569 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
570 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
571 const Type* TheTy = StrTy->getElementType(i);
572 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher329d2672008-09-24 04:55:49 +0000573 std::vector<const Type*>::iterator I = SeenList.begin(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000574 E = SeenList.end();
575 for ( ; I != E; ++I)
576 if (*I == TheTy)
577 break;
578 if (I == E)
579 WorkList.push_back(TheTy);
580 }
581 }
582 }
583 }
584 return false;
585 }
586} CurModule;
587
588static struct PerFunctionInfo {
589 Function *CurrentFunction; // Pointer to current function being created
590
591 ValueList Values; // Keep track of #'d definitions
592 unsigned NextValNum;
593 ValueList LateResolveValues;
594 bool isDeclare; // Is this function a forward declararation?
595 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
596 GlobalValue::VisibilityTypes Visibility;
597
598 /// BBForwardRefs - When we see forward references to basic blocks, keep
599 /// track of them here.
600 std::map<ValID, BasicBlock*> BBForwardRefs;
601
602 inline PerFunctionInfo() {
603 CurrentFunction = 0;
604 isDeclare = false;
605 Linkage = GlobalValue::ExternalLinkage;
606 Visibility = GlobalValue::DefaultVisibility;
607 }
608
609 inline void FunctionStart(Function *M) {
610 CurrentFunction = M;
611 NextValNum = 0;
612 }
613
614 void FunctionDone() {
615 // Any forward referenced blocks left?
616 if (!BBForwardRefs.empty()) {
617 GenerateError("Undefined reference to label " +
618 BBForwardRefs.begin()->second->getName());
619 return;
620 }
621
622 // Resolve all forward references now.
623 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
624
625 Values.clear(); // Clear out function local definitions
626 BBForwardRefs.clear();
627 CurrentFunction = 0;
628 isDeclare = false;
629 Linkage = GlobalValue::ExternalLinkage;
630 Visibility = GlobalValue::DefaultVisibility;
631 }
632} CurFun; // Info for the current function...
633
634static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
635
636
637//===----------------------------------------------------------------------===//
638// Code to handle definitions of all the types
639//===----------------------------------------------------------------------===//
640
Chris Lattner906773a2008-08-29 17:20:18 +0000641/// InsertValue - Insert a value into the value table. If it is named, this
642/// returns -1, otherwise it returns the slot number for the value.
643static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000644 // Things that have names or are void typed don't get slot numbers
645 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner906773a2008-08-29 17:20:18 +0000646 return -1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000647
648 // In the case of function values, we have to allow for the forward reference
649 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher329d2672008-09-24 04:55:49 +0000650 // track of the next insertion location with NextValNum. When a BB gets
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000651 // inserted, it could change the size of the CurFun.Values vector.
652 if (&ValueTab == &CurFun.Values) {
653 if (ValueTab.size() <= CurFun.NextValNum)
654 ValueTab.resize(CurFun.NextValNum+1);
655 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner906773a2008-08-29 17:20:18 +0000656 return CurFun.NextValNum-1;
Eric Christopher329d2672008-09-24 04:55:49 +0000657 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000658 // For all other lists, its okay to just tack it on the back of the vector.
659 ValueTab.push_back(V);
Chris Lattner906773a2008-08-29 17:20:18 +0000660 return ValueTab.size()-1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000661}
662
663static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
664 switch (D.Type) {
665 case ValID::LocalID: // Is it a numbered definition?
666 // Module constants occupy the lowest numbered slots...
667 if (D.Num < CurModule.Types.size())
668 return CurModule.Types[D.Num];
669 break;
670 case ValID::LocalName: // Is it a named definition?
671 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
672 D.destroy(); // Free old strdup'd memory...
673 return N;
674 }
675 break;
676 default:
677 GenerateError("Internal parser error: Invalid symbol type reference");
678 return 0;
679 }
680
681 // If we reached here, we referenced either a symbol that we don't know about
682 // or an id number that hasn't been read yet. We may be referencing something
683 // forward, so just create an entry to be resolved later and get to it...
684 //
685 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
686
687
688 if (inFunctionScope()) {
689 if (D.Type == ValID::LocalName) {
690 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
691 return 0;
692 } else {
693 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
694 return 0;
695 }
696 }
697
698 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Nuno Lopesb6f72c82008-10-15 11:20:21 +0000699 if (I != CurModule.LateResolveTypes.end()) {
700 D.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000701 return I->second;
Nuno Lopesb6f72c82008-10-15 11:20:21 +0000702 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000703
704 Type *Typ = OpaqueType::get();
705 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
706 return Typ;
707 }
708
709// getExistingVal - Look up the value specified by the provided type and
710// the provided ValID. If the value exists and has already been defined, return
711// it. Otherwise return null.
712//
713static Value *getExistingVal(const Type *Ty, const ValID &D) {
714 if (isa<FunctionType>(Ty)) {
715 GenerateError("Functions are not values and "
716 "must be referenced as pointers");
717 return 0;
718 }
719
720 switch (D.Type) {
721 case ValID::LocalID: { // Is it a numbered definition?
722 // Check that the number is within bounds.
Eric Christopher329d2672008-09-24 04:55:49 +0000723 if (D.Num >= CurFun.Values.size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000724 return 0;
725 Value *Result = CurFun.Values[D.Num];
726 if (Ty != Result->getType()) {
727 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher329d2672008-09-24 04:55:49 +0000728 Result->getType()->getDescription() + "' does not match "
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000729 "expected type, '" + Ty->getDescription() + "'");
730 return 0;
731 }
732 return Result;
733 }
734 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher329d2672008-09-24 04:55:49 +0000735 if (D.Num >= CurModule.Values.size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000736 return 0;
737 Value *Result = CurModule.Values[D.Num];
738 if (Ty != Result->getType()) {
739 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher329d2672008-09-24 04:55:49 +0000740 Result->getType()->getDescription() + "' does not match "
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000741 "expected type, '" + Ty->getDescription() + "'");
742 return 0;
743 }
744 return Result;
745 }
Eric Christopher329d2672008-09-24 04:55:49 +0000746
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000747 case ValID::LocalName: { // Is it a named definition?
Eric Christopher329d2672008-09-24 04:55:49 +0000748 if (!inFunctionScope())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000749 return 0;
750 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
751 Value *N = SymTab.lookup(D.getName());
Eric Christopher329d2672008-09-24 04:55:49 +0000752 if (N == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000753 return 0;
754 if (N->getType() != Ty)
755 return 0;
Eric Christopher329d2672008-09-24 04:55:49 +0000756
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000757 D.destroy(); // Free old strdup'd memory...
758 return N;
759 }
760 case ValID::GlobalName: { // Is it a named definition?
761 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
762 Value *N = SymTab.lookup(D.getName());
Eric Christopher329d2672008-09-24 04:55:49 +0000763 if (N == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000764 return 0;
765 if (N->getType() != Ty)
766 return 0;
767
768 D.destroy(); // Free old strdup'd memory...
769 return N;
770 }
771
772 // Check to make sure that "Ty" is an integral type, and that our
773 // value will fit into the specified type...
774 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000775 if (!isa<IntegerType>(Ty) ||
776 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000777 GenerateError("Signed integral constant '" +
778 itostr(D.ConstPool64) + "' is invalid for type '" +
779 Ty->getDescription() + "'");
780 return 0;
781 }
782 return ConstantInt::get(Ty, D.ConstPool64, true);
783
784 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000785 if (isa<IntegerType>(Ty) &&
786 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000787 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000788
789 if (!isa<IntegerType>(Ty) ||
790 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
791 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
792 "' is invalid or out of range for type '" +
793 Ty->getDescription() + "'");
794 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000795 }
Chris Lattner59363a32008-02-19 04:36:25 +0000796 // This is really a signed reference. Transmogrify.
797 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000798
Chris Lattnerf3d40022008-07-11 00:30:39 +0000799 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
800 if (!isa<IntegerType>(Ty)) {
801 GenerateError("Integral constant '" + D.getName() +
802 "' is invalid or out of range for type '" +
803 Ty->getDescription() + "'");
804 return 0;
805 }
Eric Christopher329d2672008-09-24 04:55:49 +0000806
Chris Lattnerf3d40022008-07-11 00:30:39 +0000807 {
808 APSInt Tmp = *D.ConstPoolInt;
Nuno Lopesafed5ce2008-11-04 14:28:33 +0000809 D.destroy();
Chris Lattnerf3d40022008-07-11 00:30:39 +0000810 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
811 return ConstantInt::get(Tmp);
812 }
Eric Christopher329d2672008-09-24 04:55:49 +0000813
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000814 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000815 if (!Ty->isFloatingPoint() ||
816 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000817 GenerateError("FP constant invalid for type");
818 return 0;
819 }
Eric Christopher329d2672008-09-24 04:55:49 +0000820 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000821 // as double. Fix this here. Long double does not need this.
822 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
Dale Johannesen5ba85fd2008-10-09 23:01:34 +0000823 Ty==Type::FloatTy) {
824 bool ignored;
825 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
826 &ignored);
827 }
Nuno Lopes97cf0032008-11-04 14:43:20 +0000828 {
829 ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP);
830 D.destroy();
831 return tmp;
832 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000833
834 case ValID::ConstNullVal: // Is it a null value?
835 if (!isa<PointerType>(Ty)) {
836 GenerateError("Cannot create a a non pointer null");
837 return 0;
838 }
839 return ConstantPointerNull::get(cast<PointerType>(Ty));
840
841 case ValID::ConstUndefVal: // Is it an undef value?
842 return UndefValue::get(Ty);
843
844 case ValID::ConstZeroVal: // Is it a zero value?
845 return Constant::getNullValue(Ty);
Eric Christopher329d2672008-09-24 04:55:49 +0000846
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000847 case ValID::ConstantVal: // Fully resolved constant?
848 if (D.ConstantValue->getType() != Ty) {
849 GenerateError("Constant expression type different from required type");
850 return 0;
851 }
852 return D.ConstantValue;
853
854 case ValID::InlineAsmVal: { // Inline asm expression
855 const PointerType *PTy = dyn_cast<PointerType>(Ty);
856 const FunctionType *FTy =
857 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
858 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
859 GenerateError("Invalid type for asm constraint string");
860 return 0;
861 }
862 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
863 D.IAD->HasSideEffects);
864 D.destroy(); // Free InlineAsmDescriptor.
865 return IA;
866 }
867 default:
868 assert(0 && "Unhandled case!");
869 return 0;
870 } // End of switch
871
872 assert(0 && "Unhandled case!");
873 return 0;
874}
875
876// getVal - This function is identical to getExistingVal, except that if a
877// value is not already defined, it "improvises" by creating a placeholder var
878// that looks and acts just like the requested variable. When the value is
879// defined later, all uses of the placeholder variable are replaced with the
880// real thing.
881//
882static Value *getVal(const Type *Ty, const ValID &ID) {
883 if (Ty == Type::LabelTy) {
884 GenerateError("Cannot use a basic block here");
885 return 0;
886 }
887
888 // See if the value has already been defined.
889 Value *V = getExistingVal(Ty, ID);
890 if (V) return V;
891 if (TriggerError) return 0;
892
893 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000894 GenerateError("Invalid use of a non-first-class type");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000895 return 0;
896 }
897
898 // If we reached here, we referenced either a symbol that we don't know about
899 // or an id number that hasn't been read yet. We may be referencing something
900 // forward, so just create an entry to be resolved later and get to it...
901 //
902 switch (ID.Type) {
903 case ValID::GlobalName:
904 case ValID::GlobalID: {
905 const PointerType *PTy = dyn_cast<PointerType>(Ty);
906 if (!PTy) {
907 GenerateError("Invalid type for reference to global" );
908 return 0;
909 }
910 const Type* ElTy = PTy->getElementType();
911 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000912 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000913 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000914 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
915 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000916 break;
917 }
918 default:
919 V = new Argument(Ty);
920 }
Eric Christopher329d2672008-09-24 04:55:49 +0000921
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000922 // Remember where this forward reference came from. FIXME, shouldn't we try
923 // to recycle these things??
924 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000925 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000926
927 if (inFunctionScope())
928 InsertValue(V, CurFun.LateResolveValues);
929 else
930 InsertValue(V, CurModule.LateResolveValues);
931 return V;
932}
933
934/// defineBBVal - This is a definition of a new basic block with the specified
935/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000936static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000937 assert(inFunctionScope() && "Can't get basic block at global scope!");
938
939 BasicBlock *BB = 0;
940
941 // First, see if this was forward referenced
942
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
945 BB = BBI->second;
946 // The forward declaration could have been inserted anywhere in the
947 // function: insert it into the correct place now.
948 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
949 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
950
951 // We're about to erase the entry, save the key so we can clean it up.
952 ValID Tmp = BBI->first;
953
954 // Erase the forward ref from the map as its no longer "forward"
955 CurFun.BBForwardRefs.erase(ID);
956
Eric Christopher329d2672008-09-24 04:55:49 +0000957 // The key has been removed from the map but so we don't want to leave
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000958 // strdup'd memory around so destroy it too.
959 Tmp.destroy();
960
961 // If its a numbered definition, bump the number and set the BB value.
962 if (ID.Type == ValID::LocalID) {
963 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
964 InsertValue(BB);
965 }
Eric Christopher329d2672008-09-24 04:55:49 +0000966 } else {
967 // We haven't seen this BB before and its first mention is a definition.
Devang Patel890cc572008-03-03 18:58:47 +0000968 // Just create it and return it.
969 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000970 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000971 if (ID.Type == ValID::LocalID) {
972 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
973 InsertValue(BB);
974 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000975 }
976
Devang Patel890cc572008-03-03 18:58:47 +0000977 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000978 return BB;
979}
980
981/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher329d2672008-09-24 04:55:49 +0000982///
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000983static BasicBlock *getBBVal(const ValID &ID) {
984 assert(inFunctionScope() && "Can't get basic block at global scope!");
985
986 BasicBlock *BB = 0;
987
988 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
989 if (BBI != CurFun.BBForwardRefs.end()) {
990 BB = BBI->second;
991 } if (ID.Type == ValID::LocalName) {
992 std::string Name = ID.getName();
993 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000994 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000995 if (N->getType()->getTypeID() == Type::LabelTyID)
996 BB = cast<BasicBlock>(N);
997 else
998 GenerateError("Reference to label '" + Name + "' is actually of type '"+
999 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +00001000 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001001 } else if (ID.Type == ValID::LocalID) {
1002 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
1003 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
1004 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
1005 else
Eric Christopher329d2672008-09-24 04:55:49 +00001006 GenerateError("Reference to label '%" + utostr(ID.Num) +
1007 "' is actually of type '"+
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001008 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1009 }
1010 } else {
1011 GenerateError("Illegal label reference " + ID.getName());
1012 return 0;
1013 }
1014
1015 // If its already been defined, return it now.
1016 if (BB) {
1017 ID.destroy(); // Free strdup'd memory.
1018 return BB;
1019 }
1020
1021 // Otherwise, this block has not been seen before, create it.
1022 std::string Name;
1023 if (ID.Type == ValID::LocalName)
1024 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +00001025 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001026
1027 // Insert it in the forward refs map.
1028 CurFun.BBForwardRefs[ID] = BB;
1029
1030 return BB;
1031}
1032
1033
1034//===----------------------------------------------------------------------===//
1035// Code to handle forward references in instructions
1036//===----------------------------------------------------------------------===//
1037//
1038// This code handles the late binding needed with statements that reference
1039// values not defined yet... for example, a forward branch, or the PHI node for
1040// a loop body.
1041//
1042// This keeps a table (CurFun.LateResolveValues) of all such forward references
1043// and back patchs after we are done.
1044//
1045
1046// ResolveDefinitions - If we could not resolve some defs at parsing
1047// time (forward branches, phi functions for loops, etc...) resolve the
1048// defs now...
1049//
Eric Christopher329d2672008-09-24 04:55:49 +00001050static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001051ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1052 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1053 while (!LateResolvers.empty()) {
1054 Value *V = LateResolvers.back();
1055 LateResolvers.pop_back();
1056
1057 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1058 CurModule.PlaceHolderInfo.find(V);
1059 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1060
1061 ValID &DID = PHI->second.first;
1062
1063 Value *TheRealValue = getExistingVal(V->getType(), DID);
1064 if (TriggerError)
1065 return;
1066 if (TheRealValue) {
1067 V->replaceAllUsesWith(TheRealValue);
1068 delete V;
1069 CurModule.PlaceHolderInfo.erase(PHI);
1070 } else if (FutureLateResolvers) {
1071 // Functions have their unresolved items forwarded to the module late
1072 // resolver table
1073 InsertValue(V, *FutureLateResolvers);
1074 } else {
1075 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1076 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1077 "' of type '" + V->getType()->getDescription() + "'",
1078 PHI->second.second);
1079 return;
1080 } else {
1081 GenerateError("Reference to an invalid definition: #" +
1082 itostr(DID.Num) + " of type '" +
1083 V->getType()->getDescription() + "'",
1084 PHI->second.second);
1085 return;
1086 }
1087 }
1088 }
1089 LateResolvers.clear();
1090}
1091
1092// ResolveTypeTo - A brand new type was just declared. This means that (if
1093// name is not null) things referencing Name can be resolved. Otherwise, things
1094// refering to the number can be resolved. Do this now.
1095//
1096static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1097 ValID D;
1098 if (Name)
1099 D = ValID::createLocalName(*Name);
Eric Christopher329d2672008-09-24 04:55:49 +00001100 else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001101 D = ValID::createLocalID(CurModule.Types.size());
1102
1103 std::map<ValID, PATypeHolder>::iterator I =
1104 CurModule.LateResolveTypes.find(D);
1105 if (I != CurModule.LateResolveTypes.end()) {
1106 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Nuno Lopes37e4b7a2008-10-15 11:11:12 +00001107 I->first.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001108 CurModule.LateResolveTypes.erase(I);
1109 }
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001110 D.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001111}
1112
1113// setValueName - Set the specified value to the name given. The name may be
1114// null potentially, in which case this is a noop. The string passed in is
1115// assumed to be a malloc'd string buffer, and is free'd by this function.
1116//
1117static void setValueName(Value *V, std::string *NameStr) {
1118 if (!NameStr) return;
1119 std::string Name(*NameStr); // Copy string
1120 delete NameStr; // Free old string
1121
1122 if (V->getType() == Type::VoidTy) {
1123 GenerateError("Can't assign name '" + Name+"' to value with void type");
1124 return;
1125 }
1126
1127 assert(inFunctionScope() && "Must be in function scope!");
1128 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1129 if (ST.lookup(Name)) {
1130 GenerateError("Redefinition of value '" + Name + "' of type '" +
1131 V->getType()->getDescription() + "'");
1132 return;
1133 }
1134
1135 // Set the name.
1136 V->setName(Name);
1137}
1138
1139/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1140/// this is a declaration, otherwise it is a definition.
1141static GlobalVariable *
1142ParseGlobalVariable(std::string *NameStr,
1143 GlobalValue::LinkageTypes Linkage,
1144 GlobalValue::VisibilityTypes Visibility,
1145 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001146 Constant *Initializer, bool IsThreadLocal,
1147 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001148 if (isa<FunctionType>(Ty)) {
1149 GenerateError("Cannot declare global vars of function type");
1150 return 0;
1151 }
Dan Gohmane5febe42008-05-31 00:58:22 +00001152 if (Ty == Type::LabelTy) {
1153 GenerateError("Cannot declare global vars of label type");
1154 return 0;
1155 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001156
Christopher Lamb0a243582007-12-11 09:02:08 +00001157 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001158
1159 std::string Name;
1160 if (NameStr) {
1161 Name = *NameStr; // Copy string
1162 delete NameStr; // Free old string
1163 }
1164
1165 // See if this global value was forward referenced. If so, recycle the
1166 // object.
1167 ValID ID;
1168 if (!Name.empty()) {
1169 ID = ValID::createGlobalName(Name);
1170 } else {
1171 ID = ValID::createGlobalID(CurModule.Values.size());
1172 }
1173
1174 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1175 // Move the global to the end of the list, from whereever it was
1176 // previously inserted.
1177 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1178 CurModule.CurrentModule->getGlobalList().remove(GV);
1179 CurModule.CurrentModule->getGlobalList().push_back(GV);
1180 GV->setInitializer(Initializer);
1181 GV->setLinkage(Linkage);
1182 GV->setVisibility(Visibility);
1183 GV->setConstant(isConstantGlobal);
1184 GV->setThreadLocal(IsThreadLocal);
1185 InsertValue(GV, CurModule.Values);
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001186 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001187 return GV;
1188 }
1189
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001190 ID.destroy();
1191
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001192 // If this global has a name
1193 if (!Name.empty()) {
1194 // if the global we're parsing has an initializer (is a definition) and
1195 // has external linkage.
1196 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1197 // If there is already a global with external linkage with this name
1198 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1199 // If we allow this GVar to get created, it will be renamed in the
1200 // symbol table because it conflicts with an existing GVar. We can't
1201 // allow redefinition of GVars whose linking indicates that their name
1202 // must stay the same. Issue the error.
1203 GenerateError("Redefinition of global variable named '" + Name +
1204 "' of type '" + Ty->getDescription() + "'");
1205 return 0;
1206 }
1207 }
1208
1209 // Otherwise there is no existing GV to use, create one now.
1210 GlobalVariable *GV =
1211 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001212 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001213 GV->setVisibility(Visibility);
1214 InsertValue(GV, CurModule.Values);
1215 return GV;
1216}
1217
1218// setTypeName - Set the specified type to the name given. The name may be
1219// null potentially, in which case this is a noop. The string passed in is
1220// assumed to be a malloc'd string buffer, and is freed by this function.
1221//
1222// This function returns true if the type has already been defined, but is
1223// allowed to be redefined in the specified context. If the name is a new name
1224// for the type plane, it is inserted and false is returned.
1225static bool setTypeName(const Type *T, std::string *NameStr) {
1226 assert(!inFunctionScope() && "Can't give types function-local names!");
1227 if (NameStr == 0) return false;
Eric Christopher329d2672008-09-24 04:55:49 +00001228
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001229 std::string Name(*NameStr); // Copy string
1230 delete NameStr; // Free old string
1231
1232 // We don't allow assigning names to void type
1233 if (T == Type::VoidTy) {
1234 GenerateError("Can't assign name '" + Name + "' to the void type");
1235 return false;
1236 }
1237
1238 // Set the type name, checking for conflicts as we do so.
1239 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1240
1241 if (AlreadyExists) { // Inserting a name that is already defined???
1242 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1243 assert(Existing && "Conflict but no matching type?!");
1244
1245 // There is only one case where this is allowed: when we are refining an
1246 // opaque type. In this case, Existing will be an opaque type.
1247 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1248 // We ARE replacing an opaque type!
1249 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1250 return true;
1251 }
1252
1253 // Otherwise, this is an attempt to redefine a type. That's okay if
1254 // the redefinition is identical to the original. This will be so if
1255 // Existing and T point to the same Type object. In this one case we
1256 // allow the equivalent redefinition.
1257 if (Existing == T) return true; // Yes, it's equal.
1258
1259 // Any other kind of (non-equivalent) redefinition is an error.
1260 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1261 T->getDescription() + "'");
1262 }
1263
1264 return false;
1265}
1266
1267//===----------------------------------------------------------------------===//
1268// Code for handling upreferences in type names...
1269//
1270
1271// TypeContains - Returns true if Ty directly contains E in it.
1272//
1273static bool TypeContains(const Type *Ty, const Type *E) {
1274 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1275 E) != Ty->subtype_end();
1276}
1277
1278namespace {
1279 struct UpRefRecord {
1280 // NestingLevel - The number of nesting levels that need to be popped before
1281 // this type is resolved.
1282 unsigned NestingLevel;
1283
1284 // LastContainedTy - This is the type at the current binding level for the
1285 // type. Every time we reduce the nesting level, this gets updated.
1286 const Type *LastContainedTy;
1287
1288 // UpRefTy - This is the actual opaque type that the upreference is
1289 // represented with.
1290 OpaqueType *UpRefTy;
1291
1292 UpRefRecord(unsigned NL, OpaqueType *URTy)
1293 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1294 };
1295}
1296
1297// UpRefs - A list of the outstanding upreferences that need to be resolved.
1298static std::vector<UpRefRecord> UpRefs;
1299
1300/// HandleUpRefs - Every time we finish a new layer of types, this function is
1301/// called. It loops through the UpRefs vector, which is a list of the
1302/// currently active types. For each type, if the up reference is contained in
1303/// the newly completed type, we decrement the level count. When the level
1304/// count reaches zero, the upreferenced type is the type that is passed in:
1305/// thus we can complete the cycle.
1306///
1307static PATypeHolder HandleUpRefs(const Type *ty) {
1308 // If Ty isn't abstract, or if there are no up-references in it, then there is
1309 // nothing to resolve here.
1310 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher329d2672008-09-24 04:55:49 +00001311
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001312 PATypeHolder Ty(ty);
1313 UR_OUT("Type '" << Ty->getDescription() <<
1314 "' newly formed. Resolving upreferences.\n" <<
1315 UpRefs.size() << " upreferences active!\n");
1316
1317 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1318 // to zero), we resolve them all together before we resolve them to Ty. At
1319 // the end of the loop, if there is anything to resolve to Ty, it will be in
1320 // this variable.
1321 OpaqueType *TypeToResolve = 0;
1322
1323 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1324 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1325 << UpRefs[i].second->getDescription() << ") = "
1326 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1327 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1328 // Decrement level of upreference
1329 unsigned Level = --UpRefs[i].NestingLevel;
1330 UpRefs[i].LastContainedTy = Ty;
1331 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1332 if (Level == 0) { // Upreference should be resolved!
1333 if (!TypeToResolve) {
1334 TypeToResolve = UpRefs[i].UpRefTy;
1335 } else {
1336 UR_OUT(" * Resolving upreference for "
1337 << UpRefs[i].second->getDescription() << "\n";
1338 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1339 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1340 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1341 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1342 }
1343 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1344 --i; // Do not skip the next element...
1345 }
1346 }
1347 }
1348
1349 if (TypeToResolve) {
1350 UR_OUT(" * Resolving upreference for "
1351 << UpRefs[i].second->getDescription() << "\n";
1352 std::string OldName = TypeToResolve->getDescription());
1353 TypeToResolve->refineAbstractTypeTo(Ty);
1354 }
1355
1356 return Ty;
1357}
1358
1359//===----------------------------------------------------------------------===//
1360// RunVMAsmParser - Define an interface to this parser
1361//===----------------------------------------------------------------------===//
1362//
1363static Module* RunParser(Module * M);
1364
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001365Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1366 InitLLLexer(MB);
1367 Module *M = RunParser(new Module(LLLgetFilename()));
1368 FreeLexer();
1369 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001370}
1371
1372
Dan Gohman54392c12008-04-19 00:24:39 +00001373
1374/* Enabling traces. */
1375#ifndef YYDEBUG
1376# define YYDEBUG 0
1377#endif
1378
1379/* Enabling verbose error messages. */
1380#ifdef YYERROR_VERBOSE
1381# undef YYERROR_VERBOSE
1382# define YYERROR_VERBOSE 1
1383#else
1384# define YYERROR_VERBOSE 0
1385#endif
1386
1387/* Enabling the token table. */
1388#ifndef YYTOKEN_TABLE
1389# define YYTOKEN_TABLE 0
1390#endif
1391
1392#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1393typedef union YYSTYPE
Nick Lewyckyff384472008-11-24 03:41:24 +00001394#line 986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001395{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001396 llvm::Module *ModuleVal;
1397 llvm::Function *FunctionVal;
1398 llvm::BasicBlock *BasicBlockVal;
1399 llvm::TerminatorInst *TermInstVal;
1400 llvm::Instruction *InstVal;
1401 llvm::Constant *ConstVal;
1402
1403 const llvm::Type *PrimType;
1404 std::list<llvm::PATypeHolder> *TypeList;
1405 llvm::PATypeHolder *TypeVal;
1406 llvm::Value *ValueVal;
1407 std::vector<llvm::Value*> *ValueList;
Dan Gohmane5febe42008-05-31 00:58:22 +00001408 std::vector<unsigned> *ConstantList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409 llvm::ArgListType *ArgList;
1410 llvm::TypeWithAttrs TypeWithAttrs;
1411 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001412 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001413
1414 // Represent the RHS of PHI node
1415 std::list<std::pair<llvm::Value*,
1416 llvm::BasicBlock*> > *PHIList;
1417 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1418 std::vector<llvm::Constant*> *ConstVector;
1419
1420 llvm::GlobalValue::LinkageTypes Linkage;
1421 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Pateld222f862008-09-25 21:00:45 +00001422 llvm::Attributes Attributes;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001423 llvm::APInt *APIntVal;
1424 int64_t SInt64Val;
1425 uint64_t UInt64Val;
1426 int SIntVal;
1427 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001428 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001429 bool BoolVal;
1430
1431 std::string *StrVal; // This memory must be deleted
1432 llvm::ValID ValIDVal;
1433
1434 llvm::Instruction::BinaryOps BinaryOpVal;
1435 llvm::Instruction::TermOps TermOpVal;
1436 llvm::Instruction::MemoryOps MemOpVal;
1437 llvm::Instruction::CastOps CastOpVal;
1438 llvm::Instruction::OtherOps OtherOpVal;
1439 llvm::ICmpInst::Predicate IPredicate;
1440 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001441}
Nick Lewyckyff384472008-11-24 03:41:24 +00001442/* Line 187 of yacc.c. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00001443#line 1444 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001444 YYSTYPE;
1445# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1446# define YYSTYPE_IS_DECLARED 1
1447# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001448#endif
1449
1450
1451
Dan Gohman54392c12008-04-19 00:24:39 +00001452/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001453
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001454
Dan Gohman54392c12008-04-19 00:24:39 +00001455/* Line 216 of yacc.c. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00001456#line 1457 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001457
Dan Gohman54392c12008-04-19 00:24:39 +00001458#ifdef short
1459# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001460#endif
1461
Dan Gohman54392c12008-04-19 00:24:39 +00001462#ifdef YYTYPE_UINT8
1463typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001464#else
Dan Gohman54392c12008-04-19 00:24:39 +00001465typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001466#endif
1467
Dan Gohman54392c12008-04-19 00:24:39 +00001468#ifdef YYTYPE_INT8
1469typedef YYTYPE_INT8 yytype_int8;
1470#elif (defined __STDC__ || defined __C99__FUNC__ \
1471 || defined __cplusplus || defined _MSC_VER)
1472typedef signed char yytype_int8;
1473#else
1474typedef short int yytype_int8;
1475#endif
1476
1477#ifdef YYTYPE_UINT16
1478typedef YYTYPE_UINT16 yytype_uint16;
1479#else
1480typedef unsigned short int yytype_uint16;
1481#endif
1482
1483#ifdef YYTYPE_INT16
1484typedef YYTYPE_INT16 yytype_int16;
1485#else
1486typedef short int yytype_int16;
1487#endif
1488
1489#ifndef YYSIZE_T
1490# ifdef __SIZE_TYPE__
1491# define YYSIZE_T __SIZE_TYPE__
1492# elif defined size_t
1493# define YYSIZE_T size_t
1494# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1495 || defined __cplusplus || defined _MSC_VER)
1496# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1497# define YYSIZE_T size_t
1498# else
1499# define YYSIZE_T unsigned int
1500# endif
1501#endif
1502
1503#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1504
1505#ifndef YY_
Nick Lewyckyff384472008-11-24 03:41:24 +00001506# if YYENABLE_NLS
Dan Gohman54392c12008-04-19 00:24:39 +00001507# if ENABLE_NLS
1508# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1509# define YY_(msgid) dgettext ("bison-runtime", msgid)
1510# endif
1511# endif
1512# ifndef YY_
1513# define YY_(msgid) msgid
1514# endif
1515#endif
1516
1517/* Suppress unused-variable warnings by "using" E. */
1518#if ! defined lint || defined __GNUC__
1519# define YYUSE(e) ((void) (e))
1520#else
1521# define YYUSE(e) /* empty */
1522#endif
1523
1524/* Identity function, used to suppress warnings about constant conditions. */
1525#ifndef lint
1526# define YYID(n) (n)
1527#else
1528#if (defined __STDC__ || defined __C99__FUNC__ \
1529 || defined __cplusplus || defined _MSC_VER)
1530static int
1531YYID (int i)
1532#else
1533static int
1534YYID (i)
1535 int i;
1536#endif
1537{
1538 return i;
1539}
1540#endif
1541
1542#if ! defined yyoverflow || YYERROR_VERBOSE
1543
1544/* The parser invokes alloca or malloc; define the necessary symbols. */
1545
1546# ifdef YYSTACK_USE_ALLOCA
1547# if YYSTACK_USE_ALLOCA
1548# ifdef __GNUC__
1549# define YYSTACK_ALLOC __builtin_alloca
1550# elif defined __BUILTIN_VA_ARG_INCR
1551# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1552# elif defined _AIX
1553# define YYSTACK_ALLOC __alloca
1554# elif defined _MSC_VER
1555# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1556# define alloca _alloca
1557# else
1558# define YYSTACK_ALLOC alloca
1559# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1560 || defined __cplusplus || defined _MSC_VER)
1561# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1562# ifndef _STDLIB_H
1563# define _STDLIB_H 1
1564# endif
1565# endif
1566# endif
1567# endif
1568# endif
1569
1570# ifdef YYSTACK_ALLOC
1571 /* Pacify GCC's `empty if-body' warning. */
1572# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1573# ifndef YYSTACK_ALLOC_MAXIMUM
1574 /* The OS might guarantee only one guard page at the bottom of the stack,
1575 and a page size can be as small as 4096 bytes. So we cannot safely
1576 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1577 to allow for a few compiler-allocated temporary stack slots. */
1578# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1579# endif
1580# else
1581# define YYSTACK_ALLOC YYMALLOC
1582# define YYSTACK_FREE YYFREE
1583# ifndef YYSTACK_ALLOC_MAXIMUM
1584# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1585# endif
1586# if (defined __cplusplus && ! defined _STDLIB_H \
1587 && ! ((defined YYMALLOC || defined malloc) \
1588 && (defined YYFREE || defined free)))
1589# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1590# ifndef _STDLIB_H
1591# define _STDLIB_H 1
1592# endif
1593# endif
1594# ifndef YYMALLOC
1595# define YYMALLOC malloc
1596# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1597 || defined __cplusplus || defined _MSC_VER)
1598void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1599# endif
1600# endif
1601# ifndef YYFREE
1602# define YYFREE free
1603# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1604 || defined __cplusplus || defined _MSC_VER)
1605void free (void *); /* INFRINGES ON USER NAME SPACE */
1606# endif
1607# endif
1608# endif
1609#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1610
1611
1612#if (! defined yyoverflow \
1613 && (! defined __cplusplus \
1614 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1615
1616/* A type that is properly aligned for any stack member. */
1617union yyalloc
1618{
1619 yytype_int16 yyss;
1620 YYSTYPE yyvs;
1621 };
1622
1623/* The size of the maximum gap between one aligned stack and the next. */
1624# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1625
1626/* The size of an array large to enough to hold all stacks, each with
1627 N elements. */
1628# define YYSTACK_BYTES(N) \
1629 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1630 + YYSTACK_GAP_MAXIMUM)
1631
1632/* Copy COUNT objects from FROM to TO. The source and destination do
1633 not overlap. */
1634# ifndef YYCOPY
1635# if defined __GNUC__ && 1 < __GNUC__
1636# define YYCOPY(To, From, Count) \
1637 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1638# else
1639# define YYCOPY(To, From, Count) \
1640 do \
1641 { \
1642 YYSIZE_T yyi; \
1643 for (yyi = 0; yyi < (Count); yyi++) \
1644 (To)[yyi] = (From)[yyi]; \
1645 } \
1646 while (YYID (0))
1647# endif
1648# endif
1649
1650/* Relocate STACK from its old location to the new one. The
1651 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1652 elements in the stack, and YYPTR gives the new location of the
1653 stack. Advance YYPTR to a properly aligned location for the next
1654 stack. */
1655# define YYSTACK_RELOCATE(Stack) \
1656 do \
1657 { \
1658 YYSIZE_T yynewbytes; \
1659 YYCOPY (&yyptr->Stack, Stack, yysize); \
1660 Stack = &yyptr->Stack; \
1661 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1662 yyptr += yynewbytes / sizeof (*yyptr); \
1663 } \
1664 while (YYID (0))
1665
1666#endif
1667
1668/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001669#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001670/* YYLAST -- Last index in YYTABLE. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00001671#define YYLAST 2434
Dan Gohman54392c12008-04-19 00:24:39 +00001672
1673/* YYNTOKENS -- Number of terminals. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00001674#define YYNTOKENS 175
Dan Gohman54392c12008-04-19 00:24:39 +00001675/* YYNNTS -- Number of nonterminals. */
Chris Lattnerc5320232008-10-15 06:16:57 +00001676#define YYNNTS 87
Dan Gohman54392c12008-04-19 00:24:39 +00001677/* YYNRULES -- Number of rules. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00001678#define YYNRULES 351
Dan Gohman54392c12008-04-19 00:24:39 +00001679/* YYNRULES -- Number of states. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00001680#define YYNSTATES 711
Dan Gohman54392c12008-04-19 00:24:39 +00001681
1682/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1683#define YYUNDEFTOK 2
Bill Wendling1ba18d32008-12-17 20:59:57 +00001684#define YYMAXUTOK 415
Dan Gohman54392c12008-04-19 00:24:39 +00001685
1686#define YYTRANSLATE(YYX) \
1687 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1688
1689/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1690static const yytype_uint8 yytranslate[] =
1691{
1692 0, 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,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001696 161, 162, 165, 2, 164, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001698 170, 163, 171, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001701 2, 167, 166, 169, 2, 2, 2, 2, 2, 174,
Dan Gohman54392c12008-04-19 00:24:39 +00001702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001704 168, 2, 2, 172, 2, 173, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001705 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1706 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1707 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1708 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1709 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1710 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1711 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1712 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1713 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1714 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1715 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1716 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1717 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1718 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1719 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1720 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1721 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1722 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1723 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1724 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1725 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1726 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1727 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1728 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1729 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1730 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1731 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001732 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001733 155, 156, 157, 158, 159, 160
Dan Gohman54392c12008-04-19 00:24:39 +00001734};
1735
1736#if YYDEBUG
1737/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1738 YYRHS. */
1739static const yytype_uint16 yyprhs[] =
1740{
1741 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1742 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1743 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1744 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1745 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1746 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Chris Lattnerc5320232008-10-15 06:16:57 +00001747 118, 123, 124, 127, 128, 131, 133, 135, 137, 138,
1748 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1749 160, 162, 164, 166, 167, 169, 171, 172, 174, 176,
1750 178, 180, 181, 183, 185, 186, 188, 190, 192, 194,
1751 196, 199, 201, 203, 205, 207, 209, 211, 213, 215,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001752 217, 220, 221, 224, 226, 228, 230, 232, 233, 236,
Bill Wendling60f02fc2008-11-13 01:03:00 +00001753 238, 240, 242, 244, 246, 248, 250, 252, 254, 256,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001754 258, 260, 261, 264, 265, 268, 269, 272, 273, 277,
1755 280, 281, 283, 284, 288, 290, 293, 295, 297, 299,
1756 301, 303, 305, 307, 309, 311, 315, 317, 320, 326,
1757 332, 338, 344, 348, 351, 357, 362, 365, 367, 369,
1758 371, 375, 377, 381, 383, 384, 386, 390, 395, 399,
1759 403, 408, 413, 417, 424, 430, 433, 436, 439, 442,
1760 445, 448, 451, 454, 457, 460, 463, 466, 473, 479,
1761 488, 495, 502, 510, 518, 526, 534, 541, 550, 559,
1762 565, 573, 577, 579, 581, 583, 585, 586, 589, 596,
1763 598, 599, 601, 604, 605, 609, 610, 614, 618, 622,
1764 626, 627, 636, 637, 647, 648, 658, 664, 667, 671,
1765 673, 677, 681, 685, 689, 691, 692, 698, 702, 704,
1766 708, 710, 711, 723, 725, 727, 732, 734, 736, 739,
1767 743, 744, 746, 748, 750, 752, 754, 756, 758, 760,
1768 762, 764, 766, 770, 774, 777, 780, 784, 787, 793,
1769 798, 800, 806, 808, 810, 812, 814, 816, 818, 821,
1770 823, 827, 830, 833, 837, 841, 844, 845, 847, 850,
1771 853, 857, 867, 877, 886, 902, 904, 906, 913, 919,
1772 922, 925, 932, 940, 945, 950, 957, 964, 965, 966,
1773 970, 973, 977, 980, 982, 988, 994, 1001, 1008, 1015,
1774 1022, 1027, 1034, 1039, 1044, 1051, 1058, 1061, 1071, 1073,
1775 1075, 1076, 1080, 1087, 1091, 1098, 1101, 1107, 1115, 1121,
1776 1126, 1131
Dan Gohman54392c12008-04-19 00:24:39 +00001777};
1778
1779/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1780static const yytype_int16 yyrhs[] =
1781{
Bill Wendling1ba18d32008-12-17 20:59:57 +00001782 222, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenf4581482008-09-26 19:32:34 +00001783 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1784 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1785 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1786 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1787 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1788 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1789 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1790 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1791 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
Chris Lattnerc5320232008-10-15 06:16:57 +00001792 -1, 102, -1, 103, -1, 26, -1, 27, -1, 19,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001793 -1, 22, -1, 24, -1, 181, -1, -1, 55, 161,
1794 4, 162, -1, -1, 181, 163, -1, -1, 7, 163,
1795 -1, 20, -1, 23, -1, 188, -1, -1, 186, 163,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001796 -1, 42, -1, 44, -1, 43, -1, 45, -1, 47,
1797 -1, 49, -1, 46, -1, 48, -1, 51, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001798 158, -1, 159, -1, 160, -1, -1, 46, -1, 48,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001799 -1, -1, 42, -1, 43, -1, 44, -1, 47, -1,
1800 -1, 44, -1, 42, -1, -1, 63, -1, 64, -1,
1801 65, -1, 66, -1, 67, -1, 62, 4, -1, 142,
1802 -1, 121, -1, 141, -1, 122, -1, 144, -1, 145,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001803 -1, 147, -1, 148, -1, 149, -1, 54, 4, -1,
1804 -1, 197, 196, -1, 144, -1, 142, -1, 141, -1,
1805 147, -1, -1, 199, 198, -1, 143, -1, 146, -1,
1806 144, -1, 142, -1, 141, -1, 150, -1, 151, -1,
1807 154, -1, 155, -1, 153, -1, 156, -1, 157, -1,
1808 -1, 201, 200, -1, -1, 152, 22, -1, -1, 54,
1809 4, -1, -1, 164, 54, 4, -1, 34, 22, -1,
1810 -1, 205, -1, -1, 164, 208, 207, -1, 205, -1,
1811 54, 4, -1, 11, -1, 12, -1, 13, -1, 16,
1812 -1, 15, -1, 14, -1, 17, -1, 50, -1, 209,
1813 -1, 210, 183, 165, -1, 244, -1, 166, 4, -1,
1814 210, 161, 214, 162, 201, -1, 10, 161, 214, 162,
1815 201, -1, 167, 4, 168, 210, 169, -1, 170, 4,
1816 168, 210, 171, -1, 172, 215, 173, -1, 172, 173,
1817 -1, 170, 172, 215, 173, 171, -1, 170, 172, 173,
1818 171, -1, 210, 197, -1, 210, -1, 10, -1, 211,
1819 -1, 213, 164, 211, -1, 213, -1, 213, 164, 39,
1820 -1, 39, -1, -1, 210, -1, 215, 164, 210, -1,
1821 210, 167, 218, 169, -1, 210, 167, 169, -1, 210,
1822 174, 22, -1, 210, 170, 218, 171, -1, 210, 172,
1823 218, 173, -1, 210, 172, 173, -1, 210, 170, 172,
1824 218, 173, 171, -1, 210, 170, 172, 173, 171, -1,
1825 210, 40, -1, 210, 41, -1, 210, 244, -1, 210,
1826 217, -1, 210, 25, -1, 210, 3, -1, 210, 5,
1827 -1, 210, 4, -1, 210, 6, -1, 210, 26, -1,
1828 210, 27, -1, 210, 9, -1, 178, 161, 216, 38,
1829 210, 162, -1, 119, 161, 216, 256, 162, -1, 133,
1830 161, 216, 164, 216, 164, 216, 162, -1, 176, 161,
1831 216, 164, 216, 162, -1, 177, 161, 216, 164, 216,
1832 162, -1, 90, 179, 161, 216, 164, 216, 162, -1,
1833 91, 180, 161, 216, 164, 216, 162, -1, 92, 179,
1834 161, 216, 164, 216, 162, -1, 93, 180, 161, 216,
1835 164, 216, 162, -1, 135, 161, 216, 164, 216, 162,
1836 -1, 136, 161, 216, 164, 216, 164, 216, 162, -1,
1837 137, 161, 216, 164, 216, 164, 216, 162, -1, 139,
1838 161, 216, 257, 162, -1, 140, 161, 216, 164, 216,
1839 257, 162, -1, 218, 164, 216, -1, 216, -1, 32,
1840 -1, 33, -1, 37, -1, -1, 212, 244, -1, 125,
1841 161, 221, 38, 210, 162, -1, 223, -1, -1, 224,
1842 -1, 223, 224, -1, -1, 31, 225, 240, -1, -1,
1843 30, 226, 241, -1, 60, 59, 230, -1, 184, 18,
1844 210, -1, 184, 18, 10, -1, -1, 187, 191, 220,
1845 219, 216, 183, 227, 207, -1, -1, 187, 189, 191,
1846 220, 219, 216, 183, 228, 207, -1, -1, 187, 190,
1847 191, 220, 219, 210, 183, 229, 207, -1, 187, 191,
1848 35, 194, 221, -1, 52, 231, -1, 56, 163, 232,
1849 -1, 22, -1, 53, 163, 22, -1, 68, 163, 22,
1850 -1, 167, 233, 169, -1, 233, 164, 22, -1, 22,
1851 -1, -1, 234, 164, 210, 197, 182, -1, 210, 197,
1852 182, -1, 234, -1, 234, 164, 39, -1, 39, -1,
1853 -1, 195, 199, 212, 186, 161, 235, 162, 201, 206,
1854 203, 202, -1, 28, -1, 172, -1, 193, 191, 236,
1855 237, -1, 29, -1, 173, -1, 248, 239, -1, 192,
1856 191, 236, -1, -1, 61, -1, 3, -1, 4, -1,
1857 5, -1, 6, -1, 9, -1, 26, -1, 27, -1,
1858 40, -1, 41, -1, 25, -1, 170, 218, 171, -1,
1859 167, 218, 169, -1, 167, 169, -1, 174, 22, -1,
1860 172, 218, 173, -1, 172, 173, -1, 170, 172, 218,
1861 173, 171, -1, 170, 172, 173, 171, -1, 217, -1,
1862 59, 242, 22, 164, 22, -1, 7, -1, 8, -1,
1863 181, -1, 186, -1, 244, -1, 243, -1, 210, 245,
1864 -1, 246, -1, 247, 164, 246, -1, 248, 249, -1,
1865 238, 249, -1, 250, 184, 251, -1, 250, 185, 251,
1866 -1, 250, 253, -1, -1, 21, -1, 69, 247, -1,
1867 69, 10, -1, 70, 17, 245, -1, 70, 11, 245,
1868 164, 17, 245, 164, 17, 245, -1, 71, 11, 245,
1869 164, 17, 245, 167, 252, 169, -1, 71, 11, 245,
1870 164, 17, 245, 167, 169, -1, 72, 195, 199, 212,
1871 245, 161, 255, 162, 201, 38, 17, 245, 73, 17,
1872 245, -1, 73, -1, 74, -1, 252, 11, 243, 164,
1873 17, 245, -1, 11, 243, 164, 17, 245, -1, 184,
1874 259, -1, 185, 259, -1, 210, 167, 245, 164, 245,
1875 169, -1, 254, 164, 167, 245, 164, 245, 169, -1,
1876 210, 197, 245, 197, -1, 17, 197, 245, 197, -1,
1877 255, 164, 210, 197, 245, 197, -1, 255, 164, 17,
1878 197, 245, 197, -1, -1, -1, 256, 164, 246, -1,
1879 164, 4, -1, 257, 164, 4, -1, 58, 57, -1,
1880 57, -1, 176, 210, 245, 164, 245, -1, 177, 210,
1881 245, 164, 245, -1, 90, 179, 210, 245, 164, 245,
1882 -1, 91, 180, 210, 245, 164, 245, -1, 92, 179,
1883 210, 245, 164, 245, -1, 93, 180, 210, 245, 164,
1884 245, -1, 178, 246, 38, 210, -1, 133, 246, 164,
1885 246, 164, 246, -1, 134, 246, 164, 210, -1, 135,
1886 246, 164, 246, -1, 136, 246, 164, 246, 164, 246,
1887 -1, 137, 246, 164, 246, 164, 246, -1, 132, 254,
1888 -1, 258, 195, 199, 212, 245, 161, 255, 162, 201,
1889 -1, 261, -1, 36, -1, -1, 114, 210, 204, -1,
1890 114, 210, 164, 11, 245, 204, -1, 115, 210, 204,
1891 -1, 115, 210, 164, 11, 245, 204, -1, 116, 246,
1892 -1, 260, 117, 210, 245, 204, -1, 260, 118, 246,
1893 164, 210, 245, 204, -1, 138, 210, 245, 164, 4,
1894 -1, 119, 210, 245, 256, -1, 139, 210, 245, 257,
1895 -1, 140, 210, 245, 164, 210, 245, 257, -1
Dan Gohman54392c12008-04-19 00:24:39 +00001896};
1897
1898/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1899static const yytype_uint16 yyrline[] =
1900{
Nuno Lopes97cf0032008-11-04 14:43:20 +00001901 0, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1902 1152, 1153, 1153, 1153, 1153, 1153, 1153, 1154, 1154, 1154,
1903 1154, 1154, 1154, 1155, 1155, 1155, 1155, 1155, 1155, 1158,
1904 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162, 1162, 1166,
1905 1166, 1167, 1167, 1168, 1168, 1169, 1169, 1170, 1170, 1171,
1906 1171, 1172, 1172, 1173, 1174, 1177, 1177, 1177, 1178, 1178,
1907 1180, 1181, 1185, 1189, 1194, 1200, 1200, 1202, 1203, 1208,
1908 1214, 1215, 1216, 1217, 1218, 1219, 1223, 1224, 1225, 1229,
1909 1230, 1231, 1232, 1236, 1237, 1238, 1242, 1243, 1244, 1245,
1910 1246, 1250, 1251, 1252, 1255, 1256, 1257, 1258, 1259, 1260,
1911 1261, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001912 1277, 1281, 1282, 1287, 1288, 1289, 1290, 1293, 1294, 1300,
Bill Wendling60f02fc2008-11-13 01:03:00 +00001913 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310,
Bill Wendling1ba18d32008-12-17 20:59:57 +00001914 1311, 1314, 1315, 1321, 1322, 1329, 1330, 1336, 1337, 1346,
1915 1354, 1355, 1360, 1361, 1362, 1367, 1380, 1380, 1380, 1380,
1916 1380, 1380, 1380, 1383, 1387, 1391, 1398, 1403, 1411, 1446,
1917 1477, 1482, 1492, 1502, 1506, 1516, 1523, 1532, 1539, 1544,
1918 1549, 1556, 1557, 1564, 1571, 1579, 1585, 1597, 1625, 1641,
1919 1668, 1696, 1722, 1742, 1768, 1788, 1800, 1807, 1873, 1883,
1920 1893, 1904, 1917, 1928, 1942, 1949, 1956, 1974, 1986, 2007,
1921 2015, 2021, 2032, 2037, 2042, 2047, 2052, 2058, 2064, 2070,
1922 2078, 2089, 2093, 2101, 2101, 2104, 2104, 2107, 2119, 2140,
1923 2145, 2153, 2154, 2158, 2158, 2162, 2162, 2165, 2168, 2192,
1924 2204, 2203, 2215, 2214, 2224, 2223, 2234, 2274, 2277, 2283,
1925 2293, 2297, 2302, 2304, 2309, 2314, 2323, 2333, 2344, 2348,
1926 2357, 2366, 2371, 2520, 2520, 2522, 2531, 2531, 2533, 2538,
1927 2550, 2554, 2559, 2563, 2567, 2572, 2577, 2581, 2585, 2589,
1928 2593, 2597, 2601, 2623, 2645, 2651, 2664, 2676, 2681, 2693,
1929 2699, 2703, 2713, 2717, 2721, 2726, 2733, 2733, 2739, 2748,
1930 2753, 2758, 2762, 2771, 2780, 2793, 2802, 2806, 2814, 2834,
1931 2838, 2843, 2854, 2873, 2882, 2986, 2990, 2997, 3008, 3021,
1932 3030, 3043, 3054, 3064, 3075, 3083, 3093, 3100, 3103, 3104,
1933 3112, 3118, 3127, 3131, 3136, 3152, 3169, 3181, 3193, 3207,
1934 3221, 3233, 3254, 3261, 3267, 3273, 3279, 3294, 3404, 3409,
1935 3413, 3420, 3427, 3437, 3444, 3454, 3462, 3476, 3493, 3507,
1936 3522, 3537
Dan Gohman54392c12008-04-19 00:24:39 +00001937};
1938#endif
1939
1940#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1941/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1942 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1943static const char *const yytname[] =
1944{
1945 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1946 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1947 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1948 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1949 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1950 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1951 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1952 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001953 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001954 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1955 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1956 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesenf4581482008-09-26 19:32:34 +00001957 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1958 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1959 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1960 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1961 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1962 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1963 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1964 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1965 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1966 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
Bill Wendling1ba18d32008-12-17 20:59:57 +00001967 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patelcd842482008-09-29 20:49:50 +00001968 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
Bill Wendling1ba18d32008-12-17 20:59:57 +00001969 "SSP", "SSPREQ", "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='",
1970 "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1971 "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
Bill Wendling60f02fc2008-11-13 01:03:00 +00001972 "IPredicates", "FPredicates", "LocalName", "OptLocalName",
1973 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1974 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1975 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1976 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
1977 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1978 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
Devang Patelcd842482008-09-29 20:49:50 +00001979 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1980 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1981 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1982 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1983 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1984 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1985 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1986 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1987 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1988 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1989 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner906773a2008-08-29 17:20:18 +00001990 "OptVolatile", "MemoryInst", 0
Dan Gohman54392c12008-04-19 00:24:39 +00001991};
1992#endif
1993
1994# ifdef YYPRINT
1995/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1996 token YYLEX-NUM. */
1997static const yytype_uint16 yytoknum[] =
1998{
1999 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
2000 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
2001 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
2002 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
2003 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
2004 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
2005 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2006 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
2007 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
2008 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
2009 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
2010 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
2011 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2012 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2013 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002014 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002015 415, 40, 41, 61, 44, 42, 92, 91, 120, 93,
2016 60, 62, 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00002017};
2018# endif
2019
2020/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002021static const yytype_uint16 yyr1[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002022{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002023 0, 175, 176, 176, 176, 176, 176, 176, 176, 176,
2024 176, 177, 177, 177, 177, 177, 177, 178, 178, 178,
2025 178, 178, 178, 178, 178, 178, 178, 178, 178, 179,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002026 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002027 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
2028 180, 180, 180, 180, 180, 181, 181, 181, 182, 182,
2029 183, 183, 184, 184, 185, 186, 186, 187, 187, 188,
2030 189, 189, 189, 189, 189, 189, 190, 190, 190, 191,
2031 191, 191, 191, 192, 192, 192, 193, 193, 193, 193,
2032 193, 194, 194, 194, 195, 195, 195, 195, 195, 195,
2033 195, 196, 196, 196, 196, 196, 196, 196, 196, 196,
2034 196, 197, 197, 198, 198, 198, 198, 199, 199, 200,
2035 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
2036 200, 201, 201, 202, 202, 203, 203, 204, 204, 205,
2037 206, 206, 207, 207, 208, 208, 209, 209, 209, 209,
2038 209, 209, 209, 210, 210, 210, 210, 210, 210, 210,
2039 210, 210, 210, 210, 210, 210, 211, 212, 212, 213,
2040 213, 214, 214, 214, 214, 215, 215, 216, 216, 216,
2041 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2042 216, 216, 216, 216, 216, 216, 216, 217, 217, 217,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002043 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002044 217, 218, 218, 219, 219, 220, 220, 221, 221, 222,
2045 222, 223, 223, 225, 224, 226, 224, 224, 224, 224,
2046 227, 224, 228, 224, 229, 224, 224, 224, 224, 230,
2047 231, 231, 232, 233, 233, 233, 234, 234, 235, 235,
2048 235, 235, 236, 237, 237, 238, 239, 239, 240, 241,
2049 242, 242, 243, 243, 243, 243, 243, 243, 243, 243,
2050 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2051 243, 243, 244, 244, 244, 244, 245, 245, 246, 247,
2052 247, 248, 248, 249, 249, 250, 250, 250, 251, 251,
2053 251, 251, 251, 251, 251, 251, 251, 252, 252, 253,
2054 253, 254, 254, 255, 255, 255, 255, 255, 256, 256,
2055 257, 257, 258, 258, 259, 259, 259, 259, 259, 259,
2056 259, 259, 259, 259, 259, 259, 259, 259, 259, 260,
2057 260, 261, 261, 261, 261, 261, 261, 261, 261, 261,
2058 261, 261
Dan Gohman54392c12008-04-19 00:24:39 +00002059};
2060
2061/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2062static const yytype_uint8 yyr2[] =
2063{
2064 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2065 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2066 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2067 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2068 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002069 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2070 4, 0, 2, 0, 2, 1, 1, 1, 0, 2,
2071 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2072 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
2073 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
2074 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002075 2, 0, 2, 1, 1, 1, 1, 0, 2, 1,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002076 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002077 1, 0, 2, 0, 2, 0, 2, 0, 3, 2,
2078 0, 1, 0, 3, 1, 2, 1, 1, 1, 1,
2079 1, 1, 1, 1, 1, 3, 1, 2, 5, 5,
2080 5, 5, 3, 2, 5, 4, 2, 1, 1, 1,
2081 3, 1, 3, 1, 0, 1, 3, 4, 3, 3,
2082 4, 4, 3, 6, 5, 2, 2, 2, 2, 2,
2083 2, 2, 2, 2, 2, 2, 2, 6, 5, 8,
2084 6, 6, 7, 7, 7, 7, 6, 8, 8, 5,
2085 7, 3, 1, 1, 1, 1, 0, 2, 6, 1,
2086 0, 1, 2, 0, 3, 0, 3, 3, 3, 3,
2087 0, 8, 0, 9, 0, 9, 5, 2, 3, 1,
2088 3, 3, 3, 3, 1, 0, 5, 3, 1, 3,
2089 1, 0, 11, 1, 1, 4, 1, 1, 2, 3,
2090 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2091 1, 1, 3, 3, 2, 2, 3, 2, 5, 4,
2092 1, 5, 1, 1, 1, 1, 1, 1, 2, 1,
2093 3, 2, 2, 3, 3, 2, 0, 1, 2, 2,
2094 3, 9, 9, 8, 15, 1, 1, 6, 5, 2,
2095 2, 6, 7, 4, 4, 6, 6, 0, 0, 3,
2096 2, 3, 2, 1, 5, 5, 6, 6, 6, 6,
2097 4, 6, 4, 4, 6, 6, 2, 9, 1, 1,
2098 0, 3, 6, 3, 6, 2, 5, 7, 5, 4,
2099 4, 7
Dan Gohman54392c12008-04-19 00:24:39 +00002100};
2101
2102/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2103 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2104 means the default is an error. */
2105static const yytype_uint16 yydefact[] =
2106{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002107 68, 55, 65, 56, 66, 57, 225, 223, 0, 0,
2108 0, 0, 0, 0, 79, 67, 0, 68, 221, 83,
2109 86, 0, 0, 237, 0, 0, 62, 0, 69, 70,
Chris Lattnerc5320232008-10-15 06:16:57 +00002110 72, 71, 73, 76, 74, 77, 75, 78, 80, 81,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002111 82, 79, 79, 216, 1, 222, 84, 85, 79, 226,
2112 87, 88, 89, 90, 79, 296, 224, 296, 0, 0,
2113 245, 238, 239, 227, 282, 283, 229, 146, 147, 148,
2114 151, 150, 149, 152, 153, 0, 0, 0, 0, 284,
2115 285, 154, 228, 156, 216, 216, 91, 215, 0, 94,
2116 94, 297, 292, 63, 256, 257, 258, 291, 240, 241,
2117 244, 0, 174, 157, 0, 0, 0, 0, 163, 175,
2118 0, 0, 174, 0, 0, 0, 93, 92, 0, 213,
2119 214, 0, 0, 95, 96, 97, 98, 99, 117, 259,
2120 0, 0, 340, 340, 295, 0, 242, 173, 111, 169,
2121 171, 0, 0, 0, 0, 0, 0, 162, 0, 0,
2122 155, 0, 0, 168, 0, 167, 0, 236, 61, 61,
2123 100, 0, 253, 254, 255, 64, 339, 323, 0, 0,
2124 0, 0, 94, 305, 306, 2, 3, 4, 5, 6,
Chris Lattnerc5320232008-10-15 06:16:57 +00002125 7, 8, 9, 10, 14, 15, 16, 11, 12, 13,
2126 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
2127 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
Nate Begeman646fa482008-05-12 19:01:56 +00002128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002129 0, 0, 293, 94, 309, 0, 338, 294, 310, 243,
2130 166, 0, 131, 61, 61, 165, 0, 176, 0, 131,
2131 61, 61, 0, 217, 190, 192, 191, 193, 196, 189,
2132 194, 195, 185, 186, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002134 0, 0, 188, 187, 230, 115, 114, 113, 116, 118,
2135 0, 322, 299, 61, 289, 298, 0, 0, 0, 117,
Nick Lewyckyff384472008-11-24 03:41:24 +00002136 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2137 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2138 42, 43, 44, 45, 46, 47, 48, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002139 137, 137, 345, 61, 61, 336, 0, 0, 0, 0,
2140 0, 61, 61, 61, 61, 61, 0, 117, 0, 0,
Nick Lewyckyff384472008-11-24 03:41:24 +00002141 0, 102, 104, 103, 101, 105, 106, 107, 108, 109,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002142 112, 172, 170, 159, 160, 161, 164, 60, 158, 232,
2143 234, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 178, 212, 0, 0, 0, 182, 0,
2145 179, 0, 0, 0, 142, 0, 262, 263, 264, 265,
2146 266, 271, 267, 268, 269, 270, 260, 0, 0, 0,
2147 0, 280, 287, 286, 288, 0, 0, 300, 0, 0,
2148 61, 61, 61, 61, 0, 341, 0, 343, 318, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002150 0, 0, 0, 61, 0, 110, 123, 122, 119, 121,
2151 120, 124, 125, 128, 126, 127, 129, 130, 132, 142,
2152 142, 0, 0, 0, 0, 0, 318, 0, 0, 0,
2153 0, 0, 0, 0, 177, 163, 175, 0, 180, 181,
2154 0, 0, 0, 0, 231, 251, 261, 0, 274, 0,
2155 0, 0, 277, 0, 275, 290, 0, 0, 0, 0,
2156 0, 0, 0, 0, 0, 0, 349, 0, 0, 0,
2157 332, 333, 0, 0, 0, 0, 350, 0, 0, 0,
2158 330, 0, 137, 0, 233, 235, 61, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 0, 211, 184,
2160 0, 0, 0, 0, 0, 0, 144, 142, 250, 111,
2161 248, 0, 0, 273, 163, 0, 272, 276, 0, 0,
2162 0, 0, 0, 0, 0, 137, 138, 137, 0, 0,
2163 0, 0, 0, 0, 348, 320, 0, 61, 324, 325,
2164 0, 0, 346, 61, 218, 0, 0, 0, 0, 198,
2165 0, 0, 0, 0, 209, 0, 183, 0, 0, 61,
2166 139, 145, 143, 59, 0, 131, 0, 279, 0, 0,
2167 0, 317, 326, 327, 328, 329, 342, 344, 319, 0,
2168 0, 331, 334, 335, 321, 0, 317, 137, 0, 0,
2169 0, 0, 0, 206, 0, 0, 0, 200, 201, 197,
2170 58, 247, 249, 111, 140, 281, 278, 0, 0, 111,
2171 111, 0, 311, 0, 351, 0, 347, 202, 203, 204,
2172 205, 0, 0, 0, 210, 59, 141, 135, 0, 0,
2173 303, 0, 0, 0, 131, 0, 312, 131, 199, 207,
2174 208, 246, 0, 133, 301, 0, 0, 302, 102, 104,
2175 111, 111, 0, 111, 111, 337, 136, 0, 252, 0,
2176 0, 314, 313, 0, 0, 0, 134, 0, 0, 0,
2177 111, 111, 308, 0, 0, 316, 315, 307, 0, 0,
2178 304
Dan Gohman54392c12008-04-19 00:24:39 +00002179};
2180
2181/* YYDEFGOTO[NTERM-NUM]. */
2182static const yytype_int16 yydefgoto[] =
2183{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002184 -1, 269, 270, 271, 300, 317, 79, 631, 113, 12,
Chris Lattnerc5320232008-10-15 06:16:57 +00002185 133, 80, 14, 15, 41, 42, 43, 48, 54, 118,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002186 128, 350, 230, 279, 161, 448, 353, 688, 673, 415,
2187 536, 657, 474, 537, 81, 158, 139, 156, 140, 141,
2188 110, 374, 401, 375, 121, 88, 157, 16, 17, 18,
2189 20, 19, 384, 449, 450, 63, 23, 61, 101, 540,
2190 541, 129, 164, 55, 96, 56, 49, 477, 402, 83,
2191 404, 284, 285, 57, 92, 93, 222, 661, 134, 325,
2192 641, 496, 506, 223, 224, 225, 226
Dan Gohman54392c12008-04-19 00:24:39 +00002193};
2194
2195/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2196 STATE-NUM. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00002197#define YYPACT_NINF -619
Dan Gohman54392c12008-04-19 00:24:39 +00002198static const yytype_int16 yypact[] =
2199{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002200 790, -619, -619, -619, -619, -619, -619, -619, 10, -86,
2201 53, -45, 136, 38, 62, -619, 49, 1492, -619, 117,
2202 167, 39, 43, -619, 45, 151, -619, 1999, -619, -619,
2203 -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2204 -619, -27, -27, 146, -619, -619, -619, -619, -27, -619,
2205 -619, -619, -619, -619, -27, 197, -619, 9, 216, 224,
2206 228, -619, -619, -619, -619, -619, 105, -619, -619, -619,
2207 -619, -619, -619, -619, -619, 266, 269, 2, 481, -619,
2208 -619, -619, -37, -619, 244, 244, 156, -619, 69, 213,
2209 213, -619, -619, 40, -619, -619, -619, -619, -619, -619,
2210 -619, -70, 1724, -619, 118, 119, 550, 105, -619, -37,
2211 -118, 124, 1724, 125, 69, 69, -619, -619, 1768, -619,
2212 -619, 2024, 285, -619, -619, -619, -619, -619, -619, -619,
2213 -16, 131, 2294, 2294, -619, 273, -619, -619, -37, -619,
2214 132, 135, 2024, 2024, 127, -83, 2024, -619, 295, 138,
2215 -619, 2024, 2024, 105, 145, -37, 46, -619, 1278, 252,
2216 -619, 1679, -619, -619, -619, -619, -619, -619, 251, 2065,
2217 78, 298, 213, -619, -619, -619, -619, -619, -619, -619,
2218 -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2219 630, 660, 630, 660, 2024, 2024, 2024, 2024, -619, -619,
2220 -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2221 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024,
2222 2024, 2024, -619, 213, -619, 59, -619, -619, -619, -619,
2223 335, 1817, -619, -39, -42, -619, 147, -37, 158, -619,
2224 252, -10, 1768, -619, -619, -619, -619, -619, -619, -619,
2225 -619, -619, -619, -619, 630, 660, 630, 660, 160, 161,
2226 170, 171, 172, 174, 175, 1858, 2124, 984, 312, 176,
2227 181, 182, -619, -619, -619, -619, -619, -619, -619, -619,
2228 64, -619, 105, 934, -619, 180, 1450, 1450, 1450, -619,
2229 -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2230 2024, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2231 -619, -619, -619, -619, -619, -619, -619, 2024, 2024, 2024,
2232 -24, -19, -619, 934, -40, 183, 184, 187, 188, 189,
2233 190, 934, 934, 934, 934, 934, 307, -619, 2024, 2024,
2234 342, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2235 -619, -619, -619, 557, -619, -619, -619, -619, 557, -619,
2236 125, 317, 195, 196, 200, 201, 2024, 2024, 2024, 2024,
2237 2024, 2024, 2024, -619, -619, -9, 1155, -120, -619, -76,
2238 -619, 2024, 2024, 2024, 203, 202, -619, -619, -619, -619,
2239 -619, -619, -619, -619, -619, -619, 299, 1899, 2165, 1327,
2240 343, -619, -619, -619, -619, 2024, 204, -619, 208, 1679,
2241 934, 934, 934, 934, 17, -619, 28, -619, -619, 1450,
2242 206, 2024, 2024, 2024, 2024, 2024, 210, 211, 212, 214,
2243 217, 2024, 1679, 934, 218, -619, -619, -619, -619, -619,
2244 -619, -619, -619, -619, -619, -619, -619, -619, -619, 203,
2245 203, 2024, 2024, 2024, 2024, 2024, -619, 220, 222, 227,
2246 229, 211, 230, 2024, -619, 193, 1106, -73, -619, -619,
2247 238, 240, 339, 6, -619, 1940, -619, 366, -619, -3,
2248 1638, -97, -619, -11, -619, -619, 375, 390, 1450, 248,
2249 250, 255, 256, 1450, 411, 1450, 257, 258, 1450, 259,
2250 -37, -619, 260, 262, 412, 423, 265, 2024, 1450, 1450,
2251 -37, 1450, 268, 2024, -619, -619, -23, 270, 271, 272,
2252 274, 55, 2024, 2024, 2024, 2024, 66, 2024, -619, -619,
2253 276, 2024, 2024, 2024, 408, 429, -619, 203, -619, -37,
2254 275, 280, 284, -619, 279, 35, -619, -619, 1450, 1450,
2255 291, 1450, 1450, 1450, 1450, 268, -619, 268, 2024, 1450,
2256 289, 2024, 2024, 2024, -619, -619, 433, 934, -619, -619,
2257 294, 404, -619, 934, -619, 2024, 2024, 2024, 2024, -619,
2258 296, 304, 303, 305, -619, 211, -619, 306, 308, -12,
2259 -619, -619, -619, 522, 1958, -619, 449, -619, 314, 311,
2260 319, 2190, -619, -619, -619, -619, -619, -619, -619, 309,
2261 1450, -619, -619, -619, -619, 211, 2190, 268, 328, 337,
2262 344, 351, 2024, -619, 2024, 2024, 72, -619, -619, -619,
2263 -619, -619, -619, -37, 173, -619, -619, 497, -2, -13,
2264 -37, 73, -619, 346, 265, 87, -619, -619, -619, -619,
2265 -619, 354, 360, 361, -619, 522, -619, 470, 1450, 1588,
2266 -619, 3, 778, 778, -619, 2231, -619, -619, -619, -619,
2267 -619, -619, 521, 374, -619, 363, 1588, -619, 367, 368,
2268 -619, -619, 474, -13, -37, 557, -619, 508, -619, 516,
2269 370, 335, 335, 523, 778, 778, -619, 1450, 525, 1450,
2270 -619, -619, -619, 1450, 465, 335, 335, -619, 526, 1450,
2271 -619
Dan Gohman54392c12008-04-19 00:24:39 +00002272};
2273
2274/* YYPGOTO[NTERM-NUM]. */
2275static const yytype_int16 yypgoto[] =
2276{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002277 -619, 110, 128, 130, -158, -132, 0, -116, -126, 452,
2278 -619, 8, -619, -619, -619, -619, 31, -619, -619, -619,
2279 -148, -619, -436, -619, -254, -619, -236, -619, -619, -316,
2280 -87, -619, -393, -619, -619, -26, 318, -150, -619, 436,
2281 445, -114, -156, -240, 157, 199, 310, -619, -619, 536,
2282 -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,
2283 -619, 466, -619, -619, -619, -619, -619, -619, -618, -108,
2284 186, -192, -619, -619, 502, -619, 438, -619, -619, -619,
2285 -38, 121, -451, -619, 446, -619, -619
Dan Gohman54392c12008-04-19 00:24:39 +00002286};
2287
2288/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2289 positive, shift that token. If negative, reduce the rule which
2290 number is the opposite. If zero, do what YYDEFACT says.
2291 If YYTABLE_NINF, syntax error. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00002292#define YYTABLE_NINF -221
Dan Gohman54392c12008-04-19 00:24:39 +00002293static const yytype_int16 yytable[] =
2294{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002295 11, 82, 272, 358, 322, 417, 105, 159, 13, 659,
2296 526, 280, 162, 111, 676, 111, 111, 11, 111, 326,
2297 327, 328, 329, 330, 289, 13, 377, 379, 493, 336,
2298 91, 111, 111, 274, 318, 409, 111, 240, 94, 495,
2299 534, 675, -152, 111, 463, 111, 146, 131, 243, 44,
2300 273, 468, 109, 64, 65, 147, 514, 515, 690, 1,
2301 535, 319, 3, 21, 5, 1, 2, 463, 3, 4,
2302 5, 494, 84, 85, 546, 337, 138, 24, 22, 89,
2303 109, 146, 494, 432, 2, 90, 138, 4, 463, 286,
2304 236, 463, 155, 11, 135, 287, 362, 469, 364, 136,
2305 530, 119, 120, 593, 29, 30, 31, 32, 33, 34,
2306 35, 36, 25, 37, 359, 360, 233, 234, 26, 112,
2307 237, 112, 112, 363, 112, 365, 241, 419, -61, 355,
2308 354, 38, 39, 40, 626, 155, 467, 112, 112, 574,
2309 414, -61, 112, 283, 592, 416, -61, 434, -152, 112,
2310 629, 112, -152, 463, 27, 463, 163, 479, 481, 483,
2311 464, 463, 547, 46, 644, 47, 543, 660, 320, 321,
2312 283, 323, 677, 62, 106, 403, 338, 339, 403, 403,
2313 403, 86, 95, 87, 324, 283, 283, 283, 283, 283,
2314 331, 332, 333, 334, 335, 283, 572, 655, 116, 463,
2315 117, 28, 58, 662, 663, 138, 59, 534, 598, 50,
2316 51, 52, 60, 485, 53, 403, 155, 579, 91, 558,
2317 38, 39, 40, 403, 403, 403, 403, 403, 584, 499,
2318 566, 501, 502, 503, 654, 664, 566, 665, 98, 606,
2319 545, 607, 219, 219, 691, 692, 99, 694, 695, 667,
2320 100, 665, 456, 457, 458, 459, 460, 461, 462, 488,
2321 220, 220, 221, 221, 705, 706, 102, 470, 471, 472,
2322 103, 151, 152, 104, 410, 122, 123, 124, 125, 126,
2323 127, 87, 511, 114, 115, 148, 142, 143, 385, 160,
2324 150, 411, 412, 413, 165, 229, 231, 232, 235, 238,
2325 239, 646, 403, 403, 403, 403, 242, 111, 281, 288,
2326 272, 403, 433, 283, 436, 437, 438, 439, 356, 440,
2327 357, 366, 367, 441, 442, 403, 443, 444, 445, 446,
2328 447, 368, 369, 370, 380, 371, 372, 381, 517, 518,
2329 519, 520, 382, 383, 405, 431, 435, 420, 421, 528,
2330 466, 422, 423, 424, 425, 451, 452, 453, 273, 634,
2331 476, 454, 455, 475, 529, 484, 608, 473, 486, 611,
2332 612, 613, 487, 498, 504, 505, 507, 533, 508, 283,
2333 403, 509, 513, 155, 522, 403, 523, 403, 542, 340,
2334 403, 524, 548, 525, 527, 283, 500, 283, 283, 283,
2335 403, 403, 531, 403, 532, 510, 155, 549, 580, 581,
2336 582, 583, 551, 585, 552, 556, 564, 587, 588, 553,
2337 554, 558, 559, 561, 562, 516, 563, 565, 682, 566,
2338 590, 685, 571, 591, 575, 576, 577, 614, 578, 594,
2339 403, 403, 595, 403, 403, 403, 403, 586, 596, 539,
2340 597, 403, 601, 610, 466, 616, 341, 342, 494, 403,
2341 622, 618, 619, 620, 621, 403, 623, 624, 627, 625,
2342 628, 635, 406, 407, 408, 637, 343, 344, 642, 345,
2343 346, 567, 347, 348, 349, 636, 638, 573, 64, 65,
2344 647, 107, 67, 68, 69, 70, 71, 72, 73, 648,
2345 1, 2, 403, 3, 4, 5, 649, 589, 651, 418,
2346 652, 653, 693, 650, 658, 666, 668, 426, 427, 428,
2347 429, 430, 669, 670, 672, 686, 687, 689, -18, -19,
2348 696, 74, 283, 697, 698, 283, 283, 283, 708, 671,
2349 699, 1, 703, 709, 3, 132, 5, 656, 149, 352,
2350 403, 145, 361, 45, 403, 403, 130, 64, 65, 97,
2351 107, 67, 68, 69, 70, 71, 72, 73, 633, 1,
2352 2, 227, 3, 4, 5, 640, 340, 521, 645, 228,
2353 0, 0, 0, 0, 0, 0, 403, 403, 0, 403,
2354 640, 403, 0, 630, 0, 403, 489, 490, 491, 492,
2355 74, 403, 0, 0, 0, 497, 0, 0, 0, 0,
2356 0, 0, 0, 0, 0, 436, 437, 438, 439, 512,
2357 440, 0, 0, 0, 441, 442, 0, 443, 444, 445,
2358 446, 447, 0, 0, 0, 0, 0, 0, 0, 684,
2359 0, 0, 0, 341, 342, 0, 0, 75, 76, 0,
2360 0, 77, 0, 78, 108, 630, 0, 0, 0, 0,
2361 0, 0, 0, 343, 344, 0, 345, 346, 0, 347,
2362 348, 349, 0, 0, 550, 0, 0, 0, 0, 555,
2363 0, 557, 0, 0, 560, 0, 301, 302, 0, 0,
2364 0, 0, 0, 0, 568, 569, 0, 570, 436, 437,
2365 438, 439, 0, 440, 0, 0, 0, 441, 442, 0,
2366 443, 444, 445, 446, 447, 0, 75, 76, 0, 0,
2367 77, 0, 78, 144, 290, 291, 292, 293, 294, 295,
2368 296, 297, 298, 299, 599, 600, 0, 602, 603, 604,
2369 605, 0, 0, 0, 0, 609, 0, 0, 0, 0,
2370 0, 0, 0, 615, 0, 0, 0, 0, 0, 617,
2371 303, 304, 305, 306, 307, 308, 309, 310, 311, 312,
2372 313, 314, 315, 316, 0, 0, 0, 0, 0, 0,
2373 0, 386, 387, 388, 389, 64, 65, 390, 0, 0,
2374 -220, 0, 0, 0, 0, 0, 643, 1, 2, 0,
2375 3, 4, 5, 391, 392, 393, 0, 0, -63, 1,
2376 2, 0, 3, 4, 5, 0, 0, 0, 394, 395,
2377 6, 7, 0, 0, 0, 0, 0, 0, 0, 0,
2378 0, 0, 340, 0, 0, 0, 0, 396, 0, 0,
2379 0, 0, 8, 0, 674, 0, 9, 0, 680, 681,
2380 10, 0, 0, 175, 176, 177, 178, 179, 180, 181,
2381 182, 183, 184, 185, 186, 187, 188, 189, 254, 255,
2382 256, 257, 0, 0, 0, 0, 0, 0, 0, 0,
2383 700, 701, 0, 702, 0, 704, 0, 0, 0, 707,
2384 0, 0, 0, 0, 0, 710, 0, 258, 198, 678,
2385 679, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2386 0, 259, 0, 260, 261, 262, 0, 263, 264, 343,
2387 344, 0, 345, 346, 0, 347, 348, 349, 0, 0,
2388 0, 0, 0, 0, 0, 0, 0, 386, 387, 388,
2389 389, 64, 65, 390, 0, 397, 0, 0, 398, 0,
2390 399, 0, 400, 1, 2, 0, 3, 4, 5, 391,
2391 392, 393, 0, 0, 0, 0, 0, 0, 0, 0,
2392 0, 0, 0, 0, 394, 395, 0, 0, 0, 0,
2393 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2394 0, 64, 65, 396, 107, 67, 68, 69, 70, 71,
2395 72, 73, 0, 1, 2, 0, 3, 4, 5, 175,
2396 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
2397 186, 187, 188, 189, 254, 255, 256, 257, 0, 0,
2398 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002400 0, 0, 0, 258, 198, 199, 200, 201, 202, 203,
2401 204, 205, 206, 207, 208, 209, 0, 259, 0, 260,
2402 261, 262, 0, 263, 264, 0, 0, 0, 0, 0,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002404 0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
2405 0, 397, 0, 0, 398, 0, 399, 0, 400, 244,
2406 245, 246, 247, 64, 65, 248, 0, 0, 0, 0,
2407 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
Nick Lewyckyff384472008-11-24 03:41:24 +00002408 5, 249, 250, 251, 0, 0, 0, 0, 0, 0,
2409 0, 0, 0, 0, 0, 0, 252, 253, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002410 75, 76, 0, 0, 77, 0, 78, 378, 0, 0,
Nick Lewyckyff384472008-11-24 03:41:24 +00002411 0, 111, 64, 65, 0, 107, 67, 68, 69, 70,
2412 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2413 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2414 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2415 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002416 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyff384472008-11-24 03:41:24 +00002417 0, 0, 0, 0, 0, 258, 198, 199, 200, 201,
2418 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2419 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002420 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002421 0, 0, 0, 0, 0, 0, 0, 112, 0, 0,
2422 0, -61, 0, 265, 0, 0, 266, 0, 267, 0,
2423 268, 244, 245, 246, 247, 64, 65, 248, 0, 0,
2424 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2425 3, 4, 5, 249, 250, 251, 0, 0, 0, 0,
2426 0, 0, 0, 0, 0, 0, 0, 0, 252, 253,
2427 0, 75, 76, 0, 0, 77, 0, 78, 465, 0,
2428 0, 0, 0, 111, 64, 65, 0, 107, 67, 68,
2429 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2430 4, 5, 0, 175, 176, 177, 178, 179, 180, 181,
2431 182, 183, 184, 185, 186, 187, 188, 189, 254, 255,
2432 256, 257, 0, 0, 0, 0, 0, 74, 0, 0,
Nick Lewyckyff384472008-11-24 03:41:24 +00002433 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002434 0, 0, 0, 0, 0, 0, 0, 258, 198, 199,
2435 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2436 0, 259, 0, 260, 261, 262, 0, 263, 264, 0,
Nick Lewyckyff384472008-11-24 03:41:24 +00002437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002438 0, 0, 0, 0, 0, 0, 0, 0, 0, 112,
2439 0, 0, 0, 0, 0, 265, 0, 0, 266, 0,
2440 267, 0, 268, 386, 387, 388, 389, 64, 65, 390,
2441 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2442 2, 0, 3, 4, 5, 391, 392, 393, 0, 0,
Nick Lewyckyff384472008-11-24 03:41:24 +00002443 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002444 394, 395, -219, 75, 76, 0, 0, 77, 0, 78,
2445 482, 0, 0, 0, 0, 0, 0, 0, 0, 396,
2446 -63, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2447 0, 0, 6, 7, 0, 175, 176, 177, 178, 179,
Nick Lewyckyff384472008-11-24 03:41:24 +00002448 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002449 254, 255, 256, 257, 8, 0, 0, 0, 9, 0,
2450 0, 0, 10, 0, 0, 0, 0, 0, 0, 0,
2451 0, 0, 0, 0, 0, 0, 0, 0, 0, 258,
Nick Lewyckyff384472008-11-24 03:41:24 +00002452 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2453 208, 209, 0, 259, 0, 260, 261, 262, 0, 263,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002454 264, 386, 387, 388, 389, 0, 0, 390, 0, 0,
2455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2456 0, 0, 0, 391, 392, 393, 0, 397, 0, 0,
2457 398, 0, 399, 0, 400, 0, 0, 0, 394, 395,
2458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2459 0, 0, 0, 0, 0, 64, 65, 396, 107, 67,
Chris Lattnerc5320232008-10-15 06:16:57 +00002460 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002461 3, 4, 5, 175, 176, 177, 178, 179, 180, 181,
2462 182, 183, 184, 185, 186, 187, 188, 189, 254, 255,
2463 256, 257, 0, 0, 0, 0, 64, 65, 74, 153,
2464 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2465 0, 3, 4, 5, 0, 0, 0, 258, 198, 199,
2466 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2467 0, 259, 0, 260, 261, 262, 0, 263, 264, 74,
2468 0, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2469 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2470 0, 0, 0, 0, 0, 397, 0, 0, 398, 0,
2471 399, 0, 400, 137, 0, 0, 0, 0, 0, 0,
2472 0, 0, 0, 0, 74, 64, 65, 0, 153, 67,
2473 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2474 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2475 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2476 78, 544, 0, 0, 0, 0, 0, 0, 74, 0,
2477 275, 276, 0, 277, 64, 65, 278, 107, 67, 68,
2478 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2479 4, 5, 0, 0, 0, 75, 76, 0, 0, 77,
2480 0, 78, 0, 0, 0, 0, 351, 0, 0, 0,
2481 0, 0, 0, 0, 0, 64, 65, 74, 107, 67,
2482 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2483 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2484 75, 76, 0, 154, 77, 0, 78, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002485 0, 0, 0, 0, 0, 0, 64, 65, 74, 107,
2486 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002487 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00002488 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002489 78, 0, 0, 0, 0, 0, 0, 64, 65, 74,
2490 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2491 2, 0, 3, 4, 5, 64, 65, 0, 107, 67,
2492 68, 69, 70, 71, 72, 73, 0, 1, 2, 538,
2493 3, 4, 5, 75, 76, 0, 0, 77, 0, 78,
2494 74, 0, 0, 0, 0, 0, 0, 632, 0, 0,
2495 0, 0, 0, 0, 0, 0, 64, 65, 74, 66,
2496 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2497 0, 3, 4, 5, 75, 76, 0, 373, 77, 0,
2498 78, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2499 72, 73, 0, 1, 2, 0, 3, 4, 5, 74,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002500 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002501 0, 0, 0, 0, 0, 75, 76, 0, 478, 77,
2502 0, 78, 64, 65, 74, 282, 67, 68, 69, 70,
2503 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002504 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00002505 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002506 77, 0, 78, 0, 0, 74, 0, 0, 0, 0,
2507 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2508 78, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2509 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2510 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2511 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2512 0, 78, 64, 65, 74, 107, 67, 68, 69, 70,
2513 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2514 75, 76, 0, 0, 77, 0, 78, 64, 65, 0,
2515 107, 67, 68, 69, 70, 71, 72, 639, 0, 1,
2516 2, 0, 3, 4, 5, 74, 0, 0, 0, 0,
2517 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2518 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
2519 74, 107, 67, 68, 69, 70, 71, 72, 683, 0,
2520 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2521 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2522 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2523 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2524 75, 76, 0, 0, 77, 0, 376, 0, 0, 0,
2525 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2526 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2527 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2528 166, 75, 76, 0, 0, 77, 0, 480, 0, 0,
2529 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2530 0, 167, 168, 0, 0, 0, 75, 76, 0, 0,
2531 77, 0, 78, 169, 170, 171, 172, 173, 174, 175,
2532 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
2533 186, 187, 188, 189, 190, 191, 192, 193, 0, 0,
2534 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2535 0, 77, 0, 78, 0, 0, 0, 0, 194, 195,
2536 196, 0, 0, 197, 198, 199, 200, 201, 202, 203,
2537 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2538 214, 215, 216, 217, 218
Dan Gohman54392c12008-04-19 00:24:39 +00002539};
2540
2541static const yytype_int16 yycheck[] =
2542{
Bill Wendling1ba18d32008-12-17 20:59:57 +00002543 0, 27, 158, 239, 196, 321, 4, 121, 0, 11,
2544 461, 161, 28, 55, 11, 55, 55, 17, 55, 211,
2545 212, 213, 214, 215, 172, 17, 266, 267, 11, 221,
2546 21, 55, 55, 159, 192, 289, 55, 151, 29, 11,
2547 34, 659, 55, 55, 164, 55, 164, 7, 156, 0,
2548 158, 171, 78, 7, 8, 173, 449, 450, 676, 19,
2549 54, 193, 22, 53, 24, 19, 20, 164, 22, 23,
2550 24, 54, 41, 42, 171, 223, 102, 163, 68, 48,
2551 106, 164, 54, 337, 20, 54, 112, 23, 164, 11,
2552 173, 164, 118, 93, 164, 17, 254, 173, 256, 169,
2553 173, 32, 33, 539, 42, 43, 44, 45, 46, 47,
2554 48, 49, 59, 51, 240, 241, 142, 143, 163, 161,
2555 146, 161, 161, 255, 161, 257, 152, 167, 165, 171,
2556 169, 158, 159, 160, 585, 161, 376, 161, 161, 162,
2557 164, 165, 161, 169, 537, 164, 165, 339, 161, 161,
2558 162, 161, 165, 164, 18, 164, 172, 397, 398, 399,
2559 169, 164, 173, 46, 615, 48, 169, 169, 194, 195,
2560 196, 197, 169, 22, 172, 283, 117, 118, 286, 287,
2561 288, 35, 173, 37, 210, 211, 212, 213, 214, 215,
2562 216, 217, 218, 219, 220, 221, 512, 633, 42, 164,
2563 44, 163, 163, 639, 640, 231, 163, 34, 173, 42,
2564 43, 44, 167, 405, 47, 323, 242, 162, 21, 164,
2565 158, 159, 160, 331, 332, 333, 334, 335, 162, 421,
2566 164, 423, 424, 425, 162, 162, 164, 164, 22, 555,
2567 480, 557, 132, 133, 680, 681, 22, 683, 684, 162,
2568 22, 164, 366, 367, 368, 369, 370, 371, 372, 409,
2569 132, 133, 132, 133, 700, 701, 161, 381, 382, 383,
2570 4, 114, 115, 4, 300, 62, 63, 64, 65, 66,
2571 67, 37, 432, 84, 85, 161, 168, 168, 280, 4,
2572 165, 317, 318, 319, 163, 22, 164, 162, 171, 4,
2573 162, 617, 410, 411, 412, 413, 161, 55, 57, 11,
2574 466, 419, 338, 339, 141, 142, 143, 144, 171, 146,
2575 162, 161, 161, 150, 151, 433, 153, 154, 155, 156,
2576 157, 161, 161, 161, 22, 161, 161, 161, 452, 453,
2577 454, 455, 161, 161, 164, 38, 4, 164, 164, 463,
2578 376, 164, 164, 164, 164, 38, 161, 161, 466, 595,
2579 61, 161, 161, 161, 171, 22, 558, 164, 164, 561,
2580 562, 563, 164, 167, 164, 164, 164, 38, 164, 405,
2581 488, 164, 164, 409, 164, 493, 164, 495, 22, 54,
2582 498, 164, 17, 164, 164, 421, 422, 423, 424, 425,
2583 508, 509, 164, 511, 164, 431, 432, 17, 522, 523,
2584 524, 525, 164, 527, 164, 4, 4, 531, 532, 164,
2585 164, 164, 164, 164, 164, 451, 164, 4, 664, 164,
2586 22, 667, 164, 4, 164, 164, 164, 4, 164, 164,
2587 548, 549, 162, 551, 552, 553, 554, 171, 164, 475,
2588 171, 559, 161, 164, 480, 161, 121, 122, 54, 567,
2589 164, 575, 576, 577, 578, 573, 162, 164, 162, 164,
2590 162, 22, 286, 287, 288, 164, 141, 142, 169, 144,
2591 145, 507, 147, 148, 149, 171, 167, 513, 7, 8,
2592 162, 10, 11, 12, 13, 14, 15, 16, 17, 162,
2593 19, 20, 610, 22, 23, 24, 162, 533, 622, 323,
2594 624, 625, 38, 162, 17, 169, 162, 331, 332, 333,
2595 334, 335, 162, 162, 54, 4, 152, 164, 161, 161,
2596 22, 50, 558, 17, 164, 561, 562, 563, 73, 655,
2597 17, 19, 17, 17, 22, 93, 24, 634, 112, 231,
2598 658, 106, 242, 17, 662, 663, 90, 7, 8, 57,
2599 10, 11, 12, 13, 14, 15, 16, 17, 594, 19,
2600 20, 133, 22, 23, 24, 601, 54, 456, 616, 133,
2601 -1, -1, -1, -1, -1, -1, 694, 695, -1, 697,
2602 616, 699, -1, 593, -1, 703, 410, 411, 412, 413,
2603 50, 709, -1, -1, -1, 419, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, 141, 142, 143, 144, 433,
2605 146, -1, -1, -1, 150, 151, -1, 153, 154, 155,
2606 156, 157, -1, -1, -1, -1, -1, -1, -1, 665,
2607 -1, -1, -1, 121, 122, -1, -1, 166, 167, -1,
2608 -1, 170, -1, 172, 173, 655, -1, -1, -1, -1,
2609 -1, -1, -1, 141, 142, -1, 144, 145, -1, 147,
2610 148, 149, -1, -1, 488, -1, -1, -1, -1, 493,
2611 -1, 495, -1, -1, 498, -1, 26, 27, -1, -1,
2612 -1, -1, -1, -1, 508, 509, -1, 511, 141, 142,
Nick Lewyckyff384472008-11-24 03:41:24 +00002613 143, 144, -1, 146, -1, -1, -1, 150, 151, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002614 153, 154, 155, 156, 157, -1, 166, 167, -1, -1,
2615 170, -1, 172, 173, 94, 95, 96, 97, 98, 99,
2616 100, 101, 102, 103, 548, 549, -1, 551, 552, 553,
2617 554, -1, -1, -1, -1, 559, -1, -1, -1, -1,
2618 -1, -1, -1, 567, -1, -1, -1, -1, -1, 573,
2619 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2620 110, 111, 112, 113, -1, -1, -1, -1, -1, -1,
2621 -1, 3, 4, 5, 6, 7, 8, 9, -1, -1,
2622 0, -1, -1, -1, -1, -1, 610, 19, 20, -1,
2623 22, 23, 24, 25, 26, 27, -1, -1, 18, 19,
2624 20, -1, 22, 23, 24, -1, -1, -1, 40, 41,
2625 30, 31, -1, -1, -1, -1, -1, -1, -1, -1,
2626 -1, -1, 54, -1, -1, -1, -1, 59, -1, -1,
2627 -1, -1, 52, -1, 658, -1, 56, -1, 662, 663,
2628 60, -1, -1, 75, 76, 77, 78, 79, 80, 81,
2629 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2630 92, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2631 694, 695, -1, 697, -1, 699, -1, -1, -1, 703,
2632 -1, -1, -1, -1, -1, 709, -1, 119, 120, 121,
2633 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2634 -1, 133, -1, 135, 136, 137, -1, 139, 140, 141,
2635 142, -1, 144, 145, -1, 147, 148, 149, -1, -1,
2636 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
2637 6, 7, 8, 9, -1, 167, -1, -1, 170, -1,
2638 172, -1, 174, 19, 20, -1, 22, 23, 24, 25,
2639 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2640 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2641 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2642 -1, 7, 8, 59, 10, 11, 12, 13, 14, 15,
2643 16, 17, -1, 19, 20, -1, 22, 23, 24, 75,
2644 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2645 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2646 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002647 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002648 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2649 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2650 136, 137, -1, 139, 140, -1, -1, -1, -1, -1,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002651 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002652 -1, -1, -1, -1, -1, 161, -1, -1, -1, -1,
2653 -1, 167, -1, -1, 170, -1, 172, -1, 174, 3,
2654 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2655 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
Nick Lewyckyff384472008-11-24 03:41:24 +00002656 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2657 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002658 166, 167, -1, -1, 170, -1, 172, 173, -1, -1,
Nick Lewyckyff384472008-11-24 03:41:24 +00002659 -1, 55, 7, 8, -1, 10, 11, 12, 13, 14,
2660 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2661 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2662 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2663 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002664 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyff384472008-11-24 03:41:24 +00002665 -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
2666 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2667 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002668 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002669 -1, -1, -1, -1, -1, -1, -1, 161, -1, -1,
2670 -1, 165, -1, 167, -1, -1, 170, -1, 172, -1,
2671 174, 3, 4, 5, 6, 7, 8, 9, -1, -1,
2672 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
2673 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
2674 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
2675 -1, 166, 167, -1, -1, 170, -1, 172, 173, -1,
2676 -1, -1, -1, 55, 7, 8, -1, 10, 11, 12,
2677 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2678 23, 24, -1, 75, 76, 77, 78, 79, 80, 81,
2679 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2680 92, 93, -1, -1, -1, -1, -1, 50, -1, -1,
Nick Lewyckyff384472008-11-24 03:41:24 +00002681 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002682 -1, -1, -1, -1, -1, -1, -1, 119, 120, 121,
2683 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2684 -1, 133, -1, 135, 136, 137, -1, 139, 140, -1,
Nick Lewyckyff384472008-11-24 03:41:24 +00002685 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002686 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2687 -1, -1, -1, -1, -1, 167, -1, -1, 170, -1,
2688 172, -1, 174, 3, 4, 5, 6, 7, 8, 9,
2689 -1, -1, -1, -1, -1, -1, -1, -1, -1, 19,
2690 20, -1, 22, 23, 24, 25, 26, 27, -1, -1,
Nick Lewyckyff384472008-11-24 03:41:24 +00002691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002692 40, 41, 0, 166, 167, -1, -1, 170, -1, 172,
2693 173, -1, -1, -1, -1, -1, -1, -1, -1, 59,
2694 18, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2695 -1, -1, 30, 31, -1, 75, 76, 77, 78, 79,
Nick Lewyckyff384472008-11-24 03:41:24 +00002696 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002697 90, 91, 92, 93, 52, -1, -1, -1, 56, -1,
2698 -1, -1, 60, -1, -1, -1, -1, -1, -1, -1,
2699 -1, -1, -1, -1, -1, -1, -1, -1, -1, 119,
Nick Lewyckyff384472008-11-24 03:41:24 +00002700 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2701 130, 131, -1, 133, -1, 135, 136, 137, -1, 139,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002702 140, 3, 4, 5, 6, -1, -1, 9, -1, -1,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002703 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002704 -1, -1, -1, 25, 26, 27, -1, 167, -1, -1,
2705 170, -1, 172, -1, 174, -1, -1, -1, 40, 41,
2706 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2707 -1, -1, -1, -1, -1, 7, 8, 59, 10, 11,
2708 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2709 22, 23, 24, 75, 76, 77, 78, 79, 80, 81,
2710 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2711 92, 93, -1, -1, -1, -1, 7, 8, 50, 10,
2712 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2713 -1, 22, 23, 24, -1, -1, -1, 119, 120, 121,
2714 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2715 -1, 133, -1, 135, 136, 137, -1, 139, 140, 50,
2716 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2717 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2718 -1, -1, -1, -1, -1, 167, -1, -1, 170, -1,
2719 172, -1, 174, 39, -1, -1, -1, -1, -1, -1,
2720 -1, -1, -1, -1, 50, 7, 8, -1, 10, 11,
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00002721 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2722 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002723 -1, -1, -1, -1, 166, 167, -1, -1, 170, -1,
2724 172, 173, -1, -1, -1, -1, -1, -1, 50, -1,
2725 141, 142, -1, 144, 7, 8, 147, 10, 11, 12,
2726 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2727 23, 24, -1, -1, -1, 166, 167, -1, -1, 170,
2728 -1, 172, -1, -1, -1, -1, 39, -1, -1, -1,
2729 -1, -1, -1, -1, -1, 7, 8, 50, 10, 11,
2730 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2731 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2732 166, 167, -1, 125, 170, -1, 172, -1, -1, -1,
2733 -1, -1, -1, -1, -1, -1, 7, 8, 50, 10,
2734 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2735 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2736 -1, -1, -1, -1, 166, 167, -1, -1, 170, -1,
2737 172, -1, -1, -1, -1, -1, -1, 7, 8, 50,
2738 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2739 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2740 12, 13, 14, 15, 16, 17, -1, 19, 20, 39,
2741 22, 23, 24, 166, 167, -1, -1, 170, -1, 172,
2742 50, -1, -1, -1, -1, -1, -1, 39, -1, -1,
2743 -1, -1, -1, -1, -1, -1, 7, 8, 50, 10,
2744 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2745 -1, 22, 23, 24, 166, 167, -1, 169, 170, -1,
2746 172, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2747 16, 17, -1, 19, 20, -1, 22, 23, 24, 50,
2748 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2749 -1, -1, -1, -1, -1, 166, 167, -1, 169, 170,
2750 -1, 172, 7, 8, 50, 10, 11, 12, 13, 14,
2751 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2752 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2753 -1, -1, -1, -1, -1, -1, 166, 167, -1, -1,
2754 170, -1, 172, -1, -1, 50, -1, -1, -1, -1,
2755 -1, -1, -1, -1, 166, 167, -1, -1, 170, -1,
2756 172, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2757 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2758 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2759 -1, -1, -1, -1, -1, 166, 167, -1, -1, 170,
2760 -1, 172, 7, 8, 50, 10, 11, 12, 13, 14,
2761 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2762 166, 167, -1, -1, 170, -1, 172, 7, 8, -1,
2763 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2764 20, -1, 22, 23, 24, 50, -1, -1, -1, -1,
2765 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2766 -1, 166, 167, -1, -1, 170, -1, 172, 7, 8,
2767 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2768 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Bill Wendling60f02fc2008-11-13 01:03:00 +00002769 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyff384472008-11-24 03:41:24 +00002770 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002771 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2772 166, 167, -1, -1, 170, -1, 172, -1, -1, -1,
2773 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2774 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2775 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2776 36, 166, 167, -1, -1, 170, -1, 172, -1, -1,
2777 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2778 -1, 57, 58, -1, -1, -1, 166, 167, -1, -1,
2779 170, -1, 172, 69, 70, 71, 72, 73, 74, 75,
2780 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2781 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2782 -1, -1, -1, -1, -1, -1, -1, 166, 167, -1,
2783 -1, 170, -1, 172, -1, -1, -1, -1, 114, 115,
2784 116, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2785 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2786 136, 137, 138, 139, 140
Dan Gohman54392c12008-04-19 00:24:39 +00002787};
2788
2789/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2790 symbol of state STATE-NUM. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002791static const yytype_uint16 yystos[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002792{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002793 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002794 60, 181, 184, 186, 187, 188, 222, 223, 224, 226,
2795 225, 53, 68, 231, 163, 59, 163, 18, 163, 42,
2796 43, 44, 45, 46, 47, 48, 49, 51, 158, 159,
2797 160, 189, 190, 191, 0, 224, 46, 48, 192, 241,
2798 42, 43, 44, 47, 193, 238, 240, 248, 163, 163,
2799 167, 232, 22, 230, 7, 8, 10, 11, 12, 13,
2800 14, 15, 16, 17, 50, 166, 167, 170, 172, 181,
2801 186, 209, 210, 244, 191, 191, 35, 37, 220, 191,
2802 191, 21, 249, 250, 29, 173, 239, 249, 22, 22,
2803 22, 233, 161, 4, 4, 4, 172, 10, 173, 210,
2804 215, 55, 161, 183, 220, 220, 42, 44, 194, 32,
2805 33, 219, 62, 63, 64, 65, 66, 67, 195, 236,
2806 236, 7, 184, 185, 253, 164, 169, 39, 210, 211,
2807 213, 214, 168, 168, 173, 215, 164, 173, 161, 214,
2808 165, 219, 219, 10, 125, 210, 212, 221, 210, 216,
2809 4, 199, 28, 172, 237, 163, 36, 57, 58, 69,
Chris Lattnerc5320232008-10-15 06:16:57 +00002810 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2811 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2812 90, 91, 92, 93, 114, 115, 116, 119, 120, 121,
2813 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002814 132, 133, 134, 135, 136, 137, 138, 139, 140, 176,
2815 177, 178, 251, 258, 259, 260, 261, 251, 259, 22,
2816 197, 164, 162, 210, 210, 171, 173, 210, 4, 162,
2817 216, 210, 161, 244, 3, 4, 5, 6, 9, 25,
Chris Lattnerc5320232008-10-15 06:16:57 +00002818 26, 27, 40, 41, 90, 91, 92, 93, 119, 133,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002819 135, 136, 137, 139, 140, 167, 170, 172, 174, 176,
2820 177, 178, 217, 244, 183, 141, 142, 144, 147, 198,
2821 212, 57, 10, 210, 246, 247, 11, 17, 11, 195,
Nick Lewyckyff384472008-11-24 03:41:24 +00002822 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002823 179, 26, 27, 100, 101, 102, 103, 104, 105, 106,
2824 107, 108, 109, 110, 111, 112, 113, 180, 179, 180,
2825 210, 210, 246, 210, 210, 254, 246, 246, 246, 246,
2826 246, 210, 210, 210, 210, 210, 246, 195, 117, 118,
Nick Lewyckyff384472008-11-24 03:41:24 +00002827 54, 121, 122, 141, 142, 144, 145, 147, 148, 149,
Bill Wendling1ba18d32008-12-17 20:59:57 +00002828 196, 39, 211, 201, 169, 171, 171, 162, 201, 183,
2829 183, 221, 179, 180, 179, 180, 161, 161, 161, 161,
2830 161, 161, 161, 169, 216, 218, 172, 218, 173, 218,
2831 22, 161, 161, 161, 227, 186, 3, 4, 5, 6,
2832 9, 25, 26, 27, 40, 41, 59, 167, 170, 172,
2833 174, 217, 243, 244, 245, 164, 245, 245, 245, 199,
2834 210, 210, 210, 210, 164, 204, 164, 204, 245, 167,
2835 164, 164, 164, 164, 164, 164, 245, 245, 245, 245,
2836 245, 38, 199, 210, 246, 4, 141, 142, 143, 144,
2837 146, 150, 151, 153, 154, 155, 156, 157, 200, 228,
2838 229, 38, 161, 161, 161, 161, 216, 216, 216, 216,
2839 216, 216, 216, 164, 169, 173, 210, 218, 171, 173,
2840 216, 216, 216, 164, 207, 161, 61, 242, 169, 218,
2841 172, 218, 173, 218, 22, 246, 164, 164, 212, 245,
2842 245, 245, 245, 11, 54, 11, 256, 245, 167, 246,
2843 210, 246, 246, 246, 164, 164, 257, 164, 164, 164,
2844 210, 212, 245, 164, 207, 207, 210, 216, 216, 216,
2845 216, 256, 164, 164, 164, 164, 257, 164, 216, 171,
2846 173, 164, 164, 38, 34, 54, 205, 208, 39, 210,
2847 234, 235, 22, 169, 173, 218, 171, 173, 17, 17,
2848 245, 164, 164, 164, 164, 245, 4, 245, 164, 164,
2849 245, 164, 164, 164, 4, 4, 164, 210, 245, 245,
2850 245, 164, 204, 210, 162, 164, 164, 164, 164, 162,
2851 216, 216, 216, 216, 162, 216, 171, 216, 216, 210,
2852 22, 4, 207, 197, 164, 162, 164, 171, 173, 245,
2853 245, 161, 245, 245, 245, 245, 204, 204, 246, 245,
2854 164, 246, 246, 246, 4, 245, 161, 245, 216, 216,
2855 216, 216, 164, 162, 164, 164, 257, 162, 162, 162,
2856 181, 182, 39, 210, 201, 22, 171, 164, 167, 17,
2857 210, 255, 169, 245, 257, 255, 204, 162, 162, 162,
2858 162, 216, 216, 216, 162, 197, 205, 206, 17, 11,
2859 169, 252, 197, 197, 162, 164, 169, 162, 162, 162,
2860 162, 182, 54, 203, 245, 243, 11, 169, 121, 122,
2861 245, 245, 201, 17, 210, 201, 4, 152, 202, 164,
2862 243, 197, 197, 38, 197, 197, 22, 17, 164, 17,
2863 245, 245, 245, 17, 245, 197, 197, 245, 73, 17,
2864 245
Dan Gohman54392c12008-04-19 00:24:39 +00002865};
David Greene9145dd22007-08-01 03:59:32 +00002866
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002867#define yyerrok (yyerrstatus = 0)
2868#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002869#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002870#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002871
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002872#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002873#define YYABORT goto yyabortlab
2874#define YYERROR goto yyerrorlab
2875
2876
2877/* Like YYERROR except do call yyerror. This remains here temporarily
2878 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002879 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002880
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002881#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002882
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002883#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002884
2885#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002886do \
2887 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002888 { \
2889 yychar = (Token); \
2890 yylval = (Value); \
2891 yytoken = YYTRANSLATE (yychar); \
2892 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002893 goto yybackup; \
2894 } \
2895 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002896 { \
2897 yyerror (YY_("syntax error: cannot back up")); \
2898 YYERROR; \
2899 } \
2900while (YYID (0))
2901
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002902
2903#define YYTERROR 1
2904#define YYERRCODE 256
2905
Dan Gohman54392c12008-04-19 00:24:39 +00002906
2907/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2908 If N is 0, then set CURRENT to the empty location which ends
2909 the previous symbol: RHS[0] (always defined). */
2910
2911#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2912#ifndef YYLLOC_DEFAULT
2913# define YYLLOC_DEFAULT(Current, Rhs, N) \
2914 do \
2915 if (YYID (N)) \
2916 { \
2917 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2918 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2919 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2920 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2921 } \
2922 else \
2923 { \
2924 (Current).first_line = (Current).last_line = \
2925 YYRHSLOC (Rhs, 0).last_line; \
2926 (Current).first_column = (Current).last_column = \
2927 YYRHSLOC (Rhs, 0).last_column; \
2928 } \
2929 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002930#endif
2931
Dan Gohman54392c12008-04-19 00:24:39 +00002932
2933/* YY_LOCATION_PRINT -- Print the location on the stream.
2934 This macro was not mandated originally: define only if we know
2935 we won't break user code: when these are the locations we know. */
2936
2937#ifndef YY_LOCATION_PRINT
Nick Lewyckyff384472008-11-24 03:41:24 +00002938# if YYLTYPE_IS_TRIVIAL
Dan Gohman54392c12008-04-19 00:24:39 +00002939# define YY_LOCATION_PRINT(File, Loc) \
2940 fprintf (File, "%d.%d-%d.%d", \
2941 (Loc).first_line, (Loc).first_column, \
2942 (Loc).last_line, (Loc).last_column)
2943# else
2944# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2945# endif
2946#endif
2947
2948
2949/* YYLEX -- calling `yylex' with the right arguments. */
2950
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002951#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002952# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002953#else
Dan Gohman54392c12008-04-19 00:24:39 +00002954# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002955#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002956
2957/* Enable debugging if requested. */
2958#if YYDEBUG
2959
2960# ifndef YYFPRINTF
2961# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2962# define YYFPRINTF fprintf
2963# endif
2964
2965# define YYDPRINTF(Args) \
2966do { \
2967 if (yydebug) \
2968 YYFPRINTF Args; \
2969} while (YYID (0))
2970
2971# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2972do { \
2973 if (yydebug) \
2974 { \
2975 YYFPRINTF (stderr, "%s ", Title); \
2976 yy_symbol_print (stderr, \
2977 Type, Value); \
2978 YYFPRINTF (stderr, "\n"); \
2979 } \
2980} while (YYID (0))
2981
2982
2983/*--------------------------------.
2984| Print this symbol on YYOUTPUT. |
2985`--------------------------------*/
2986
2987/*ARGSUSED*/
2988#if (defined __STDC__ || defined __C99__FUNC__ \
2989 || defined __cplusplus || defined _MSC_VER)
2990static void
2991yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002992#else
Dan Gohman54392c12008-04-19 00:24:39 +00002993static void
2994yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2995 FILE *yyoutput;
2996 int yytype;
2997 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002998#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002999{
3000 if (!yyvaluep)
3001 return;
3002# ifdef YYPRINT
3003 if (yytype < YYNTOKENS)
3004 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
3005# else
3006 YYUSE (yyoutput);
3007# endif
3008 switch (yytype)
3009 {
3010 default:
3011 break;
3012 }
3013}
3014
3015
3016/*--------------------------------.
3017| Print this symbol on YYOUTPUT. |
3018`--------------------------------*/
3019
3020#if (defined __STDC__ || defined __C99__FUNC__ \
3021 || defined __cplusplus || defined _MSC_VER)
3022static void
3023yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3024#else
3025static void
3026yy_symbol_print (yyoutput, yytype, yyvaluep)
3027 FILE *yyoutput;
3028 int yytype;
3029 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00003030#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003031{
3032 if (yytype < YYNTOKENS)
3033 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3034 else
3035 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00003036
Dan Gohman54392c12008-04-19 00:24:39 +00003037 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3038 YYFPRINTF (yyoutput, ")");
3039}
Chris Lattner59363a32008-02-19 04:36:25 +00003040
Dan Gohman54392c12008-04-19 00:24:39 +00003041/*------------------------------------------------------------------.
3042| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3043| TOP (included). |
3044`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00003045
Dan Gohman54392c12008-04-19 00:24:39 +00003046#if (defined __STDC__ || defined __C99__FUNC__ \
3047 || defined __cplusplus || defined _MSC_VER)
3048static void
3049yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3050#else
3051static void
3052yy_stack_print (bottom, top)
3053 yytype_int16 *bottom;
3054 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00003055#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003056{
3057 YYFPRINTF (stderr, "Stack now");
3058 for (; bottom <= top; ++bottom)
3059 YYFPRINTF (stderr, " %d", *bottom);
3060 YYFPRINTF (stderr, "\n");
3061}
Chris Lattner59363a32008-02-19 04:36:25 +00003062
Dan Gohman54392c12008-04-19 00:24:39 +00003063# define YY_STACK_PRINT(Bottom, Top) \
3064do { \
3065 if (yydebug) \
3066 yy_stack_print ((Bottom), (Top)); \
3067} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00003068
Dan Gohman54392c12008-04-19 00:24:39 +00003069
3070/*------------------------------------------------.
3071| Report that the YYRULE is going to be reduced. |
3072`------------------------------------------------*/
3073
3074#if (defined __STDC__ || defined __C99__FUNC__ \
3075 || defined __cplusplus || defined _MSC_VER)
3076static void
3077yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3078#else
3079static void
3080yy_reduce_print (yyvsp, yyrule)
3081 YYSTYPE *yyvsp;
3082 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00003083#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003084{
3085 int yynrhs = yyr2[yyrule];
3086 int yyi;
3087 unsigned long int yylno = yyrline[yyrule];
3088 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3089 yyrule - 1, yylno);
3090 /* The symbols being reduced. */
3091 for (yyi = 0; yyi < yynrhs; yyi++)
3092 {
3093 fprintf (stderr, " $%d = ", yyi + 1);
3094 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3095 &(yyvsp[(yyi + 1) - (yynrhs)])
3096 );
3097 fprintf (stderr, "\n");
3098 }
3099}
Scott Michel5a6f17b2008-01-30 02:55:46 +00003100
Dan Gohman54392c12008-04-19 00:24:39 +00003101# define YY_REDUCE_PRINT(Rule) \
3102do { \
3103 if (yydebug) \
3104 yy_reduce_print (yyvsp, Rule); \
3105} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00003106
Dan Gohman54392c12008-04-19 00:24:39 +00003107/* Nonzero means print parse trace. It is left uninitialized so that
3108 multiple parsers can coexist. */
3109int yydebug;
3110#else /* !YYDEBUG */
3111# define YYDPRINTF(Args)
3112# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3113# define YY_STACK_PRINT(Bottom, Top)
3114# define YY_REDUCE_PRINT(Rule)
3115#endif /* !YYDEBUG */
3116
3117
3118/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003119#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003120# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003121#endif
3122
Dan Gohman54392c12008-04-19 00:24:39 +00003123/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3124 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003125
Dan Gohman54392c12008-04-19 00:24:39 +00003126 Do not make this value too large; the results are undefined if
3127 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3128 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00003129
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003130#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003131# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003132#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003133
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003134
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003135
Dan Gohman54392c12008-04-19 00:24:39 +00003136#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003137
Dan Gohman54392c12008-04-19 00:24:39 +00003138# ifndef yystrlen
3139# if defined __GLIBC__ && defined _STRING_H
3140# define yystrlen strlen
3141# else
3142/* Return the length of YYSTR. */
3143#if (defined __STDC__ || defined __C99__FUNC__ \
3144 || defined __cplusplus || defined _MSC_VER)
3145static YYSIZE_T
3146yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00003147#else
Dan Gohman54392c12008-04-19 00:24:39 +00003148static YYSIZE_T
3149yystrlen (yystr)
3150 const char *yystr;
3151#endif
3152{
3153 YYSIZE_T yylen;
3154 for (yylen = 0; yystr[yylen]; yylen++)
3155 continue;
3156 return yylen;
3157}
3158# endif
3159# endif
3160
3161# ifndef yystpcpy
3162# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3163# define yystpcpy stpcpy
3164# else
3165/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3166 YYDEST. */
3167#if (defined __STDC__ || defined __C99__FUNC__ \
3168 || defined __cplusplus || defined _MSC_VER)
3169static char *
3170yystpcpy (char *yydest, const char *yysrc)
3171#else
3172static char *
3173yystpcpy (yydest, yysrc)
3174 char *yydest;
3175 const char *yysrc;
3176#endif
3177{
3178 char *yyd = yydest;
3179 const char *yys = yysrc;
3180
3181 while ((*yyd++ = *yys++) != '\0')
3182 continue;
3183
3184 return yyd - 1;
3185}
3186# endif
3187# endif
3188
3189# ifndef yytnamerr
3190/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3191 quotes and backslashes, so that it's suitable for yyerror. The
3192 heuristic is that double-quoting is unnecessary unless the string
3193 contains an apostrophe, a comma, or backslash (other than
3194 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3195 null, do not copy; instead, return the length of what the result
3196 would have been. */
3197static YYSIZE_T
3198yytnamerr (char *yyres, const char *yystr)
3199{
3200 if (*yystr == '"')
3201 {
3202 YYSIZE_T yyn = 0;
3203 char const *yyp = yystr;
3204
3205 for (;;)
3206 switch (*++yyp)
3207 {
3208 case '\'':
3209 case ',':
3210 goto do_not_strip_quotes;
3211
3212 case '\\':
3213 if (*++yyp != '\\')
3214 goto do_not_strip_quotes;
3215 /* Fall through. */
3216 default:
3217 if (yyres)
3218 yyres[yyn] = *yyp;
3219 yyn++;
3220 break;
3221
3222 case '"':
3223 if (yyres)
3224 yyres[yyn] = '\0';
3225 return yyn;
3226 }
3227 do_not_strip_quotes: ;
3228 }
3229
3230 if (! yyres)
3231 return yystrlen (yystr);
3232
3233 return yystpcpy (yyres, yystr) - yyres;
3234}
3235# endif
3236
3237/* Copy into YYRESULT an error message about the unexpected token
3238 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3239 including the terminating null byte. If YYRESULT is null, do not
3240 copy anything; just return the number of bytes that would be
3241 copied. As a special case, return 0 if an ordinary "syntax error"
3242 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3243 size calculation. */
3244static YYSIZE_T
3245yysyntax_error (char *yyresult, int yystate, int yychar)
3246{
3247 int yyn = yypact[yystate];
3248
3249 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3250 return 0;
3251 else
3252 {
3253 int yytype = YYTRANSLATE (yychar);
3254 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3255 YYSIZE_T yysize = yysize0;
3256 YYSIZE_T yysize1;
3257 int yysize_overflow = 0;
3258 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3259 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3260 int yyx;
3261
3262# if 0
3263 /* This is so xgettext sees the translatable formats that are
3264 constructed on the fly. */
3265 YY_("syntax error, unexpected %s");
3266 YY_("syntax error, unexpected %s, expecting %s");
3267 YY_("syntax error, unexpected %s, expecting %s or %s");
3268 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3269 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3270# endif
3271 char *yyfmt;
3272 char const *yyf;
3273 static char const yyunexpected[] = "syntax error, unexpected %s";
3274 static char const yyexpecting[] = ", expecting %s";
3275 static char const yyor[] = " or %s";
3276 char yyformat[sizeof yyunexpected
3277 + sizeof yyexpecting - 1
3278 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3279 * (sizeof yyor - 1))];
3280 char const *yyprefix = yyexpecting;
3281
3282 /* Start YYX at -YYN if negative to avoid negative indexes in
3283 YYCHECK. */
3284 int yyxbegin = yyn < 0 ? -yyn : 0;
3285
3286 /* Stay within bounds of both yycheck and yytname. */
3287 int yychecklim = YYLAST - yyn + 1;
3288 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3289 int yycount = 1;
3290
3291 yyarg[0] = yytname[yytype];
3292 yyfmt = yystpcpy (yyformat, yyunexpected);
3293
3294 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3295 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3296 {
3297 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3298 {
3299 yycount = 1;
3300 yysize = yysize0;
3301 yyformat[sizeof yyunexpected - 1] = '\0';
3302 break;
3303 }
3304 yyarg[yycount++] = yytname[yyx];
3305 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3306 yysize_overflow |= (yysize1 < yysize);
3307 yysize = yysize1;
3308 yyfmt = yystpcpy (yyfmt, yyprefix);
3309 yyprefix = yyor;
3310 }
3311
3312 yyf = YY_(yyformat);
3313 yysize1 = yysize + yystrlen (yyf);
3314 yysize_overflow |= (yysize1 < yysize);
3315 yysize = yysize1;
3316
3317 if (yysize_overflow)
3318 return YYSIZE_MAXIMUM;
3319
3320 if (yyresult)
3321 {
3322 /* Avoid sprintf, as that infringes on the user's name space.
3323 Don't have undefined behavior even if the translation
3324 produced a string with the wrong number of "%s"s. */
3325 char *yyp = yyresult;
3326 int yyi = 0;
3327 while ((*yyp = *yyf) != '\0')
3328 {
3329 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3330 {
3331 yyp += yytnamerr (yyp, yyarg[yyi++]);
3332 yyf += 2;
3333 }
3334 else
3335 {
3336 yyp++;
3337 yyf++;
3338 }
3339 }
3340 }
3341 return yysize;
3342 }
3343}
3344#endif /* YYERROR_VERBOSE */
3345
3346
3347/*-----------------------------------------------.
3348| Release the memory associated to this symbol. |
3349`-----------------------------------------------*/
3350
3351/*ARGSUSED*/
3352#if (defined __STDC__ || defined __C99__FUNC__ \
3353 || defined __cplusplus || defined _MSC_VER)
3354static void
3355yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3356#else
3357static void
3358yydestruct (yymsg, yytype, yyvaluep)
3359 const char *yymsg;
3360 int yytype;
3361 YYSTYPE *yyvaluep;
3362#endif
3363{
3364 YYUSE (yyvaluep);
3365
3366 if (!yymsg)
3367 yymsg = "Deleting";
3368 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3369
3370 switch (yytype)
3371 {
3372
3373 default:
3374 break;
3375 }
3376}
3377
3378
3379/* Prevent warnings from -Wmissing-prototypes. */
3380
3381#ifdef YYPARSE_PARAM
3382#if defined __STDC__ || defined __cplusplus
3383int yyparse (void *YYPARSE_PARAM);
3384#else
3385int yyparse ();
3386#endif
3387#else /* ! YYPARSE_PARAM */
3388#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003389int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003390#else
Dan Gohman54392c12008-04-19 00:24:39 +00003391int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003392#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003393#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003394
Chris Lattner59363a32008-02-19 04:36:25 +00003395
Dan Gohman54392c12008-04-19 00:24:39 +00003396
3397/* The look-ahead symbol. */
3398int yychar;
3399
3400/* The semantic value of the look-ahead symbol. */
3401YYSTYPE yylval;
3402
3403/* Number of syntax errors so far. */
3404int yynerrs;
3405
3406
3407
3408/*----------.
3409| yyparse. |
3410`----------*/
3411
3412#ifdef YYPARSE_PARAM
3413#if (defined __STDC__ || defined __C99__FUNC__ \
3414 || defined __cplusplus || defined _MSC_VER)
3415int
3416yyparse (void *YYPARSE_PARAM)
3417#else
3418int
3419yyparse (YYPARSE_PARAM)
3420 void *YYPARSE_PARAM;
3421#endif
3422#else /* ! YYPARSE_PARAM */
3423#if (defined __STDC__ || defined __C99__FUNC__ \
3424 || defined __cplusplus || defined _MSC_VER)
3425int
3426yyparse (void)
3427#else
3428int
3429yyparse ()
3430
Gabor Greif89f01162008-04-06 23:07:54 +00003431#endif
3432#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003433{
3434
3435 int yystate;
3436 int yyn;
3437 int yyresult;
3438 /* Number of tokens to shift before error messages enabled. */
3439 int yyerrstatus;
3440 /* Look-ahead token as an internal (translated) token number. */
3441 int yytoken = 0;
3442#if YYERROR_VERBOSE
3443 /* Buffer for error messages, and its allocated size. */
3444 char yymsgbuf[128];
3445 char *yymsg = yymsgbuf;
3446 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003447#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003448
Dan Gohman54392c12008-04-19 00:24:39 +00003449 /* Three stacks and their tools:
3450 `yyss': related to states,
3451 `yyvs': related to semantic values,
3452 `yyls': related to locations.
3453
3454 Refer to the stacks thru separate pointers, to allow yyoverflow
3455 to reallocate them elsewhere. */
3456
3457 /* The state stack. */
3458 yytype_int16 yyssa[YYINITDEPTH];
3459 yytype_int16 *yyss = yyssa;
3460 yytype_int16 *yyssp;
3461
3462 /* The semantic value stack. */
3463 YYSTYPE yyvsa[YYINITDEPTH];
3464 YYSTYPE *yyvs = yyvsa;
3465 YYSTYPE *yyvsp;
3466
3467
3468
3469#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3470
3471 YYSIZE_T yystacksize = YYINITDEPTH;
3472
3473 /* The variables used to return semantic value and location from the
3474 action routines. */
3475 YYSTYPE yyval;
3476
3477
3478 /* The number of symbols on the RHS of the reduced rule.
3479 Keep to zero when no symbol should be popped. */
3480 int yylen = 0;
3481
3482 YYDPRINTF ((stderr, "Starting parse\n"));
3483
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003484 yystate = 0;
3485 yyerrstatus = 0;
3486 yynerrs = 0;
3487 yychar = YYEMPTY; /* Cause a token to be read. */
3488
3489 /* Initialize stack pointers.
3490 Waste one element of value and location stack
3491 so that they stay on the same level as the state stack.
3492 The wasted elements are never initialized. */
3493
Dan Gohman54392c12008-04-19 00:24:39 +00003494 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003495 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003496
Dan Gohman54392c12008-04-19 00:24:39 +00003497 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003498
Dan Gohman54392c12008-04-19 00:24:39 +00003499/*------------------------------------------------------------.
3500| yynewstate -- Push a new state, which is found in yystate. |
3501`------------------------------------------------------------*/
3502 yynewstate:
3503 /* In all cases, when you get here, the value and location stacks
3504 have just been pushed. So pushing a state here evens the stacks. */
3505 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003506
Dan Gohman54392c12008-04-19 00:24:39 +00003507 yysetstate:
3508 *yyssp = yystate;
3509
3510 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003511 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003512 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003513 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003514
3515#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003516 {
3517 /* Give user a chance to reallocate the stack. Use copies of
3518 these so that the &'s don't force the real ones into
3519 memory. */
3520 YYSTYPE *yyvs1 = yyvs;
3521 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003522
Dan Gohman54392c12008-04-19 00:24:39 +00003523
3524 /* Each stack pointer address is followed by the size of the
3525 data in use in that stack, in bytes. This used to be a
3526 conditional around just the two extra args, but that might
3527 be undefined if yyoverflow is a macro. */
3528 yyoverflow (YY_("memory exhausted"),
3529 &yyss1, yysize * sizeof (*yyssp),
3530 &yyvs1, yysize * sizeof (*yyvsp),
3531
3532 &yystacksize);
3533
3534 yyss = yyss1;
3535 yyvs = yyvs1;
3536 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003537#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003538# ifndef YYSTACK_RELOCATE
3539 goto yyexhaustedlab;
3540# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003541 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003542 if (YYMAXDEPTH <= yystacksize)
3543 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003544 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003545 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003546 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003547
3548 {
3549 yytype_int16 *yyss1 = yyss;
3550 union yyalloc *yyptr =
3551 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3552 if (! yyptr)
3553 goto yyexhaustedlab;
3554 YYSTACK_RELOCATE (yyss);
3555 YYSTACK_RELOCATE (yyvs);
3556
3557# undef YYSTACK_RELOCATE
3558 if (yyss1 != yyssa)
3559 YYSTACK_FREE (yyss1);
3560 }
3561# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003562#endif /* no yyoverflow */
3563
Dan Gohman54392c12008-04-19 00:24:39 +00003564 yyssp = yyss + yysize - 1;
3565 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003566
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003567
Dan Gohman54392c12008-04-19 00:24:39 +00003568 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3569 (unsigned long int) yystacksize));
3570
3571 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003572 YYABORT;
3573 }
3574
Dan Gohman54392c12008-04-19 00:24:39 +00003575 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003576
3577 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003578
Dan Gohman54392c12008-04-19 00:24:39 +00003579/*-----------.
3580| yybackup. |
3581`-----------*/
3582yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003583
Dan Gohman54392c12008-04-19 00:24:39 +00003584 /* Do appropriate processing given the current state. Read a
3585 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003586
Dan Gohman54392c12008-04-19 00:24:39 +00003587 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003588 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003589 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003590 goto yydefault;
3591
Dan Gohman54392c12008-04-19 00:24:39 +00003592 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003593
Dan Gohman54392c12008-04-19 00:24:39 +00003594 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003595 if (yychar == YYEMPTY)
3596 {
Dan Gohman54392c12008-04-19 00:24:39 +00003597 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003598 yychar = YYLEX;
3599 }
3600
Dan Gohman54392c12008-04-19 00:24:39 +00003601 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003602 {
Dan Gohman54392c12008-04-19 00:24:39 +00003603 yychar = yytoken = YYEOF;
3604 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003605 }
3606 else
3607 {
Dan Gohman54392c12008-04-19 00:24:39 +00003608 yytoken = YYTRANSLATE (yychar);
3609 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003610 }
3611
Dan Gohman54392c12008-04-19 00:24:39 +00003612 /* If the proper action on seeing token YYTOKEN is to reduce or to
3613 detect an error, take that action. */
3614 yyn += yytoken;
3615 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003616 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003617 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003618 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003619 {
Dan Gohman54392c12008-04-19 00:24:39 +00003620 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003621 goto yyerrlab;
3622 yyn = -yyn;
3623 goto yyreduce;
3624 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003625
3626 if (yyn == YYFINAL)
3627 YYACCEPT;
3628
Dan Gohman54392c12008-04-19 00:24:39 +00003629 /* Count tokens shifted since error; after three, turn off error
3630 status. */
3631 if (yyerrstatus)
3632 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003633
Dan Gohman54392c12008-04-19 00:24:39 +00003634 /* Shift the look-ahead token. */
3635 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003636
Dan Gohman54392c12008-04-19 00:24:39 +00003637 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003638 if (yychar != YYEOF)
3639 yychar = YYEMPTY;
3640
Gabor Greif89f01162008-04-06 23:07:54 +00003641 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003642 *++yyvsp = yylval;
3643
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003644 goto yynewstate;
3645
Gabor Greif89f01162008-04-06 23:07:54 +00003646
Dan Gohman54392c12008-04-19 00:24:39 +00003647/*-----------------------------------------------------------.
3648| yydefault -- do the default action for the current state. |
3649`-----------------------------------------------------------*/
3650yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003651 yyn = yydefact[yystate];
3652 if (yyn == 0)
3653 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003654 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003655
Dan Gohman54392c12008-04-19 00:24:39 +00003656
3657/*-----------------------------.
3658| yyreduce -- Do a reduction. |
3659`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003660yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003661 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003662 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003663
Dan Gohman54392c12008-04-19 00:24:39 +00003664 /* If YYLEN is nonzero, implement the default value of the action:
3665 `$$ = $1'.
3666
3667 Otherwise, the following line sets YYVAL to garbage.
3668 This behavior is undocumented and Bison
3669 users should not rely upon it. Assigning to YYVAL
3670 unconditionally makes the parser a bit smaller, and it avoids a
3671 GCC warning that YYVAL may be used uninitialized. */
3672 yyval = yyvsp[1-yylen];
3673
3674
3675 YY_REDUCE_PRINT (yyn);
3676 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003677 {
Dan Gohman54392c12008-04-19 00:24:39 +00003678 case 29:
Nick Lewyckyff384472008-11-24 03:41:24 +00003679#line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003680 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3681 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003682
Dan Gohman54392c12008-04-19 00:24:39 +00003683 case 30:
Nick Lewyckyff384472008-11-24 03:41:24 +00003684#line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003685 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3686 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003687
Dan Gohman54392c12008-04-19 00:24:39 +00003688 case 31:
Nick Lewyckyff384472008-11-24 03:41:24 +00003689#line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003690 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3691 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003692
Dan Gohman54392c12008-04-19 00:24:39 +00003693 case 32:
Nick Lewyckyff384472008-11-24 03:41:24 +00003694#line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003695 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3696 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003697
Dan Gohman54392c12008-04-19 00:24:39 +00003698 case 33:
Nick Lewyckyff384472008-11-24 03:41:24 +00003699#line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003700 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3701 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003702
Dan Gohman54392c12008-04-19 00:24:39 +00003703 case 34:
Nick Lewyckyff384472008-11-24 03:41:24 +00003704#line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003705 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3706 break;
3707
3708 case 35:
Nick Lewyckyff384472008-11-24 03:41:24 +00003709#line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003710 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3711 break;
3712
3713 case 36:
Nick Lewyckyff384472008-11-24 03:41:24 +00003714#line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003715 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3716 break;
3717
3718 case 37:
Nick Lewyckyff384472008-11-24 03:41:24 +00003719#line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003720 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3721 break;
3722
3723 case 38:
Nick Lewyckyff384472008-11-24 03:41:24 +00003724#line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003725 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3726 break;
3727
3728 case 39:
Nick Lewyckyff384472008-11-24 03:41:24 +00003729#line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003730 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3731 break;
3732
3733 case 40:
Nick Lewyckyff384472008-11-24 03:41:24 +00003734#line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003735 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3736 break;
3737
3738 case 41:
Nick Lewyckyff384472008-11-24 03:41:24 +00003739#line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003740 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3741 break;
3742
3743 case 42:
Nick Lewyckyff384472008-11-24 03:41:24 +00003744#line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003745 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3746 break;
3747
3748 case 43:
Nick Lewyckyff384472008-11-24 03:41:24 +00003749#line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003750 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3751 break;
3752
3753 case 44:
Nick Lewyckyff384472008-11-24 03:41:24 +00003754#line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003755 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3756 break;
3757
3758 case 45:
Nick Lewyckyff384472008-11-24 03:41:24 +00003759#line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003760 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3761 break;
3762
3763 case 46:
Nick Lewyckyff384472008-11-24 03:41:24 +00003764#line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003765 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3766 break;
3767
3768 case 47:
Nick Lewyckyff384472008-11-24 03:41:24 +00003769#line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003770 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3771 break;
3772
3773 case 48:
Nick Lewyckyff384472008-11-24 03:41:24 +00003774#line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003775 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3776 break;
3777
3778 case 49:
Nick Lewyckyff384472008-11-24 03:41:24 +00003779#line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003780 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3781 break;
3782
3783 case 50:
Nick Lewyckyff384472008-11-24 03:41:24 +00003784#line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003785 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3786 break;
3787
3788 case 51:
Nick Lewyckyff384472008-11-24 03:41:24 +00003789#line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003790 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3791 break;
3792
3793 case 52:
Nick Lewyckyff384472008-11-24 03:41:24 +00003794#line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003795 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3796 break;
3797
3798 case 53:
Nick Lewyckyff384472008-11-24 03:41:24 +00003799#line 1173 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003800 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3801 break;
3802
3803 case 54:
Nick Lewyckyff384472008-11-24 03:41:24 +00003804#line 1174 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003805 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3806 break;
3807
Chris Lattnerc5320232008-10-15 06:16:57 +00003808 case 59:
Nick Lewyckyff384472008-11-24 03:41:24 +00003809#line 1178 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003810 { (yyval.StrVal) = 0; ;}
3811 break;
3812
Chris Lattnerc5320232008-10-15 06:16:57 +00003813 case 60:
Nick Lewyckyff384472008-11-24 03:41:24 +00003814#line 1180 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003815 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3816 break;
3817
Chris Lattnerc5320232008-10-15 06:16:57 +00003818 case 61:
Nick Lewyckyff384472008-11-24 03:41:24 +00003819#line 1181 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003820 { (yyval.UIntVal)=0; ;}
3821 break;
3822
Chris Lattnerc5320232008-10-15 06:16:57 +00003823 case 62:
Nick Lewyckyff384472008-11-24 03:41:24 +00003824#line 1185 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003825 {
3826 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003827 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003828 ;}
3829 break;
3830
Chris Lattnerc5320232008-10-15 06:16:57 +00003831 case 63:
Nick Lewyckyff384472008-11-24 03:41:24 +00003832#line 1189 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003833 {
3834 (yyval.StrVal) = 0;
3835 CHECK_FOR_ERROR
3836 ;}
3837 break;
3838
3839 case 64:
Nick Lewyckyff384472008-11-24 03:41:24 +00003840#line 1194 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003841 {
3842 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3843 CHECK_FOR_ERROR
3844;}
3845 break;
3846
Chris Lattner8f5544c2008-10-15 06:03:48 +00003847 case 68:
Nick Lewyckyff384472008-11-24 03:41:24 +00003848#line 1203 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003849 {
3850 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003851 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003852 ;}
3853 break;
3854
Chris Lattner8f5544c2008-10-15 06:03:48 +00003855 case 69:
Nick Lewyckyff384472008-11-24 03:41:24 +00003856#line 1208 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003857 {
3858 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003859 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003860 ;}
3861 break;
3862
Chris Lattnerc5320232008-10-15 06:16:57 +00003863 case 70:
Nick Lewyckyff384472008-11-24 03:41:24 +00003864#line 1214 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003865 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3866 break;
3867
Chris Lattnerc5320232008-10-15 06:16:57 +00003868 case 71:
Nick Lewyckyff384472008-11-24 03:41:24 +00003869#line 1215 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003870 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3871 break;
3872
Chris Lattnerc5320232008-10-15 06:16:57 +00003873 case 72:
Nick Lewyckyff384472008-11-24 03:41:24 +00003874#line 1216 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003875 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3876 break;
3877
Chris Lattnerc5320232008-10-15 06:16:57 +00003878 case 73:
Nick Lewyckyff384472008-11-24 03:41:24 +00003879#line 1217 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003880 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3881 break;
3882
Chris Lattnerc5320232008-10-15 06:16:57 +00003883 case 74:
Nick Lewyckyff384472008-11-24 03:41:24 +00003884#line 1218 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003885 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3886 break;
3887
Chris Lattnerc5320232008-10-15 06:16:57 +00003888 case 75:
Nick Lewyckyff384472008-11-24 03:41:24 +00003889#line 1219 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003890 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003891 break;
3892
Chris Lattnerc5320232008-10-15 06:16:57 +00003893 case 76:
Nick Lewyckyff384472008-11-24 03:41:24 +00003894#line 1223 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003895 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003896 break;
3897
Chris Lattnerc5320232008-10-15 06:16:57 +00003898 case 77:
Nick Lewyckyff384472008-11-24 03:41:24 +00003899#line 1224 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003900 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003901 break;
3902
Chris Lattnerc5320232008-10-15 06:16:57 +00003903 case 78:
Nick Lewyckyff384472008-11-24 03:41:24 +00003904#line 1225 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003905 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3906 break;
3907
3908 case 79:
Nick Lewyckyff384472008-11-24 03:41:24 +00003909#line 1229 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00003910 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3911 break;
3912
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003913 case 80:
Nick Lewyckyff384472008-11-24 03:41:24 +00003914#line 1230 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003915 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3916 break;
3917
3918 case 81:
Nick Lewyckyff384472008-11-24 03:41:24 +00003919#line 1231 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003920 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3921 break;
3922
3923 case 82:
Nick Lewyckyff384472008-11-24 03:41:24 +00003924#line 1232 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003925 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3926 break;
3927
3928 case 83:
Nick Lewyckyff384472008-11-24 03:41:24 +00003929#line 1236 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003930 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003931 break;
3932
Chris Lattner8f5544c2008-10-15 06:03:48 +00003933 case 84:
Nick Lewyckyff384472008-11-24 03:41:24 +00003934#line 1237 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003935 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003936 break;
3937
Chris Lattnerc5320232008-10-15 06:16:57 +00003938 case 85:
Nick Lewyckyff384472008-11-24 03:41:24 +00003939#line 1238 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003940 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003941 break;
3942
Chris Lattnerc5320232008-10-15 06:16:57 +00003943 case 86:
Nick Lewyckyff384472008-11-24 03:41:24 +00003944#line 1242 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003945 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3946 break;
3947
3948 case 87:
Nick Lewyckyff384472008-11-24 03:41:24 +00003949#line 1243 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003950 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3951 break;
3952
3953 case 88:
Nick Lewyckyff384472008-11-24 03:41:24 +00003954#line 1244 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003955 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3956 break;
3957
3958 case 89:
Nick Lewyckyff384472008-11-24 03:41:24 +00003959#line 1245 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003960 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3961 break;
3962
3963 case 90:
Nick Lewyckyff384472008-11-24 03:41:24 +00003964#line 1246 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003965 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3966 break;
3967
3968 case 91:
Nick Lewyckyff384472008-11-24 03:41:24 +00003969#line 1250 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00003970 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3971 break;
3972
Chris Lattner8f5544c2008-10-15 06:03:48 +00003973 case 92:
Nick Lewyckyff384472008-11-24 03:41:24 +00003974#line 1251 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003975 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Chris Lattner8f5544c2008-10-15 06:03:48 +00003976 break;
3977
Chris Lattner906773a2008-08-29 17:20:18 +00003978 case 93:
Nick Lewyckyff384472008-11-24 03:41:24 +00003979#line 1252 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003980 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003981 break;
3982
Chris Lattnerc5320232008-10-15 06:16:57 +00003983 case 94:
Nick Lewyckyff384472008-11-24 03:41:24 +00003984#line 1255 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00003985 { (yyval.UIntVal) = CallingConv::C; ;}
3986 break;
3987
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003988 case 95:
Nick Lewyckyff384472008-11-24 03:41:24 +00003989#line 1256 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003990 { (yyval.UIntVal) = CallingConv::C; ;}
3991 break;
3992
3993 case 96:
Nick Lewyckyff384472008-11-24 03:41:24 +00003994#line 1257 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003995 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003996 break;
3997
Chris Lattnerc5320232008-10-15 06:16:57 +00003998 case 97:
Nick Lewyckyff384472008-11-24 03:41:24 +00003999#line 1258 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004000 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004001 break;
4002
Chris Lattnerc5320232008-10-15 06:16:57 +00004003 case 98:
Nick Lewyckyff384472008-11-24 03:41:24 +00004004#line 1259 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004005 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004006 break;
4007
Chris Lattnerc5320232008-10-15 06:16:57 +00004008 case 99:
Nick Lewyckyff384472008-11-24 03:41:24 +00004009#line 1260 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004010 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004011 break;
4012
Chris Lattnerc5320232008-10-15 06:16:57 +00004013 case 100:
Nick Lewyckyff384472008-11-24 03:41:24 +00004014#line 1261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004015 {
4016 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004017 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00004018 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004019 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004020 ;}
4021 break;
4022
Chris Lattnerc5320232008-10-15 06:16:57 +00004023 case 101:
Nick Lewyckyff384472008-11-24 03:41:24 +00004024#line 1268 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00004025 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattnerc5320232008-10-15 06:16:57 +00004026 break;
4027
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004028 case 102:
Nick Lewyckyff384472008-11-24 03:41:24 +00004029#line 1269 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004030 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattnerc5320232008-10-15 06:16:57 +00004031 break;
4032
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004033 case 103:
Nick Lewyckyff384472008-11-24 03:41:24 +00004034#line 1270 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00004035 { (yyval.Attributes) = Attribute::SExt; ;}
4036 break;
4037
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004038 case 104:
Nick Lewyckyff384472008-11-24 03:41:24 +00004039#line 1271 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004040 { (yyval.Attributes) = Attribute::SExt; ;}
4041 break;
4042
4043 case 105:
Nick Lewyckyff384472008-11-24 03:41:24 +00004044#line 1272 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004045 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004046 break;
4047
Chris Lattnerc5320232008-10-15 06:16:57 +00004048 case 106:
Nick Lewyckyff384472008-11-24 03:41:24 +00004049#line 1273 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004050 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004051 break;
4052
Chris Lattnerc5320232008-10-15 06:16:57 +00004053 case 107:
Nick Lewyckyff384472008-11-24 03:41:24 +00004054#line 1274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004055 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004056 break;
4057
Chris Lattnerc5320232008-10-15 06:16:57 +00004058 case 108:
Nick Lewyckyff384472008-11-24 03:41:24 +00004059#line 1275 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004060 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004061 break;
4062
Chris Lattnerc5320232008-10-15 06:16:57 +00004063 case 109:
Nick Lewyckyff384472008-11-24 03:41:24 +00004064#line 1276 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004065 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004066 break;
4067
Chris Lattnerc5320232008-10-15 06:16:57 +00004068 case 110:
Nick Lewyckyff384472008-11-24 03:41:24 +00004069#line 1277 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004070 { (yyval.Attributes) =
4071 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004072 break;
4073
Bill Wendling1ba18d32008-12-17 20:59:57 +00004074 case 111:
4075#line 1281 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004076 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004077 break;
4078
Bill Wendling1ba18d32008-12-17 20:59:57 +00004079 case 112:
4080#line 1282 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004081 {
4082 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4083 ;}
4084 break;
4085
Bill Wendling1ba18d32008-12-17 20:59:57 +00004086 case 113:
4087#line 1287 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4088 { (yyval.Attributes) = Attribute::InReg; ;}
4089 break;
4090
Chris Lattnerc5320232008-10-15 06:16:57 +00004091 case 114:
Nick Lewyckyff384472008-11-24 03:41:24 +00004092#line 1288 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004093 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004094 break;
4095
Chris Lattnerc5320232008-10-15 06:16:57 +00004096 case 115:
Nick Lewyckyff384472008-11-24 03:41:24 +00004097#line 1289 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004098 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004099 break;
4100
Chris Lattnerc5320232008-10-15 06:16:57 +00004101 case 116:
Nick Lewyckyff384472008-11-24 03:41:24 +00004102#line 1290 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004103 { (yyval.Attributes) = Attribute::NoAlias; ;}
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004104 break;
4105
Chris Lattnerc5320232008-10-15 06:16:57 +00004106 case 117:
Bill Wendling1ba18d32008-12-17 20:59:57 +00004107#line 1293 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4108 { (yyval.Attributes) = Attribute::None; ;}
Nick Lewyckyff384472008-11-24 03:41:24 +00004109 break;
4110
4111 case 118:
4112#line 1294 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004113 {
4114 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4115 ;}
4116 break;
4117
Bill Wendling1ba18d32008-12-17 20:59:57 +00004118 case 119:
4119#line 1300 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4120 { (yyval.Attributes) = Attribute::NoReturn; ;}
4121 break;
4122
Nick Lewyckyff384472008-11-24 03:41:24 +00004123 case 120:
4124#line 1301 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004125 { (yyval.Attributes) = Attribute::NoUnwind; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004126 break;
4127
Nick Lewyckyff384472008-11-24 03:41:24 +00004128 case 121:
4129#line 1302 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004130 { (yyval.Attributes) = Attribute::InReg; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004131 break;
4132
Nick Lewyckyff384472008-11-24 03:41:24 +00004133 case 122:
4134#line 1303 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004135 { (yyval.Attributes) = Attribute::ZExt; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004136 break;
4137
Nick Lewyckyff384472008-11-24 03:41:24 +00004138 case 123:
4139#line 1304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004140 { (yyval.Attributes) = Attribute::SExt; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004141 break;
4142
Nick Lewyckyff384472008-11-24 03:41:24 +00004143 case 124:
4144#line 1305 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004145 { (yyval.Attributes) = Attribute::ReadNone; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004146 break;
4147
Nick Lewyckyff384472008-11-24 03:41:24 +00004148 case 125:
4149#line 1306 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004150 { (yyval.Attributes) = Attribute::ReadOnly; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004151 break;
4152
Nick Lewyckyff384472008-11-24 03:41:24 +00004153 case 126:
4154#line 1307 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004155 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004156 break;
4157
Nick Lewyckyff384472008-11-24 03:41:24 +00004158 case 127:
4159#line 1308 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004160 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004161 break;
4162
Nick Lewyckyff384472008-11-24 03:41:24 +00004163 case 128:
4164#line 1309 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004165 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004166 break;
4167
Nick Lewyckyff384472008-11-24 03:41:24 +00004168 case 129:
4169#line 1310 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004170 { (yyval.Attributes) = Attribute::StackProtect; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004171 break;
4172
Nick Lewyckyff384472008-11-24 03:41:24 +00004173 case 130:
4174#line 1311 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004175 { (yyval.Attributes) = Attribute::StackProtectReq; ;}
Bill Wendling60f02fc2008-11-13 01:03:00 +00004176 break;
4177
Nick Lewyckyff384472008-11-24 03:41:24 +00004178 case 131:
Bill Wendling1ba18d32008-12-17 20:59:57 +00004179#line 1314 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4180 { (yyval.Attributes) = Attribute::None; ;}
Bill Wendling60f02fc2008-11-13 01:03:00 +00004181 break;
4182
Nick Lewyckyff384472008-11-24 03:41:24 +00004183 case 132:
4184#line 1315 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004185 {
Devang Pateld222f862008-09-25 21:00:45 +00004186 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner906773a2008-08-29 17:20:18 +00004187 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004188 break;
4189
Bill Wendling1ba18d32008-12-17 20:59:57 +00004190 case 133:
4191#line 1321 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004192 { (yyval.StrVal) = 0; ;}
4193 break;
4194
Bill Wendling1ba18d32008-12-17 20:59:57 +00004195 case 134:
4196#line 1322 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004197 {
4198 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4199 ;}
4200 break;
4201
Bill Wendling1ba18d32008-12-17 20:59:57 +00004202 case 135:
4203#line 1329 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004204 { (yyval.UIntVal) = 0; ;}
4205 break;
4206
Bill Wendling1ba18d32008-12-17 20:59:57 +00004207 case 136:
4208#line 1330 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004209 {
4210 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4211 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004212 GEN_ERROR("Alignment must be a power of two");
4213 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004214;}
4215 break;
4216
Bill Wendling1ba18d32008-12-17 20:59:57 +00004217 case 137:
4218#line 1336 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004219 { (yyval.UIntVal) = 0; ;}
4220 break;
4221
Bill Wendling1ba18d32008-12-17 20:59:57 +00004222 case 138:
4223#line 1337 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004224 {
4225 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4226 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00004227 GEN_ERROR("Alignment must be a power of two");
4228 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004229;}
4230 break;
4231
Bill Wendling1ba18d32008-12-17 20:59:57 +00004232 case 139:
4233#line 1346 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004234 {
4235 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4236 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004237 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00004238 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004239 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004240;}
4241 break;
4242
Bill Wendling1ba18d32008-12-17 20:59:57 +00004243 case 140:
4244#line 1354 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00004245 { (yyval.StrVal) = 0; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004246 break;
4247
Bill Wendling1ba18d32008-12-17 20:59:57 +00004248 case 141:
4249#line 1355 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4250 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4251 break;
4252
Bill Wendling60f02fc2008-11-13 01:03:00 +00004253 case 142:
Nick Lewyckyff384472008-11-24 03:41:24 +00004254#line 1360 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling1ba18d32008-12-17 20:59:57 +00004255 {;}
Bill Wendling60f02fc2008-11-13 01:03:00 +00004256 break;
4257
4258 case 143:
Bill Wendling1ba18d32008-12-17 20:59:57 +00004259#line 1361 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyff384472008-11-24 03:41:24 +00004260 {;}
4261 break;
4262
4263 case 144:
Bill Wendling1ba18d32008-12-17 20:59:57 +00004264#line 1362 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004265 {
4266 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4267 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004268 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004269 ;}
4270 break;
4271
Bill Wendling1ba18d32008-12-17 20:59:57 +00004272 case 145:
4273#line 1367 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004274 {
4275 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004276 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004277 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004278 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004279 ;}
4280 break;
4281
Bill Wendling1ba18d32008-12-17 20:59:57 +00004282 case 153:
4283#line 1383 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004284 {
4285 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004286 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004287 ;}
4288 break;
4289
Bill Wendling1ba18d32008-12-17 20:59:57 +00004290 case 154:
4291#line 1387 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004292 {
4293 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004294 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004295 ;}
4296 break;
4297
Bill Wendling1ba18d32008-12-17 20:59:57 +00004298 case 155:
4299#line 1391 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004300 { // Pointer type?
4301 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004302 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004303 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4304 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004305 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004306 ;}
4307 break;
4308
Bill Wendling1ba18d32008-12-17 20:59:57 +00004309 case 156:
4310#line 1398 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004311 { // Named types are also simple types...
4312 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004313 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004314 (yyval.TypeVal) = new PATypeHolder(tmp);
4315 ;}
4316 break;
4317
Bill Wendling1ba18d32008-12-17 20:59:57 +00004318 case 157:
4319#line 1403 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004320 { // Type UpReference
4321 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004323 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4324 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004325 UR_OUT("New Upreference!\n");
4326 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004327 ;}
4328 break;
4329
Bill Wendling1ba18d32008-12-17 20:59:57 +00004330 case 158:
4331#line 1411 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004332 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004333 // Allow but ignore attributes on function types; this permits auto-upgrade.
4334 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004335 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4336 if (!FunctionType::isValidReturnType(RetTy))
4337 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00004338
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004339 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004340 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004341 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004342 const Type *Ty = I->Ty->get();
4343 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004344 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004345
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004346 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4347 if (isVarArg) Params.pop_back();
4348
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004349 for (unsigned i = 0; i != Params.size(); ++i)
4350 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4351 GEN_ERROR("Function arguments must be value types!");
4352
4353 CHECK_FOR_ERROR
4354
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004355 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004356 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher329d2672008-09-24 04:55:49 +00004357 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes896f4572008-10-05 16:49:34 +00004358
4359 // Delete the argument list
4360 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4361 delete I->Ty;
4362 }
4363 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4364
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004365 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004366 ;}
4367 break;
4368
Bill Wendling1ba18d32008-12-17 20:59:57 +00004369 case 159:
4370#line 1446 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004371 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004372 // Allow but ignore attributes on function types; this permits auto-upgrade.
4373 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004374 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004375 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004376 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004377 const Type* Ty = I->Ty->get();
4378 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004379 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004380
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004381 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4382 if (isVarArg) Params.pop_back();
4383
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004384 for (unsigned i = 0; i != Params.size(); ++i)
4385 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4386 GEN_ERROR("Function arguments must be value types!");
4387
4388 CHECK_FOR_ERROR
4389
Dan Gohman54392c12008-04-19 00:24:39 +00004390 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher329d2672008-09-24 04:55:49 +00004391 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes896f4572008-10-05 16:49:34 +00004392
4393 // Delete the argument list
4394 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4395 delete I->Ty;
4396 }
4397 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4398
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004399 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004400 ;}
4401 break;
4402
Bill Wendling1ba18d32008-12-17 20:59:57 +00004403 case 160:
4404#line 1477 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004405 { // Sized array type?
Dan Gohmane5febe42008-05-31 00:58:22 +00004406 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohman54392c12008-04-19 00:24:39 +00004407 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004408 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004409 ;}
4410 break;
4411
Bill Wendling1ba18d32008-12-17 20:59:57 +00004412 case 161:
4413#line 1482 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004414 { // Vector type?
4415 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4416 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004417 GEN_ERROR("Unsigned result not equal to signed result");
4418 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4419 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004420 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4421 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004422 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004423 ;}
4424 break;
4425
Bill Wendling1ba18d32008-12-17 20:59:57 +00004426 case 162:
4427#line 1492 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004428 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004429 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004430 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4431 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004432 Elements.push_back(*I);
4433
Dan Gohman54392c12008-04-19 00:24:39 +00004434 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4435 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004436 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004437 ;}
4438 break;
4439
Bill Wendling1ba18d32008-12-17 20:59:57 +00004440 case 163:
4441#line 1502 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004442 { // Empty structure type?
4443 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004444 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004445 ;}
4446 break;
4447
Bill Wendling1ba18d32008-12-17 20:59:57 +00004448 case 164:
4449#line 1506 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004450 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004451 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004452 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4453 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004454 Elements.push_back(*I);
4455
Dan Gohman54392c12008-04-19 00:24:39 +00004456 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4457 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004458 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004459 ;}
4460 break;
4461
Bill Wendling1ba18d32008-12-17 20:59:57 +00004462 case 165:
4463#line 1516 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004464 { // Empty structure type?
4465 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004466 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004467 ;}
4468 break;
4469
Bill Wendling1ba18d32008-12-17 20:59:57 +00004470 case 166:
4471#line 1523 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004472 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004473 // Allow but ignore attributes on function types; this permits auto-upgrade.
4474 // FIXME: remove in LLVM 3.0.
Eric Christopher329d2672008-09-24 04:55:49 +00004475 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Pateld222f862008-09-25 21:00:45 +00004476 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00004477 ;}
4478 break;
4479
Bill Wendling1ba18d32008-12-17 20:59:57 +00004480 case 167:
4481#line 1532 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004482 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004483 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004484 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4485 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004486 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004487 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4488 ;}
4489 break;
4490
Bill Wendling1ba18d32008-12-17 20:59:57 +00004491 case 168:
4492#line 1539 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004493 {
4494 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4495 ;}
4496 break;
4497
Bill Wendling1ba18d32008-12-17 20:59:57 +00004498 case 169:
4499#line 1544 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004500 {
4501 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4502 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004503 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004504 ;}
4505 break;
4506
Bill Wendling1ba18d32008-12-17 20:59:57 +00004507 case 170:
4508#line 1549 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004509 {
4510 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004511 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004512 ;}
4513 break;
4514
Bill Wendling1ba18d32008-12-17 20:59:57 +00004515 case 172:
4516#line 1557 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4517 {
4518 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4519 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
4520 TWA.Ty = new PATypeHolder(Type::VoidTy);
4521 (yyval.TypeWithAttrsList)->push_back(TWA);
4522 CHECK_FOR_ERROR
4523 ;}
4524 break;
4525
Nick Lewyckyff384472008-11-24 03:41:24 +00004526 case 173:
4527#line 1564 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004528 {
Bill Wendling1ba18d32008-12-17 20:59:57 +00004529 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Pateld222f862008-09-25 21:00:45 +00004530 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004531 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004532 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004533 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004534 ;}
4535 break;
4536
Nick Lewyckyff384472008-11-24 03:41:24 +00004537 case 174:
4538#line 1571 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004539 {
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00004540 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4541 CHECK_FOR_ERROR
4542 ;}
4543 break;
4544
Bill Wendling1ba18d32008-12-17 20:59:57 +00004545 case 175:
4546#line 1579 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004547 {
4548 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher329d2672008-09-24 04:55:49 +00004549 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004550 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004551 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004552 ;}
4553 break;
4554
Bill Wendling1ba18d32008-12-17 20:59:57 +00004555 case 176:
4556#line 1585 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004557 {
Eric Christopher329d2672008-09-24 04:55:49 +00004558 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004559 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004560 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004561 ;}
4562 break;
4563
Bill Wendling1ba18d32008-12-17 20:59:57 +00004564 case 177:
4565#line 1597 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004566 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004567 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004568 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4569 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004570 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004571 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004572 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004573 const Type *ETy = ATy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004574 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004575
4576 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004577 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004578 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004579 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004580 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004581
4582 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004583 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4584 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004585 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004586 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004587 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004588 }
4589
Dan Gohman54392c12008-04-19 00:24:39 +00004590 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4591 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004592 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004593 ;}
4594 break;
4595
Bill Wendling1ba18d32008-12-17 20:59:57 +00004596 case 178:
4597#line 1625 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004598 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004599 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004600 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4601 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004602 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004603 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004604 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004605
Dan Gohman7185e4b2008-06-23 18:43:26 +00004606 uint64_t NumElements = ATy->getNumElements();
Eric Christopher329d2672008-09-24 04:55:49 +00004607 if (NumElements != uint64_t(-1) && NumElements != 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004608 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004609 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004610 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4611 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004612 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004613 ;}
4614 break;
4615
Bill Wendling1ba18d32008-12-17 20:59:57 +00004616 case 179:
4617#line 1641 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004618 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004619 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004620 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4621 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004622 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004623 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004624 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004625
Dan Gohman7185e4b2008-06-23 18:43:26 +00004626 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004627 const Type *ETy = ATy->getElementType();
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004628 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher329d2672008-09-24 04:55:49 +00004629 GEN_ERROR("Can't build string constant of size " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004630 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4631 " when array has size " + utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004632 std::vector<Constant*> Vals;
4633 if (ETy == Type::Int8Ty) {
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004634 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohman54392c12008-04-19 00:24:39 +00004635 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004636 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004637 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004638 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4639 }
Dan Gohman54392c12008-04-19 00:24:39 +00004640 delete (yyvsp[(3) - (3)].StrVal);
4641 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4642 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004643 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004644 ;}
4645 break;
4646
Bill Wendling1ba18d32008-12-17 20:59:57 +00004647 case 180:
4648#line 1668 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004649 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004651 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4652 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004653 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004654 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004655 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004656 const Type *ETy = PTy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004657 unsigned NumElements = PTy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004658
4659 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004660 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004661 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004662 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004663 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004664
4665 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004666 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4667 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004668 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004669 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004670 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004671 }
4672
Dan Gohman54392c12008-04-19 00:24:39 +00004673 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4674 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004675 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004676 ;}
4677 break;
4678
Bill Wendling1ba18d32008-12-17 20:59:57 +00004679 case 181:
4680#line 1696 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004681 {
4682 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004683 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004684 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004685 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004686
Dan Gohman54392c12008-04-19 00:24:39 +00004687 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004688 GEN_ERROR("Illegal number of initializers for structure type");
4689
4690 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004691 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4692 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004693 GEN_ERROR("Expected type '" +
4694 STy->getElementType(i)->getDescription() +
4695 "' for element #" + utostr(i) +
4696 " of structure initializer");
4697
4698 // Check to ensure that Type is not packed
4699 if (STy->isPacked())
4700 GEN_ERROR("Unpacked Initializer to vector type '" +
4701 STy->getDescription() + "'");
4702
Dan Gohman54392c12008-04-19 00:24:39 +00004703 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4704 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004705 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004706 ;}
4707 break;
4708
Bill Wendling1ba18d32008-12-17 20:59:57 +00004709 case 182:
4710#line 1722 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004711 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004712 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004713 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4714 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004715 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004716 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004717 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004718
4719 if (STy->getNumContainedTypes() != 0)
4720 GEN_ERROR("Illegal number of initializers for structure type");
4721
4722 // Check to ensure that Type is not packed
4723 if (STy->isPacked())
4724 GEN_ERROR("Unpacked Initializer to vector type '" +
4725 STy->getDescription() + "'");
4726
Dan Gohman54392c12008-04-19 00:24:39 +00004727 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4728 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004729 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004730 ;}
4731 break;
4732
Bill Wendling1ba18d32008-12-17 20:59:57 +00004733 case 183:
4734#line 1742 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004735 {
4736 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004737 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004738 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004739 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004740
Dan Gohman54392c12008-04-19 00:24:39 +00004741 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004742 GEN_ERROR("Illegal number of initializers for structure type");
4743
4744 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004745 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4746 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004747 GEN_ERROR("Expected type '" +
4748 STy->getElementType(i)->getDescription() +
4749 "' for element #" + utostr(i) +
4750 " of structure initializer");
4751
4752 // Check to ensure that Type is packed
4753 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004754 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004755 STy->getDescription() + "'");
4756
Dan Gohman54392c12008-04-19 00:24:39 +00004757 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4758 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004759 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004760 ;}
4761 break;
4762
Bill Wendling1ba18d32008-12-17 20:59:57 +00004763 case 184:
4764#line 1768 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004765 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004766 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004767 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4768 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004769 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004770 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004771 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004772
4773 if (STy->getNumContainedTypes() != 0)
4774 GEN_ERROR("Illegal number of initializers for structure type");
4775
4776 // Check to ensure that Type is packed
4777 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004778 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004779 STy->getDescription() + "'");
4780
Dan Gohman54392c12008-04-19 00:24:39 +00004781 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4782 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004783 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004784 ;}
4785 break;
4786
Bill Wendling1ba18d32008-12-17 20:59:57 +00004787 case 185:
4788#line 1788 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004789 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004790 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004791 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4792 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004793 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004794 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004795 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004796
Dan Gohman54392c12008-04-19 00:24:39 +00004797 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4798 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004799 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004800 ;}
4801 break;
4802
Bill Wendling1ba18d32008-12-17 20:59:57 +00004803 case 186:
4804#line 1800 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004805 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004806 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004807 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4808 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4809 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004810 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004811 ;}
4812 break;
4813
Bill Wendling1ba18d32008-12-17 20:59:57 +00004814 case 187:
4815#line 1807 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004816 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004817 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004818 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4819 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004820 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004821 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004822
4823 // ConstExprs can exist in the body of a function, thus creating
4824 // GlobalValues whenever they refer to a variable. Because we are in
4825 // the context of a function, getExistingVal will search the functions
4826 // symbol table instead of the module symbol table for the global symbol,
4827 // which throws things all off. To get around this, we just tell
4828 // getExistingVal that we are at global scope here.
4829 //
4830 Function *SavedCurFn = CurFun.CurrentFunction;
4831 CurFun.CurrentFunction = 0;
4832
Dan Gohman54392c12008-04-19 00:24:39 +00004833 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004834 CHECK_FOR_ERROR
4835
4836 CurFun.CurrentFunction = SavedCurFn;
4837
4838 // If this is an initializer for a constant pointer, which is referencing a
4839 // (currently) undefined variable, create a stub now that shall be replaced
4840 // in the future with the right type of variable.
4841 //
4842 if (V == 0) {
4843 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4844 const PointerType *PT = cast<PointerType>(Ty);
4845
4846 // First check to see if the forward references value is already created!
4847 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004848 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher329d2672008-09-24 04:55:49 +00004849
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004850 if (I != CurModule.GlobalRefs.end()) {
4851 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004852 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004853 } else {
4854 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004855 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4856 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4857 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004858 GEN_ERROR("Invalid reference to global");
4859
4860 // Create the forward referenced global.
4861 GlobalValue *GV;
Eric Christopher329d2672008-09-24 04:55:49 +00004862 if (const FunctionType *FTy =
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004863 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004864 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4865 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004866 } else {
4867 GV = new GlobalVariable(PT->getElementType(), false,
4868 GlobalValue::ExternalWeakLinkage, 0,
4869 Name, CurModule.CurrentModule);
4870 }
4871
4872 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004873 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004874 V = GV;
4875 }
4876 }
4877
Dan Gohman54392c12008-04-19 00:24:39 +00004878 (yyval.ConstVal) = cast<GlobalValue>(V);
4879 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004880 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004881 ;}
4882 break;
4883
Bill Wendling1ba18d32008-12-17 20:59:57 +00004884 case 188:
4885#line 1873 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004886 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004887 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004888 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4889 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004890 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004891 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4892 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4893 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004894 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004895 ;}
4896 break;
4897
Bill Wendling1ba18d32008-12-17 20:59:57 +00004898 case 189:
4899#line 1883 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004900 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004901 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004902 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4903 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004904 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4905 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004906 (yyval.ConstVal) = Constant::getNullValue(Ty);
4907 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004908 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004909 ;}
4910 break;
4911
Bill Wendling1ba18d32008-12-17 20:59:57 +00004912 case 190:
4913#line 1893 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004914 { // integral constants
Chris Lattnerc5320232008-10-15 06:16:57 +00004915 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4916 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val)))
4917 GEN_ERROR("Constant value doesn't fit in type");
4918 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true);
4919 } else {
4920 GEN_ERROR("integer constant must have integer type");
4921 }
4922 delete (yyvsp[(1) - (2)].TypeVal);
4923 CHECK_FOR_ERROR
4924 ;}
4925 break;
4926
Bill Wendling1ba18d32008-12-17 20:59:57 +00004927 case 191:
4928#line 1904 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004929 { // arbitrary precision integer constants
4930 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4931 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4932 GEN_ERROR("Constant value does not fit in type");
4933 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth());
4934 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4935 } else {
4936 GEN_ERROR("integer constant must have integer type");
4937 }
4938 delete (yyvsp[(1) - (2)].TypeVal);
4939 delete (yyvsp[(2) - (2)].APIntVal);
4940 CHECK_FOR_ERROR
4941 ;}
4942 break;
4943
Bill Wendling1ba18d32008-12-17 20:59:57 +00004944 case 192:
4945#line 1917 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004946 { // integral constants
4947 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4948 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val)))
4949 GEN_ERROR("Constant value doesn't fit in type");
4950 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false);
4951 } else {
4952 GEN_ERROR("integer constant must have integer type");
4953 }
4954 delete (yyvsp[(1) - (2)].TypeVal);
4955 CHECK_FOR_ERROR
4956 ;}
4957 break;
4958
Bill Wendling1ba18d32008-12-17 20:59:57 +00004959 case 193:
4960#line 1928 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004961 { // arbitrary precision integer constants
4962 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4963 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4964 GEN_ERROR("Constant value does not fit in type");
4965 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth());
4966 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4967 } else {
4968 GEN_ERROR("integer constant must have integer type");
4969 }
4970
4971 delete (yyvsp[(2) - (2)].APIntVal);
4972 delete (yyvsp[(1) - (2)].TypeVal);
4973 CHECK_FOR_ERROR
4974 ;}
4975 break;
4976
Bill Wendling1ba18d32008-12-17 20:59:57 +00004977 case 194:
4978#line 1942 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004979 { // Boolean constants
4980 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4981 GEN_ERROR("Constant true must have type i1");
4982 (yyval.ConstVal) = ConstantInt::getTrue();
4983 delete (yyvsp[(1) - (2)].TypeVal);
4984 CHECK_FOR_ERROR
4985 ;}
4986 break;
4987
Bill Wendling1ba18d32008-12-17 20:59:57 +00004988 case 195:
4989#line 1949 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004990 { // Boolean constants
4991 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4992 GEN_ERROR("Constant false must have type i1");
4993 (yyval.ConstVal) = ConstantInt::getFalse();
4994 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004995 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004996 ;}
4997 break;
4998
Bill Wendling1ba18d32008-12-17 20:59:57 +00004999 case 196:
5000#line 1956 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005001 { // Floating point constants
Chris Lattnerc5320232008-10-15 06:16:57 +00005002 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005003 GEN_ERROR("Floating point constant invalid for type");
Chris Lattnerc5320232008-10-15 06:16:57 +00005004
Eric Christopher329d2672008-09-24 04:55:49 +00005005 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +00005006 // as double. Fix this here. Long double is done right.
Chris Lattnerc5320232008-10-15 06:16:57 +00005007 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].TypeVal)->get()==Type::FloatTy) {
Dale Johannesen5ba85fd2008-10-09 23:01:34 +00005008 bool ignored;
5009 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
5010 &ignored);
5011 }
Chris Lattner05ba86e2008-04-20 00:41:19 +00005012 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Chris Lattnerc5320232008-10-15 06:16:57 +00005013 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00005014 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005015 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005016 ;}
5017 break;
5018
Bill Wendling1ba18d32008-12-17 20:59:57 +00005019 case 197:
5020#line 1974 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005021 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005022 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005023 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
5024 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5025 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5026 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005027 GEN_ERROR("invalid cast opcode for cast from '" +
5028 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00005029 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00005030 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5031 delete (yyvsp[(5) - (6)].TypeVal);
5032 ;}
5033 break;
5034
Bill Wendling1ba18d32008-12-17 20:59:57 +00005035 case 198:
5036#line 1986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005037 {
5038 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005039 GEN_ERROR("GetElementPtr requires a pointer operand");
5040
5041 const Type *IdxTy =
Dan Gohman8055f772008-05-15 19:50:34 +00005042 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005043 if (!IdxTy)
5044 GEN_ERROR("Index list invalid for constant getelementptr");
5045
5046 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00005047 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
5048 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005049 IdxVec.push_back(C);
5050 else
5051 GEN_ERROR("Indices to constant getelementptr must be constants");
5052
Dan Gohman54392c12008-04-19 00:24:39 +00005053 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005054
Dan Gohman54392c12008-04-19 00:24:39 +00005055 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005056 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005057 ;}
5058 break;
5059
Bill Wendling1ba18d32008-12-17 20:59:57 +00005060 case 199:
5061#line 2007 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005062 {
5063 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005064 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00005065 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005066 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005067 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005068 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005069 ;}
5070 break;
5071
Bill Wendling1ba18d32008-12-17 20:59:57 +00005072 case 200:
5073#line 2015 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005074 {
5075 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005076 GEN_ERROR("Binary operator types must match");
5077 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00005078 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5079 ;}
5080 break;
5081
Bill Wendling1ba18d32008-12-17 20:59:57 +00005082 case 201:
5083#line 2021 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005084 {
5085 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005086 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005087 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher329d2672008-09-24 04:55:49 +00005088 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00005089 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005090 GEN_ERROR("Logical operator requires integral operands");
5091 }
Dan Gohman54392c12008-04-19 00:24:39 +00005092 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005093 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005094 ;}
5095 break;
5096
Bill Wendling1ba18d32008-12-17 20:59:57 +00005097 case 202:
5098#line 2032 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005099 {
5100 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005101 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005102 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5103 ;}
5104 break;
5105
Bill Wendling1ba18d32008-12-17 20:59:57 +00005106 case 203:
5107#line 2037 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005108 {
5109 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005110 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005111 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5112 ;}
5113 break;
5114
Bill Wendling1ba18d32008-12-17 20:59:57 +00005115 case 204:
5116#line 2042 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005117 {
5118 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5119 GEN_ERROR("vicmp operand types must match");
5120 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5121 ;}
5122 break;
5123
Bill Wendling1ba18d32008-12-17 20:59:57 +00005124 case 205:
5125#line 2047 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005126 {
5127 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5128 GEN_ERROR("vfcmp operand types must match");
5129 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5130 ;}
5131 break;
5132
Bill Wendling1ba18d32008-12-17 20:59:57 +00005133 case 206:
5134#line 2052 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005135 {
5136 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005137 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005138 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005139 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005140 ;}
5141 break;
5142
Bill Wendling1ba18d32008-12-17 20:59:57 +00005143 case 207:
5144#line 2058 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005145 {
5146 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005147 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005148 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005149 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005150 ;}
5151 break;
5152
Bill Wendling1ba18d32008-12-17 20:59:57 +00005153 case 208:
5154#line 2064 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005155 {
5156 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005157 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005158 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005159 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005160 ;}
5161 break;
5162
Bill Wendling1ba18d32008-12-17 20:59:57 +00005163 case 209:
5164#line 2070 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005165 {
5166 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5167 GEN_ERROR("ExtractValue requires an aggregate operand");
5168
Dan Gohmane5febe42008-05-31 00:58:22 +00005169 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5170 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005171 CHECK_FOR_ERROR
5172 ;}
5173 break;
5174
Bill Wendling1ba18d32008-12-17 20:59:57 +00005175 case 210:
5176#line 2078 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005177 {
5178 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5179 GEN_ERROR("InsertValue requires an aggregate operand");
5180
Dan Gohmane5febe42008-05-31 00:58:22 +00005181 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5182 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005183 CHECK_FOR_ERROR
5184 ;}
5185 break;
5186
Bill Wendling1ba18d32008-12-17 20:59:57 +00005187 case 211:
5188#line 2089 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005189 {
5190 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005191 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005192 ;}
5193 break;
5194
Bill Wendling1ba18d32008-12-17 20:59:57 +00005195 case 212:
5196#line 2093 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005197 {
5198 (yyval.ConstVector) = new std::vector<Constant*>();
5199 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005200 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005201 ;}
5202 break;
5203
Bill Wendling1ba18d32008-12-17 20:59:57 +00005204 case 213:
5205#line 2101 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling60f02fc2008-11-13 01:03:00 +00005206 { (yyval.BoolVal) = false; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005207 break;
5208
Bill Wendling1ba18d32008-12-17 20:59:57 +00005209 case 214:
5210#line 2101 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5211 { (yyval.BoolVal) = true; ;}
5212 break;
5213
Bill Wendling60f02fc2008-11-13 01:03:00 +00005214 case 215:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005215#line 2104 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyff384472008-11-24 03:41:24 +00005216 { (yyval.BoolVal) = true; ;}
Bill Wendling60f02fc2008-11-13 01:03:00 +00005217 break;
5218
5219 case 216:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005220#line 2104 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00005221 { (yyval.BoolVal) = false; ;}
5222 break;
5223
Bill Wendling1ba18d32008-12-17 20:59:57 +00005224 case 217:
5225#line 2107 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005226 {
5227 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5228 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00005229 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005230 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5231 if (!Aliasee)
5232 GEN_ERROR("Aliases can be created only to global values");
5233
Dan Gohman54392c12008-04-19 00:24:39 +00005234 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005235 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005236 delete (yyvsp[(1) - (2)].TypeVal);
5237 ;}
5238 break;
5239
Bill Wendling1ba18d32008-12-17 20:59:57 +00005240 case 218:
5241#line 2119 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005242 {
5243 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5244 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5245 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005246 GEN_ERROR("invalid cast opcode for cast from '" +
5247 Val->getType()->getDescription() + "' to '" +
5248 DestTy->getDescription() + "'");
Eric Christopher329d2672008-09-24 04:55:49 +00005249
Dan Gohman54392c12008-04-19 00:24:39 +00005250 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005251 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005252 delete (yyvsp[(5) - (6)].TypeVal);
5253 ;}
5254 break;
5255
Bill Wendling1ba18d32008-12-17 20:59:57 +00005256 case 219:
5257#line 2140 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5258 {
5259 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5260 CurModule.ModuleDone();
5261 CHECK_FOR_ERROR;
5262 ;}
5263 break;
5264
Nick Lewyckyff384472008-11-24 03:41:24 +00005265 case 220:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005266#line 2145 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyff384472008-11-24 03:41:24 +00005267 {
5268 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5269 CurModule.ModuleDone();
5270 CHECK_FOR_ERROR;
5271 ;}
Devang Patelcd842482008-09-29 20:49:50 +00005272 break;
5273
Bill Wendling1ba18d32008-12-17 20:59:57 +00005274 case 223:
5275#line 2158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckye2c0e0f2008-12-15 07:31:07 +00005276 { CurFun.isDeclare = false; ;}
5277 break;
5278
Bill Wendling1ba18d32008-12-17 20:59:57 +00005279 case 224:
5280#line 2158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005281 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005282 CurFun.FunctionDone();
5283 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005284 ;}
5285 break;
5286
Bill Wendling1ba18d32008-12-17 20:59:57 +00005287 case 225:
5288#line 2162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005289 { CurFun.isDeclare = true; ;}
5290 break;
5291
Bill Wendling1ba18d32008-12-17 20:59:57 +00005292 case 226:
5293#line 2162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5294 {
5295 CHECK_FOR_ERROR
5296 ;}
5297 break;
5298
Bill Wendling60f02fc2008-11-13 01:03:00 +00005299 case 227:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005300#line 2165 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyff384472008-11-24 03:41:24 +00005301 {
5302 CHECK_FOR_ERROR
5303 ;}
5304 break;
5305
5306 case 228:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005307#line 2168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005308 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005309 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005310 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005311 // Eagerly resolve types. This is not an optimization, this is a
5312 // requirement that is due to the fact that we could have this:
5313 //
5314 // %list = type { %list * }
5315 // %list = type { %list * } ; repeated type decl
5316 //
5317 // If types are not resolved eagerly, then the two types will not be
5318 // determined to be the same type!
5319 //
Dan Gohman54392c12008-04-19 00:24:39 +00005320 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005321
Dan Gohman54392c12008-04-19 00:24:39 +00005322 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005323 CHECK_FOR_ERROR
5324 // If this is a named type that is not a redefinition, add it to the slot
5325 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005326 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005327 }
5328
Dan Gohman54392c12008-04-19 00:24:39 +00005329 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005330 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005331 ;}
5332 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005333
Bill Wendling1ba18d32008-12-17 20:59:57 +00005334 case 229:
5335#line 2192 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005336 {
5337 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5338
5339 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005340 CHECK_FOR_ERROR
5341 // If this is a named type that is not a redefinition, add it to the slot
5342 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005343 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005344 }
5345 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005346 ;}
5347 break;
5348
Bill Wendling1ba18d32008-12-17 20:59:57 +00005349 case 230:
5350#line 2204 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005351 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005352 /* "Externally Visible" Linkage */
Eric Christopher329d2672008-09-24 04:55:49 +00005353 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005354 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005355 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5356 (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 +00005357 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005358 ;}
5359 break;
5360
Bill Wendling1ba18d32008-12-17 20:59:57 +00005361 case 231:
5362#line 2211 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005363 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005364 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005365 ;}
5366 break;
5367
Bill Wendling1ba18d32008-12-17 20:59:57 +00005368 case 232:
5369#line 2215 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005370 {
Eric Christopher329d2672008-09-24 04:55:49 +00005371 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005372 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005373 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 +00005374 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005375 ;}
5376 break;
5377
Bill Wendling1ba18d32008-12-17 20:59:57 +00005378 case 233:
5379#line 2220 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005380 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005381 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005382 ;}
5383 break;
5384
Bill Wendling1ba18d32008-12-17 20:59:57 +00005385 case 234:
5386#line 2224 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005387 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005388 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005389 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5390 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 +00005391 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005392 delete (yyvsp[(6) - (7)].TypeVal);
5393 ;}
5394 break;
5395
Bill Wendling1ba18d32008-12-17 20:59:57 +00005396 case 235:
5397#line 2230 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005398 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005399 CurGV = 0;
5400 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005401 ;}
5402 break;
5403
Bill Wendling1ba18d32008-12-17 20:59:57 +00005404 case 236:
5405#line 2234 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005406 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005407 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005408 if ((yyvsp[(1) - (5)].StrVal)) {
5409 Name = *(yyvsp[(1) - (5)].StrVal);
5410 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005411 }
5412 if (Name.empty())
5413 GEN_ERROR("Alias name cannot be empty");
Eric Christopher329d2672008-09-24 04:55:49 +00005414
Dan Gohman54392c12008-04-19 00:24:39 +00005415 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005416 if (Aliasee == 0)
5417 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5418
Dan Gohman54392c12008-04-19 00:24:39 +00005419 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005420 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005421 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005422 InsertValue(GA, CurModule.Values);
Eric Christopher329d2672008-09-24 04:55:49 +00005423
5424
Chris Lattner5eefce32007-09-10 23:24:14 +00005425 // If there was a forward reference of this alias, resolve it now.
Eric Christopher329d2672008-09-24 04:55:49 +00005426
Chris Lattner5eefce32007-09-10 23:24:14 +00005427 ValID ID;
5428 if (!Name.empty())
5429 ID = ValID::createGlobalName(Name);
5430 else
5431 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher329d2672008-09-24 04:55:49 +00005432
Chris Lattner5eefce32007-09-10 23:24:14 +00005433 if (GlobalValue *FWGV =
5434 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5435 // Replace uses of the fwdref with the actual alias.
5436 FWGV->replaceAllUsesWith(GA);
5437 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5438 GV->eraseFromParent();
5439 else
5440 cast<Function>(FWGV)->eraseFromParent();
5441 }
5442 ID.destroy();
Eric Christopher329d2672008-09-24 04:55:49 +00005443
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005444 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005445 ;}
5446 break;
5447
Bill Wendling1ba18d32008-12-17 20:59:57 +00005448 case 237:
5449#line 2274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5450 {
5451 CHECK_FOR_ERROR
5452 ;}
5453 break;
5454
Bill Wendling60f02fc2008-11-13 01:03:00 +00005455 case 238:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005456#line 2277 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyff384472008-11-24 03:41:24 +00005457 {
5458 CHECK_FOR_ERROR
5459 ;}
5460 break;
5461
5462 case 239:
Bill Wendling1ba18d32008-12-17 20:59:57 +00005463#line 2283 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005464 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005465 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5466 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005467 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005468 else
Dan Gohman54392c12008-04-19 00:24:39 +00005469 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5470 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005471 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005472;}
5473 break;
5474
Bill Wendling1ba18d32008-12-17 20:59:57 +00005475 case 240:
5476#line 2293 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005477 {
5478 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5479 delete (yyvsp[(3) - (3)].StrVal);
5480 ;}
5481 break;
5482
Bill Wendling1ba18d32008-12-17 20:59:57 +00005483 case 241:
5484#line 2297 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005485 {
5486 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5487 delete (yyvsp[(3) - (3)].StrVal);
5488 ;}
5489 break;
5490
Bill Wendling1ba18d32008-12-17 20:59:57 +00005491 case 243:
5492#line 2304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005493 {
5494 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5495 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005496 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005497 ;}
5498 break;
5499
Bill Wendling1ba18d32008-12-17 20:59:57 +00005500 case 244:
5501#line 2309 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005502 {
5503 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5504 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005505 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005506 ;}
5507 break;
5508
Bill Wendling1ba18d32008-12-17 20:59:57 +00005509 case 245:
5510#line 2314 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005511 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005512 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005513 ;}
5514 break;
5515
Bill Wendling1ba18d32008-12-17 20:59:57 +00005516 case 246:
5517#line 2323 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005518 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005519 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005520 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005521 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5522 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005523 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 +00005524 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5525 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005526 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005527 ;}
5528 break;
5529
Bill Wendling1ba18d32008-12-17 20:59:57 +00005530 case 247:
5531#line 2333 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005532 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005533 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005534 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005535 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5536 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005537 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 +00005538 (yyval.ArgList) = new ArgListType;
5539 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005540 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005541 ;}
5542 break;
5543
Bill Wendling1ba18d32008-12-17 20:59:57 +00005544 case 248:
5545#line 2344 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005546 {
5547 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005548 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005549 ;}
5550 break;
5551
Bill Wendling1ba18d32008-12-17 20:59:57 +00005552 case 249:
5553#line 2348 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005554 {
5555 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005556 struct ArgListEntry E;
5557 E.Ty = new PATypeHolder(Type::VoidTy);
5558 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005559 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005560 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005561 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005562 ;}
5563 break;
5564
Bill Wendling1ba18d32008-12-17 20:59:57 +00005565 case 250:
5566#line 2357 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005567 {
5568 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005569 struct ArgListEntry E;
5570 E.Ty = new PATypeHolder(Type::VoidTy);
5571 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005572 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005573 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005574 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005575 ;}
5576 break;
5577
Bill Wendling1ba18d32008-12-17 20:59:57 +00005578 case 251:
5579#line 2366 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005580 {
5581 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005582 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005583 ;}
5584 break;
5585
Bill Wendling1ba18d32008-12-17 20:59:57 +00005586 case 252:
5587#line 2372 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005588 {
Devang Patelcd842482008-09-29 20:49:50 +00005589 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5590 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher329d2672008-09-24 04:55:49 +00005591
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005592 // Check the function result for abstractness if this is a define. We should
5593 // have no abstract types at this point
Devang Patelcd842482008-09-29 20:49:50 +00005594 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5595 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005596
Devang Patelcd842482008-09-29 20:49:50 +00005597 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00005598 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00005599
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005600 std::vector<const Type*> ParamTypeList;
Devang Pateld222f862008-09-25 21:00:45 +00005601 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005602 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5603 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00005604 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5605 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5606 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005607 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00005608 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005609 }
Devang Patelcd842482008-09-29 20:49:50 +00005610 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005611 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00005612 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005613 }
Devang Patelcd842482008-09-29 20:49:50 +00005614 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005615 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00005616 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005617 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00005618 }
Devang Patelcd842482008-09-29 20:49:50 +00005619 if (RetAttrs != Attribute::None)
5620 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5621 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005622 unsigned index = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005623 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005624 const Type* Ty = I->Ty->get();
5625 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5626 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5627 ParamTypeList.push_back(Ty);
Devang Pateld222f862008-09-25 21:00:45 +00005628 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5629 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005630 }
5631 }
Devang Patelcd842482008-09-29 20:49:50 +00005632 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5633 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005634
5635 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5636 if (isVarArg) ParamTypeList.pop_back();
5637
Devang Pateld222f862008-09-25 21:00:45 +00005638 AttrListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005639 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00005640 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005641
Devang Patelcd842482008-09-29 20:49:50 +00005642 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005643 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patelcd842482008-09-29 20:49:50 +00005644 delete (yyvsp[(3) - (11)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005645
5646 ValID ID;
5647 if (!FunctionName.empty()) {
5648 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5649 } else {
5650 ID = ValID::createGlobalID(CurModule.Values.size());
5651 }
5652
5653 Function *Fn = 0;
5654 // See if this function was forward referenced. If so, recycle the object.
5655 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher329d2672008-09-24 04:55:49 +00005656 // Move the function to the end of the list, from whereever it was
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005657 // previously inserted.
5658 Fn = cast<Function>(FWRef);
Devang Pateld222f862008-09-25 21:00:45 +00005659 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner1c8733e2008-03-12 17:45:29 +00005660 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005661 CurModule.CurrentModule->getFunctionList().remove(Fn);
5662 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5663 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5664 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005665 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005666 // The existing function doesn't have the same type. This is an overload
5667 // error.
5668 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Pateld222f862008-09-25 21:00:45 +00005669 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005670 // The existing function doesn't have the same parameter attributes.
5671 // This is an overload error.
5672 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005673 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5674 // Neither the existing or the current function is a declaration and they
5675 // have the same name and same type. Clearly this is a redefinition.
5676 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005677 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005678 // Make sure to strip off any argument names so we can't get conflicts.
5679 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5680 AI != AE; ++AI)
5681 AI->setName("");
5682 }
5683 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005684 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5685 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005686 InsertValue(Fn, CurModule.Values);
5687 }
5688
Nuno Lopese20dbca2008-10-03 15:45:58 +00005689 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005690 CurFun.FunctionStart(Fn);
5691
5692 if (CurFun.isDeclare) {
5693 // If we have declaration, always overwrite linkage. This will allow us to
5694 // correctly handle cases, when pointer to function is passed as argument to
5695 // another function.
5696 Fn->setLinkage(CurFun.Linkage);
5697 Fn->setVisibility(CurFun.Visibility);
5698 }
Devang Patel5df692d2008-09-02 20:52:40 +00005699 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00005700 Fn->setAttributes(PAL);
Devang Patelcd842482008-09-29 20:49:50 +00005701 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5702 if ((yyvsp[(9) - (11)].StrVal)) {
5703 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5704 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005705 }
Devang Patelcd842482008-09-29 20:49:50 +00005706 if ((yyvsp[(11) - (11)].StrVal)) {
5707 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5708 delete (yyvsp[(11) - (11)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005709 }
5710
5711 // Add all of the arguments we parsed to the function...
Devang Patelcd842482008-09-29 20:49:50 +00005712 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005713 if (isVarArg) { // Nuke the last entry
Devang Patelcd842482008-09-29 20:49:50 +00005714 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005715 "Not a varargs marker!");
Devang Patelcd842482008-09-29 20:49:50 +00005716 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5717 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005718 }
5719 Function::arg_iterator ArgIt = Fn->arg_begin();
5720 Function::arg_iterator ArgEnd = Fn->arg_end();
5721 unsigned Idx = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005722 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5723 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005724 delete I->Ty; // Delete the typeholder...
5725 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5726 CHECK_FOR_ERROR
5727 InsertValue(ArgIt);
5728 Idx++;
5729 }
5730
Devang Patelcd842482008-09-29 20:49:50 +00005731 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005732 }
5733 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005734;}
5735 break;
5736
Bill Wendling1ba18d32008-12-17 20:59:57 +00005737 case 255:
5738#line 2522 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005739 {
5740 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005741
5742 // Make sure that we keep track of the linkage type even if there was a
5743 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005744 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5745 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5746;}
5747 break;
5748
Bill Wendling1ba18d32008-12-17 20:59:57 +00005749 case 258:
5750#line 2533 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005751 {
5752 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005753 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005754;}
5755 break;
5756
Bill Wendling1ba18d32008-12-17 20:59:57 +00005757 case 259:
5758#line 2538 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005759 {
5760 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5761 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5762 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005763 CurFun.FunctionDone();
5764 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005765 ;}
5766 break;
5767
Bill Wendling1ba18d32008-12-17 20:59:57 +00005768 case 260:
5769#line 2550 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005770 {
5771 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005772 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005773 ;}
5774 break;
5775
Bill Wendling1ba18d32008-12-17 20:59:57 +00005776 case 261:
5777#line 2554 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005778 {
5779 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005780 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005781 ;}
5782 break;
5783
Bill Wendling1ba18d32008-12-17 20:59:57 +00005784 case 262:
5785#line 2559 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005786 { // A reference to a direct constant
5787 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005788 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005789 ;}
5790 break;
5791
Bill Wendling1ba18d32008-12-17 20:59:57 +00005792 case 263:
5793#line 2563 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005794 {
5795 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005796 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005797 ;}
5798 break;
5799
Bill Wendling1ba18d32008-12-17 20:59:57 +00005800 case 264:
5801#line 2567 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005802 { // arbitrary precision integer constants
5803 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5804 delete (yyvsp[(1) - (1)].APIntVal);
5805 CHECK_FOR_ERROR
5806 ;}
5807 break;
5808
Bill Wendling1ba18d32008-12-17 20:59:57 +00005809 case 265:
5810#line 2572 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005811 { // arbitrary precision integer constants
5812 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5813 delete (yyvsp[(1) - (1)].APIntVal);
5814 CHECK_FOR_ERROR
5815 ;}
5816 break;
5817
Bill Wendling1ba18d32008-12-17 20:59:57 +00005818 case 266:
5819#line 2577 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005820 { // Perhaps it's an FP constant?
5821 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005822 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005823 ;}
5824 break;
5825
Bill Wendling1ba18d32008-12-17 20:59:57 +00005826 case 267:
5827#line 2581 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005828 {
5829 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005830 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005831 ;}
5832 break;
5833
Bill Wendling1ba18d32008-12-17 20:59:57 +00005834 case 268:
5835#line 2585 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005836 {
5837 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005838 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005839 ;}
5840 break;
5841
Bill Wendling1ba18d32008-12-17 20:59:57 +00005842 case 269:
5843#line 2589 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005844 {
5845 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005846 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005847 ;}
5848 break;
5849
Bill Wendling1ba18d32008-12-17 20:59:57 +00005850 case 270:
5851#line 2593 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005852 {
5853 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005854 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005855 ;}
5856 break;
5857
Bill Wendling1ba18d32008-12-17 20:59:57 +00005858 case 271:
5859#line 2597 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005860 { // A vector zero constant.
5861 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005862 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005863 ;}
5864 break;
5865
Bill Wendling1ba18d32008-12-17 20:59:57 +00005866 case 272:
5867#line 2601 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005868 { // Nonempty unsized packed vector
5869 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005870 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmane5febe42008-05-31 00:58:22 +00005871
5872 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5873 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00005874
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005875 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005876 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher329d2672008-09-24 04:55:49 +00005877
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005878 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005879 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5880 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005881 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005882 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005883 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005884 }
5885
Dan Gohman54392c12008-04-19 00:24:39 +00005886 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5887 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005888 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005889 ;}
5890 break;
5891
Bill Wendling1ba18d32008-12-17 20:59:57 +00005892 case 273:
5893#line 2623 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005894 { // Nonempty unsized arr
5895 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005896 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005897
5898 if (!ETy->isFirstClassType())
5899 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5900
5901 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5902 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5903
5904 // Verify all elements are correct type!
5905 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5906 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005907 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005908 ETy->getDescription() +"' as required!\nIt is of type '"+
5909 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5910 }
5911
5912 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5913 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5914 CHECK_FOR_ERROR
5915 ;}
5916 break;
5917
Bill Wendling1ba18d32008-12-17 20:59:57 +00005918 case 274:
5919#line 2645 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005920 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005921 // Use undef instead of an array because it's inconvenient to determine
5922 // the element type at this point, there being no elements to examine.
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005923 (yyval.ValIDVal) = ValID::createUndef();
5924 CHECK_FOR_ERROR
5925 ;}
5926 break;
5927
Bill Wendling1ba18d32008-12-17 20:59:57 +00005928 case 275:
5929#line 2651 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005930 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005931 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005932 const Type *ETy = Type::Int8Ty;
5933
5934 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5935
5936 std::vector<Constant*> Vals;
5937 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5938 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5939 delete (yyvsp[(2) - (2)].StrVal);
5940 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5941 CHECK_FOR_ERROR
5942 ;}
5943 break;
5944
Bill Wendling1ba18d32008-12-17 20:59:57 +00005945 case 276:
5946#line 2664 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005947 {
5948 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5949 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5950 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5951
5952 const StructType *STy = StructType::get(Elements);
5953 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5954
5955 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5956 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5957 CHECK_FOR_ERROR
5958 ;}
5959 break;
5960
Bill Wendling1ba18d32008-12-17 20:59:57 +00005961 case 277:
5962#line 2676 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005963 {
5964 const StructType *STy = StructType::get(std::vector<const Type*>());
5965 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5966 CHECK_FOR_ERROR
5967 ;}
5968 break;
5969
Bill Wendling1ba18d32008-12-17 20:59:57 +00005970 case 278:
5971#line 2681 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005972 {
5973 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5974 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5975 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5976
5977 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5978 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5979
5980 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5981 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5982 CHECK_FOR_ERROR
5983 ;}
5984 break;
5985
Bill Wendling1ba18d32008-12-17 20:59:57 +00005986 case 279:
5987#line 2693 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005988 {
5989 const StructType *STy = StructType::get(std::vector<const Type*>(),
5990 /*isPacked=*/true);
5991 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5992 CHECK_FOR_ERROR
5993 ;}
5994 break;
5995
Bill Wendling1ba18d32008-12-17 20:59:57 +00005996 case 280:
5997#line 2699 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005998 {
5999 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006000 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006001 ;}
6002 break;
6003
Bill Wendling1ba18d32008-12-17 20:59:57 +00006004 case 281:
6005#line 2703 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006006 {
6007 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
6008 delete (yyvsp[(3) - (5)].StrVal);
6009 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006010 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006011 ;}
6012 break;
6013
Bill Wendling1ba18d32008-12-17 20:59:57 +00006014 case 282:
6015#line 2713 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006016 { // Is it an integer reference...?
6017 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006018 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006019 ;}
6020 break;
6021
Bill Wendling1ba18d32008-12-17 20:59:57 +00006022 case 283:
6023#line 2717 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006024 {
6025 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006026 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006027 ;}
6028 break;
6029
Bill Wendling1ba18d32008-12-17 20:59:57 +00006030 case 284:
6031#line 2721 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006032 { // Is it a named reference...?
6033 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
6034 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006035 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006036 ;}
6037 break;
6038
Bill Wendling1ba18d32008-12-17 20:59:57 +00006039 case 285:
6040#line 2726 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006041 { // Is it a named reference...?
6042 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
6043 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006044 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006045 ;}
6046 break;
6047
Bill Wendling1ba18d32008-12-17 20:59:57 +00006048 case 288:
6049#line 2739 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006050 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006051 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006052 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00006053 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00006054 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006055 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006056 ;}
6057 break;
6058
Bill Wendling1ba18d32008-12-17 20:59:57 +00006059 case 289:
6060#line 2748 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006061 {
6062 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher329d2672008-09-24 04:55:49 +00006063 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00006064 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006065 ;}
6066 break;
6067
Bill Wendling1ba18d32008-12-17 20:59:57 +00006068 case 290:
6069#line 2753 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006070 {
Eric Christopher329d2672008-09-24 04:55:49 +00006071 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00006072 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006073 ;}
6074 break;
6075
Bill Wendling1ba18d32008-12-17 20:59:57 +00006076 case 291:
6077#line 2758 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006078 {
6079 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006080 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006081 ;}
6082 break;
6083
Bill Wendling1ba18d32008-12-17 20:59:57 +00006084 case 292:
6085#line 2762 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006086 { // Do not allow functions with 0 basic blocks
Dan Gohman54392c12008-04-19 00:24:39 +00006087 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006088 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006089 ;}
6090 break;
6091
Bill Wendling1ba18d32008-12-17 20:59:57 +00006092 case 293:
6093#line 2771 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006094 {
6095 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006096 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006097 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6098 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6099 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006100 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006101 ;}
6102 break;
6103
Bill Wendling1ba18d32008-12-17 20:59:57 +00006104 case 294:
6105#line 2780 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006106 {
6107 CHECK_FOR_ERROR
6108 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6109 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6110 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6111 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher329d2672008-09-24 04:55:49 +00006112
Chris Lattner906773a2008-08-29 17:20:18 +00006113 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6114 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6115 CHECK_FOR_ERROR
6116;}
6117 break;
6118
Bill Wendling1ba18d32008-12-17 20:59:57 +00006119 case 295:
6120#line 2793 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006121 {
6122 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006123 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6124 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00006125 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6126 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6127 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006128 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006129 ;}
6130 break;
Chris Lattner59363a32008-02-19 04:36:25 +00006131
Bill Wendling1ba18d32008-12-17 20:59:57 +00006132 case 296:
6133#line 2802 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006134 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00006135 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00006136 CHECK_FOR_ERROR
6137 ;}
6138 break;
6139
Bill Wendling1ba18d32008-12-17 20:59:57 +00006140 case 297:
6141#line 2806 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00006142 { // Labelled (named) basic block
6143 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6144 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006145 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00006146
Dan Gohman54392c12008-04-19 00:24:39 +00006147 ;}
6148 break;
6149
Bill Wendling1ba18d32008-12-17 20:59:57 +00006150 case 298:
6151#line 2814 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006152 { // Return with a result...
6153 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6154 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006155 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6156 if (VL.size() > 1 ||
6157 (isa<StructType>(ReturnType) &&
6158 (VL.empty() || VL[0]->getType() != ReturnType))) {
6159 Value *RV = UndefValue::get(ReturnType);
6160 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6161 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6162 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6163 RV = I;
6164 }
6165 (yyval.TermInstVal) = ReturnInst::Create(RV);
6166 } else {
6167 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6168 }
Dan Gohman54392c12008-04-19 00:24:39 +00006169 delete (yyvsp[(2) - (2)].ValueList);
6170 CHECK_FOR_ERROR
6171 ;}
6172 break;
6173
Bill Wendling1ba18d32008-12-17 20:59:57 +00006174 case 299:
6175#line 2834 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006176 { // Return with no result...
6177 (yyval.TermInstVal) = ReturnInst::Create();
6178 CHECK_FOR_ERROR
6179 ;}
6180 break;
6181
Bill Wendling1ba18d32008-12-17 20:59:57 +00006182 case 300:
6183#line 2838 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006184 { // Unconditional Branch...
6185 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6186 CHECK_FOR_ERROR
6187 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6188 ;}
6189 break;
6190
Bill Wendling1ba18d32008-12-17 20:59:57 +00006191 case 301:
6192#line 2843 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006193 {
Dan Gohmane5febe42008-05-31 00:58:22 +00006194 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6195 GEN_ERROR("Branch condition must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00006196 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6197 CHECK_FOR_ERROR
6198 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6199 CHECK_FOR_ERROR
6200 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6201 CHECK_FOR_ERROR
6202 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6203 ;}
6204 break;
6205
Bill Wendling1ba18d32008-12-17 20:59:57 +00006206 case 302:
6207#line 2854 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006208 {
6209 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6210 CHECK_FOR_ERROR
6211 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6212 CHECK_FOR_ERROR
6213 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6214 (yyval.TermInstVal) = S;
6215
6216 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6217 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006218 for (; I != E; ++I) {
6219 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6220 S->addCase(CI, I->second);
6221 else
6222 GEN_ERROR("Switch case is constant, but not a simple integer");
6223 }
Dan Gohman54392c12008-04-19 00:24:39 +00006224 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006225 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006226 ;}
6227 break;
6228
Bill Wendling1ba18d32008-12-17 20:59:57 +00006229 case 303:
6230#line 2873 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006231 {
6232 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006233 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006234 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006235 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00006236 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00006237 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006238 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006239 ;}
6240 break;
6241
Bill Wendling1ba18d32008-12-17 20:59:57 +00006242 case 304:
6243#line 2883 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006244 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006245
6246 // Handle the short syntax
6247 const PointerType *PFTy = 0;
6248 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006249 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006250 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6251 // Pull out the types of all of the arguments...
6252 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006253 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006254 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006255 const Type *Ty = I->Val->getType();
6256 if (Ty == Type::VoidTy)
6257 GEN_ERROR("Short call syntax cannot be used with varargs");
6258 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006259 }
Eric Christopher329d2672008-09-24 04:55:49 +00006260
Devang Patelcd842482008-09-29 20:49:50 +00006261 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006262 GEN_ERROR("Invalid result type for LLVM function");
6263
Devang Patelcd842482008-09-29 20:49:50 +00006264 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006265 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006266 }
6267
Devang Patelcd842482008-09-29 20:49:50 +00006268 delete (yyvsp[(4) - (15)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006269
Devang Patelcd842482008-09-29 20:49:50 +00006270 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006271 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006272 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006273 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006274 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006275 CHECK_FOR_ERROR
6276
Devang Pateld222f862008-09-25 21:00:45 +00006277 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006278 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6279 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006280 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6281 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6282 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006283 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006284 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006285 }
Devang Patelcd842482008-09-29 20:49:50 +00006286 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006287 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006288 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006289 }
Devang Patelcd842482008-09-29 20:49:50 +00006290 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006291 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006292 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006293 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006294 }
Devang Patelcd842482008-09-29 20:49:50 +00006295 if (RetAttrs != Attribute::None)
6296 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006297
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006298 // Check the arguments
6299 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006300 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006301 // Make sure no arguments is a good thing!
6302 if (Ty->getNumParams() != 0)
6303 GEN_ERROR("No arguments passed to a function that "
6304 "expects arguments");
6305 } else { // Has arguments?
6306 // Loop through FunctionType's arguments and ensure they are specified
6307 // correctly!
6308 FunctionType::param_iterator I = Ty->param_begin();
6309 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006310 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006311 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006312
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006313 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006314 if (ArgI->Val->getType() != *I)
6315 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6316 (*I)->getDescription() + "'");
6317 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006318 if (ArgI->Attrs != Attribute::None)
6319 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006320 }
6321
6322 if (Ty->isVarArg()) {
6323 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006324 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006325 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006326 if (ArgI->Attrs != Attribute::None)
6327 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006328 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 } else if (I != E || ArgI != ArgE)
6330 GEN_ERROR("Invalid number of parameters detected");
6331 }
Devang Patelcd842482008-09-29 20:49:50 +00006332 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6333 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Pateld222f862008-09-25 21:00:45 +00006334 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006335 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006336 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006337
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006338 // Create the InvokeInst
Dan Gohman8055f772008-05-15 19:50:34 +00006339 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6340 Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006341 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006342 II->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006343 (yyval.TermInstVal) = II;
Devang Patelcd842482008-09-29 20:49:50 +00006344 delete (yyvsp[(7) - (15)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006345 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006346 ;}
6347 break;
6348
Bill Wendling1ba18d32008-12-17 20:59:57 +00006349 case 305:
6350#line 2986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006351 {
6352 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006353 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006354 ;}
6355 break;
6356
Bill Wendling1ba18d32008-12-17 20:59:57 +00006357 case 306:
6358#line 2990 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006359 {
6360 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006361 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006362 ;}
6363 break;
6364
Bill Wendling1ba18d32008-12-17 20:59:57 +00006365 case 307:
6366#line 2997 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006367 {
6368 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6369 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006370 CHECK_FOR_ERROR
6371 if (V == 0)
6372 GEN_ERROR("May only switch on a constant pool value");
6373
Dan Gohman54392c12008-04-19 00:24:39 +00006374 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006375 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006376 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6377 ;}
6378 break;
6379
Bill Wendling1ba18d32008-12-17 20:59:57 +00006380 case 308:
6381#line 3008 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006382 {
6383 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6384 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006385 CHECK_FOR_ERROR
6386
6387 if (V == 0)
6388 GEN_ERROR("May only switch on a constant pool value");
6389
Dan Gohman54392c12008-04-19 00:24:39 +00006390 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006391 CHECK_FOR_ERROR
Eric Christopher329d2672008-09-24 04:55:49 +00006392 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohman54392c12008-04-19 00:24:39 +00006393 ;}
6394 break;
6395
Bill Wendling1ba18d32008-12-17 20:59:57 +00006396 case 309:
6397#line 3021 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006398 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006399 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00006400 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006401 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006402 InsertValue((yyvsp[(2) - (2)].InstVal));
6403 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006404 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006405 ;}
6406 break;
6407
Bill Wendling1ba18d32008-12-17 20:59:57 +00006408 case 310:
6409#line 3030 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006410 {
6411 CHECK_FOR_ERROR
6412 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher329d2672008-09-24 04:55:49 +00006413
Chris Lattner906773a2008-08-29 17:20:18 +00006414 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6415 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6416 " is incorrect, expected %" + utostr((unsigned)ValNum));
6417
6418 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6419 CHECK_FOR_ERROR
6420 ;}
6421 break;
6422
Bill Wendling1ba18d32008-12-17 20:59:57 +00006423 case 311:
6424#line 3043 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006425 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006426 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006427 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6428 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6429 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006430 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006431 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006432 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006433 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6434 delete (yyvsp[(1) - (6)].TypeVal);
6435 ;}
6436 break;
6437
Bill Wendling1ba18d32008-12-17 20:59:57 +00006438 case 312:
6439#line 3054 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006440 {
6441 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6442 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006443 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006444 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006445 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006446 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6447 ;}
6448 break;
6449
Bill Wendling1ba18d32008-12-17 20:59:57 +00006450 case 313:
6451#line 3064 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006452 {
Devang Pateld222f862008-09-25 21:00:45 +00006453 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006454 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006455 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006456 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00006457 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006458 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 +00006459 (yyval.ParamList)->push_back(E);
6460 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006461 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006462 ;}
6463 break;
6464
Bill Wendling1ba18d32008-12-17 20:59:57 +00006465 case 314:
6466#line 3075 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006467 {
Devang Pateld222f862008-09-25 21:00:45 +00006468 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00006469 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00006470 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006471 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 +00006472 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006473 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006474 ;}
6475 break;
6476
Bill Wendling1ba18d32008-12-17 20:59:57 +00006477 case 315:
6478#line 3083 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006479 {
Devang Pateld222f862008-09-25 21:00:45 +00006480 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006481 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006482 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6483 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006484 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 +00006485 (yyval.ParamList)->push_back(E);
6486 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006487 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006488 ;}
6489 break;
6490
Bill Wendling1ba18d32008-12-17 20:59:57 +00006491 case 316:
6492#line 3093 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006493 {
Devang Pateld222f862008-09-25 21:00:45 +00006494 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00006495 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006496 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 +00006497 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00006498 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006499 ;}
6500 break;
6501
Bill Wendling1ba18d32008-12-17 20:59:57 +00006502 case 317:
6503#line 3100 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006504 { (yyval.ParamList) = new ParamList(); ;}
6505 break;
6506
Bill Wendling1ba18d32008-12-17 20:59:57 +00006507 case 318:
6508#line 3103 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006509 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6510 break;
6511
Bill Wendling1ba18d32008-12-17 20:59:57 +00006512 case 319:
6513#line 3104 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006514 {
6515 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6516 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006517 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006518 ;}
6519 break;
6520
Bill Wendling1ba18d32008-12-17 20:59:57 +00006521 case 320:
6522#line 3112 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006523 {
6524 (yyval.ConstantList) = new std::vector<unsigned>();
6525 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6526 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6527 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6528 ;}
6529 break;
6530
Bill Wendling1ba18d32008-12-17 20:59:57 +00006531 case 321:
6532#line 3118 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006533 {
6534 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6535 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6536 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6537 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6538 CHECK_FOR_ERROR
6539 ;}
6540 break;
6541
Bill Wendling1ba18d32008-12-17 20:59:57 +00006542 case 322:
6543#line 3127 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006544 {
6545 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006546 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006547 ;}
6548 break;
6549
Bill Wendling1ba18d32008-12-17 20:59:57 +00006550 case 323:
6551#line 3131 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006552 {
6553 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006554 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006555 ;}
6556 break;
6557
Bill Wendling1ba18d32008-12-17 20:59:57 +00006558 case 324:
6559#line 3136 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006560 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006561 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006562 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00006563 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohman54392c12008-04-19 00:24:39 +00006564 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006565 GEN_ERROR(
6566 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher329d2672008-09-24 04:55:49 +00006567 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006568 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006569 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006570 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006571 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohman54392c12008-04-19 00:24:39 +00006572 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006573 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006574 delete (yyvsp[(2) - (5)].TypeVal);
6575 ;}
6576 break;
6577
Bill Wendling1ba18d32008-12-17 20:59:57 +00006578 case 325:
6579#line 3152 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006580 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006581 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006582 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6583 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begemanbb1ce942008-07-29 15:49:41 +00006584 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00006585 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006586 GEN_ERROR("Logical operator requires integral operands");
6587 }
Dan Gohman54392c12008-04-19 00:24:39 +00006588 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006589 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006590 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006591 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006592 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006593 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006594 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006595 delete (yyvsp[(2) - (5)].TypeVal);
6596 ;}
6597 break;
6598
Bill Wendling1ba18d32008-12-17 20:59:57 +00006599 case 326:
6600#line 3169 "/home/nicholas/llvm-commit/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[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006604 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006605 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006606 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006607 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006608 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006609 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006610 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006611 delete (yyvsp[(3) - (6)].TypeVal);
6612 ;}
6613 break;
6614
Bill Wendling1ba18d32008-12-17 20:59:57 +00006615 case 327:
6616#line 3181 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006617 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006618 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006619 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006620 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006621 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006622 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006623 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006624 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006625 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006626 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006627 delete (yyvsp[(3) - (6)].TypeVal);
6628 ;}
6629 break;
6630
Bill Wendling1ba18d32008-12-17 20:59:57 +00006631 case 328:
6632#line 3193 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006633 {
6634 if (!UpRefs.empty())
6635 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6636 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6637 GEN_ERROR("Scalar types not supported by vicmp instruction");
6638 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6639 CHECK_FOR_ERROR
6640 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6641 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006642 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006643 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006644 GEN_ERROR("vicmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006645 delete (yyvsp[(3) - (6)].TypeVal);
6646 ;}
6647 break;
6648
Bill Wendling1ba18d32008-12-17 20:59:57 +00006649 case 329:
6650#line 3207 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006651 {
6652 if (!UpRefs.empty())
6653 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6654 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6655 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6656 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6657 CHECK_FOR_ERROR
6658 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6659 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006660 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006661 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006662 GEN_ERROR("vfcmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006663 delete (yyvsp[(3) - (6)].TypeVal);
6664 ;}
6665 break;
6666
Bill Wendling1ba18d32008-12-17 20:59:57 +00006667 case 330:
6668#line 3221 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006669 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006670 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006671 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6672 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6673 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6674 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006675 GEN_ERROR("invalid cast opcode for cast from '" +
6676 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00006677 DestTy->getDescription() + "'");
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006678 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohman54392c12008-04-19 00:24:39 +00006679 delete (yyvsp[(4) - (4)].TypeVal);
6680 ;}
6681 break;
6682
Bill Wendling1ba18d32008-12-17 20:59:57 +00006683 case 331:
6684#line 3233 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006685 {
Dan Gohman181f4e42008-09-09 01:13:24 +00006686 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6687 // vector select
6688 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6689 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6690 GEN_ERROR("vector select value types must be vector types");
6691 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6692 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6693 if (cond_type->getElementType() != Type::Int1Ty)
6694 GEN_ERROR("vector select condition element type must be boolean");
6695 if (cond_type->getNumElements() != select_type->getNumElements())
6696 GEN_ERROR("vector select number of elements must be the same");
6697 } else {
6698 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6699 GEN_ERROR("select condition must be boolean");
6700 }
Dan Gohman54392c12008-04-19 00:24:39 +00006701 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohman181f4e42008-09-09 01:13:24 +00006702 GEN_ERROR("select value types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00006703 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006704 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006705 ;}
6706 break;
6707
Bill Wendling1ba18d32008-12-17 20:59:57 +00006708 case 332:
6709#line 3254 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006710 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006711 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006712 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6713 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6714 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006715 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006716 ;}
6717 break;
6718
Bill Wendling1ba18d32008-12-17 20:59:57 +00006719 case 333:
6720#line 3261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006721 {
6722 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006723 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006724 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006725 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006726 ;}
6727 break;
6728
Bill Wendling1ba18d32008-12-17 20:59:57 +00006729 case 334:
6730#line 3267 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006731 {
6732 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006733 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006734 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006735 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006736 ;}
6737 break;
6738
Bill Wendling1ba18d32008-12-17 20:59:57 +00006739 case 335:
6740#line 3273 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006741 {
6742 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006743 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006744 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006745 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006746 ;}
6747 break;
6748
Bill Wendling1ba18d32008-12-17 20:59:57 +00006749 case 336:
6750#line 3279 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006751 {
6752 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006753 if (!Ty->isFirstClassType())
6754 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006755 (yyval.InstVal) = PHINode::Create(Ty);
6756 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6757 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher329d2672008-09-24 04:55:49 +00006758 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006759 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006760 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6761 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006762 }
Dan Gohman54392c12008-04-19 00:24:39 +00006763 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006764 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006765 ;}
6766 break;
6767
Bill Wendling1ba18d32008-12-17 20:59:57 +00006768 case 337:
6769#line 3295 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006770 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006771
6772 // Handle the short syntax
6773 const PointerType *PFTy = 0;
6774 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006775 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006776 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6777 // Pull out the types of all of the arguments...
6778 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006779 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006780 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006781 const Type *Ty = I->Val->getType();
6782 if (Ty == Type::VoidTy)
6783 GEN_ERROR("Short call syntax cannot be used with varargs");
6784 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006785 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006786
Devang Patelcd842482008-09-29 20:49:50 +00006787 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006788 GEN_ERROR("Invalid result type for LLVM function");
6789
Devang Patelcd842482008-09-29 20:49:50 +00006790 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006791 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006792 }
6793
Devang Patelcd842482008-09-29 20:49:50 +00006794 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006795 CHECK_FOR_ERROR
6796
6797 // Check for call to invalid intrinsic to avoid crashing later.
6798 if (Function *theF = dyn_cast<Function>(V)) {
6799 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6800 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6801 !theF->getIntrinsicID(true))
6802 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6803 theF->getName() + "'");
6804 }
6805
Devang Pateld222f862008-09-25 21:00:45 +00006806 // Set up the Attributes for the function
6807 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006808 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6809 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006810 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6811 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6812 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006813 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006814 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006815 }
Devang Patelcd842482008-09-29 20:49:50 +00006816 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006817 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006818 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006819 }
Devang Patelcd842482008-09-29 20:49:50 +00006820 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006821 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006822 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006823 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006824 }
Devang Patelcd842482008-09-29 20:49:50 +00006825 if (RetAttrs != Attribute::None)
6826 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006827
Eric Christopher329d2672008-09-24 04:55:49 +00006828 // Check the arguments
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006829 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006830 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006831 // Make sure no arguments is a good thing!
6832 if (Ty->getNumParams() != 0)
6833 GEN_ERROR("No arguments passed to a function that "
6834 "expects arguments");
6835 } else { // Has arguments?
6836 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006837 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006838 FunctionType::param_iterator I = Ty->param_begin();
6839 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006840 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006841 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006842
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006843 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006844 if (ArgI->Val->getType() != *I)
6845 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6846 (*I)->getDescription() + "'");
6847 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006848 if (ArgI->Attrs != Attribute::None)
6849 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006850 }
6851 if (Ty->isVarArg()) {
6852 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006853 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006854 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006855 if (ArgI->Attrs != Attribute::None)
6856 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006857 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006858 } else if (I != E || ArgI != ArgE)
6859 GEN_ERROR("Invalid number of parameters detected");
6860 }
Devang Patelcd842482008-09-29 20:49:50 +00006861 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6862 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006863
Devang Pateld222f862008-09-25 21:00:45 +00006864 // Finish off the Attributes and check them
6865 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006866 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006867 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006868
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006869 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006870 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006871 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6872 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006873 CI->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006874 (yyval.InstVal) = CI;
Devang Patelcd842482008-09-29 20:49:50 +00006875 delete (yyvsp[(7) - (9)].ParamList);
6876 delete (yyvsp[(4) - (9)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006877 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006878 ;}
6879 break;
6880
Bill Wendling1ba18d32008-12-17 20:59:57 +00006881 case 338:
6882#line 3404 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006883 {
6884 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006885 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006886 ;}
6887 break;
6888
Bill Wendling1ba18d32008-12-17 20:59:57 +00006889 case 339:
6890#line 3409 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006891 {
6892 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006893 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006894 ;}
6895 break;
6896
Bill Wendling1ba18d32008-12-17 20:59:57 +00006897 case 340:
6898#line 3413 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006899 {
6900 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006901 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006902 ;}
6903 break;
6904
Bill Wendling1ba18d32008-12-17 20:59:57 +00006905 case 341:
6906#line 3420 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006907 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006908 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006909 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6910 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6911 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006912 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006913 ;}
6914 break;
6915
Bill Wendling1ba18d32008-12-17 20:59:57 +00006916 case 342:
6917#line 3427 "/home/nicholas/llvm-commit/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[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006921 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6922 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006923 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006924 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006925 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6926 delete (yyvsp[(2) - (6)].TypeVal);
6927 ;}
6928 break;
6929
Bill Wendling1ba18d32008-12-17 20:59:57 +00006930 case 343:
6931#line 3437 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006932 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006933 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006934 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6935 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6936 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006937 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006938 ;}
6939 break;
6940
Bill Wendling1ba18d32008-12-17 20:59:57 +00006941 case 344:
6942#line 3444 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006943 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006944 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006945 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006946 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6947 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006948 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006949 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006950 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6951 delete (yyvsp[(2) - (6)].TypeVal);
6952 ;}
6953 break;
6954
Bill Wendling1ba18d32008-12-17 20:59:57 +00006955 case 345:
6956#line 3454 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006957 {
6958 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher329d2672008-09-24 04:55:49 +00006959 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006960 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6961 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006962 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006963 ;}
6964 break;
6965
Bill Wendling1ba18d32008-12-17 20:59:57 +00006966 case 346:
6967#line 3462 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006968 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006969 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006970 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6971 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006972 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006973 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6974 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006975 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006976 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6977 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006978 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006979 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6980 delete (yyvsp[(3) - (5)].TypeVal);
6981 ;}
6982 break;
6983
Bill Wendling1ba18d32008-12-17 20:59:57 +00006984 case 347:
6985#line 3476 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006986 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006987 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006988 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6989 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006990 if (!PT)
6991 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006992 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006993 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006994 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6995 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006996 "' into space of type '" + ElTy->getDescription() + "'");
6997
Dan Gohman54392c12008-04-19 00:24:39 +00006998 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006999 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00007000 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
7001 delete (yyvsp[(5) - (7)].TypeVal);
7002 ;}
7003 break;
7004
Bill Wendling1ba18d32008-12-17 20:59:57 +00007005 case 348:
7006#line 3493 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00007007 {
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00007008 if (!UpRefs.empty())
7009 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
7010 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
7011 GEN_ERROR("getresult insn requires an aggregate operand");
7012 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
7013 GEN_ERROR("Invalid getresult index for type '" +
7014 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
7015
7016 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel3b8849c2008-02-19 22:27:01 +00007017 CHECK_FOR_ERROR
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00007018 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
7019 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00007020 ;}
7021 break;
7022
Bill Wendling1ba18d32008-12-17 20:59:57 +00007023 case 349:
7024#line 3507 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00007025 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007026 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00007027 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7028 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007029 GEN_ERROR("getelementptr insn requires pointer operand");
7030
Dan Gohman8055f772008-05-15 19:50:34 +00007031 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007032 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00007033 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7034 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007035 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00007036 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007037 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00007038 delete (yyvsp[(4) - (4)].ValueList);
7039 ;}
7040 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007041
Bill Wendling1ba18d32008-12-17 20:59:57 +00007042 case 350:
7043#line 3522 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007044 {
7045 if (!UpRefs.empty())
7046 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7047 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
7048 GEN_ERROR("extractvalue insn requires an aggregate operand");
7049
Dan Gohmane5febe42008-05-31 00:58:22 +00007050 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007051 GEN_ERROR("Invalid extractvalue indices for type '" +
7052 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7053 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7054 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00007055 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007056 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00007057 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007058 ;}
7059 break;
7060
Bill Wendling1ba18d32008-12-17 20:59:57 +00007061 case 351:
7062#line 3537 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007063 {
7064 if (!UpRefs.empty())
7065 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7066 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7067 GEN_ERROR("extractvalue insn requires an aggregate operand");
7068
Dan Gohmane5febe42008-05-31 00:58:22 +00007069 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 +00007070 GEN_ERROR("Invalid insertvalue indices for type '" +
7071 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7072 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7073 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7074 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00007075 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007076 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007077 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00007078 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007079 ;}
7080 break;
7081
Dan Gohman54392c12008-04-19 00:24:39 +00007082
7083/* Line 1267 of yacc.c. */
Bill Wendling1ba18d32008-12-17 20:59:57 +00007084#line 7085 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00007085 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00007086 }
Dan Gohman54392c12008-04-19 00:24:39 +00007087 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7088
7089 YYPOPSTACK (yylen);
7090 yylen = 0;
7091 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007092
7093 *++yyvsp = yyval;
7094
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007095
Dan Gohman54392c12008-04-19 00:24:39 +00007096 /* Now `shift' the result of the reduction. Determine what state
7097 that goes to, based on the state we popped back to and the rule
7098 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007099
7100 yyn = yyr1[yyn];
7101
Dan Gohman54392c12008-04-19 00:24:39 +00007102 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7103 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007104 yystate = yytable[yystate];
7105 else
Dan Gohman54392c12008-04-19 00:24:39 +00007106 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007107
7108 goto yynewstate;
7109
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007110
Dan Gohman54392c12008-04-19 00:24:39 +00007111/*------------------------------------.
7112| yyerrlab -- here on detecting error |
7113`------------------------------------*/
7114yyerrlab:
7115 /* If not already recovering from an error, report this error. */
7116 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007117 {
7118 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00007119#if ! YYERROR_VERBOSE
7120 yyerror (YY_("syntax error"));
7121#else
7122 {
7123 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7124 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7125 {
7126 YYSIZE_T yyalloc = 2 * yysize;
7127 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7128 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7129 if (yymsg != yymsgbuf)
7130 YYSTACK_FREE (yymsg);
7131 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7132 if (yymsg)
7133 yymsg_alloc = yyalloc;
7134 else
7135 {
7136 yymsg = yymsgbuf;
7137 yymsg_alloc = sizeof yymsgbuf;
7138 }
7139 }
Dale Johannesen3afee192007-09-07 21:07:57 +00007140
Dan Gohman54392c12008-04-19 00:24:39 +00007141 if (0 < yysize && yysize <= yymsg_alloc)
7142 {
7143 (void) yysyntax_error (yymsg, yystate, yychar);
7144 yyerror (yymsg);
7145 }
7146 else
7147 {
7148 yyerror (YY_("syntax error"));
7149 if (yysize != 0)
7150 goto yyexhaustedlab;
7151 }
7152 }
7153#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007154 }
7155
Dan Gohman54392c12008-04-19 00:24:39 +00007156
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007157
7158 if (yyerrstatus == 3)
7159 {
Dan Gohman54392c12008-04-19 00:24:39 +00007160 /* If just tried and failed to reuse look-ahead token after an
7161 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007162
Dan Gohman54392c12008-04-19 00:24:39 +00007163 if (yychar <= YYEOF)
7164 {
7165 /* Return failure if at end of input. */
7166 if (yychar == YYEOF)
7167 YYABORT;
7168 }
7169 else
7170 {
7171 yydestruct ("Error: discarding",
7172 yytoken, &yylval);
7173 yychar = YYEMPTY;
7174 }
7175 }
7176
7177 /* Else will try to reuse look-ahead token after shifting the error
7178 token. */
7179 goto yyerrlab1;
7180
7181
7182/*---------------------------------------------------.
7183| yyerrorlab -- error raised explicitly by YYERROR. |
7184`---------------------------------------------------*/
7185yyerrorlab:
7186
7187 /* Pacify compilers like GCC when the user code never invokes
7188 YYERROR and the label yyerrorlab therefore never appears in user
7189 code. */
7190 if (/*CONSTCOND*/ 0)
7191 goto yyerrorlab;
7192
7193 /* Do not reclaim the symbols of the rule which action triggered
7194 this YYERROR. */
7195 YYPOPSTACK (yylen);
7196 yylen = 0;
7197 YY_STACK_PRINT (yyss, yyssp);
7198 yystate = *yyssp;
7199 goto yyerrlab1;
7200
7201
7202/*-------------------------------------------------------------.
7203| yyerrlab1 -- common code for both syntax error and YYERROR. |
7204`-------------------------------------------------------------*/
7205yyerrlab1:
7206 yyerrstatus = 3; /* Each real token shifted decrements this. */
7207
7208 for (;;)
7209 {
7210 yyn = yypact[yystate];
7211 if (yyn != YYPACT_NINF)
7212 {
7213 yyn += YYTERROR;
7214 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7215 {
7216 yyn = yytable[yyn];
7217 if (0 < yyn)
7218 break;
7219 }
7220 }
7221
7222 /* Pop the current state because it cannot handle the error token. */
7223 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007224 YYABORT;
7225
Dale Johannesen3afee192007-09-07 21:07:57 +00007226
Dan Gohman54392c12008-04-19 00:24:39 +00007227 yydestruct ("Error: popping",
7228 yystos[yystate], yyvsp);
7229 YYPOPSTACK (1);
7230 yystate = *yyssp;
7231 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007232 }
7233
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007234 if (yyn == YYFINAL)
7235 YYACCEPT;
7236
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007237 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00007238
7239
7240 /* Shift the error token. */
7241 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00007242
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007243 yystate = yyn;
7244 goto yynewstate;
7245
Gabor Greif89f01162008-04-06 23:07:54 +00007246
Dan Gohman54392c12008-04-19 00:24:39 +00007247/*-------------------------------------.
7248| yyacceptlab -- YYACCEPT comes here. |
7249`-------------------------------------*/
7250yyacceptlab:
7251 yyresult = 0;
7252 goto yyreturn;
7253
7254/*-----------------------------------.
7255| yyabortlab -- YYABORT comes here. |
7256`-----------------------------------*/
7257yyabortlab:
7258 yyresult = 1;
7259 goto yyreturn;
7260
7261#ifndef yyoverflow
7262/*-------------------------------------------------.
7263| yyexhaustedlab -- memory exhaustion comes here. |
7264`-------------------------------------------------*/
7265yyexhaustedlab:
7266 yyerror (YY_("memory exhausted"));
7267 yyresult = 2;
7268 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00007269#endif
Dan Gohman54392c12008-04-19 00:24:39 +00007270
7271yyreturn:
7272 if (yychar != YYEOF && yychar != YYEMPTY)
7273 yydestruct ("Cleanup: discarding lookahead",
7274 yytoken, &yylval);
7275 /* Do not reclaim the symbols of the rule which action triggered
7276 this YYABORT or YYACCEPT. */
7277 YYPOPSTACK (yylen);
7278 YY_STACK_PRINT (yyss, yyssp);
7279 while (yyssp != yyss)
7280 {
7281 yydestruct ("Cleanup: popping",
7282 yystos[*yyssp], yyvsp);
7283 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00007284 }
Dan Gohman54392c12008-04-19 00:24:39 +00007285#ifndef yyoverflow
7286 if (yyss != yyssa)
7287 YYSTACK_FREE (yyss);
7288#endif
7289#if YYERROR_VERBOSE
7290 if (yymsg != yymsgbuf)
7291 YYSTACK_FREE (yymsg);
7292#endif
7293 /* Make sure YYID is used. */
7294 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007295}
Dan Gohman54392c12008-04-19 00:24:39 +00007296
7297
Bill Wendling1ba18d32008-12-17 20:59:57 +00007298#line 3556 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007299
7300
7301// common code from the two 'RunVMAsmParser' functions
7302static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007303 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007304 // Check to make sure the parser succeeded
7305 if (yyparse()) {
7306 if (ParserResult)
7307 delete ParserResult;
7308 return 0;
7309 }
7310
7311 // Emit an error if there are any unresolved types left.
7312 if (!CurModule.LateResolveTypes.empty()) {
7313 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7314 if (DID.Type == ValID::LocalName) {
7315 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7316 } else {
7317 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7318 }
7319 if (ParserResult)
7320 delete ParserResult;
7321 return 0;
7322 }
7323
7324 // Emit an error if there are any unresolved values left.
7325 if (!CurModule.LateResolveValues.empty()) {
7326 Value *V = CurModule.LateResolveValues.back();
7327 std::map<Value*, std::pair<ValID, int> >::iterator I =
7328 CurModule.PlaceHolderInfo.find(V);
7329
7330 if (I != CurModule.PlaceHolderInfo.end()) {
7331 ValID &DID = I->second.first;
7332 if (DID.Type == ValID::LocalName) {
7333 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7334 } else {
7335 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7336 }
7337 if (ParserResult)
7338 delete ParserResult;
7339 return 0;
7340 }
7341 }
7342
7343 // Check to make sure that parsing produced a result
7344 if (!ParserResult)
7345 return 0;
7346
7347 // Reset ParserResult variable while saving its value for the result.
7348 Module *Result = ParserResult;
7349 ParserResult = 0;
7350
7351 return Result;
7352}
7353
7354void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007355 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007356 // TODO: column number in exception
7357 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007358 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007359 TriggerError = 1;
7360}
7361
7362int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007363 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007364 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007365 if (yychar != YYEMPTY && yychar != 0) {
7366 errMsg += " while reading token: '";
Eric Christopher329d2672008-09-24 04:55:49 +00007367 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007368 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7369 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007370 GenerateError(errMsg);
7371 return 0;
7372}
Dan Gohman54392c12008-04-19 00:24:39 +00007373