blob: 4689c5be44250d67c5bd7ff7be6a0324b3d59624 [file] [log] [blame]
Dan Gohman54392c12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Dan Gohman54392c12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Dan Gohman54392c12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007
Dan Gohman54392c12008-04-19 00:24:39 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062#define yyparse llvmAsmparse
Dan Gohman54392c12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +000064#define yyerror llvmAsmerror
Dan Gohman54392c12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Dan Gohmanf17a25c2007-07-18 16:29:46 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069
Dan Gohman54392c12008-04-19 00:24:39 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
Dale Johannesenf4581482008-09-26 19:32:34 +0000142 DATALAYOUT = 323,
143 RET = 324,
144 BR = 325,
145 SWITCH = 326,
146 INVOKE = 327,
147 UNWIND = 328,
148 UNREACHABLE = 329,
149 ADD = 330,
150 SUB = 331,
151 MUL = 332,
152 UDIV = 333,
153 SDIV = 334,
154 FDIV = 335,
155 UREM = 336,
156 SREM = 337,
157 FREM = 338,
158 AND = 339,
159 OR = 340,
160 XOR = 341,
161 SHL = 342,
162 LSHR = 343,
163 ASHR = 344,
164 ICMP = 345,
165 FCMP = 346,
166 VICMP = 347,
167 VFCMP = 348,
168 EQ = 349,
169 NE = 350,
170 SLT = 351,
171 SGT = 352,
172 SLE = 353,
173 SGE = 354,
174 ULT = 355,
175 UGT = 356,
176 ULE = 357,
177 UGE = 358,
178 OEQ = 359,
179 ONE = 360,
180 OLT = 361,
181 OGT = 362,
182 OLE = 363,
183 OGE = 364,
184 ORD = 365,
185 UNO = 366,
186 UEQ = 367,
187 UNE = 368,
188 MALLOC = 369,
189 ALLOCA = 370,
190 FREE = 371,
191 LOAD = 372,
192 STORE = 373,
193 GETELEMENTPTR = 374,
194 TRUNC = 375,
195 ZEXT = 376,
196 SEXT = 377,
197 FPTRUNC = 378,
198 FPEXT = 379,
199 BITCAST = 380,
200 UITOFP = 381,
201 SITOFP = 382,
202 FPTOUI = 383,
203 FPTOSI = 384,
204 INTTOPTR = 385,
205 PTRTOINT = 386,
206 PHI_TOK = 387,
207 SELECT = 388,
208 VAARG = 389,
209 EXTRACTELEMENT = 390,
210 INSERTELEMENT = 391,
211 SHUFFLEVECTOR = 392,
212 GETRESULT = 393,
213 EXTRACTVALUE = 394,
214 INSERTVALUE = 395,
215 SIGNEXT = 396,
216 ZEROEXT = 397,
217 NORETURN = 398,
218 INREG = 399,
219 SRET = 400,
220 NOUNWIND = 401,
221 NOALIAS = 402,
222 BYVAL = 403,
223 NEST = 404,
224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
Devang Patelcd842482008-09-29 20:49:50 +0000227 OPTSIZE = 408,
228 NOINLINE = 409,
229 ALWAYSINLINE = 410,
230 DEFAULT = 411,
231 HIDDEN = 412,
232 PROTECTED = 413
Dan Gohman54392c12008-04-19 00:24:39 +0000233 };
234#endif
235/* Tokens. */
236#define ESINT64VAL 258
237#define EUINT64VAL 259
238#define ESAPINTVAL 260
239#define EUAPINTVAL 261
240#define LOCALVAL_ID 262
241#define GLOBALVAL_ID 263
242#define FPVAL 264
243#define VOID 265
244#define INTTYPE 266
245#define FLOAT 267
246#define DOUBLE 268
247#define X86_FP80 269
248#define FP128 270
249#define PPC_FP128 271
250#define LABEL 272
251#define TYPE 273
252#define LOCALVAR 274
253#define GLOBALVAR 275
254#define LABELSTR 276
255#define STRINGCONSTANT 277
256#define ATSTRINGCONSTANT 278
257#define PCTSTRINGCONSTANT 279
258#define ZEROINITIALIZER 280
259#define TRUETOK 281
260#define FALSETOK 282
261#define BEGINTOK 283
262#define ENDTOK 284
263#define DECLARE 285
264#define DEFINE 286
265#define GLOBAL 287
266#define CONSTANT 288
267#define SECTION 289
268#define ALIAS 290
269#define VOLATILE 291
270#define THREAD_LOCAL 292
271#define TO 293
272#define DOTDOTDOT 294
273#define NULL_TOK 295
274#define UNDEF 296
275#define INTERNAL 297
276#define LINKONCE 298
277#define WEAK 299
278#define APPENDING 300
279#define DLLIMPORT 301
280#define DLLEXPORT 302
281#define EXTERN_WEAK 303
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000282#define COMMON 304
283#define OPAQUE 305
284#define EXTERNAL 306
285#define TARGET 307
286#define TRIPLE 308
287#define ALIGN 309
288#define ADDRSPACE 310
289#define DEPLIBS 311
290#define CALL 312
291#define TAIL 313
292#define ASM_TOK 314
293#define MODULE 315
294#define SIDEEFFECT 316
295#define CC_TOK 317
296#define CCC_TOK 318
297#define FASTCC_TOK 319
298#define COLDCC_TOK 320
299#define X86_STDCALLCC_TOK 321
300#define X86_FASTCALLCC_TOK 322
Dale Johannesenf4581482008-09-26 19:32:34 +0000301#define DATALAYOUT 323
302#define RET 324
303#define BR 325
304#define SWITCH 326
305#define INVOKE 327
306#define UNWIND 328
307#define UNREACHABLE 329
308#define ADD 330
309#define SUB 331
310#define MUL 332
311#define UDIV 333
312#define SDIV 334
313#define FDIV 335
314#define UREM 336
315#define SREM 337
316#define FREM 338
317#define AND 339
318#define OR 340
319#define XOR 341
320#define SHL 342
321#define LSHR 343
322#define ASHR 344
323#define ICMP 345
324#define FCMP 346
325#define VICMP 347
326#define VFCMP 348
327#define EQ 349
328#define NE 350
329#define SLT 351
330#define SGT 352
331#define SLE 353
332#define SGE 354
333#define ULT 355
334#define UGT 356
335#define ULE 357
336#define UGE 358
337#define OEQ 359
338#define ONE 360
339#define OLT 361
340#define OGT 362
341#define OLE 363
342#define OGE 364
343#define ORD 365
344#define UNO 366
345#define UEQ 367
346#define UNE 368
347#define MALLOC 369
348#define ALLOCA 370
349#define FREE 371
350#define LOAD 372
351#define STORE 373
352#define GETELEMENTPTR 374
353#define TRUNC 375
354#define ZEXT 376
355#define SEXT 377
356#define FPTRUNC 378
357#define FPEXT 379
358#define BITCAST 380
359#define UITOFP 381
360#define SITOFP 382
361#define FPTOUI 383
362#define FPTOSI 384
363#define INTTOPTR 385
364#define PTRTOINT 386
365#define PHI_TOK 387
366#define SELECT 388
367#define VAARG 389
368#define EXTRACTELEMENT 390
369#define INSERTELEMENT 391
370#define SHUFFLEVECTOR 392
371#define GETRESULT 393
372#define EXTRACTVALUE 394
373#define INSERTVALUE 395
374#define SIGNEXT 396
375#define ZEROEXT 397
376#define NORETURN 398
377#define INREG 399
378#define SRET 400
379#define NOUNWIND 401
380#define NOALIAS 402
381#define BYVAL 403
382#define NEST 404
383#define READNONE 405
384#define READONLY 406
385#define GC 407
Devang Patelcd842482008-09-29 20:49:50 +0000386#define OPTSIZE 408
387#define NOINLINE 409
388#define ALWAYSINLINE 410
389#define DEFAULT 411
390#define HIDDEN 412
391#define PROTECTED 413
Dan Gohman54392c12008-04-19 00:24:39 +0000392
393
394
395
396/* Copy the first part of user declarations. */
Nuno Lopes37e4b7a2008-10-15 11:11:12 +0000397#line 14 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000398
399#include "ParserInternals.h"
400#include "llvm/CallingConv.h"
401#include "llvm/InlineAsm.h"
402#include "llvm/Instructions.h"
403#include "llvm/Module.h"
404#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000405#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000406#include "llvm/Support/GetElementPtrTypeIterator.h"
407#include "llvm/Support/CommandLine.h"
408#include "llvm/ADT/SmallVector.h"
409#include "llvm/ADT/STLExtras.h"
410#include "llvm/Support/MathExtras.h"
411#include "llvm/Support/Streams.h"
412#include <algorithm>
413#include <list>
414#include <map>
415#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000416
417// The following is a gross hack. In order to rid the libAsmParser library of
418// exceptions, we have to have a way of getting the yyparse function to go into
419// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher329d2672008-09-24 04:55:49 +0000420// function (see bottom of file) sets TriggerError. Then, at the end of each
421// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
422// (a goto) to put YACC in error state. Furthermore, several calls to
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000423// GenerateError are made from inside productions and they must simulate the
424// previous exception behavior by exiting the production immediately. We have
425// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher329d2672008-09-24 04:55:49 +0000426// immediately invokes YYERROR. This would be so much cleaner if it was a
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000427// recursive descent parser.
428static bool TriggerError = false;
429#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
430#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
431
432int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
433int yylex(); // declaration" of xxx warnings.
434int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000435using namespace llvm;
436
437static Module *ParserResult;
438
439// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
440// relating to upreferences in the input stream.
441//
442//#define DEBUG_UPREFS 1
443#ifdef DEBUG_UPREFS
444#define UR_OUT(X) cerr << X
445#else
446#define UR_OUT(X)
447#endif
448
449#define YYERROR_VERBOSE 1
450
451static GlobalVariable *CurGV;
452
453
454// This contains info used when building the body of a function. It is
455// destroyed when the function is completed.
456//
457typedef std::vector<Value *> ValueList; // Numbered defs
458
Eric Christopher329d2672008-09-24 04:55:49 +0000459static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000460ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
461
462static struct PerModuleInfo {
463 Module *CurrentModule;
464 ValueList Values; // Module level numbered definitions
465 ValueList LateResolveValues;
466 std::vector<PATypeHolder> Types;
467 std::map<ValID, PATypeHolder> LateResolveTypes;
468
469 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
470 /// how they were referenced and on which line of the input they came from so
471 /// that we can resolve them later and print error messages as appropriate.
472 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
473
474 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
475 // references to global values. Global values may be referenced before they
476 // are defined, and if so, the temporary object that they represent is held
477 // here. This is used for forward references of GlobalValues.
478 //
479 typedef std::map<std::pair<const PointerType *,
480 ValID>, GlobalValue*> GlobalRefsType;
481 GlobalRefsType GlobalRefs;
482
483 void ModuleDone() {
484 // If we could not resolve some functions at function compilation time
485 // (calls to functions before they are defined), resolve them now... Types
486 // are resolved when the constant pool has been completely parsed.
487 //
488 ResolveDefinitions(LateResolveValues);
489 if (TriggerError)
490 return;
491
492 // Check to make sure that all global value forward references have been
493 // resolved!
494 //
495 if (!GlobalRefs.empty()) {
496 std::string UndefinedReferences = "Unresolved global references exist:\n";
497
498 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
499 I != E; ++I) {
500 UndefinedReferences += " " + I->first.first->getDescription() + " " +
501 I->first.second.getName() + "\n";
502 }
503 GenerateError(UndefinedReferences);
504 return;
505 }
506
Chandler Carruth563d4a42007-08-04 01:56:21 +0000507 // Look for intrinsic functions and CallInst that need to be upgraded
508 for (Module::iterator FI = CurrentModule->begin(),
509 FE = CurrentModule->end(); FI != FE; )
510 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
511
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000512 Values.clear(); // Clear out function local definitions
513 Types.clear();
514 CurrentModule = 0;
515 }
516
517 // GetForwardRefForGlobal - Check to see if there is a forward reference
518 // for this global. If so, remove it from the GlobalRefs map and return it.
519 // If not, just return null.
520 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
521 // Check to see if there is a forward reference to this global variable...
522 // if there is, eliminate it and patch the reference to use the new def'n.
523 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
524 GlobalValue *Ret = 0;
525 if (I != GlobalRefs.end()) {
526 Ret = I->second;
Nuno Lopes363e49d2008-10-15 12:05:02 +0000527 I->first.second.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000528 GlobalRefs.erase(I);
529 }
530 return Ret;
531 }
532
533 bool TypeIsUnresolved(PATypeHolder* PATy) {
534 // If it isn't abstract, its resolved
535 const Type* Ty = PATy->get();
536 if (!Ty->isAbstract())
537 return false;
538 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher329d2672008-09-24 04:55:49 +0000539 // we don't need to traverse that leg of the type.
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000540 std::vector<const Type*> WorkList, SeenList;
541 WorkList.push_back(Ty);
542 while (!WorkList.empty()) {
543 const Type* Ty = WorkList.back();
544 SeenList.push_back(Ty);
545 WorkList.pop_back();
546 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
547 // Check to see if this is an unresolved type
548 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
549 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
550 for ( ; I != E; ++I) {
551 if (I->second.get() == OpTy)
552 return true;
553 }
554 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
555 const Type* TheTy = SeqTy->getElementType();
556 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher329d2672008-09-24 04:55:49 +0000557 std::vector<const Type*>::iterator I = SeenList.begin(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000558 E = SeenList.end();
559 for ( ; I != E; ++I)
560 if (*I == TheTy)
561 break;
562 if (I == E)
563 WorkList.push_back(TheTy);
564 }
565 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
566 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
567 const Type* TheTy = StrTy->getElementType(i);
568 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher329d2672008-09-24 04:55:49 +0000569 std::vector<const Type*>::iterator I = SeenList.begin(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000570 E = SeenList.end();
571 for ( ; I != E; ++I)
572 if (*I == TheTy)
573 break;
574 if (I == E)
575 WorkList.push_back(TheTy);
576 }
577 }
578 }
579 }
580 return false;
581 }
582} CurModule;
583
584static struct PerFunctionInfo {
585 Function *CurrentFunction; // Pointer to current function being created
586
587 ValueList Values; // Keep track of #'d definitions
588 unsigned NextValNum;
589 ValueList LateResolveValues;
590 bool isDeclare; // Is this function a forward declararation?
591 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
592 GlobalValue::VisibilityTypes Visibility;
593
594 /// BBForwardRefs - When we see forward references to basic blocks, keep
595 /// track of them here.
596 std::map<ValID, BasicBlock*> BBForwardRefs;
597
598 inline PerFunctionInfo() {
599 CurrentFunction = 0;
600 isDeclare = false;
601 Linkage = GlobalValue::ExternalLinkage;
602 Visibility = GlobalValue::DefaultVisibility;
603 }
604
605 inline void FunctionStart(Function *M) {
606 CurrentFunction = M;
607 NextValNum = 0;
608 }
609
610 void FunctionDone() {
611 // Any forward referenced blocks left?
612 if (!BBForwardRefs.empty()) {
613 GenerateError("Undefined reference to label " +
614 BBForwardRefs.begin()->second->getName());
615 return;
616 }
617
618 // Resolve all forward references now.
619 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
620
621 Values.clear(); // Clear out function local definitions
622 BBForwardRefs.clear();
623 CurrentFunction = 0;
624 isDeclare = false;
625 Linkage = GlobalValue::ExternalLinkage;
626 Visibility = GlobalValue::DefaultVisibility;
627 }
628} CurFun; // Info for the current function...
629
630static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
631
632
633//===----------------------------------------------------------------------===//
634// Code to handle definitions of all the types
635//===----------------------------------------------------------------------===//
636
Chris Lattner906773a2008-08-29 17:20:18 +0000637/// InsertValue - Insert a value into the value table. If it is named, this
638/// returns -1, otherwise it returns the slot number for the value.
639static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000640 // Things that have names or are void typed don't get slot numbers
641 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner906773a2008-08-29 17:20:18 +0000642 return -1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000643
644 // In the case of function values, we have to allow for the forward reference
645 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher329d2672008-09-24 04:55:49 +0000646 // track of the next insertion location with NextValNum. When a BB gets
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000647 // inserted, it could change the size of the CurFun.Values vector.
648 if (&ValueTab == &CurFun.Values) {
649 if (ValueTab.size() <= CurFun.NextValNum)
650 ValueTab.resize(CurFun.NextValNum+1);
651 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner906773a2008-08-29 17:20:18 +0000652 return CurFun.NextValNum-1;
Eric Christopher329d2672008-09-24 04:55:49 +0000653 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000654 // For all other lists, its okay to just tack it on the back of the vector.
655 ValueTab.push_back(V);
Chris Lattner906773a2008-08-29 17:20:18 +0000656 return ValueTab.size()-1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000657}
658
659static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
660 switch (D.Type) {
661 case ValID::LocalID: // Is it a numbered definition?
662 // Module constants occupy the lowest numbered slots...
663 if (D.Num < CurModule.Types.size())
664 return CurModule.Types[D.Num];
665 break;
666 case ValID::LocalName: // Is it a named definition?
667 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
668 D.destroy(); // Free old strdup'd memory...
669 return N;
670 }
671 break;
672 default:
673 GenerateError("Internal parser error: Invalid symbol type reference");
674 return 0;
675 }
676
677 // If we reached here, we referenced either a symbol that we don't know about
678 // or an id number that hasn't been read yet. We may be referencing something
679 // forward, so just create an entry to be resolved later and get to it...
680 //
681 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
682
683
684 if (inFunctionScope()) {
685 if (D.Type == ValID::LocalName) {
686 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
687 return 0;
688 } else {
689 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
690 return 0;
691 }
692 }
693
694 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Nuno Lopesb6f72c82008-10-15 11:20:21 +0000695 if (I != CurModule.LateResolveTypes.end()) {
696 D.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000697 return I->second;
Nuno Lopesb6f72c82008-10-15 11:20:21 +0000698 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000699
700 Type *Typ = OpaqueType::get();
701 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
702 return Typ;
703 }
704
705// getExistingVal - Look up the value specified by the provided type and
706// the provided ValID. If the value exists and has already been defined, return
707// it. Otherwise return null.
708//
709static Value *getExistingVal(const Type *Ty, const ValID &D) {
710 if (isa<FunctionType>(Ty)) {
711 GenerateError("Functions are not values and "
712 "must be referenced as pointers");
713 return 0;
714 }
715
716 switch (D.Type) {
717 case ValID::LocalID: { // Is it a numbered definition?
718 // Check that the number is within bounds.
Eric Christopher329d2672008-09-24 04:55:49 +0000719 if (D.Num >= CurFun.Values.size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000720 return 0;
721 Value *Result = CurFun.Values[D.Num];
722 if (Ty != Result->getType()) {
723 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher329d2672008-09-24 04:55:49 +0000724 Result->getType()->getDescription() + "' does not match "
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000725 "expected type, '" + Ty->getDescription() + "'");
726 return 0;
727 }
728 return Result;
729 }
730 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher329d2672008-09-24 04:55:49 +0000731 if (D.Num >= CurModule.Values.size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000732 return 0;
733 Value *Result = CurModule.Values[D.Num];
734 if (Ty != Result->getType()) {
735 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher329d2672008-09-24 04:55:49 +0000736 Result->getType()->getDescription() + "' does not match "
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000737 "expected type, '" + Ty->getDescription() + "'");
738 return 0;
739 }
740 return Result;
741 }
Eric Christopher329d2672008-09-24 04:55:49 +0000742
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000743 case ValID::LocalName: { // Is it a named definition?
Eric Christopher329d2672008-09-24 04:55:49 +0000744 if (!inFunctionScope())
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000745 return 0;
746 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
747 Value *N = SymTab.lookup(D.getName());
Eric Christopher329d2672008-09-24 04:55:49 +0000748 if (N == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000749 return 0;
750 if (N->getType() != Ty)
751 return 0;
Eric Christopher329d2672008-09-24 04:55:49 +0000752
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000753 D.destroy(); // Free old strdup'd memory...
754 return N;
755 }
756 case ValID::GlobalName: { // Is it a named definition?
757 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
758 Value *N = SymTab.lookup(D.getName());
Eric Christopher329d2672008-09-24 04:55:49 +0000759 if (N == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000760 return 0;
761 if (N->getType() != Ty)
762 return 0;
763
764 D.destroy(); // Free old strdup'd memory...
765 return N;
766 }
767
768 // Check to make sure that "Ty" is an integral type, and that our
769 // value will fit into the specified type...
770 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000771 if (!isa<IntegerType>(Ty) ||
772 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000773 GenerateError("Signed integral constant '" +
774 itostr(D.ConstPool64) + "' is invalid for type '" +
775 Ty->getDescription() + "'");
776 return 0;
777 }
778 return ConstantInt::get(Ty, D.ConstPool64, true);
779
780 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000781 if (isa<IntegerType>(Ty) &&
782 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000783 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000784
785 if (!isa<IntegerType>(Ty) ||
786 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
787 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
788 "' is invalid or out of range for type '" +
789 Ty->getDescription() + "'");
790 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000791 }
Chris Lattner59363a32008-02-19 04:36:25 +0000792 // This is really a signed reference. Transmogrify.
793 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000794
Chris Lattnerf3d40022008-07-11 00:30:39 +0000795 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
796 if (!isa<IntegerType>(Ty)) {
797 GenerateError("Integral constant '" + D.getName() +
798 "' is invalid or out of range for type '" +
799 Ty->getDescription() + "'");
800 return 0;
801 }
Eric Christopher329d2672008-09-24 04:55:49 +0000802
Chris Lattnerf3d40022008-07-11 00:30:39 +0000803 {
804 APSInt Tmp = *D.ConstPoolInt;
Nuno Lopesafed5ce2008-11-04 14:28:33 +0000805 D.destroy();
Chris Lattnerf3d40022008-07-11 00:30:39 +0000806 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
807 return ConstantInt::get(Tmp);
808 }
Eric Christopher329d2672008-09-24 04:55:49 +0000809
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000810 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000811 if (!Ty->isFloatingPoint() ||
812 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000813 GenerateError("FP constant invalid for type");
814 return 0;
815 }
Eric Christopher329d2672008-09-24 04:55:49 +0000816 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000817 // as double. Fix this here. Long double does not need this.
818 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
Dale Johannesen5ba85fd2008-10-09 23:01:34 +0000819 Ty==Type::FloatTy) {
820 bool ignored;
821 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
822 &ignored);
823 }
Nuno Lopes97cf0032008-11-04 14:43:20 +0000824 {
825 ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP);
826 D.destroy();
827 return tmp;
828 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000829
830 case ValID::ConstNullVal: // Is it a null value?
831 if (!isa<PointerType>(Ty)) {
832 GenerateError("Cannot create a a non pointer null");
833 return 0;
834 }
835 return ConstantPointerNull::get(cast<PointerType>(Ty));
836
837 case ValID::ConstUndefVal: // Is it an undef value?
838 return UndefValue::get(Ty);
839
840 case ValID::ConstZeroVal: // Is it a zero value?
841 return Constant::getNullValue(Ty);
Eric Christopher329d2672008-09-24 04:55:49 +0000842
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000843 case ValID::ConstantVal: // Fully resolved constant?
844 if (D.ConstantValue->getType() != Ty) {
845 GenerateError("Constant expression type different from required type");
846 return 0;
847 }
848 return D.ConstantValue;
849
850 case ValID::InlineAsmVal: { // Inline asm expression
851 const PointerType *PTy = dyn_cast<PointerType>(Ty);
852 const FunctionType *FTy =
853 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
854 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
855 GenerateError("Invalid type for asm constraint string");
856 return 0;
857 }
858 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
859 D.IAD->HasSideEffects);
860 D.destroy(); // Free InlineAsmDescriptor.
861 return IA;
862 }
863 default:
864 assert(0 && "Unhandled case!");
865 return 0;
866 } // End of switch
867
868 assert(0 && "Unhandled case!");
869 return 0;
870}
871
872// getVal - This function is identical to getExistingVal, except that if a
873// value is not already defined, it "improvises" by creating a placeholder var
874// that looks and acts just like the requested variable. When the value is
875// defined later, all uses of the placeholder variable are replaced with the
876// real thing.
877//
878static Value *getVal(const Type *Ty, const ValID &ID) {
879 if (Ty == Type::LabelTy) {
880 GenerateError("Cannot use a basic block here");
881 return 0;
882 }
883
884 // See if the value has already been defined.
885 Value *V = getExistingVal(Ty, ID);
886 if (V) return V;
887 if (TriggerError) return 0;
888
889 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000890 GenerateError("Invalid use of a non-first-class type");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000891 return 0;
892 }
893
894 // If we reached here, we referenced either a symbol that we don't know about
895 // or an id number that hasn't been read yet. We may be referencing something
896 // forward, so just create an entry to be resolved later and get to it...
897 //
898 switch (ID.Type) {
899 case ValID::GlobalName:
900 case ValID::GlobalID: {
901 const PointerType *PTy = dyn_cast<PointerType>(Ty);
902 if (!PTy) {
903 GenerateError("Invalid type for reference to global" );
904 return 0;
905 }
906 const Type* ElTy = PTy->getElementType();
907 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000908 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000909 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000910 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
911 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000912 break;
913 }
914 default:
915 V = new Argument(Ty);
916 }
Eric Christopher329d2672008-09-24 04:55:49 +0000917
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000918 // Remember where this forward reference came from. FIXME, shouldn't we try
919 // to recycle these things??
920 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000921 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000922
923 if (inFunctionScope())
924 InsertValue(V, CurFun.LateResolveValues);
925 else
926 InsertValue(V, CurModule.LateResolveValues);
927 return V;
928}
929
930/// defineBBVal - This is a definition of a new basic block with the specified
931/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000932static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000933 assert(inFunctionScope() && "Can't get basic block at global scope!");
934
935 BasicBlock *BB = 0;
936
937 // First, see if this was forward referenced
938
939 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
940 if (BBI != CurFun.BBForwardRefs.end()) {
941 BB = BBI->second;
942 // The forward declaration could have been inserted anywhere in the
943 // function: insert it into the correct place now.
944 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
945 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
946
947 // We're about to erase the entry, save the key so we can clean it up.
948 ValID Tmp = BBI->first;
949
950 // Erase the forward ref from the map as its no longer "forward"
951 CurFun.BBForwardRefs.erase(ID);
952
Eric Christopher329d2672008-09-24 04:55:49 +0000953 // The key has been removed from the map but so we don't want to leave
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000954 // strdup'd memory around so destroy it too.
955 Tmp.destroy();
956
957 // If its a numbered definition, bump the number and set the BB value.
958 if (ID.Type == ValID::LocalID) {
959 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
960 InsertValue(BB);
961 }
Eric Christopher329d2672008-09-24 04:55:49 +0000962 } else {
963 // We haven't seen this BB before and its first mention is a definition.
Devang Patel890cc572008-03-03 18:58:47 +0000964 // Just create it and return it.
965 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000966 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000967 if (ID.Type == ValID::LocalID) {
968 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
969 InsertValue(BB);
970 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000971 }
972
Devang Patel890cc572008-03-03 18:58:47 +0000973 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000974 return BB;
975}
976
977/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher329d2672008-09-24 04:55:49 +0000978///
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000979static BasicBlock *getBBVal(const ValID &ID) {
980 assert(inFunctionScope() && "Can't get basic block at global scope!");
981
982 BasicBlock *BB = 0;
983
984 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
985 if (BBI != CurFun.BBForwardRefs.end()) {
986 BB = BBI->second;
987 } if (ID.Type == ValID::LocalName) {
988 std::string Name = ID.getName();
989 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000990 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000991 if (N->getType()->getTypeID() == Type::LabelTyID)
992 BB = cast<BasicBlock>(N);
993 else
994 GenerateError("Reference to label '" + Name + "' is actually of type '"+
995 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000996 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000997 } else if (ID.Type == ValID::LocalID) {
998 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
999 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
1000 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
1001 else
Eric Christopher329d2672008-09-24 04:55:49 +00001002 GenerateError("Reference to label '%" + utostr(ID.Num) +
1003 "' is actually of type '"+
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001004 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1005 }
1006 } else {
1007 GenerateError("Illegal label reference " + ID.getName());
1008 return 0;
1009 }
1010
1011 // If its already been defined, return it now.
1012 if (BB) {
1013 ID.destroy(); // Free strdup'd memory.
1014 return BB;
1015 }
1016
1017 // Otherwise, this block has not been seen before, create it.
1018 std::string Name;
1019 if (ID.Type == ValID::LocalName)
1020 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +00001021 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001022
1023 // Insert it in the forward refs map.
1024 CurFun.BBForwardRefs[ID] = BB;
1025
1026 return BB;
1027}
1028
1029
1030//===----------------------------------------------------------------------===//
1031// Code to handle forward references in instructions
1032//===----------------------------------------------------------------------===//
1033//
1034// This code handles the late binding needed with statements that reference
1035// values not defined yet... for example, a forward branch, or the PHI node for
1036// a loop body.
1037//
1038// This keeps a table (CurFun.LateResolveValues) of all such forward references
1039// and back patchs after we are done.
1040//
1041
1042// ResolveDefinitions - If we could not resolve some defs at parsing
1043// time (forward branches, phi functions for loops, etc...) resolve the
1044// defs now...
1045//
Eric Christopher329d2672008-09-24 04:55:49 +00001046static void
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001047ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1048 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1049 while (!LateResolvers.empty()) {
1050 Value *V = LateResolvers.back();
1051 LateResolvers.pop_back();
1052
1053 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1054 CurModule.PlaceHolderInfo.find(V);
1055 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1056
1057 ValID &DID = PHI->second.first;
1058
1059 Value *TheRealValue = getExistingVal(V->getType(), DID);
1060 if (TriggerError)
1061 return;
1062 if (TheRealValue) {
1063 V->replaceAllUsesWith(TheRealValue);
1064 delete V;
1065 CurModule.PlaceHolderInfo.erase(PHI);
1066 } else if (FutureLateResolvers) {
1067 // Functions have their unresolved items forwarded to the module late
1068 // resolver table
1069 InsertValue(V, *FutureLateResolvers);
1070 } else {
1071 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1072 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1073 "' of type '" + V->getType()->getDescription() + "'",
1074 PHI->second.second);
1075 return;
1076 } else {
1077 GenerateError("Reference to an invalid definition: #" +
1078 itostr(DID.Num) + " of type '" +
1079 V->getType()->getDescription() + "'",
1080 PHI->second.second);
1081 return;
1082 }
1083 }
1084 }
1085 LateResolvers.clear();
1086}
1087
1088// ResolveTypeTo - A brand new type was just declared. This means that (if
1089// name is not null) things referencing Name can be resolved. Otherwise, things
1090// refering to the number can be resolved. Do this now.
1091//
1092static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1093 ValID D;
1094 if (Name)
1095 D = ValID::createLocalName(*Name);
Eric Christopher329d2672008-09-24 04:55:49 +00001096 else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001097 D = ValID::createLocalID(CurModule.Types.size());
1098
1099 std::map<ValID, PATypeHolder>::iterator I =
1100 CurModule.LateResolveTypes.find(D);
1101 if (I != CurModule.LateResolveTypes.end()) {
1102 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Nuno Lopes37e4b7a2008-10-15 11:11:12 +00001103 I->first.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001104 CurModule.LateResolveTypes.erase(I);
1105 }
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001106 D.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001107}
1108
1109// setValueName - Set the specified value to the name given. The name may be
1110// null potentially, in which case this is a noop. The string passed in is
1111// assumed to be a malloc'd string buffer, and is free'd by this function.
1112//
1113static void setValueName(Value *V, std::string *NameStr) {
1114 if (!NameStr) return;
1115 std::string Name(*NameStr); // Copy string
1116 delete NameStr; // Free old string
1117
1118 if (V->getType() == Type::VoidTy) {
1119 GenerateError("Can't assign name '" + Name+"' to value with void type");
1120 return;
1121 }
1122
1123 assert(inFunctionScope() && "Must be in function scope!");
1124 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1125 if (ST.lookup(Name)) {
1126 GenerateError("Redefinition of value '" + Name + "' of type '" +
1127 V->getType()->getDescription() + "'");
1128 return;
1129 }
1130
1131 // Set the name.
1132 V->setName(Name);
1133}
1134
1135/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1136/// this is a declaration, otherwise it is a definition.
1137static GlobalVariable *
1138ParseGlobalVariable(std::string *NameStr,
1139 GlobalValue::LinkageTypes Linkage,
1140 GlobalValue::VisibilityTypes Visibility,
1141 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001142 Constant *Initializer, bool IsThreadLocal,
1143 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001144 if (isa<FunctionType>(Ty)) {
1145 GenerateError("Cannot declare global vars of function type");
1146 return 0;
1147 }
Dan Gohmane5febe42008-05-31 00:58:22 +00001148 if (Ty == Type::LabelTy) {
1149 GenerateError("Cannot declare global vars of label type");
1150 return 0;
1151 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001152
Christopher Lamb0a243582007-12-11 09:02:08 +00001153 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001154
1155 std::string Name;
1156 if (NameStr) {
1157 Name = *NameStr; // Copy string
1158 delete NameStr; // Free old string
1159 }
1160
1161 // See if this global value was forward referenced. If so, recycle the
1162 // object.
1163 ValID ID;
1164 if (!Name.empty()) {
1165 ID = ValID::createGlobalName(Name);
1166 } else {
1167 ID = ValID::createGlobalID(CurModule.Values.size());
1168 }
1169
1170 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1171 // Move the global to the end of the list, from whereever it was
1172 // previously inserted.
1173 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1174 CurModule.CurrentModule->getGlobalList().remove(GV);
1175 CurModule.CurrentModule->getGlobalList().push_back(GV);
1176 GV->setInitializer(Initializer);
1177 GV->setLinkage(Linkage);
1178 GV->setVisibility(Visibility);
1179 GV->setConstant(isConstantGlobal);
1180 GV->setThreadLocal(IsThreadLocal);
1181 InsertValue(GV, CurModule.Values);
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001182 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001183 return GV;
1184 }
1185
Nuno Lopes1697e8b2008-10-03 15:52:39 +00001186 ID.destroy();
1187
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001188 // If this global has a name
1189 if (!Name.empty()) {
1190 // if the global we're parsing has an initializer (is a definition) and
1191 // has external linkage.
1192 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1193 // If there is already a global with external linkage with this name
1194 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1195 // If we allow this GVar to get created, it will be renamed in the
1196 // symbol table because it conflicts with an existing GVar. We can't
1197 // allow redefinition of GVars whose linking indicates that their name
1198 // must stay the same. Issue the error.
1199 GenerateError("Redefinition of global variable named '" + Name +
1200 "' of type '" + Ty->getDescription() + "'");
1201 return 0;
1202 }
1203 }
1204
1205 // Otherwise there is no existing GV to use, create one now.
1206 GlobalVariable *GV =
1207 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001208 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001209 GV->setVisibility(Visibility);
1210 InsertValue(GV, CurModule.Values);
1211 return GV;
1212}
1213
1214// setTypeName - Set the specified type to the name given. The name may be
1215// null potentially, in which case this is a noop. The string passed in is
1216// assumed to be a malloc'd string buffer, and is freed by this function.
1217//
1218// This function returns true if the type has already been defined, but is
1219// allowed to be redefined in the specified context. If the name is a new name
1220// for the type plane, it is inserted and false is returned.
1221static bool setTypeName(const Type *T, std::string *NameStr) {
1222 assert(!inFunctionScope() && "Can't give types function-local names!");
1223 if (NameStr == 0) return false;
Eric Christopher329d2672008-09-24 04:55:49 +00001224
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001225 std::string Name(*NameStr); // Copy string
1226 delete NameStr; // Free old string
1227
1228 // We don't allow assigning names to void type
1229 if (T == Type::VoidTy) {
1230 GenerateError("Can't assign name '" + Name + "' to the void type");
1231 return false;
1232 }
1233
1234 // Set the type name, checking for conflicts as we do so.
1235 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1236
1237 if (AlreadyExists) { // Inserting a name that is already defined???
1238 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1239 assert(Existing && "Conflict but no matching type?!");
1240
1241 // There is only one case where this is allowed: when we are refining an
1242 // opaque type. In this case, Existing will be an opaque type.
1243 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1244 // We ARE replacing an opaque type!
1245 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1246 return true;
1247 }
1248
1249 // Otherwise, this is an attempt to redefine a type. That's okay if
1250 // the redefinition is identical to the original. This will be so if
1251 // Existing and T point to the same Type object. In this one case we
1252 // allow the equivalent redefinition.
1253 if (Existing == T) return true; // Yes, it's equal.
1254
1255 // Any other kind of (non-equivalent) redefinition is an error.
1256 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1257 T->getDescription() + "'");
1258 }
1259
1260 return false;
1261}
1262
1263//===----------------------------------------------------------------------===//
1264// Code for handling upreferences in type names...
1265//
1266
1267// TypeContains - Returns true if Ty directly contains E in it.
1268//
1269static bool TypeContains(const Type *Ty, const Type *E) {
1270 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1271 E) != Ty->subtype_end();
1272}
1273
1274namespace {
1275 struct UpRefRecord {
1276 // NestingLevel - The number of nesting levels that need to be popped before
1277 // this type is resolved.
1278 unsigned NestingLevel;
1279
1280 // LastContainedTy - This is the type at the current binding level for the
1281 // type. Every time we reduce the nesting level, this gets updated.
1282 const Type *LastContainedTy;
1283
1284 // UpRefTy - This is the actual opaque type that the upreference is
1285 // represented with.
1286 OpaqueType *UpRefTy;
1287
1288 UpRefRecord(unsigned NL, OpaqueType *URTy)
1289 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1290 };
1291}
1292
1293// UpRefs - A list of the outstanding upreferences that need to be resolved.
1294static std::vector<UpRefRecord> UpRefs;
1295
1296/// HandleUpRefs - Every time we finish a new layer of types, this function is
1297/// called. It loops through the UpRefs vector, which is a list of the
1298/// currently active types. For each type, if the up reference is contained in
1299/// the newly completed type, we decrement the level count. When the level
1300/// count reaches zero, the upreferenced type is the type that is passed in:
1301/// thus we can complete the cycle.
1302///
1303static PATypeHolder HandleUpRefs(const Type *ty) {
1304 // If Ty isn't abstract, or if there are no up-references in it, then there is
1305 // nothing to resolve here.
1306 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher329d2672008-09-24 04:55:49 +00001307
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001308 PATypeHolder Ty(ty);
1309 UR_OUT("Type '" << Ty->getDescription() <<
1310 "' newly formed. Resolving upreferences.\n" <<
1311 UpRefs.size() << " upreferences active!\n");
1312
1313 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1314 // to zero), we resolve them all together before we resolve them to Ty. At
1315 // the end of the loop, if there is anything to resolve to Ty, it will be in
1316 // this variable.
1317 OpaqueType *TypeToResolve = 0;
1318
1319 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1320 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1321 << UpRefs[i].second->getDescription() << ") = "
1322 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1323 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1324 // Decrement level of upreference
1325 unsigned Level = --UpRefs[i].NestingLevel;
1326 UpRefs[i].LastContainedTy = Ty;
1327 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1328 if (Level == 0) { // Upreference should be resolved!
1329 if (!TypeToResolve) {
1330 TypeToResolve = UpRefs[i].UpRefTy;
1331 } else {
1332 UR_OUT(" * Resolving upreference for "
1333 << UpRefs[i].second->getDescription() << "\n";
1334 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1335 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1336 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1337 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1338 }
1339 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1340 --i; // Do not skip the next element...
1341 }
1342 }
1343 }
1344
1345 if (TypeToResolve) {
1346 UR_OUT(" * Resolving upreference for "
1347 << UpRefs[i].second->getDescription() << "\n";
1348 std::string OldName = TypeToResolve->getDescription());
1349 TypeToResolve->refineAbstractTypeTo(Ty);
1350 }
1351
1352 return Ty;
1353}
1354
1355//===----------------------------------------------------------------------===//
1356// RunVMAsmParser - Define an interface to this parser
1357//===----------------------------------------------------------------------===//
1358//
1359static Module* RunParser(Module * M);
1360
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001361Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1362 InitLLLexer(MB);
1363 Module *M = RunParser(new Module(LLLgetFilename()));
1364 FreeLexer();
1365 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001366}
1367
1368
Dan Gohman54392c12008-04-19 00:24:39 +00001369
1370/* Enabling traces. */
1371#ifndef YYDEBUG
1372# define YYDEBUG 0
1373#endif
1374
1375/* Enabling verbose error messages. */
1376#ifdef YYERROR_VERBOSE
1377# undef YYERROR_VERBOSE
1378# define YYERROR_VERBOSE 1
1379#else
1380# define YYERROR_VERBOSE 0
1381#endif
1382
1383/* Enabling the token table. */
1384#ifndef YYTOKEN_TABLE
1385# define YYTOKEN_TABLE 0
1386#endif
1387
1388#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1389typedef union YYSTYPE
Nuno Lopes97cf0032008-11-04 14:43:20 +00001390#line 986 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001391{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001392 llvm::Module *ModuleVal;
1393 llvm::Function *FunctionVal;
1394 llvm::BasicBlock *BasicBlockVal;
1395 llvm::TerminatorInst *TermInstVal;
1396 llvm::Instruction *InstVal;
1397 llvm::Constant *ConstVal;
1398
1399 const llvm::Type *PrimType;
1400 std::list<llvm::PATypeHolder> *TypeList;
1401 llvm::PATypeHolder *TypeVal;
1402 llvm::Value *ValueVal;
1403 std::vector<llvm::Value*> *ValueList;
Dan Gohmane5febe42008-05-31 00:58:22 +00001404 std::vector<unsigned> *ConstantList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405 llvm::ArgListType *ArgList;
1406 llvm::TypeWithAttrs TypeWithAttrs;
1407 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001408 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409
1410 // Represent the RHS of PHI node
1411 std::list<std::pair<llvm::Value*,
1412 llvm::BasicBlock*> > *PHIList;
1413 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1414 std::vector<llvm::Constant*> *ConstVector;
1415
1416 llvm::GlobalValue::LinkageTypes Linkage;
1417 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Pateld222f862008-09-25 21:00:45 +00001418 llvm::Attributes Attributes;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001419 llvm::APInt *APIntVal;
1420 int64_t SInt64Val;
1421 uint64_t UInt64Val;
1422 int SIntVal;
1423 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001424 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001425 bool BoolVal;
1426
1427 std::string *StrVal; // This memory must be deleted
1428 llvm::ValID ValIDVal;
1429
1430 llvm::Instruction::BinaryOps BinaryOpVal;
1431 llvm::Instruction::TermOps TermOpVal;
1432 llvm::Instruction::MemoryOps MemOpVal;
1433 llvm::Instruction::CastOps CastOpVal;
1434 llvm::Instruction::OtherOps OtherOpVal;
1435 llvm::ICmpInst::Predicate IPredicate;
1436 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001437}
Nuno Lopes37e4b7a2008-10-15 11:11:12 +00001438/* Line 187 of yacc.c. */
Nuno Lopes97cf0032008-11-04 14:43:20 +00001439#line 1440 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001440 YYSTYPE;
1441# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1442# define YYSTYPE_IS_DECLARED 1
1443# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001444#endif
1445
1446
1447
Dan Gohman54392c12008-04-19 00:24:39 +00001448/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001449
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001450
Dan Gohman54392c12008-04-19 00:24:39 +00001451/* Line 216 of yacc.c. */
Nuno Lopes97cf0032008-11-04 14:43:20 +00001452#line 1453 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001453
Dan Gohman54392c12008-04-19 00:24:39 +00001454#ifdef short
1455# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001456#endif
1457
Dan Gohman54392c12008-04-19 00:24:39 +00001458#ifdef YYTYPE_UINT8
1459typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001460#else
Dan Gohman54392c12008-04-19 00:24:39 +00001461typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001462#endif
1463
Dan Gohman54392c12008-04-19 00:24:39 +00001464#ifdef YYTYPE_INT8
1465typedef YYTYPE_INT8 yytype_int8;
1466#elif (defined __STDC__ || defined __C99__FUNC__ \
1467 || defined __cplusplus || defined _MSC_VER)
1468typedef signed char yytype_int8;
1469#else
1470typedef short int yytype_int8;
1471#endif
1472
1473#ifdef YYTYPE_UINT16
1474typedef YYTYPE_UINT16 yytype_uint16;
1475#else
1476typedef unsigned short int yytype_uint16;
1477#endif
1478
1479#ifdef YYTYPE_INT16
1480typedef YYTYPE_INT16 yytype_int16;
1481#else
1482typedef short int yytype_int16;
1483#endif
1484
1485#ifndef YYSIZE_T
1486# ifdef __SIZE_TYPE__
1487# define YYSIZE_T __SIZE_TYPE__
1488# elif defined size_t
1489# define YYSIZE_T size_t
1490# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1491 || defined __cplusplus || defined _MSC_VER)
1492# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1493# define YYSIZE_T size_t
1494# else
1495# define YYSIZE_T unsigned int
1496# endif
1497#endif
1498
1499#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1500
1501#ifndef YY_
Nuno Lopes37e4b7a2008-10-15 11:11:12 +00001502# if YYENABLE_NLS
Dan Gohman54392c12008-04-19 00:24:39 +00001503# if ENABLE_NLS
1504# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1505# define YY_(msgid) dgettext ("bison-runtime", msgid)
1506# endif
1507# endif
1508# ifndef YY_
1509# define YY_(msgid) msgid
1510# endif
1511#endif
1512
1513/* Suppress unused-variable warnings by "using" E. */
1514#if ! defined lint || defined __GNUC__
1515# define YYUSE(e) ((void) (e))
1516#else
1517# define YYUSE(e) /* empty */
1518#endif
1519
1520/* Identity function, used to suppress warnings about constant conditions. */
1521#ifndef lint
1522# define YYID(n) (n)
1523#else
1524#if (defined __STDC__ || defined __C99__FUNC__ \
1525 || defined __cplusplus || defined _MSC_VER)
1526static int
1527YYID (int i)
1528#else
1529static int
1530YYID (i)
1531 int i;
1532#endif
1533{
1534 return i;
1535}
1536#endif
1537
1538#if ! defined yyoverflow || YYERROR_VERBOSE
1539
1540/* The parser invokes alloca or malloc; define the necessary symbols. */
1541
1542# ifdef YYSTACK_USE_ALLOCA
1543# if YYSTACK_USE_ALLOCA
1544# ifdef __GNUC__
1545# define YYSTACK_ALLOC __builtin_alloca
1546# elif defined __BUILTIN_VA_ARG_INCR
1547# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1548# elif defined _AIX
1549# define YYSTACK_ALLOC __alloca
1550# elif defined _MSC_VER
1551# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1552# define alloca _alloca
1553# else
1554# define YYSTACK_ALLOC alloca
1555# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1556 || defined __cplusplus || defined _MSC_VER)
1557# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1558# ifndef _STDLIB_H
1559# define _STDLIB_H 1
1560# endif
1561# endif
1562# endif
1563# endif
1564# endif
1565
1566# ifdef YYSTACK_ALLOC
1567 /* Pacify GCC's `empty if-body' warning. */
1568# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1569# ifndef YYSTACK_ALLOC_MAXIMUM
1570 /* The OS might guarantee only one guard page at the bottom of the stack,
1571 and a page size can be as small as 4096 bytes. So we cannot safely
1572 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1573 to allow for a few compiler-allocated temporary stack slots. */
1574# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1575# endif
1576# else
1577# define YYSTACK_ALLOC YYMALLOC
1578# define YYSTACK_FREE YYFREE
1579# ifndef YYSTACK_ALLOC_MAXIMUM
1580# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1581# endif
1582# if (defined __cplusplus && ! defined _STDLIB_H \
1583 && ! ((defined YYMALLOC || defined malloc) \
1584 && (defined YYFREE || defined free)))
1585# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1586# ifndef _STDLIB_H
1587# define _STDLIB_H 1
1588# endif
1589# endif
1590# ifndef YYMALLOC
1591# define YYMALLOC malloc
1592# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1593 || defined __cplusplus || defined _MSC_VER)
1594void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1595# endif
1596# endif
1597# ifndef YYFREE
1598# define YYFREE free
1599# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1600 || defined __cplusplus || defined _MSC_VER)
1601void free (void *); /* INFRINGES ON USER NAME SPACE */
1602# endif
1603# endif
1604# endif
1605#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1606
1607
1608#if (! defined yyoverflow \
1609 && (! defined __cplusplus \
1610 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1611
1612/* A type that is properly aligned for any stack member. */
1613union yyalloc
1614{
1615 yytype_int16 yyss;
1616 YYSTYPE yyvs;
1617 };
1618
1619/* The size of the maximum gap between one aligned stack and the next. */
1620# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1621
1622/* The size of an array large to enough to hold all stacks, each with
1623 N elements. */
1624# define YYSTACK_BYTES(N) \
1625 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1626 + YYSTACK_GAP_MAXIMUM)
1627
1628/* Copy COUNT objects from FROM to TO. The source and destination do
1629 not overlap. */
1630# ifndef YYCOPY
1631# if defined __GNUC__ && 1 < __GNUC__
1632# define YYCOPY(To, From, Count) \
1633 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1634# else
1635# define YYCOPY(To, From, Count) \
1636 do \
1637 { \
1638 YYSIZE_T yyi; \
1639 for (yyi = 0; yyi < (Count); yyi++) \
1640 (To)[yyi] = (From)[yyi]; \
1641 } \
1642 while (YYID (0))
1643# endif
1644# endif
1645
1646/* Relocate STACK from its old location to the new one. The
1647 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1648 elements in the stack, and YYPTR gives the new location of the
1649 stack. Advance YYPTR to a properly aligned location for the next
1650 stack. */
1651# define YYSTACK_RELOCATE(Stack) \
1652 do \
1653 { \
1654 YYSIZE_T yynewbytes; \
1655 YYCOPY (&yyptr->Stack, Stack, yysize); \
1656 Stack = &yyptr->Stack; \
1657 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1658 yyptr += yynewbytes / sizeof (*yyptr); \
1659 } \
1660 while (YYID (0))
1661
1662#endif
1663
1664/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001665#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001666/* YYLAST -- Last index in YYTABLE. */
Chris Lattnerc5320232008-10-15 06:16:57 +00001667#define YYLAST 2377
Dan Gohman54392c12008-04-19 00:24:39 +00001668
1669/* YYNTOKENS -- Number of terminals. */
Devang Patelcd842482008-09-29 20:49:50 +00001670#define YYNTOKENS 173
Dan Gohman54392c12008-04-19 00:24:39 +00001671/* YYNNTS -- Number of nonterminals. */
Chris Lattnerc5320232008-10-15 06:16:57 +00001672#define YYNNTS 87
Dan Gohman54392c12008-04-19 00:24:39 +00001673/* YYNRULES -- Number of rules. */
Chris Lattnerc5320232008-10-15 06:16:57 +00001674#define YYNRULES 348
Dan Gohman54392c12008-04-19 00:24:39 +00001675/* YYNRULES -- Number of states. */
Chris Lattnerc5320232008-10-15 06:16:57 +00001676#define YYNSTATES 708
Dan Gohman54392c12008-04-19 00:24:39 +00001677
1678/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1679#define YYUNDEFTOK 2
Devang Patelcd842482008-09-29 20:49:50 +00001680#define YYMAXUTOK 413
Dan Gohman54392c12008-04-19 00:24:39 +00001681
1682#define YYTRANSLATE(YYX) \
1683 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1684
1685/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1686static const yytype_uint8 yytranslate[] =
1687{
1688 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001692 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001694 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001697 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
Dan Gohman54392c12008-04-19 00:24:39 +00001698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patelcd842482008-09-29 20:49:50 +00001700 166, 2, 2, 170, 2, 171, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1705 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, 1, 2, 3, 4,
1714 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1715 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1716 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1717 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1718 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1719 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1720 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1721 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1722 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1723 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1724 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1725 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1726 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1727 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001728 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Patelcd842482008-09-29 20:49:50 +00001729 155, 156, 157, 158
Dan Gohman54392c12008-04-19 00:24:39 +00001730};
1731
1732#if YYDEBUG
1733/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1734 YYRHS. */
1735static const yytype_uint16 yyprhs[] =
1736{
1737 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1738 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1739 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1740 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1741 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1742 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Chris Lattnerc5320232008-10-15 06:16:57 +00001743 118, 123, 124, 127, 128, 131, 133, 135, 137, 138,
1744 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1745 160, 162, 164, 166, 167, 169, 171, 172, 174, 176,
1746 178, 180, 181, 183, 185, 186, 188, 190, 192, 194,
1747 196, 199, 201, 203, 205, 207, 209, 211, 213, 215,
1748 217, 220, 221, 224, 226, 228, 230, 231, 234, 236,
1749 238, 240, 242, 244, 246, 248, 250, 252, 254, 255,
1750 258, 259, 262, 263, 266, 267, 271, 274, 275, 277,
1751 278, 282, 284, 287, 289, 291, 293, 295, 297, 299,
1752 301, 303, 305, 309, 311, 314, 320, 326, 332, 338,
1753 342, 345, 351, 356, 359, 361, 363, 365, 369, 371,
1754 375, 377, 378, 380, 384, 389, 393, 397, 402, 407,
1755 411, 418, 424, 427, 430, 433, 436, 439, 442, 445,
1756 448, 451, 454, 457, 460, 467, 473, 482, 489, 496,
1757 504, 512, 520, 528, 535, 544, 553, 559, 567, 571,
1758 573, 575, 577, 579, 580, 583, 590, 592, 593, 595,
1759 598, 599, 603, 604, 608, 612, 616, 620, 621, 630,
1760 631, 641, 642, 652, 658, 661, 665, 667, 671, 675,
1761 679, 683, 685, 686, 692, 696, 698, 702, 704, 705,
1762 717, 719, 721, 726, 728, 730, 733, 737, 738, 740,
1763 742, 744, 746, 748, 750, 752, 754, 756, 758, 760,
1764 764, 768, 771, 774, 778, 781, 787, 792, 794, 800,
1765 802, 804, 806, 808, 810, 812, 815, 817, 821, 824,
1766 827, 831, 835, 838, 839, 841, 844, 847, 851, 861,
1767 871, 880, 896, 898, 900, 907, 913, 916, 919, 926,
1768 934, 939, 944, 951, 958, 959, 960, 964, 967, 971,
1769 974, 976, 982, 988, 995, 1002, 1009, 1016, 1021, 1028,
1770 1033, 1038, 1045, 1052, 1055, 1065, 1067, 1069, 1070, 1074,
1771 1081, 1085, 1092, 1095, 1101, 1109, 1115, 1120, 1125
Dan Gohman54392c12008-04-19 00:24:39 +00001772};
1773
1774/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1775static const yytype_int16 yyrhs[] =
1776{
Chris Lattnerc5320232008-10-15 06:16:57 +00001777 220, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenf4581482008-09-26 19:32:34 +00001778 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1779 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1780 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1781 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1782 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1783 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1784 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1785 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1786 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
Chris Lattnerc5320232008-10-15 06:16:57 +00001787 -1, 102, -1, 103, -1, 26, -1, 27, -1, 19,
1788 -1, 22, -1, 24, -1, 179, -1, -1, 55, 159,
1789 4, 160, -1, -1, 179, 161, -1, -1, 7, 161,
1790 -1, 20, -1, 23, -1, 186, -1, -1, 184, 161,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001791 -1, 42, -1, 44, -1, 43, -1, 45, -1, 47,
1792 -1, 49, -1, 46, -1, 48, -1, 51, -1, -1,
1793 156, -1, 157, -1, 158, -1, -1, 46, -1, 48,
1794 -1, -1, 42, -1, 43, -1, 44, -1, 47, -1,
1795 -1, 44, -1, 42, -1, -1, 63, -1, 64, -1,
1796 65, -1, 66, -1, 67, -1, 62, 4, -1, 142,
1797 -1, 121, -1, 141, -1, 122, -1, 144, -1, 145,
1798 -1, 147, -1, 148, -1, 149, -1, 54, 4, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00001799 -1, 195, 194, -1, 144, -1, 142, -1, 141, -1,
1800 -1, 197, 196, -1, 143, -1, 146, -1, 144, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001801 142, -1, 141, -1, 150, -1, 151, -1, 154, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00001802 155, -1, 153, -1, -1, 199, 198, -1, -1, 152,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001803 22, -1, -1, 54, 4, -1, -1, 162, 54, 4,
Chris Lattnerc5320232008-10-15 06:16:57 +00001804 -1, 34, 22, -1, -1, 203, -1, -1, 162, 206,
1805 205, -1, 203, -1, 54, 4, -1, 11, -1, 12,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001806 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
Chris Lattnerc5320232008-10-15 06:16:57 +00001807 -1, 50, -1, 207, -1, 208, 181, 163, -1, 242,
1808 -1, 164, 4, -1, 208, 159, 212, 160, 199, -1,
1809 10, 159, 212, 160, 199, -1, 165, 4, 166, 208,
1810 167, -1, 168, 4, 166, 208, 169, -1, 170, 213,
1811 171, -1, 170, 171, -1, 168, 170, 213, 171, 169,
1812 -1, 168, 170, 171, 169, -1, 208, 195, -1, 208,
1813 -1, 10, -1, 209, -1, 211, 162, 209, -1, 211,
1814 -1, 211, 162, 39, -1, 39, -1, -1, 208, -1,
1815 213, 162, 208, -1, 208, 165, 216, 167, -1, 208,
1816 165, 167, -1, 208, 172, 22, -1, 208, 168, 216,
1817 169, -1, 208, 170, 216, 171, -1, 208, 170, 171,
1818 -1, 208, 168, 170, 216, 171, 169, -1, 208, 168,
1819 170, 171, 169, -1, 208, 40, -1, 208, 41, -1,
1820 208, 242, -1, 208, 215, -1, 208, 25, -1, 208,
1821 3, -1, 208, 5, -1, 208, 4, -1, 208, 6,
1822 -1, 208, 26, -1, 208, 27, -1, 208, 9, -1,
1823 176, 159, 214, 38, 208, 160, -1, 119, 159, 214,
1824 254, 160, -1, 133, 159, 214, 162, 214, 162, 214,
1825 160, -1, 174, 159, 214, 162, 214, 160, -1, 175,
1826 159, 214, 162, 214, 160, -1, 90, 177, 159, 214,
1827 162, 214, 160, -1, 91, 178, 159, 214, 162, 214,
1828 160, -1, 92, 177, 159, 214, 162, 214, 160, -1,
1829 93, 178, 159, 214, 162, 214, 160, -1, 135, 159,
1830 214, 162, 214, 160, -1, 136, 159, 214, 162, 214,
1831 162, 214, 160, -1, 137, 159, 214, 162, 214, 162,
1832 214, 160, -1, 139, 159, 214, 255, 160, -1, 140,
1833 159, 214, 162, 214, 255, 160, -1, 216, 162, 214,
1834 -1, 214, -1, 32, -1, 33, -1, 37, -1, -1,
1835 210, 242, -1, 125, 159, 219, 38, 208, 160, -1,
1836 221, -1, -1, 222, -1, 221, 222, -1, -1, 31,
1837 223, 238, -1, -1, 30, 224, 239, -1, 60, 59,
1838 228, -1, 182, 18, 208, -1, 182, 18, 10, -1,
1839 -1, 185, 189, 218, 217, 214, 181, 225, 205, -1,
1840 -1, 185, 187, 189, 218, 217, 214, 181, 226, 205,
1841 -1, -1, 185, 188, 189, 218, 217, 208, 181, 227,
1842 205, -1, 185, 189, 35, 192, 219, -1, 52, 229,
1843 -1, 56, 161, 230, -1, 22, -1, 53, 161, 22,
1844 -1, 68, 161, 22, -1, 165, 231, 167, -1, 231,
1845 162, 22, -1, 22, -1, -1, 232, 162, 208, 195,
1846 180, -1, 208, 195, 180, -1, 232, -1, 232, 162,
1847 39, -1, 39, -1, -1, 193, 197, 210, 184, 159,
1848 233, 160, 199, 204, 201, 200, -1, 28, -1, 170,
1849 -1, 191, 189, 234, 235, -1, 29, -1, 171, -1,
1850 246, 237, -1, 190, 189, 234, -1, -1, 61, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00001851 3, -1, 4, -1, 5, -1, 6, -1, 9, -1,
1852 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00001853 168, 216, 169, -1, 165, 216, 167, -1, 165, 167,
1854 -1, 172, 22, -1, 170, 216, 171, -1, 170, 171,
1855 -1, 168, 170, 216, 171, 169, -1, 168, 170, 171,
1856 169, -1, 215, -1, 59, 240, 22, 162, 22, -1,
1857 7, -1, 8, -1, 179, -1, 184, -1, 242, -1,
1858 241, -1, 208, 243, -1, 244, -1, 245, 162, 244,
1859 -1, 246, 247, -1, 236, 247, -1, 248, 182, 249,
1860 -1, 248, 183, 249, -1, 248, 251, -1, -1, 21,
1861 -1, 69, 245, -1, 69, 10, -1, 70, 17, 243,
1862 -1, 70, 11, 243, 162, 17, 243, 162, 17, 243,
1863 -1, 71, 11, 243, 162, 17, 243, 165, 250, 167,
1864 -1, 71, 11, 243, 162, 17, 243, 165, 167, -1,
1865 72, 193, 197, 210, 243, 159, 253, 160, 199, 38,
1866 17, 243, 73, 17, 243, -1, 73, -1, 74, -1,
1867 250, 11, 241, 162, 17, 243, -1, 11, 241, 162,
1868 17, 243, -1, 182, 257, -1, 183, 257, -1, 208,
1869 165, 243, 162, 243, 167, -1, 252, 162, 165, 243,
1870 162, 243, 167, -1, 208, 195, 243, 195, -1, 17,
1871 195, 243, 195, -1, 253, 162, 208, 195, 243, 195,
1872 -1, 253, 162, 17, 195, 243, 195, -1, -1, -1,
1873 254, 162, 244, -1, 162, 4, -1, 255, 162, 4,
1874 -1, 58, 57, -1, 57, -1, 174, 208, 243, 162,
1875 243, -1, 175, 208, 243, 162, 243, -1, 90, 177,
1876 208, 243, 162, 243, -1, 91, 178, 208, 243, 162,
1877 243, -1, 92, 177, 208, 243, 162, 243, -1, 93,
1878 178, 208, 243, 162, 243, -1, 176, 244, 38, 208,
1879 -1, 133, 244, 162, 244, 162, 244, -1, 134, 244,
1880 162, 208, -1, 135, 244, 162, 244, -1, 136, 244,
1881 162, 244, 162, 244, -1, 137, 244, 162, 244, 162,
1882 244, -1, 132, 252, -1, 256, 193, 197, 210, 243,
1883 159, 253, 160, 199, -1, 259, -1, 36, -1, -1,
1884 114, 208, 202, -1, 114, 208, 162, 11, 243, 202,
1885 -1, 115, 208, 202, -1, 115, 208, 162, 11, 243,
1886 202, -1, 116, 244, -1, 258, 117, 208, 243, 202,
1887 -1, 258, 118, 244, 162, 208, 243, 202, -1, 138,
1888 208, 243, 162, 4, -1, 119, 208, 243, 254, -1,
1889 139, 208, 243, 255, -1, 140, 208, 243, 162, 208,
1890 243, 255, -1
Dan Gohman54392c12008-04-19 00:24:39 +00001891};
1892
1893/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1894static const yytype_uint16 yyrline[] =
1895{
Nuno Lopes97cf0032008-11-04 14:43:20 +00001896 0, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1897 1152, 1153, 1153, 1153, 1153, 1153, 1153, 1154, 1154, 1154,
1898 1154, 1154, 1154, 1155, 1155, 1155, 1155, 1155, 1155, 1158,
1899 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162, 1162, 1166,
1900 1166, 1167, 1167, 1168, 1168, 1169, 1169, 1170, 1170, 1171,
1901 1171, 1172, 1172, 1173, 1174, 1177, 1177, 1177, 1178, 1178,
1902 1180, 1181, 1185, 1189, 1194, 1200, 1200, 1202, 1203, 1208,
1903 1214, 1215, 1216, 1217, 1218, 1219, 1223, 1224, 1225, 1229,
1904 1230, 1231, 1232, 1236, 1237, 1238, 1242, 1243, 1244, 1245,
1905 1246, 1250, 1251, 1252, 1255, 1256, 1257, 1258, 1259, 1260,
1906 1261, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276,
1907 1277, 1281, 1282, 1287, 1288, 1289, 1292, 1293, 1299, 1300,
1908 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1311, 1312,
1909 1318, 1319, 1326, 1327, 1333, 1334, 1343, 1351, 1352, 1357,
1910 1358, 1359, 1364, 1377, 1377, 1377, 1377, 1377, 1377, 1377,
1911 1380, 1384, 1388, 1395, 1400, 1408, 1443, 1474, 1479, 1489,
1912 1499, 1503, 1513, 1520, 1529, 1536, 1541, 1546, 1553, 1554,
1913 1561, 1568, 1576, 1582, 1594, 1622, 1638, 1665, 1693, 1719,
1914 1739, 1765, 1785, 1797, 1804, 1870, 1880, 1890, 1901, 1914,
1915 1925, 1939, 1946, 1953, 1971, 1983, 2004, 2012, 2018, 2029,
1916 2034, 2039, 2044, 2049, 2055, 2061, 2067, 2075, 2086, 2090,
1917 2098, 2098, 2101, 2101, 2104, 2116, 2137, 2142, 2150, 2151,
1918 2155, 2155, 2159, 2159, 2162, 2165, 2189, 2201, 2200, 2212,
1919 2211, 2221, 2220, 2231, 2271, 2274, 2280, 2290, 2294, 2299,
1920 2301, 2306, 2311, 2320, 2330, 2341, 2345, 2354, 2363, 2368,
1921 2517, 2517, 2519, 2528, 2528, 2530, 2535, 2547, 2551, 2556,
1922 2560, 2564, 2569, 2574, 2578, 2582, 2586, 2590, 2594, 2598,
1923 2620, 2642, 2648, 2661, 2673, 2678, 2690, 2696, 2700, 2710,
1924 2714, 2718, 2723, 2730, 2730, 2736, 2745, 2750, 2755, 2759,
1925 2768, 2777, 2790, 2799, 2803, 2811, 2831, 2835, 2840, 2851,
1926 2870, 2879, 2983, 2987, 2994, 3005, 3018, 3027, 3040, 3051,
1927 3061, 3072, 3080, 3090, 3097, 3100, 3101, 3109, 3115, 3124,
1928 3128, 3133, 3149, 3166, 3178, 3190, 3204, 3218, 3230, 3251,
1929 3258, 3264, 3270, 3276, 3291, 3401, 3406, 3410, 3417, 3424,
1930 3434, 3441, 3451, 3459, 3473, 3490, 3504, 3519, 3534
Dan Gohman54392c12008-04-19 00:24:39 +00001931};
1932#endif
1933
1934#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1935/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1936 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1937static const char *const yytname[] =
1938{
1939 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1940 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1941 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1942 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1943 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1944 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1945 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1946 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001947 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001948 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1949 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1950 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesenf4581482008-09-26 19:32:34 +00001951 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1952 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1953 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1954 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1955 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1956 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1957 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1958 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1959 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1960 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1961 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patelcd842482008-09-29 20:49:50 +00001962 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1963 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1964 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1965 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
Chris Lattnerc5320232008-10-15 06:16:57 +00001966 "FPredicates", "LocalName", "OptLocalName", "OptAddrSpace",
Chris Lattner8f5544c2008-10-15 06:03:48 +00001967 "OptLocalAssign", "LocalNumber", "GlobalName", "OptGlobalAssign",
1968 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1969 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1970 "AliasLinkage", "OptCallingConv", "Attribute", "OptAttributes",
1971 "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs", "OptGC",
1972 "OptAlign", "OptCAlign", "SectionString", "OptSection",
Devang Patelcd842482008-09-29 20:49:50 +00001973 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1974 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1975 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1976 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1977 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1978 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1979 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1980 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1981 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1982 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1983 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner906773a2008-08-29 17:20:18 +00001984 "OptVolatile", "MemoryInst", 0
Dan Gohman54392c12008-04-19 00:24:39 +00001985};
1986#endif
1987
1988# ifdef YYPRINT
1989/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1990 token YYLEX-NUM. */
1991static const yytype_uint16 yytoknum[] =
1992{
1993 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1994 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1995 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1996 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1997 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1998 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1999 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2000 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
2001 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
2002 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
2003 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
2004 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
2005 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2006 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2007 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patelcd842482008-09-29 20:49:50 +00002008 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
2009 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
2010 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00002011};
2012# endif
2013
2014/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002015static const yytype_uint16 yyr1[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002016{
Devang Patelcd842482008-09-29 20:49:50 +00002017 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2018 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2019 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2020 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2021 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
Chris Lattnerc5320232008-10-15 06:16:57 +00002022 178, 178, 178, 178, 178, 179, 179, 179, 180, 180,
2023 181, 181, 182, 182, 183, 184, 184, 185, 185, 186,
2024 187, 187, 187, 187, 187, 187, 188, 188, 188, 189,
2025 189, 189, 189, 190, 190, 190, 191, 191, 191, 191,
2026 191, 192, 192, 192, 193, 193, 193, 193, 193, 193,
2027 193, 194, 194, 194, 194, 194, 194, 194, 194, 194,
2028 194, 195, 195, 196, 196, 196, 197, 197, 198, 198,
2029 198, 198, 198, 198, 198, 198, 198, 198, 199, 199,
2030 200, 200, 201, 201, 202, 202, 203, 204, 204, 205,
2031 205, 206, 206, 207, 207, 207, 207, 207, 207, 207,
2032 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
2033 208, 208, 208, 209, 210, 210, 211, 211, 212, 212,
2034 212, 212, 213, 213, 214, 214, 214, 214, 214, 214,
2035 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
2036 214, 214, 214, 214, 215, 215, 215, 215, 215, 215,
2037 215, 215, 215, 215, 215, 215, 215, 215, 216, 216,
2038 217, 217, 218, 218, 219, 219, 220, 220, 221, 221,
2039 223, 222, 224, 222, 222, 222, 222, 225, 222, 226,
2040 222, 227, 222, 222, 222, 222, 228, 229, 229, 230,
2041 231, 231, 231, 232, 232, 233, 233, 233, 233, 234,
2042 235, 235, 236, 237, 237, 238, 239, 240, 240, 241,
2043 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
2044 241, 241, 241, 241, 241, 241, 241, 241, 241, 242,
2045 242, 242, 242, 243, 243, 244, 245, 245, 246, 246,
2046 247, 247, 248, 248, 248, 249, 249, 249, 249, 249,
2047 249, 249, 249, 249, 250, 250, 251, 251, 252, 252,
2048 253, 253, 253, 253, 253, 254, 254, 255, 255, 256,
2049 256, 257, 257, 257, 257, 257, 257, 257, 257, 257,
2050 257, 257, 257, 257, 257, 257, 258, 258, 259, 259,
2051 259, 259, 259, 259, 259, 259, 259, 259, 259
Dan Gohman54392c12008-04-19 00:24:39 +00002052};
2053
2054/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2055static const yytype_uint8 yyr2[] =
2056{
2057 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2059 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2060 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2061 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002062 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2063 4, 0, 2, 0, 2, 1, 1, 1, 0, 2,
2064 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2065 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
2066 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
2067 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2068 2, 0, 2, 1, 1, 1, 0, 2, 1, 1,
2069 1, 1, 1, 1, 1, 1, 1, 1, 0, 2,
2070 0, 2, 0, 2, 0, 3, 2, 0, 1, 0,
2071 3, 1, 2, 1, 1, 1, 1, 1, 1, 1,
2072 1, 1, 3, 1, 2, 5, 5, 5, 5, 3,
2073 2, 5, 4, 2, 1, 1, 1, 3, 1, 3,
2074 1, 0, 1, 3, 4, 3, 3, 4, 4, 3,
2075 6, 5, 2, 2, 2, 2, 2, 2, 2, 2,
2076 2, 2, 2, 2, 6, 5, 8, 6, 6, 7,
2077 7, 7, 7, 6, 8, 8, 5, 7, 3, 1,
2078 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
2079 0, 3, 0, 3, 3, 3, 3, 0, 8, 0,
2080 9, 0, 9, 5, 2, 3, 1, 3, 3, 3,
2081 3, 1, 0, 5, 3, 1, 3, 1, 0, 11,
2082 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
2083 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
2084 3, 2, 2, 3, 2, 5, 4, 1, 5, 1,
2085 1, 1, 1, 1, 1, 2, 1, 3, 2, 2,
2086 3, 3, 2, 0, 1, 2, 2, 3, 9, 9,
2087 8, 15, 1, 1, 6, 5, 2, 2, 6, 7,
2088 4, 4, 6, 6, 0, 0, 3, 2, 3, 2,
2089 1, 5, 5, 6, 6, 6, 6, 4, 6, 4,
2090 4, 6, 6, 2, 9, 1, 1, 0, 3, 6,
2091 3, 6, 2, 5, 7, 5, 4, 4, 7
Dan Gohman54392c12008-04-19 00:24:39 +00002092};
2093
2094/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2095 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2096 means the default is an error. */
2097static const yytype_uint16 yydefact[] =
2098{
Chris Lattnerc5320232008-10-15 06:16:57 +00002099 68, 55, 65, 56, 66, 57, 222, 220, 0, 0,
2100 0, 0, 0, 0, 79, 67, 0, 68, 218, 83,
2101 86, 0, 0, 234, 0, 0, 62, 0, 69, 70,
2102 72, 71, 73, 76, 74, 77, 75, 78, 80, 81,
2103 82, 79, 79, 213, 1, 219, 84, 85, 79, 223,
2104 87, 88, 89, 90, 79, 293, 221, 293, 0, 0,
2105 242, 235, 236, 224, 279, 280, 226, 143, 144, 145,
2106 148, 147, 146, 149, 150, 0, 0, 0, 0, 281,
2107 282, 151, 225, 153, 213, 213, 91, 212, 0, 94,
2108 94, 294, 289, 63, 253, 254, 255, 288, 237, 238,
2109 241, 0, 171, 154, 0, 0, 0, 0, 160, 172,
2110 0, 0, 171, 0, 0, 0, 93, 92, 0, 210,
2111 211, 0, 0, 95, 96, 97, 98, 99, 116, 256,
2112 0, 0, 337, 337, 292, 0, 239, 170, 111, 166,
2113 168, 0, 0, 0, 0, 0, 0, 159, 0, 0,
2114 152, 0, 0, 165, 0, 164, 0, 233, 61, 61,
2115 100, 0, 250, 251, 252, 64, 336, 320, 0, 0,
2116 0, 0, 94, 302, 303, 2, 3, 4, 5, 6,
2117 7, 8, 9, 10, 14, 15, 16, 11, 12, 13,
2118 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
2119 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
Nate Begeman646fa482008-05-12 19:01:56 +00002120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002121 0, 0, 290, 94, 306, 0, 335, 291, 307, 240,
2122 163, 0, 128, 61, 61, 162, 0, 173, 0, 128,
2123 61, 61, 0, 214, 187, 189, 188, 190, 193, 186,
2124 191, 192, 182, 183, 0, 0, 0, 0, 0, 0,
2125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2126 0, 0, 185, 184, 227, 115, 114, 113, 117, 0,
2127 319, 296, 61, 286, 295, 0, 0, 0, 116, 29,
2128 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2129 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2130 43, 44, 45, 46, 47, 48, 0, 0, 0, 134,
2131 134, 342, 61, 61, 333, 0, 0, 0, 0, 0,
2132 61, 61, 61, 61, 61, 0, 116, 0, 0, 0,
2133 102, 104, 103, 101, 105, 106, 107, 108, 109, 112,
2134 169, 167, 156, 157, 158, 161, 60, 155, 229, 231,
2135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2136 0, 0, 175, 209, 0, 0, 0, 179, 0, 176,
2137 0, 0, 0, 139, 0, 259, 260, 261, 262, 263,
2138 268, 264, 265, 266, 267, 257, 0, 0, 0, 0,
2139 277, 284, 283, 285, 0, 0, 297, 0, 0, 61,
2140 61, 61, 61, 0, 338, 0, 340, 315, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 0, 0, 61, 0, 110, 122, 121, 118, 120, 119,
2143 123, 124, 127, 125, 126, 129, 139, 139, 0, 0,
2144 0, 0, 0, 315, 0, 0, 0, 0, 0, 0,
2145 0, 174, 160, 172, 0, 177, 178, 0, 0, 0,
2146 0, 228, 248, 258, 0, 271, 0, 0, 0, 274,
2147 0, 272, 287, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 0, 346, 0, 0, 0, 329, 330, 0,
2149 0, 0, 0, 347, 0, 0, 0, 327, 0, 134,
2150 0, 230, 232, 61, 0, 0, 0, 0, 0, 0,
2151 0, 0, 0, 0, 0, 208, 181, 0, 0, 0,
2152 0, 0, 0, 141, 139, 247, 111, 245, 0, 0,
2153 270, 160, 0, 269, 273, 0, 0, 0, 0, 0,
2154 0, 0, 134, 135, 134, 0, 0, 0, 0, 0,
2155 0, 345, 317, 0, 61, 321, 322, 0, 0, 343,
2156 61, 215, 0, 0, 0, 0, 195, 0, 0, 0,
2157 0, 206, 0, 180, 0, 0, 61, 136, 142, 140,
2158 59, 0, 128, 0, 276, 0, 0, 0, 314, 323,
2159 324, 325, 326, 339, 341, 316, 0, 0, 328, 331,
2160 332, 318, 0, 314, 134, 0, 0, 0, 0, 0,
2161 203, 0, 0, 0, 197, 198, 194, 58, 244, 246,
2162 111, 137, 278, 275, 0, 0, 111, 111, 0, 308,
2163 0, 348, 0, 344, 199, 200, 201, 202, 0, 0,
2164 0, 207, 59, 138, 132, 0, 0, 300, 0, 0,
2165 0, 128, 0, 309, 128, 196, 204, 205, 243, 0,
2166 130, 298, 0, 0, 299, 102, 104, 111, 111, 0,
2167 111, 111, 334, 133, 0, 249, 0, 0, 311, 310,
2168 0, 0, 0, 131, 0, 0, 0, 111, 111, 305,
2169 0, 0, 313, 312, 304, 0, 0, 301
Dan Gohman54392c12008-04-19 00:24:39 +00002170};
2171
2172/* YYDEFGOTO[NTERM-NUM]. */
2173static const yytype_int16 yydefgoto[] =
2174{
Chris Lattnerc5320232008-10-15 06:16:57 +00002175 -1, 269, 270, 271, 299, 316, 79, 628, 113, 12,
2176 133, 80, 14, 15, 41, 42, 43, 48, 54, 118,
2177 128, 349, 230, 278, 161, 445, 352, 685, 670, 414,
2178 533, 654, 471, 534, 81, 158, 139, 156, 140, 141,
2179 110, 373, 400, 374, 121, 88, 157, 16, 17, 18,
2180 20, 19, 383, 446, 447, 63, 23, 61, 101, 537,
2181 538, 129, 164, 55, 96, 56, 49, 474, 401, 83,
2182 403, 283, 284, 57, 92, 93, 222, 658, 134, 324,
2183 638, 493, 503, 223, 224, 225, 226
Dan Gohman54392c12008-04-19 00:24:39 +00002184};
2185
2186/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2187 STATE-NUM. */
Chris Lattnerc5320232008-10-15 06:16:57 +00002188#define YYPACT_NINF -624
Dan Gohman54392c12008-04-19 00:24:39 +00002189static const yytype_int16 yypact[] =
2190{
Chris Lattnerc5320232008-10-15 06:16:57 +00002191 815, -624, -624, -624, -624, -624, -624, -624, 14, -114,
2192 16, -73, 78, -31, 299, -624, 163, 2187, -624, 164,
2193 80, 19, 22, -624, 2, 179, -624, 1912, -624, -624,
2194 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2195 -624, 68, 68, 201, -624, -624, -624, -624, 68, -624,
2196 -624, -624, -624, -624, 68, 200, -624, 5, 215, 222,
2197 225, -624, -624, -624, -624, -624, 117, -624, -624, -624,
2198 -624, -624, -624, -624, -624, 264, 277, 7, 49, -624,
2199 -624, -624, -12, -624, 252, 252, 198, -624, 79, 231,
2200 231, -624, -624, 83, -624, -624, -624, -624, -624, -624,
2201 -624, -21, 649, -624, 138, 149, 627, 117, -624, -12,
2202 -120, 159, 649, 158, 79, 79, -624, -624, 1557, -624,
2203 -624, 2012, 320, -624, -624, -624, -624, -624, -624, -624,
2204 -13, 173, 2237, 2237, -624, 313, -624, -624, -12, -624,
2205 174, 177, 2012, 2012, 169, -118, 2012, -624, 336, 191,
2206 -624, 2012, 2012, 117, 193, -12, 226, -624, 1296, 308,
2207 -624, 1516, -624, -624, -624, -624, -624, -624, 307, 2031,
2208 108, 357, 231, -624, -624, -624, -624, -624, -624, -624,
2209 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2210 454, 958, 454, 958, 2012, 2012, 2012, 2012, -624, -624,
2211 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2212 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012,
2213 2012, 2012, -624, 231, -624, 55, -624, -624, -624, -624,
2214 161, 1748, -624, -23, -41, -624, 203, -12, 214, -624,
2215 308, -20, 1557, -624, -624, -624, -624, -624, -624, -624,
2216 -624, -624, -624, -624, 454, 958, 454, 958, 216, 217,
2217 218, 220, 221, 224, 227, 1789, 2076, 732, 351, 228,
2218 229, 230, -624, -624, -624, -624, -624, -624, -624, 109,
2219 -624, 117, 956, -624, 219, 1466, 1466, 1466, -624, -624,
2220 -624, -624, -624, -624, -624, -624, -624, -624, -624, 2012,
2221 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2222 -624, -624, -624, -624, -624, -624, 2012, 2012, 2012, -10,
2223 3, -624, 956, -17, 223, 237, 238, 239, 240, 241,
2224 956, 956, 956, 956, 956, 352, -624, 2012, 2012, 387,
2225 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2226 -624, -624, 539, -624, -624, -624, -624, 539, -624, 158,
2227 354, 234, 248, 249, 250, 2012, 2012, 2012, 2012, 2012,
2228 2012, 2012, -624, -624, 42, 1006, -121, -624, -116, -624,
2229 2012, 2012, 2012, 253, 251, -624, -624, -624, -624, -624,
2230 -624, -624, -624, -624, -624, 353, 1807, 2094, 1175, 390,
2231 -624, -624, -624, -624, 2012, 255, -624, 256, 1516, 956,
2232 956, 956, 956, 20, -624, 29, -624, -624, 1466, 254,
2233 2012, 2012, 2012, 2012, 2012, 258, 259, 261, 262, 263,
2234 2012, 1516, 956, 266, -624, -624, -624, -624, -624, -624,
2235 -624, -624, -624, -624, -624, -624, 253, 253, 2012, 2012,
2236 2012, 2012, 2012, -624, 269, 270, 272, 273, 259, 274,
2237 2012, -624, 268, 1126, -84, -624, -624, 280, 281, 406,
2238 -5, -624, 1830, -624, 423, -624, 61, 1345, -56, -624,
2239 -77, -624, -624, 430, 431, 1466, 288, 290, 291, 292,
2240 1466, 455, 1466, 296, 298, 1466, 300, -12, -624, 301,
2241 302, 457, 461, 306, 2012, 1466, 1466, -12, 1466, 311,
2242 2012, -624, -624, -1, 312, 314, 317, 319, 101, 2012,
2243 2012, 2012, 2012, 112, 2012, -624, -624, 318, 2012, 2012,
2244 2012, 453, 478, -624, 253, -624, -12, 321, 326, 327,
2245 -624, 323, -67, -624, -624, 1466, 1466, 329, 1466, 1466,
2246 1466, 1466, 311, -624, 311, 2012, 1466, 328, 2012, 2012,
2247 2012, -624, -624, 489, 956, -624, -624, 335, 441, -624,
2248 956, -624, 2012, 2012, 2012, 2012, -624, 334, 337, 339,
2249 340, -624, 259, -624, 343, 345, 15, -624, -624, -624,
2250 178, 1848, -624, 484, -624, 338, 350, 349, 2117, -624,
2251 -624, -624, -624, -624, -624, -624, 348, 1466, -624, -624,
2252 -624, -624, 259, 2117, 311, 356, 359, 360, 361, 2012,
2253 -624, 2012, 2012, 115, -624, -624, -624, -624, -624, -624,
2254 -12, 116, -624, -624, 505, -7, 59, -12, 118, -624,
2255 358, 306, 124, -624, -624, -624, -624, -624, 363, 364,
2256 366, -624, 178, -624, 473, 1466, 1614, -624, -6, 802,
2257 802, -624, 2135, -624, -624, -624, -624, -624, -624, 526,
2258 379, -624, 374, 1614, -624, 378, 380, -624, -624, 442,
2259 59, -12, 539, -624, 516, -624, 523, 396, 161, 161,
2260 524, 802, 802, -624, 1466, 525, 1466, -624, -624, -624,
2261 1466, 486, 161, 161, -624, 543, 1466, -624
Dan Gohman54392c12008-04-19 00:24:39 +00002262};
2263
2264/* YYPGOTO[NTERM-NUM]. */
2265static const yytype_int16 yypgoto[] =
2266{
Chris Lattnerc5320232008-10-15 06:16:57 +00002267 -624, 132, 155, 181, -165, -154, 0, -86, -143, 474,
2268 -624, 6, -624, -624, -624, -624, 67, -624, -624, -624,
2269 -142, -624, -499, -624, -252, -624, -231, -624, -624, -313,
2270 -63, -624, -434, -624, -624, -26, 342, -152, -624, 458,
2271 463, -11, -156, -242, 202, 244, 332, -624, -624, 554,
2272 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2273 -624, 485, -624, -624, -624, -624, -624, -624, -623, -79,
2274 213, -193, -624, -624, 520, -624, 445, -624, -624, -624,
2275 -34, 129, -448, -624, 456, -624, -624
Dan Gohman54392c12008-04-19 00:24:39 +00002276};
2277
2278/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2279 positive, shift that token. If negative, reduce the rule which
2280 number is the opposite. If zero, do what YYDEFACT says.
2281 If YYTABLE_NINF, syntax error. */
Chris Lattnerc5320232008-10-15 06:16:57 +00002282#define YYTABLE_NINF -218
Dan Gohman54392c12008-04-19 00:24:39 +00002283static const yytype_int16 yytable[] =
2284{
Chris Lattnerc5320232008-10-15 06:16:57 +00002285 11, 82, 272, 321, 656, 673, 13, 416, 357, 279,
2286 523, 105, 511, 512, 111, 162, 274, 11, 325, 326,
2287 327, 328, 329, 13, 376, 378, 91, 317, 335, 531,
2288 288, 490, 111, 672, 94, 111, 408, 590, 111, 318,
2289 492, 460, 146, 111, 146, 111, 460, 24, 465, 532,
2290 687, 147, 109, 236, 111, 466, 64, 65, 111, 107,
2291 67, 68, 69, 70, 71, 72, 73, 21, 1, 2,
2292 111, 3, 4, 5, 491, 25, 138, 243, 460, 273,
2293 109, 336, 22, 491, 431, 460, 138, 527, 26, 361,
2294 131, 363, 155, 11, 544, 460, 27, 358, 359, 74,
2295 589, 362, 1, 364, 595, 3, 460, 5, 84, 85,
2296 159, 119, 120, 543, -149, 89, 233, 234, 112, 285,
2297 237, 90, 50, 51, 52, 286, 241, 53, 354, 2,
2298 28, 652, 4, 464, 623, 155, 112, 659, 660, 112,
2299 240, 135, 112, 282, 353, 433, 136, 112, 418, 112,
2300 531, -61, 413, -61, 476, 478, 480, 163, 112, 571,
2301 657, 674, 112, 44, 641, 415, -61, 60, 319, 320,
2302 282, 322, 337, 338, 112, 626, 95, 106, 688, 689,
2303 58, 691, 692, 59, 323, 282, 282, 282, 282, 282,
2304 330, 331, 332, 333, 334, 282, 569, 1, 702, 703,
2305 3, 62, 5, 402, 460, 138, 402, 402, 402, 461,
2306 46, 482, 47, 75, 76, 339, 155, 77, -149, 78,
2307 108, 91, -149, 460, 38, 39, 40, 496, 540, 498,
2308 499, 500, 339, 64, 65, 542, 86, 98, 87, 603,
2309 116, 604, 117, 402, 99, 1, 2, 100, 3, 4,
2310 5, 402, 402, 402, 402, 402, 485, 435, 436, 437,
2311 438, 576, 439, 555, 219, 219, 440, 441, 103, 442,
2312 443, 444, 581, 409, 563, 651, 102, 563, 661, 508,
2313 662, 104, 340, 341, 664, 384, 662, 220, 220, 87,
2314 410, 411, 412, 122, 123, 124, 125, 126, 127, 340,
2315 341, 643, 342, 343, 142, 344, 345, 272, 346, 347,
2316 348, 432, 282, 221, 221, 143, 151, 152, 148, 342,
2317 343, 150, 344, 345, 160, 346, 347, 348, 114, 115,
2318 402, 402, 402, 402, 165, 229, 231, 232, 235, 402,
2319 238, 29, 30, 31, 32, 33, 34, 35, 36, 463,
2320 37, 239, 242, 402, 453, 454, 455, 456, 457, 458,
2321 459, 631, 605, 111, 280, 608, 609, 610, 287, 467,
2322 468, 469, 355, 379, 356, 365, 366, 367, 282, 368,
2323 369, 404, 155, 370, 273, 419, 371, 380, 381, 382,
2324 430, 434, 448, 449, 282, 497, 282, 282, 282, 420,
2325 421, 422, 423, 424, 507, 155, 402, 450, 451, 452,
2326 472, 402, 481, 402, 473, 470, 402, 483, 484, 495,
2327 501, 502, 513, 504, 505, 506, 402, 402, 510, 402,
2328 679, 519, 520, 682, 521, 522, 524, 526, 514, 515,
2329 516, 517, 528, 529, 530, 539, 536, 545, 546, 525,
2330 548, 463, 549, 550, 551, 38, 39, 40, 555, 553,
2331 556, 561, 558, 559, 560, 562, 402, 402, 563, 402,
2332 402, 402, 402, 568, 572, 587, 573, 402, 564, 574,
2333 690, 575, 588, 591, 570, 402, 592, 583, 598, 593,
2334 607, 402, 594, 611, 613, 491, 619, 620, 405, 406,
2335 407, 621, 622, 624, 586, 625, 632, 633, 577, 578,
2336 579, 580, 634, 582, 635, 639, 644, 584, 585, 645,
2337 646, 647, 655, 665, 666, 663, 667, 669, 402, 282,
2338 683, 684, 282, 282, 282, 417, 686, -18, 693, -19,
2339 694, 696, 700, 425, 426, 427, 428, 429, 289, 290,
2340 291, 292, 293, 294, 295, 296, 297, 298, 695, 705,
2341 706, 615, 616, 617, 618, 630, 668, 132, 653, 145,
2342 149, 45, 637, 351, 360, 130, 402, 97, 227, 642,
2343 402, 402, 518, 435, 436, 437, 438, 637, 439, 228,
2344 627, 0, 440, 441, 0, 442, 443, 444, 0, 0,
2345 0, 0, 0, 0, 0, 0, 0, 0, 648, 0,
2346 649, 650, 402, 402, 0, 402, 0, 402, 0, 0,
2347 0, 402, 486, 487, 488, 489, 0, 402, 0, 0,
2348 0, 494, 0, 0, 64, 65, 681, 107, 67, 68,
2349 69, 70, 71, 72, 73, 509, 1, 2, 0, 3,
2350 4, 5, 627, 0, 0, 0, 64, 65, 0, 107,
2351 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2352 0, 3, 4, 5, 0, 0, 0, 74, 0, 0,
2353 435, 436, 437, 438, 0, 439, 0, 0, 137, 440,
2354 441, 0, 442, 443, 444, 0, 0, 0, 547, 74,
2355 0, 0, 0, 552, 0, 554, 0, 0, 557, 0,
2356 0, 0, 0, 0, 0, 0, 0, 0, 565, 566,
2357 0, 567, 0, 0, 0, 0, 0, 0, 0, 0,
2358 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,
2359 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2360 0, 1, 2, 0, 3, 4, 5, 0, 596, 597,
2361 0, 599, 600, 601, 602, 0, 0, 0, 0, 606,
2362 0, 0, 0, 0, 0, 0, 0, 612, 0, 0,
2363 0, 0, 74, 614, 0, 0, 0, 0, 0, 0,
2364 0, 75, 76, 0, 0, 77, 0, 78, 144, 0,
2365 0, 0, 0, 0, 0, 385, 386, 387, 388, 64,
2366 65, 389, 0, 75, 76, -217, 0, 77, 0, 78,
2367 640, 1, 2, 0, 3, 4, 5, 390, 391, 392,
2368 0, 0, 0, -63, 1, 2, 0, 3, 4, 5,
2369 0, 0, 393, 394, 0, 6, 7, 0, 0, 0,
2370 0, 0, 0, 0, 0, 0, 339, 0, 0, 0,
2371 0, 395, 0, 0, 0, 0, 0, 8, 671, 0,
2372 0, 9, 677, 678, 0, 10, 0, 175, 176, 177,
2373 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2374 188, 189, 254, 255, 256, 257, 75, 76, 0, 0,
2375 77, 0, 78, 377, 697, 698, 0, 699, 0, 701,
2376 0, 0, 0, 704, 0, 0, 0, 0, 0, 707,
2377 0, 258, 198, 675, 676, 201, 202, 203, 204, 205,
2378 206, 207, 208, 209, 0, 259, 0, 260, 261, 262,
2379 0, 263, 264, 342, 343, 0, 344, 345, 0, 346,
2380 347, 348, 0, 0, 0, 0, 0, 0, 0, 385,
2381 386, 387, 388, 64, 65, 389, 0, 396, 0, 0,
2382 397, 0, 398, 0, 399, 1, 2, 0, 3, 4,
2383 5, 390, 391, 392, 300, 301, 0, 0, 0, 0,
2384 0, 0, 0, 0, 0, 0, 393, 394, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002385 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002386 0, 111, 0, 64, 65, 395, 107, 67, 68, 69,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002387 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
Chris Lattnerc5320232008-10-15 06:16:57 +00002388 5, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2389 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2390 0, 0, 0, 0, 0, 0, 74, 0, 302, 303,
2391 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
2392 314, 315, 0, 0, 0, 258, 198, 199, 200, 201,
2393 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2394 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002396 0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
2397 0, 396, 0, 0, 397, 0, 398, 0, 399, 244,
2398 245, 246, 247, 64, 65, 248, 0, 0, 0, 0,
2399 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2400 5, 249, 250, 251, 0, 0, 0, 0, 0, 0,
2401 0, 0, 0, 0, 0, 0, 252, 253, 0, 0,
2402 75, 76, 0, 0, 77, 0, 78, 462, 0, 0,
2403 0, 111, 64, 65, 0, 107, 67, 68, 69, 70,
2404 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2405 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2406 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2407 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002408 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002409 0, 0, 0, 0, 0, 258, 198, 199, 200, 201,
2410 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2411 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002413 0, 0, 0, 0, 0, 112, 0, 0, 0, -61,
2414 0, 265, 0, 0, 266, 0, 267, 0, 268, 244,
2415 245, 246, 247, 64, 65, 248, 0, 0, 0, 0,
2416 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2417 5, 249, 250, 251, 0, 0, 0, 0, 0, 0,
2418 0, 0, 0, 0, 0, 0, 252, 253, 0, 75,
2419 76, 0, 0, 77, 0, 78, 479, 0, 0, 0,
2420 0, 111, 64, 65, 0, 107, 67, 68, 69, 70,
2421 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2422 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2423 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2424 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002426 0, 0, 0, 0, 0, 258, 198, 199, 200, 201,
2427 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2428 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
2429 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2430 0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
2431 0, 265, 0, 0, 266, 0, 267, 0, 268, 385,
2432 386, 387, 388, 64, 65, 389, 0, 0, 0, 0,
2433 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2434 5, 390, 391, 392, 0, 0, 0, 0, 0, 0,
2435 0, 0, 0, 0, 0, 0, 393, 394, 0, 75,
2436 76, 0, 0, 77, 0, 78, 541, 0, 0, 0,
2437 0, 0, 0, 64, 65, 395, 153, 67, 68, 69,
2438 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2439 5, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2440 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2441 0, 0, 0, 0, 64, 65, 74, 153, 67, 68,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002442 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
Chris Lattnerc5320232008-10-15 06:16:57 +00002443 4, 5, 0, 0, 0, 258, 198, 199, 200, 201,
2444 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2445 0, 260, 261, 262, 0, 263, 264, 74, 0, 0,
2446 0, 0, 0, 0, 0, 0, 0, 385, 386, 387,
2447 388, 0, 0, 389, 0, 0, 0, 0, 0, 0,
2448 0, 396, 0, 0, 397, 0, 398, 0, 399, 390,
2449 391, 392, 0, 0, 0, 0, 0, 0, 0, 0,
2450 0, 0, 0, 0, 393, 394, 0, 275, 276, 0,
2451 277, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2452 0, 0, 0, 395, 0, 0, 0, 0, 0, 0,
2453 75, 76, 154, 0, 77, 0, 78, 0, 0, 175,
2454 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
2455 186, 187, 188, 189, 254, 255, 256, 257, 0, 0,
Devang Patelcd842482008-09-29 20:49:50 +00002456 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002457 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002458 0, 0, 0, 258, 198, 199, 200, 201, 202, 203,
2459 204, 205, 206, 207, 208, 209, 0, 259, 0, 260,
2460 261, 262, 0, 263, 264, 64, 65, 0, 107, 67,
2461 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2462 3, 4, 5, 0, 0, 0, 0, 0, 0, 396,
2463 0, 0, 397, 0, 398, 0, 399, 350, 0, 0,
2464 0, 0, 0, 0, 0, 0, 64, 65, 74, 107,
2465 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2466 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
2467 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2468 4, 5, 0, 0, 0, 0, 0, 64, 65, 74,
2469 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2470 2, 0, 3, 4, 5, 64, 65, 74, 107, 67,
2471 68, 69, 70, 71, 72, 73, 0, 1, 2, 535,
2472 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2473 74, 0, 0, 0, 0, 0, 0, 629, 0, 0,
2474 0, 0, 0, 0, 0, 0, 0, 0, 74, 0,
Dale Johannesenf4581482008-09-26 19:32:34 +00002475 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerc5320232008-10-15 06:16:57 +00002476 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2477 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
2478 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2479 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2480 0, 0, 0, 75, 76, 0, 372, 77, 0, 78,
2481 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2482 0, 75, 76, 0, 475, 77, 0, 78, 0, 0,
2483 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2484 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2485 78, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2486 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2487 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2488 0, 1, 2, 0, 3, 4, 5, 0, 64, 65,
2489 0, 281, 67, 68, 69, 70, 71, 72, 73, 0,
2490 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2491 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2492 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2493 77, 74, 78, 64, 65, 0, 107, 67, 68, 69,
2494 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2495 5, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2496 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2497 0, 0, 0, 0, 64, 65, 74, 107, 67, 68,
2498 69, 70, 71, 72, 636, 0, 1, 2, 0, 3,
2499 4, 5, 64, 65, 74, 107, 67, 68, 69, 70,
2500 71, 72, 680, 0, 1, 2, 0, 3, 4, 5,
2501 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2502 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2503 77, 0, 78, 0, 0, 74, 0, -216, 0, 0,
2504 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2505 0, 78, 0, 0, 0, -63, 1, 2, 0, 3,
2506 4, 5, 0, 0, 0, 0, 0, 6, 7, 0,
2507 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2508 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
2509 75, 76, 0, 9, 77, 0, 375, 10, 0, 0,
2510 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2511 0, 0, 77, 0, 477, 0, 0, 0, 0, 0,
2512 0, 0, 0, 166, 0, 0, 0, 0, 0, 0,
2513 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2514 0, 0, 0, 0, 167, 168, 0, 0, 0, 75,
2515 76, 0, 0, 77, 0, 78, 169, 170, 171, 172,
2516 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002517 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
Chris Lattnerc5320232008-10-15 06:16:57 +00002518 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2519 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2520 0, 194, 195, 196, 0, 0, 197, 198, 199, 200,
2521 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2522 211, 212, 213, 214, 215, 216, 217, 218
Dan Gohman54392c12008-04-19 00:24:39 +00002523};
2524
2525static const yytype_int16 yycheck[] =
2526{
Chris Lattnerc5320232008-10-15 06:16:57 +00002527 0, 27, 158, 196, 11, 11, 0, 320, 239, 161,
2528 458, 4, 446, 447, 55, 28, 159, 17, 211, 212,
2529 213, 214, 215, 17, 266, 267, 21, 192, 221, 34,
2530 172, 11, 55, 656, 29, 55, 288, 536, 55, 193,
2531 11, 162, 162, 55, 162, 55, 162, 161, 169, 54,
2532 673, 171, 78, 171, 55, 171, 7, 8, 55, 10,
2533 11, 12, 13, 14, 15, 16, 17, 53, 19, 20,
2534 55, 22, 23, 24, 54, 59, 102, 156, 162, 158,
2535 106, 223, 68, 54, 336, 162, 112, 171, 161, 254,
2536 7, 256, 118, 93, 171, 162, 18, 240, 241, 50,
2537 534, 255, 19, 257, 171, 22, 162, 24, 41, 42,
2538 121, 32, 33, 169, 55, 48, 142, 143, 159, 11,
2539 146, 54, 42, 43, 44, 17, 152, 47, 169, 20,
2540 161, 630, 23, 375, 582, 161, 159, 636, 637, 159,
2541 151, 162, 159, 169, 167, 338, 167, 159, 165, 159,
2542 34, 163, 162, 163, 396, 397, 398, 170, 159, 160,
2543 167, 167, 159, 0, 612, 162, 163, 165, 194, 195,
2544 196, 197, 117, 118, 159, 160, 171, 170, 677, 678,
2545 161, 680, 681, 161, 210, 211, 212, 213, 214, 215,
2546 216, 217, 218, 219, 220, 221, 509, 19, 697, 698,
2547 22, 22, 24, 282, 162, 231, 285, 286, 287, 167,
2548 46, 404, 48, 164, 165, 54, 242, 168, 159, 170,
2549 171, 21, 163, 162, 156, 157, 158, 420, 167, 422,
2550 423, 424, 54, 7, 8, 477, 35, 22, 37, 552,
2551 42, 554, 44, 322, 22, 19, 20, 22, 22, 23,
2552 24, 330, 331, 332, 333, 334, 408, 141, 142, 143,
2553 144, 160, 146, 162, 132, 133, 150, 151, 4, 153,
2554 154, 155, 160, 299, 162, 160, 159, 162, 160, 431,
2555 162, 4, 121, 122, 160, 279, 162, 132, 133, 37,
2556 316, 317, 318, 62, 63, 64, 65, 66, 67, 121,
2557 122, 614, 141, 142, 166, 144, 145, 463, 147, 148,
2558 149, 337, 338, 132, 133, 166, 114, 115, 159, 141,
2559 142, 163, 144, 145, 4, 147, 148, 149, 84, 85,
2560 409, 410, 411, 412, 161, 22, 162, 160, 169, 418,
2561 4, 42, 43, 44, 45, 46, 47, 48, 49, 375,
2562 51, 160, 159, 432, 365, 366, 367, 368, 369, 370,
2563 371, 592, 555, 55, 57, 558, 559, 560, 11, 380,
2564 381, 382, 169, 22, 160, 159, 159, 159, 404, 159,
2565 159, 162, 408, 159, 463, 162, 159, 159, 159, 159,
2566 38, 4, 38, 159, 420, 421, 422, 423, 424, 162,
2567 162, 162, 162, 162, 430, 431, 485, 159, 159, 159,
2568 159, 490, 22, 492, 61, 162, 495, 162, 162, 165,
2569 162, 162, 448, 162, 162, 162, 505, 506, 162, 508,
2570 661, 162, 162, 664, 162, 162, 162, 169, 449, 450,
2571 451, 452, 162, 162, 38, 22, 472, 17, 17, 460,
2572 162, 477, 162, 162, 162, 156, 157, 158, 162, 4,
2573 162, 4, 162, 162, 162, 4, 545, 546, 162, 548,
2574 549, 550, 551, 162, 162, 22, 162, 556, 504, 162,
2575 38, 162, 4, 162, 510, 564, 160, 169, 159, 162,
2576 162, 570, 169, 4, 159, 54, 162, 160, 285, 286,
2577 287, 162, 162, 160, 530, 160, 22, 169, 519, 520,
2578 521, 522, 162, 524, 165, 167, 160, 528, 529, 160,
2579 160, 160, 17, 160, 160, 167, 160, 54, 607, 555,
2580 4, 152, 558, 559, 560, 322, 162, 159, 22, 159,
2581 17, 17, 17, 330, 331, 332, 333, 334, 94, 95,
2582 96, 97, 98, 99, 100, 101, 102, 103, 162, 73,
2583 17, 572, 573, 574, 575, 591, 652, 93, 631, 106,
2584 112, 17, 598, 231, 242, 90, 655, 57, 133, 613,
2585 659, 660, 453, 141, 142, 143, 144, 613, 146, 133,
2586 590, -1, 150, 151, -1, 153, 154, 155, -1, -1,
2587 -1, -1, -1, -1, -1, -1, -1, -1, 619, -1,
2588 621, 622, 691, 692, -1, 694, -1, 696, -1, -1,
2589 -1, 700, 409, 410, 411, 412, -1, 706, -1, -1,
2590 -1, 418, -1, -1, 7, 8, 662, 10, 11, 12,
2591 13, 14, 15, 16, 17, 432, 19, 20, -1, 22,
2592 23, 24, 652, -1, -1, -1, 7, 8, -1, 10,
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00002593 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Chris Lattnerc5320232008-10-15 06:16:57 +00002594 -1, 22, 23, 24, -1, -1, -1, 50, -1, -1,
2595 141, 142, 143, 144, -1, 146, -1, -1, 39, 150,
2596 151, -1, 153, 154, 155, -1, -1, -1, 485, 50,
2597 -1, -1, -1, 490, -1, 492, -1, -1, 495, -1,
2598 -1, -1, -1, -1, -1, -1, -1, -1, 505, 506,
2599 -1, 508, -1, -1, -1, -1, -1, -1, -1, -1,
2600 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
Devang Patelcd842482008-09-29 20:49:50 +00002601 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
Chris Lattnerc5320232008-10-15 06:16:57 +00002602 -1, 19, 20, -1, 22, 23, 24, -1, 545, 546,
2603 -1, 548, 549, 550, 551, -1, -1, -1, -1, 556,
2604 -1, -1, -1, -1, -1, -1, -1, 564, -1, -1,
2605 -1, -1, 50, 570, -1, -1, -1, -1, -1, -1,
2606 -1, 164, 165, -1, -1, 168, -1, 170, 171, -1,
2607 -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
2608 8, 9, -1, 164, 165, 0, -1, 168, -1, 170,
2609 607, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2610 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2611 -1, -1, 40, 41, -1, 30, 31, -1, -1, -1,
2612 -1, -1, -1, -1, -1, -1, 54, -1, -1, -1,
2613 -1, 59, -1, -1, -1, -1, -1, 52, 655, -1,
2614 -1, 56, 659, 660, -1, 60, -1, 75, 76, 77,
2615 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2616 88, 89, 90, 91, 92, 93, 164, 165, -1, -1,
2617 168, -1, 170, 171, 691, 692, -1, 694, -1, 696,
2618 -1, -1, -1, 700, -1, -1, -1, -1, -1, 706,
2619 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2620 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2621 -1, 139, 140, 141, 142, -1, 144, 145, -1, 147,
2622 148, 149, -1, -1, -1, -1, -1, -1, -1, 3,
2623 4, 5, 6, 7, 8, 9, -1, 165, -1, -1,
2624 168, -1, 170, -1, 172, 19, 20, -1, 22, 23,
2625 24, 25, 26, 27, 26, 27, -1, -1, -1, -1,
2626 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
Dale Johannesenf4581482008-09-26 19:32:34 +00002627 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002628 -1, 55, -1, 7, 8, 59, 10, 11, 12, 13,
2629 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2630 24, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2631 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2632 -1, -1, -1, -1, -1, -1, 50, -1, 100, 101,
2633 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2634 112, 113, -1, -1, -1, 119, 120, 121, 122, 123,
2635 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2636 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
2637 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2638 -1, -1, -1, -1, -1, 159, -1, -1, -1, -1,
2639 -1, 165, -1, -1, 168, -1, 170, -1, 172, 3,
2640 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2641 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2642 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2643 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2644 164, 165, -1, -1, 168, -1, 170, 171, -1, -1,
2645 -1, 55, 7, 8, -1, 10, 11, 12, 13, 14,
Dale Johannesenf4581482008-09-26 19:32:34 +00002646 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Chris Lattnerc5320232008-10-15 06:16:57 +00002647 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2648 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2649 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
Devang Patelcd842482008-09-29 20:49:50 +00002650 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002651 -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
2652 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2653 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002654 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002655 -1, -1, -1, -1, -1, 159, -1, -1, -1, 163,
2656 -1, 165, -1, -1, 168, -1, 170, -1, 172, 3,
2657 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2658 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2659 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2660 -1, -1, -1, -1, -1, -1, 40, 41, -1, 164,
2661 165, -1, -1, 168, -1, 170, 171, -1, -1, -1,
2662 -1, 55, 7, 8, -1, 10, 11, 12, 13, 14,
2663 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2664 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2665 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2666 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
Chris Lattner906773a2008-08-29 17:20:18 +00002667 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002668 -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
2669 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2670 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
2671 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2672 -1, -1, -1, -1, -1, 159, -1, -1, -1, -1,
2673 -1, 165, -1, -1, 168, -1, 170, -1, 172, 3,
2674 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2675 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2676 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2677 -1, -1, -1, -1, -1, -1, 40, 41, -1, 164,
2678 165, -1, -1, 168, -1, 170, 171, -1, -1, -1,
2679 -1, -1, -1, 7, 8, 59, 10, 11, 12, 13,
2680 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2681 24, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2682 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2683 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2684 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2685 23, 24, -1, -1, -1, 119, 120, 121, 122, 123,
2686 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2687 -1, 135, 136, 137, -1, 139, 140, 50, -1, -1,
2688 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
2689 6, -1, -1, 9, -1, -1, -1, -1, -1, -1,
2690 -1, 165, -1, -1, 168, -1, 170, -1, 172, 25,
2691 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2692 -1, -1, -1, -1, 40, 41, -1, 141, 142, -1,
2693 144, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2694 -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
2695 164, 165, 125, -1, 168, -1, 170, -1, -1, 75,
Chris Lattner8f5544c2008-10-15 06:03:48 +00002696 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2697 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
Chris Lattnerc5320232008-10-15 06:16:57 +00002698 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2699 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2700 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2701 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2702 136, 137, -1, 139, 140, 7, 8, -1, 10, 11,
2703 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2704 22, 23, 24, -1, -1, -1, -1, -1, -1, 165,
2705 -1, -1, 168, -1, 170, -1, 172, 39, -1, -1,
2706 -1, -1, -1, -1, -1, -1, 7, 8, 50, 10,
2707 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2708 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2709 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2710 23, 24, -1, -1, -1, -1, -1, 7, 8, 50,
2711 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2712 20, -1, 22, 23, 24, 7, 8, 50, 10, 11,
2713 12, 13, 14, 15, 16, 17, -1, 19, 20, 39,
2714 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2715 50, -1, -1, -1, -1, -1, -1, 39, -1, -1,
2716 -1, -1, -1, -1, -1, -1, -1, -1, 50, -1,
2717 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2718 -1, -1, 164, 165, -1, -1, 168, -1, 170, 7,
2719 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2720 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2721 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2722 -1, -1, -1, 164, 165, -1, 167, 168, -1, 170,
2723 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2724 -1, 164, 165, -1, 167, 168, -1, 170, -1, -1,
2725 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2726 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2727 170, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2728 -1, -1, 164, 165, -1, -1, 168, -1, 170, 7,
2729 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2730 -1, 19, 20, -1, 22, 23, 24, -1, 7, 8,
2731 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2732 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2733 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2734 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2735 168, 50, 170, 7, 8, -1, 10, 11, 12, 13,
2736 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2737 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2738 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2739 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2740 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2741 23, 24, 7, 8, 50, 10, 11, 12, 13, 14,
2742 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2743 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2744 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2745 168, -1, 170, -1, -1, 50, -1, 0, -1, -1,
2746 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2747 -1, 170, -1, -1, -1, 18, 19, 20, -1, 22,
2748 23, 24, -1, -1, -1, -1, -1, 30, 31, -1,
2749 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2750 -1, -1, -1, -1, -1, -1, -1, -1, -1, 52,
2751 164, 165, -1, 56, 168, -1, 170, 60, -1, -1,
2752 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2753 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2754 -1, -1, -1, 36, -1, -1, -1, -1, -1, -1,
2755 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2756 -1, -1, -1, -1, 57, 58, -1, -1, -1, 164,
2757 165, -1, -1, 168, -1, 170, 69, 70, 71, 72,
2758 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2759 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2760 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2761 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2762 -1, 114, 115, 116, -1, -1, 119, 120, 121, 122,
2763 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2764 133, 134, 135, 136, 137, 138, 139, 140
Dan Gohman54392c12008-04-19 00:24:39 +00002765};
2766
2767/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2768 symbol of state STATE-NUM. */
Dale Johannesen9cdf0652008-08-13 18:41:46 +00002769static const yytype_uint16 yystos[] =
Dan Gohman54392c12008-04-19 00:24:39 +00002770{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002771 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Chris Lattnerc5320232008-10-15 06:16:57 +00002772 60, 179, 182, 184, 185, 186, 220, 221, 222, 224,
2773 223, 53, 68, 229, 161, 59, 161, 18, 161, 42,
Devang Patelcd842482008-09-29 20:49:50 +00002774 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
Chris Lattnerc5320232008-10-15 06:16:57 +00002775 158, 187, 188, 189, 0, 222, 46, 48, 190, 239,
2776 42, 43, 44, 47, 191, 236, 238, 246, 161, 161,
2777 165, 230, 22, 228, 7, 8, 10, 11, 12, 13,
2778 14, 15, 16, 17, 50, 164, 165, 168, 170, 179,
2779 184, 207, 208, 242, 189, 189, 35, 37, 218, 189,
2780 189, 21, 247, 248, 29, 171, 237, 247, 22, 22,
2781 22, 231, 159, 4, 4, 4, 170, 10, 171, 208,
2782 213, 55, 159, 181, 218, 218, 42, 44, 192, 32,
2783 33, 217, 62, 63, 64, 65, 66, 67, 193, 234,
2784 234, 7, 182, 183, 251, 162, 167, 39, 208, 209,
2785 211, 212, 166, 166, 171, 213, 162, 171, 159, 212,
2786 163, 217, 217, 10, 125, 208, 210, 219, 208, 214,
2787 4, 197, 28, 170, 235, 161, 36, 57, 58, 69,
2788 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2789 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2790 90, 91, 92, 93, 114, 115, 116, 119, 120, 121,
2791 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2792 132, 133, 134, 135, 136, 137, 138, 139, 140, 174,
2793 175, 176, 249, 256, 257, 258, 259, 249, 257, 22,
2794 195, 162, 160, 208, 208, 169, 171, 208, 4, 160,
2795 214, 208, 159, 242, 3, 4, 5, 6, 9, 25,
2796 26, 27, 40, 41, 90, 91, 92, 93, 119, 133,
2797 135, 136, 137, 139, 140, 165, 168, 170, 172, 174,
2798 175, 176, 215, 242, 181, 141, 142, 144, 196, 210,
2799 57, 10, 208, 244, 245, 11, 17, 11, 193, 94,
2800 95, 96, 97, 98, 99, 100, 101, 102, 103, 177,
2801 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2802 108, 109, 110, 111, 112, 113, 178, 177, 178, 208,
2803 208, 244, 208, 208, 252, 244, 244, 244, 244, 244,
2804 208, 208, 208, 208, 208, 244, 193, 117, 118, 54,
2805 121, 122, 141, 142, 144, 145, 147, 148, 149, 194,
2806 39, 209, 199, 167, 169, 169, 160, 199, 181, 181,
2807 219, 177, 178, 177, 178, 159, 159, 159, 159, 159,
2808 159, 159, 167, 214, 216, 170, 216, 171, 216, 22,
2809 159, 159, 159, 225, 184, 3, 4, 5, 6, 9,
2810 25, 26, 27, 40, 41, 59, 165, 168, 170, 172,
2811 215, 241, 242, 243, 162, 243, 243, 243, 197, 208,
2812 208, 208, 208, 162, 202, 162, 202, 243, 165, 162,
2813 162, 162, 162, 162, 162, 243, 243, 243, 243, 243,
2814 38, 197, 208, 244, 4, 141, 142, 143, 144, 146,
2815 150, 151, 153, 154, 155, 198, 226, 227, 38, 159,
2816 159, 159, 159, 214, 214, 214, 214, 214, 214, 214,
2817 162, 167, 171, 208, 216, 169, 171, 214, 214, 214,
2818 162, 205, 159, 61, 240, 167, 216, 170, 216, 171,
2819 216, 22, 244, 162, 162, 210, 243, 243, 243, 243,
2820 11, 54, 11, 254, 243, 165, 244, 208, 244, 244,
2821 244, 162, 162, 255, 162, 162, 162, 208, 210, 243,
2822 162, 205, 205, 208, 214, 214, 214, 214, 254, 162,
2823 162, 162, 162, 255, 162, 214, 169, 171, 162, 162,
2824 38, 34, 54, 203, 206, 39, 208, 232, 233, 22,
2825 167, 171, 216, 169, 171, 17, 17, 243, 162, 162,
2826 162, 162, 243, 4, 243, 162, 162, 243, 162, 162,
2827 162, 4, 4, 162, 208, 243, 243, 243, 162, 202,
2828 208, 160, 162, 162, 162, 162, 160, 214, 214, 214,
2829 214, 160, 214, 169, 214, 214, 208, 22, 4, 205,
2830 195, 162, 160, 162, 169, 171, 243, 243, 159, 243,
2831 243, 243, 243, 202, 202, 244, 243, 162, 244, 244,
2832 244, 4, 243, 159, 243, 214, 214, 214, 214, 162,
2833 160, 162, 162, 255, 160, 160, 160, 179, 180, 39,
2834 208, 199, 22, 169, 162, 165, 17, 208, 253, 167,
2835 243, 255, 253, 202, 160, 160, 160, 160, 214, 214,
2836 214, 160, 195, 203, 204, 17, 11, 167, 250, 195,
2837 195, 160, 162, 167, 160, 160, 160, 160, 180, 54,
2838 201, 243, 241, 11, 167, 121, 122, 243, 243, 199,
2839 17, 208, 199, 4, 152, 200, 162, 241, 195, 195,
2840 38, 195, 195, 22, 17, 162, 17, 243, 243, 243,
2841 17, 243, 195, 195, 243, 73, 17, 243
Dan Gohman54392c12008-04-19 00:24:39 +00002842};
David Greene9145dd22007-08-01 03:59:32 +00002843
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002844#define yyerrok (yyerrstatus = 0)
2845#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002846#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002847#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002848
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002849#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002850#define YYABORT goto yyabortlab
2851#define YYERROR goto yyerrorlab
2852
2853
2854/* Like YYERROR except do call yyerror. This remains here temporarily
2855 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002856 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002857
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002858#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002859
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002860#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002861
2862#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002863do \
2864 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002865 { \
2866 yychar = (Token); \
2867 yylval = (Value); \
2868 yytoken = YYTRANSLATE (yychar); \
2869 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002870 goto yybackup; \
2871 } \
2872 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002873 { \
2874 yyerror (YY_("syntax error: cannot back up")); \
2875 YYERROR; \
2876 } \
2877while (YYID (0))
2878
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002879
2880#define YYTERROR 1
2881#define YYERRCODE 256
2882
Dan Gohman54392c12008-04-19 00:24:39 +00002883
2884/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2885 If N is 0, then set CURRENT to the empty location which ends
2886 the previous symbol: RHS[0] (always defined). */
2887
2888#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2889#ifndef YYLLOC_DEFAULT
2890# define YYLLOC_DEFAULT(Current, Rhs, N) \
2891 do \
2892 if (YYID (N)) \
2893 { \
2894 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2895 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2896 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2897 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2898 } \
2899 else \
2900 { \
2901 (Current).first_line = (Current).last_line = \
2902 YYRHSLOC (Rhs, 0).last_line; \
2903 (Current).first_column = (Current).last_column = \
2904 YYRHSLOC (Rhs, 0).last_column; \
2905 } \
2906 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002907#endif
2908
Dan Gohman54392c12008-04-19 00:24:39 +00002909
2910/* YY_LOCATION_PRINT -- Print the location on the stream.
2911 This macro was not mandated originally: define only if we know
2912 we won't break user code: when these are the locations we know. */
2913
2914#ifndef YY_LOCATION_PRINT
Nuno Lopes37e4b7a2008-10-15 11:11:12 +00002915# if YYLTYPE_IS_TRIVIAL
Dan Gohman54392c12008-04-19 00:24:39 +00002916# define YY_LOCATION_PRINT(File, Loc) \
2917 fprintf (File, "%d.%d-%d.%d", \
2918 (Loc).first_line, (Loc).first_column, \
2919 (Loc).last_line, (Loc).last_column)
2920# else
2921# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2922# endif
2923#endif
2924
2925
2926/* YYLEX -- calling `yylex' with the right arguments. */
2927
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002928#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002929# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002930#else
Dan Gohman54392c12008-04-19 00:24:39 +00002931# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002932#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002933
2934/* Enable debugging if requested. */
2935#if YYDEBUG
2936
2937# ifndef YYFPRINTF
2938# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2939# define YYFPRINTF fprintf
2940# endif
2941
2942# define YYDPRINTF(Args) \
2943do { \
2944 if (yydebug) \
2945 YYFPRINTF Args; \
2946} while (YYID (0))
2947
2948# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2949do { \
2950 if (yydebug) \
2951 { \
2952 YYFPRINTF (stderr, "%s ", Title); \
2953 yy_symbol_print (stderr, \
2954 Type, Value); \
2955 YYFPRINTF (stderr, "\n"); \
2956 } \
2957} while (YYID (0))
2958
2959
2960/*--------------------------------.
2961| Print this symbol on YYOUTPUT. |
2962`--------------------------------*/
2963
2964/*ARGSUSED*/
2965#if (defined __STDC__ || defined __C99__FUNC__ \
2966 || defined __cplusplus || defined _MSC_VER)
2967static void
2968yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002969#else
Dan Gohman54392c12008-04-19 00:24:39 +00002970static void
2971yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2972 FILE *yyoutput;
2973 int yytype;
2974 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002975#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002976{
2977 if (!yyvaluep)
2978 return;
2979# ifdef YYPRINT
2980 if (yytype < YYNTOKENS)
2981 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2982# else
2983 YYUSE (yyoutput);
2984# endif
2985 switch (yytype)
2986 {
2987 default:
2988 break;
2989 }
2990}
2991
2992
2993/*--------------------------------.
2994| Print this symbol on YYOUTPUT. |
2995`--------------------------------*/
2996
2997#if (defined __STDC__ || defined __C99__FUNC__ \
2998 || defined __cplusplus || defined _MSC_VER)
2999static void
3000yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3001#else
3002static void
3003yy_symbol_print (yyoutput, yytype, yyvaluep)
3004 FILE *yyoutput;
3005 int yytype;
3006 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00003007#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003008{
3009 if (yytype < YYNTOKENS)
3010 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3011 else
3012 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00003013
Dan Gohman54392c12008-04-19 00:24:39 +00003014 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3015 YYFPRINTF (yyoutput, ")");
3016}
Chris Lattner59363a32008-02-19 04:36:25 +00003017
Dan Gohman54392c12008-04-19 00:24:39 +00003018/*------------------------------------------------------------------.
3019| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3020| TOP (included). |
3021`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00003022
Dan Gohman54392c12008-04-19 00:24:39 +00003023#if (defined __STDC__ || defined __C99__FUNC__ \
3024 || defined __cplusplus || defined _MSC_VER)
3025static void
3026yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3027#else
3028static void
3029yy_stack_print (bottom, top)
3030 yytype_int16 *bottom;
3031 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00003032#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003033{
3034 YYFPRINTF (stderr, "Stack now");
3035 for (; bottom <= top; ++bottom)
3036 YYFPRINTF (stderr, " %d", *bottom);
3037 YYFPRINTF (stderr, "\n");
3038}
Chris Lattner59363a32008-02-19 04:36:25 +00003039
Dan Gohman54392c12008-04-19 00:24:39 +00003040# define YY_STACK_PRINT(Bottom, Top) \
3041do { \
3042 if (yydebug) \
3043 yy_stack_print ((Bottom), (Top)); \
3044} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00003045
Dan Gohman54392c12008-04-19 00:24:39 +00003046
3047/*------------------------------------------------.
3048| Report that the YYRULE is going to be reduced. |
3049`------------------------------------------------*/
3050
3051#if (defined __STDC__ || defined __C99__FUNC__ \
3052 || defined __cplusplus || defined _MSC_VER)
3053static void
3054yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3055#else
3056static void
3057yy_reduce_print (yyvsp, yyrule)
3058 YYSTYPE *yyvsp;
3059 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00003060#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003061{
3062 int yynrhs = yyr2[yyrule];
3063 int yyi;
3064 unsigned long int yylno = yyrline[yyrule];
3065 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3066 yyrule - 1, yylno);
3067 /* The symbols being reduced. */
3068 for (yyi = 0; yyi < yynrhs; yyi++)
3069 {
3070 fprintf (stderr, " $%d = ", yyi + 1);
3071 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3072 &(yyvsp[(yyi + 1) - (yynrhs)])
3073 );
3074 fprintf (stderr, "\n");
3075 }
3076}
Scott Michel5a6f17b2008-01-30 02:55:46 +00003077
Dan Gohman54392c12008-04-19 00:24:39 +00003078# define YY_REDUCE_PRINT(Rule) \
3079do { \
3080 if (yydebug) \
3081 yy_reduce_print (yyvsp, Rule); \
3082} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00003083
Dan Gohman54392c12008-04-19 00:24:39 +00003084/* Nonzero means print parse trace. It is left uninitialized so that
3085 multiple parsers can coexist. */
3086int yydebug;
3087#else /* !YYDEBUG */
3088# define YYDPRINTF(Args)
3089# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3090# define YY_STACK_PRINT(Bottom, Top)
3091# define YY_REDUCE_PRINT(Rule)
3092#endif /* !YYDEBUG */
3093
3094
3095/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003096#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003097# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003098#endif
3099
Dan Gohman54392c12008-04-19 00:24:39 +00003100/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3101 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003102
Dan Gohman54392c12008-04-19 00:24:39 +00003103 Do not make this value too large; the results are undefined if
3104 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3105 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00003106
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003107#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003108# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003109#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003110
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003111
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003112
Dan Gohman54392c12008-04-19 00:24:39 +00003113#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003114
Dan Gohman54392c12008-04-19 00:24:39 +00003115# ifndef yystrlen
3116# if defined __GLIBC__ && defined _STRING_H
3117# define yystrlen strlen
3118# else
3119/* Return the length of YYSTR. */
3120#if (defined __STDC__ || defined __C99__FUNC__ \
3121 || defined __cplusplus || defined _MSC_VER)
3122static YYSIZE_T
3123yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00003124#else
Dan Gohman54392c12008-04-19 00:24:39 +00003125static YYSIZE_T
3126yystrlen (yystr)
3127 const char *yystr;
3128#endif
3129{
3130 YYSIZE_T yylen;
3131 for (yylen = 0; yystr[yylen]; yylen++)
3132 continue;
3133 return yylen;
3134}
3135# endif
3136# endif
3137
3138# ifndef yystpcpy
3139# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3140# define yystpcpy stpcpy
3141# else
3142/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3143 YYDEST. */
3144#if (defined __STDC__ || defined __C99__FUNC__ \
3145 || defined __cplusplus || defined _MSC_VER)
3146static char *
3147yystpcpy (char *yydest, const char *yysrc)
3148#else
3149static char *
3150yystpcpy (yydest, yysrc)
3151 char *yydest;
3152 const char *yysrc;
3153#endif
3154{
3155 char *yyd = yydest;
3156 const char *yys = yysrc;
3157
3158 while ((*yyd++ = *yys++) != '\0')
3159 continue;
3160
3161 return yyd - 1;
3162}
3163# endif
3164# endif
3165
3166# ifndef yytnamerr
3167/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3168 quotes and backslashes, so that it's suitable for yyerror. The
3169 heuristic is that double-quoting is unnecessary unless the string
3170 contains an apostrophe, a comma, or backslash (other than
3171 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3172 null, do not copy; instead, return the length of what the result
3173 would have been. */
3174static YYSIZE_T
3175yytnamerr (char *yyres, const char *yystr)
3176{
3177 if (*yystr == '"')
3178 {
3179 YYSIZE_T yyn = 0;
3180 char const *yyp = yystr;
3181
3182 for (;;)
3183 switch (*++yyp)
3184 {
3185 case '\'':
3186 case ',':
3187 goto do_not_strip_quotes;
3188
3189 case '\\':
3190 if (*++yyp != '\\')
3191 goto do_not_strip_quotes;
3192 /* Fall through. */
3193 default:
3194 if (yyres)
3195 yyres[yyn] = *yyp;
3196 yyn++;
3197 break;
3198
3199 case '"':
3200 if (yyres)
3201 yyres[yyn] = '\0';
3202 return yyn;
3203 }
3204 do_not_strip_quotes: ;
3205 }
3206
3207 if (! yyres)
3208 return yystrlen (yystr);
3209
3210 return yystpcpy (yyres, yystr) - yyres;
3211}
3212# endif
3213
3214/* Copy into YYRESULT an error message about the unexpected token
3215 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3216 including the terminating null byte. If YYRESULT is null, do not
3217 copy anything; just return the number of bytes that would be
3218 copied. As a special case, return 0 if an ordinary "syntax error"
3219 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3220 size calculation. */
3221static YYSIZE_T
3222yysyntax_error (char *yyresult, int yystate, int yychar)
3223{
3224 int yyn = yypact[yystate];
3225
3226 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3227 return 0;
3228 else
3229 {
3230 int yytype = YYTRANSLATE (yychar);
3231 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3232 YYSIZE_T yysize = yysize0;
3233 YYSIZE_T yysize1;
3234 int yysize_overflow = 0;
3235 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3236 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3237 int yyx;
3238
3239# if 0
3240 /* This is so xgettext sees the translatable formats that are
3241 constructed on the fly. */
3242 YY_("syntax error, unexpected %s");
3243 YY_("syntax error, unexpected %s, expecting %s");
3244 YY_("syntax error, unexpected %s, expecting %s or %s");
3245 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3246 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3247# endif
3248 char *yyfmt;
3249 char const *yyf;
3250 static char const yyunexpected[] = "syntax error, unexpected %s";
3251 static char const yyexpecting[] = ", expecting %s";
3252 static char const yyor[] = " or %s";
3253 char yyformat[sizeof yyunexpected
3254 + sizeof yyexpecting - 1
3255 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3256 * (sizeof yyor - 1))];
3257 char const *yyprefix = yyexpecting;
3258
3259 /* Start YYX at -YYN if negative to avoid negative indexes in
3260 YYCHECK. */
3261 int yyxbegin = yyn < 0 ? -yyn : 0;
3262
3263 /* Stay within bounds of both yycheck and yytname. */
3264 int yychecklim = YYLAST - yyn + 1;
3265 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3266 int yycount = 1;
3267
3268 yyarg[0] = yytname[yytype];
3269 yyfmt = yystpcpy (yyformat, yyunexpected);
3270
3271 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3272 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3273 {
3274 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3275 {
3276 yycount = 1;
3277 yysize = yysize0;
3278 yyformat[sizeof yyunexpected - 1] = '\0';
3279 break;
3280 }
3281 yyarg[yycount++] = yytname[yyx];
3282 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3283 yysize_overflow |= (yysize1 < yysize);
3284 yysize = yysize1;
3285 yyfmt = yystpcpy (yyfmt, yyprefix);
3286 yyprefix = yyor;
3287 }
3288
3289 yyf = YY_(yyformat);
3290 yysize1 = yysize + yystrlen (yyf);
3291 yysize_overflow |= (yysize1 < yysize);
3292 yysize = yysize1;
3293
3294 if (yysize_overflow)
3295 return YYSIZE_MAXIMUM;
3296
3297 if (yyresult)
3298 {
3299 /* Avoid sprintf, as that infringes on the user's name space.
3300 Don't have undefined behavior even if the translation
3301 produced a string with the wrong number of "%s"s. */
3302 char *yyp = yyresult;
3303 int yyi = 0;
3304 while ((*yyp = *yyf) != '\0')
3305 {
3306 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3307 {
3308 yyp += yytnamerr (yyp, yyarg[yyi++]);
3309 yyf += 2;
3310 }
3311 else
3312 {
3313 yyp++;
3314 yyf++;
3315 }
3316 }
3317 }
3318 return yysize;
3319 }
3320}
3321#endif /* YYERROR_VERBOSE */
3322
3323
3324/*-----------------------------------------------.
3325| Release the memory associated to this symbol. |
3326`-----------------------------------------------*/
3327
3328/*ARGSUSED*/
3329#if (defined __STDC__ || defined __C99__FUNC__ \
3330 || defined __cplusplus || defined _MSC_VER)
3331static void
3332yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3333#else
3334static void
3335yydestruct (yymsg, yytype, yyvaluep)
3336 const char *yymsg;
3337 int yytype;
3338 YYSTYPE *yyvaluep;
3339#endif
3340{
3341 YYUSE (yyvaluep);
3342
3343 if (!yymsg)
3344 yymsg = "Deleting";
3345 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3346
3347 switch (yytype)
3348 {
3349
3350 default:
3351 break;
3352 }
3353}
3354
3355
3356/* Prevent warnings from -Wmissing-prototypes. */
3357
3358#ifdef YYPARSE_PARAM
3359#if defined __STDC__ || defined __cplusplus
3360int yyparse (void *YYPARSE_PARAM);
3361#else
3362int yyparse ();
3363#endif
3364#else /* ! YYPARSE_PARAM */
3365#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003366int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003367#else
Dan Gohman54392c12008-04-19 00:24:39 +00003368int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003369#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003370#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003371
Chris Lattner59363a32008-02-19 04:36:25 +00003372
Dan Gohman54392c12008-04-19 00:24:39 +00003373
3374/* The look-ahead symbol. */
3375int yychar;
3376
3377/* The semantic value of the look-ahead symbol. */
3378YYSTYPE yylval;
3379
3380/* Number of syntax errors so far. */
3381int yynerrs;
3382
3383
3384
3385/*----------.
3386| yyparse. |
3387`----------*/
3388
3389#ifdef YYPARSE_PARAM
3390#if (defined __STDC__ || defined __C99__FUNC__ \
3391 || defined __cplusplus || defined _MSC_VER)
3392int
3393yyparse (void *YYPARSE_PARAM)
3394#else
3395int
3396yyparse (YYPARSE_PARAM)
3397 void *YYPARSE_PARAM;
3398#endif
3399#else /* ! YYPARSE_PARAM */
3400#if (defined __STDC__ || defined __C99__FUNC__ \
3401 || defined __cplusplus || defined _MSC_VER)
3402int
3403yyparse (void)
3404#else
3405int
3406yyparse ()
3407
Gabor Greif89f01162008-04-06 23:07:54 +00003408#endif
3409#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003410{
3411
3412 int yystate;
3413 int yyn;
3414 int yyresult;
3415 /* Number of tokens to shift before error messages enabled. */
3416 int yyerrstatus;
3417 /* Look-ahead token as an internal (translated) token number. */
3418 int yytoken = 0;
3419#if YYERROR_VERBOSE
3420 /* Buffer for error messages, and its allocated size. */
3421 char yymsgbuf[128];
3422 char *yymsg = yymsgbuf;
3423 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003424#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003425
Dan Gohman54392c12008-04-19 00:24:39 +00003426 /* Three stacks and their tools:
3427 `yyss': related to states,
3428 `yyvs': related to semantic values,
3429 `yyls': related to locations.
3430
3431 Refer to the stacks thru separate pointers, to allow yyoverflow
3432 to reallocate them elsewhere. */
3433
3434 /* The state stack. */
3435 yytype_int16 yyssa[YYINITDEPTH];
3436 yytype_int16 *yyss = yyssa;
3437 yytype_int16 *yyssp;
3438
3439 /* The semantic value stack. */
3440 YYSTYPE yyvsa[YYINITDEPTH];
3441 YYSTYPE *yyvs = yyvsa;
3442 YYSTYPE *yyvsp;
3443
3444
3445
3446#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3447
3448 YYSIZE_T yystacksize = YYINITDEPTH;
3449
3450 /* The variables used to return semantic value and location from the
3451 action routines. */
3452 YYSTYPE yyval;
3453
3454
3455 /* The number of symbols on the RHS of the reduced rule.
3456 Keep to zero when no symbol should be popped. */
3457 int yylen = 0;
3458
3459 YYDPRINTF ((stderr, "Starting parse\n"));
3460
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003461 yystate = 0;
3462 yyerrstatus = 0;
3463 yynerrs = 0;
3464 yychar = YYEMPTY; /* Cause a token to be read. */
3465
3466 /* Initialize stack pointers.
3467 Waste one element of value and location stack
3468 so that they stay on the same level as the state stack.
3469 The wasted elements are never initialized. */
3470
Dan Gohman54392c12008-04-19 00:24:39 +00003471 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003472 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003473
Dan Gohman54392c12008-04-19 00:24:39 +00003474 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003475
Dan Gohman54392c12008-04-19 00:24:39 +00003476/*------------------------------------------------------------.
3477| yynewstate -- Push a new state, which is found in yystate. |
3478`------------------------------------------------------------*/
3479 yynewstate:
3480 /* In all cases, when you get here, the value and location stacks
3481 have just been pushed. So pushing a state here evens the stacks. */
3482 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003483
Dan Gohman54392c12008-04-19 00:24:39 +00003484 yysetstate:
3485 *yyssp = yystate;
3486
3487 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003488 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003489 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003490 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003491
3492#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003493 {
3494 /* Give user a chance to reallocate the stack. Use copies of
3495 these so that the &'s don't force the real ones into
3496 memory. */
3497 YYSTYPE *yyvs1 = yyvs;
3498 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003499
Dan Gohman54392c12008-04-19 00:24:39 +00003500
3501 /* Each stack pointer address is followed by the size of the
3502 data in use in that stack, in bytes. This used to be a
3503 conditional around just the two extra args, but that might
3504 be undefined if yyoverflow is a macro. */
3505 yyoverflow (YY_("memory exhausted"),
3506 &yyss1, yysize * sizeof (*yyssp),
3507 &yyvs1, yysize * sizeof (*yyvsp),
3508
3509 &yystacksize);
3510
3511 yyss = yyss1;
3512 yyvs = yyvs1;
3513 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003514#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003515# ifndef YYSTACK_RELOCATE
3516 goto yyexhaustedlab;
3517# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003518 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003519 if (YYMAXDEPTH <= yystacksize)
3520 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003521 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003522 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003523 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003524
3525 {
3526 yytype_int16 *yyss1 = yyss;
3527 union yyalloc *yyptr =
3528 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3529 if (! yyptr)
3530 goto yyexhaustedlab;
3531 YYSTACK_RELOCATE (yyss);
3532 YYSTACK_RELOCATE (yyvs);
3533
3534# undef YYSTACK_RELOCATE
3535 if (yyss1 != yyssa)
3536 YYSTACK_FREE (yyss1);
3537 }
3538# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003539#endif /* no yyoverflow */
3540
Dan Gohman54392c12008-04-19 00:24:39 +00003541 yyssp = yyss + yysize - 1;
3542 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003543
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003544
Dan Gohman54392c12008-04-19 00:24:39 +00003545 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3546 (unsigned long int) yystacksize));
3547
3548 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003549 YYABORT;
3550 }
3551
Dan Gohman54392c12008-04-19 00:24:39 +00003552 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003553
3554 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003555
Dan Gohman54392c12008-04-19 00:24:39 +00003556/*-----------.
3557| yybackup. |
3558`-----------*/
3559yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003560
Dan Gohman54392c12008-04-19 00:24:39 +00003561 /* Do appropriate processing given the current state. Read a
3562 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003563
Dan Gohman54392c12008-04-19 00:24:39 +00003564 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003565 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003566 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003567 goto yydefault;
3568
Dan Gohman54392c12008-04-19 00:24:39 +00003569 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003570
Dan Gohman54392c12008-04-19 00:24:39 +00003571 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003572 if (yychar == YYEMPTY)
3573 {
Dan Gohman54392c12008-04-19 00:24:39 +00003574 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003575 yychar = YYLEX;
3576 }
3577
Dan Gohman54392c12008-04-19 00:24:39 +00003578 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003579 {
Dan Gohman54392c12008-04-19 00:24:39 +00003580 yychar = yytoken = YYEOF;
3581 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003582 }
3583 else
3584 {
Dan Gohman54392c12008-04-19 00:24:39 +00003585 yytoken = YYTRANSLATE (yychar);
3586 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003587 }
3588
Dan Gohman54392c12008-04-19 00:24:39 +00003589 /* If the proper action on seeing token YYTOKEN is to reduce or to
3590 detect an error, take that action. */
3591 yyn += yytoken;
3592 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003593 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003594 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003595 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003596 {
Dan Gohman54392c12008-04-19 00:24:39 +00003597 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003598 goto yyerrlab;
3599 yyn = -yyn;
3600 goto yyreduce;
3601 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003602
3603 if (yyn == YYFINAL)
3604 YYACCEPT;
3605
Dan Gohman54392c12008-04-19 00:24:39 +00003606 /* Count tokens shifted since error; after three, turn off error
3607 status. */
3608 if (yyerrstatus)
3609 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003610
Dan Gohman54392c12008-04-19 00:24:39 +00003611 /* Shift the look-ahead token. */
3612 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003613
Dan Gohman54392c12008-04-19 00:24:39 +00003614 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003615 if (yychar != YYEOF)
3616 yychar = YYEMPTY;
3617
Gabor Greif89f01162008-04-06 23:07:54 +00003618 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003619 *++yyvsp = yylval;
3620
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003621 goto yynewstate;
3622
Gabor Greif89f01162008-04-06 23:07:54 +00003623
Dan Gohman54392c12008-04-19 00:24:39 +00003624/*-----------------------------------------------------------.
3625| yydefault -- do the default action for the current state. |
3626`-----------------------------------------------------------*/
3627yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003628 yyn = yydefact[yystate];
3629 if (yyn == 0)
3630 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003631 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003632
Dan Gohman54392c12008-04-19 00:24:39 +00003633
3634/*-----------------------------.
3635| yyreduce -- Do a reduction. |
3636`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003637yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003638 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003639 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003640
Dan Gohman54392c12008-04-19 00:24:39 +00003641 /* If YYLEN is nonzero, implement the default value of the action:
3642 `$$ = $1'.
3643
3644 Otherwise, the following line sets YYVAL to garbage.
3645 This behavior is undocumented and Bison
3646 users should not rely upon it. Assigning to YYVAL
3647 unconditionally makes the parser a bit smaller, and it avoids a
3648 GCC warning that YYVAL may be used uninitialized. */
3649 yyval = yyvsp[1-yylen];
3650
3651
3652 YY_REDUCE_PRINT (yyn);
3653 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003654 {
Dan Gohman54392c12008-04-19 00:24:39 +00003655 case 29:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003656#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003657 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3658 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003659
Dan Gohman54392c12008-04-19 00:24:39 +00003660 case 30:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003661#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003662 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3663 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003664
Dan Gohman54392c12008-04-19 00:24:39 +00003665 case 31:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003666#line 1159 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003667 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3668 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003669
Dan Gohman54392c12008-04-19 00:24:39 +00003670 case 32:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003671#line 1159 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003672 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3673 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003674
Dan Gohman54392c12008-04-19 00:24:39 +00003675 case 33:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003676#line 1160 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003677 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3678 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003679
Dan Gohman54392c12008-04-19 00:24:39 +00003680 case 34:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003681#line 1160 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003682 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3683 break;
3684
3685 case 35:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003686#line 1161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003687 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3688 break;
3689
3690 case 36:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003691#line 1161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003692 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3693 break;
3694
3695 case 37:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003696#line 1162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003697 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3698 break;
3699
3700 case 38:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003701#line 1162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003702 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3703 break;
3704
3705 case 39:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003706#line 1166 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003707 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3708 break;
3709
3710 case 40:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003711#line 1166 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003712 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3713 break;
3714
3715 case 41:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003716#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003717 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3718 break;
3719
3720 case 42:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003721#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003722 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3723 break;
3724
3725 case 43:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003726#line 1168 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003727 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3728 break;
3729
3730 case 44:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003731#line 1168 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003732 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3733 break;
3734
3735 case 45:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003736#line 1169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003737 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3738 break;
3739
3740 case 46:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003741#line 1169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003742 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3743 break;
3744
3745 case 47:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003746#line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003747 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3748 break;
3749
3750 case 48:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003751#line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003752 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3753 break;
3754
3755 case 49:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003756#line 1171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003757 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3758 break;
3759
3760 case 50:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003761#line 1171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003762 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3763 break;
3764
3765 case 51:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003766#line 1172 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003767 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3768 break;
3769
3770 case 52:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003771#line 1172 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003772 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3773 break;
3774
3775 case 53:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003776#line 1173 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003777 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3778 break;
3779
3780 case 54:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003781#line 1174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003782 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3783 break;
3784
Chris Lattnerc5320232008-10-15 06:16:57 +00003785 case 59:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003786#line 1178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003787 { (yyval.StrVal) = 0; ;}
3788 break;
3789
Chris Lattnerc5320232008-10-15 06:16:57 +00003790 case 60:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003791#line 1180 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003792 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3793 break;
3794
Chris Lattnerc5320232008-10-15 06:16:57 +00003795 case 61:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003796#line 1181 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003797 { (yyval.UIntVal)=0; ;}
3798 break;
3799
Chris Lattnerc5320232008-10-15 06:16:57 +00003800 case 62:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003801#line 1185 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003802 {
3803 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003804 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003805 ;}
3806 break;
3807
Chris Lattnerc5320232008-10-15 06:16:57 +00003808 case 63:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003809#line 1189 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003810 {
3811 (yyval.StrVal) = 0;
3812 CHECK_FOR_ERROR
3813 ;}
3814 break;
3815
3816 case 64:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003817#line 1194 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003818 {
3819 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3820 CHECK_FOR_ERROR
3821;}
3822 break;
3823
Chris Lattner8f5544c2008-10-15 06:03:48 +00003824 case 68:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003825#line 1203 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003826 {
3827 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003828 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003829 ;}
3830 break;
3831
Chris Lattner8f5544c2008-10-15 06:03:48 +00003832 case 69:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003833#line 1208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003834 {
3835 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003836 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003837 ;}
3838 break;
3839
Chris Lattnerc5320232008-10-15 06:16:57 +00003840 case 70:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003841#line 1214 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003842 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3843 break;
3844
Chris Lattnerc5320232008-10-15 06:16:57 +00003845 case 71:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003846#line 1215 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003847 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3848 break;
3849
Chris Lattnerc5320232008-10-15 06:16:57 +00003850 case 72:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003851#line 1216 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003852 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3853 break;
3854
Chris Lattnerc5320232008-10-15 06:16:57 +00003855 case 73:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003856#line 1217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003857 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3858 break;
3859
Chris Lattnerc5320232008-10-15 06:16:57 +00003860 case 74:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003861#line 1218 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003862 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3863 break;
3864
Chris Lattnerc5320232008-10-15 06:16:57 +00003865 case 75:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003866#line 1219 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003867 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003868 break;
3869
Chris Lattnerc5320232008-10-15 06:16:57 +00003870 case 76:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003871#line 1223 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003872 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003873 break;
3874
Chris Lattnerc5320232008-10-15 06:16:57 +00003875 case 77:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003876#line 1224 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003877 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003878 break;
3879
Chris Lattnerc5320232008-10-15 06:16:57 +00003880 case 78:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003881#line 1225 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003882 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3883 break;
3884
3885 case 79:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003886#line 1229 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00003887 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3888 break;
3889
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003890 case 80:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003891#line 1230 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003892 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3893 break;
3894
3895 case 81:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003896#line 1231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003897 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3898 break;
3899
3900 case 82:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003901#line 1232 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003902 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3903 break;
3904
3905 case 83:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003906#line 1236 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003907 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003908 break;
3909
Chris Lattner8f5544c2008-10-15 06:03:48 +00003910 case 84:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003911#line 1237 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003912 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003913 break;
3914
Chris Lattnerc5320232008-10-15 06:16:57 +00003915 case 85:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003916#line 1238 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003917 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmane5febe42008-05-31 00:58:22 +00003918 break;
3919
Chris Lattnerc5320232008-10-15 06:16:57 +00003920 case 86:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003921#line 1242 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003922 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3923 break;
3924
3925 case 87:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003926#line 1243 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003927 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3928 break;
3929
3930 case 88:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003931#line 1244 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003932 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3933 break;
3934
3935 case 89:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003936#line 1245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003937 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3938 break;
3939
3940 case 90:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003941#line 1246 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003942 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3943 break;
3944
3945 case 91:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003946#line 1250 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00003947 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3948 break;
3949
Chris Lattner8f5544c2008-10-15 06:03:48 +00003950 case 92:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003951#line 1251 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00003952 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Chris Lattner8f5544c2008-10-15 06:03:48 +00003953 break;
3954
Chris Lattner906773a2008-08-29 17:20:18 +00003955 case 93:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003956#line 1252 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003957 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003958 break;
3959
Chris Lattnerc5320232008-10-15 06:16:57 +00003960 case 94:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003961#line 1255 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00003962 { (yyval.UIntVal) = CallingConv::C; ;}
3963 break;
3964
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003965 case 95:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003966#line 1256 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00003967 { (yyval.UIntVal) = CallingConv::C; ;}
3968 break;
3969
3970 case 96:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003971#line 1257 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003972 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003973 break;
3974
Chris Lattnerc5320232008-10-15 06:16:57 +00003975 case 97:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003976#line 1258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003977 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003978 break;
3979
Chris Lattnerc5320232008-10-15 06:16:57 +00003980 case 98:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003981#line 1259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003982 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003983 break;
3984
Chris Lattnerc5320232008-10-15 06:16:57 +00003985 case 99:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003986#line 1260 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00003987 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00003988 break;
3989
Chris Lattnerc5320232008-10-15 06:16:57 +00003990 case 100:
Nuno Lopes97cf0032008-11-04 14:43:20 +00003991#line 1261 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003992 {
3993 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003994 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00003995 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003996 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003997 ;}
3998 break;
3999
Chris Lattnerc5320232008-10-15 06:16:57 +00004000 case 101:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004001#line 1268 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00004002 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattnerc5320232008-10-15 06:16:57 +00004003 break;
4004
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004005 case 102:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004006#line 1269 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004007 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattnerc5320232008-10-15 06:16:57 +00004008 break;
4009
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004010 case 103:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004011#line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00004012 { (yyval.Attributes) = Attribute::SExt; ;}
4013 break;
4014
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004015 case 104:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004016#line 1271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004017 { (yyval.Attributes) = Attribute::SExt; ;}
4018 break;
4019
4020 case 105:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004021#line 1272 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004022 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004023 break;
4024
Chris Lattnerc5320232008-10-15 06:16:57 +00004025 case 106:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004026#line 1273 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004027 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004028 break;
4029
Chris Lattnerc5320232008-10-15 06:16:57 +00004030 case 107:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004031#line 1274 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004032 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004033 break;
4034
Chris Lattnerc5320232008-10-15 06:16:57 +00004035 case 108:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004036#line 1275 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004037 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004038 break;
4039
Chris Lattnerc5320232008-10-15 06:16:57 +00004040 case 109:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004041#line 1276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004042 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004043 break;
4044
Chris Lattnerc5320232008-10-15 06:16:57 +00004045 case 110:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004046#line 1277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004047 { (yyval.Attributes) =
4048 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004049 break;
4050
Chris Lattnerc5320232008-10-15 06:16:57 +00004051 case 111:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004052#line 1281 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004053 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004054 break;
4055
Chris Lattnerc5320232008-10-15 06:16:57 +00004056 case 112:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004057#line 1282 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenf4581482008-09-26 19:32:34 +00004058 {
4059 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4060 ;}
4061 break;
4062
Chris Lattnerc5320232008-10-15 06:16:57 +00004063 case 113:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004064#line 1287 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004065 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004066 break;
4067
Chris Lattnerc5320232008-10-15 06:16:57 +00004068 case 114:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004069#line 1288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004070 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004071 break;
4072
Chris Lattnerc5320232008-10-15 06:16:57 +00004073 case 115:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004074#line 1289 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004075 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner906773a2008-08-29 17:20:18 +00004076 break;
4077
Chris Lattnerc5320232008-10-15 06:16:57 +00004078 case 116:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004079#line 1292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld222f862008-09-25 21:00:45 +00004080 { (yyval.Attributes) = Attribute::None; ;}
Chris Lattnerf6bbfbc2008-09-23 21:18:31 +00004081 break;
4082
Chris Lattnerc5320232008-10-15 06:16:57 +00004083 case 117:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004084#line 1293 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004085 {
4086 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4087 ;}
4088 break;
4089
Chris Lattnerc5320232008-10-15 06:16:57 +00004090 case 118:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004091#line 1299 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004092 { (yyval.Attributes) = Attribute::NoReturn; ;}
4093 break;
4094
Chris Lattnerc5320232008-10-15 06:16:57 +00004095 case 119:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004096#line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004097 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4098 break;
4099
Chris Lattnerc5320232008-10-15 06:16:57 +00004100 case 120:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004101#line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004102 { (yyval.Attributes) = Attribute::InReg; ;}
4103 break;
4104
Chris Lattnerc5320232008-10-15 06:16:57 +00004105 case 121:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004106#line 1302 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004107 { (yyval.Attributes) = Attribute::ZExt; ;}
4108 break;
4109
Chris Lattnerc5320232008-10-15 06:16:57 +00004110 case 122:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004111#line 1303 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004112 { (yyval.Attributes) = Attribute::SExt; ;}
4113 break;
4114
Chris Lattnerc5320232008-10-15 06:16:57 +00004115 case 123:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004116#line 1304 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004117 { (yyval.Attributes) = Attribute::ReadNone; ;}
4118 break;
4119
Chris Lattnerc5320232008-10-15 06:16:57 +00004120 case 124:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004121#line 1305 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004122 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4123 break;
4124
Chris Lattnerc5320232008-10-15 06:16:57 +00004125 case 125:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004126#line 1306 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00004127 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004128 break;
4129
Chris Lattnerc5320232008-10-15 06:16:57 +00004130 case 126:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004131#line 1307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00004132 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004133 break;
4134
Chris Lattnerc5320232008-10-15 06:16:57 +00004135 case 127:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004136#line 1308 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner5a0f2fe2008-10-08 06:44:45 +00004137 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patelcd842482008-09-29 20:49:50 +00004138 break;
4139
Chris Lattnerc5320232008-10-15 06:16:57 +00004140 case 128:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004141#line 1311 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00004142 { (yyval.Attributes) = Attribute::None; ;}
4143 break;
4144
Chris Lattnerc5320232008-10-15 06:16:57 +00004145 case 129:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004146#line 1312 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00004147 {
Devang Pateld222f862008-09-25 21:00:45 +00004148 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner906773a2008-08-29 17:20:18 +00004149 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00004150 break;
4151
Chris Lattnerc5320232008-10-15 06:16:57 +00004152 case 130:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004153#line 1318 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5df692d2008-09-02 20:52:40 +00004154 { (yyval.StrVal) = 0; ;}
4155 break;
4156
Chris Lattnerc5320232008-10-15 06:16:57 +00004157 case 131:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004158#line 1319 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004159 {
4160 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4161 ;}
4162 break;
4163
Chris Lattnerc5320232008-10-15 06:16:57 +00004164 case 132:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004165#line 1326 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004166 { (yyval.UIntVal) = 0; ;}
4167 break;
4168
Chris Lattnerc5320232008-10-15 06:16:57 +00004169 case 133:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004170#line 1327 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004171 {
4172 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4173 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004174 GEN_ERROR("Alignment must be a power of two");
4175 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004176;}
4177 break;
4178
Chris Lattnerc5320232008-10-15 06:16:57 +00004179 case 134:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004180#line 1333 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004181 { (yyval.UIntVal) = 0; ;}
4182 break;
4183
Chris Lattnerc5320232008-10-15 06:16:57 +00004184 case 135:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004185#line 1334 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004186 {
4187 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4188 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00004189 GEN_ERROR("Alignment must be a power of two");
4190 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004191;}
4192 break;
4193
Chris Lattnerc5320232008-10-15 06:16:57 +00004194 case 136:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004195#line 1343 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004196 {
4197 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4198 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004199 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00004200 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004201 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004202;}
4203 break;
4204
Chris Lattnerc5320232008-10-15 06:16:57 +00004205 case 137:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004206#line 1351 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004207 { (yyval.StrVal) = 0; ;}
4208 break;
4209
Chris Lattnerc5320232008-10-15 06:16:57 +00004210 case 138:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004211#line 1352 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004212 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4213 break;
4214
Chris Lattnerc5320232008-10-15 06:16:57 +00004215 case 139:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004216#line 1357 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes363e49d2008-10-15 12:05:02 +00004217 {;}
4218 break;
4219
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004220 case 140:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004221#line 1358 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopesafed5ce2008-11-04 14:28:33 +00004222 {;}
4223 break;
4224
4225 case 141:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004226#line 1359 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004227 {
4228 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4229 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004230 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004231 ;}
4232 break;
4233
Chris Lattnerc5320232008-10-15 06:16:57 +00004234 case 142:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004235#line 1364 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004236 {
4237 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004238 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004239 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004240 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004241 ;}
4242 break;
4243
Chris Lattnerc5320232008-10-15 06:16:57 +00004244 case 150:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004245#line 1380 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004246 {
4247 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004248 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004249 ;}
4250 break;
4251
Chris Lattnerc5320232008-10-15 06:16:57 +00004252 case 151:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004253#line 1384 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004254 {
4255 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004256 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004257 ;}
4258 break;
4259
Chris Lattnerc5320232008-10-15 06:16:57 +00004260 case 152:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004261#line 1388 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004262 { // Pointer type?
4263 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004264 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004265 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4266 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004267 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004268 ;}
4269 break;
4270
Chris Lattnerc5320232008-10-15 06:16:57 +00004271 case 153:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004272#line 1395 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004273 { // Named types are also simple types...
4274 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004275 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004276 (yyval.TypeVal) = new PATypeHolder(tmp);
4277 ;}
4278 break;
4279
Chris Lattnerc5320232008-10-15 06:16:57 +00004280 case 154:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004281#line 1400 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004282 { // Type UpReference
4283 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004284 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004285 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4286 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004287 UR_OUT("New Upreference!\n");
4288 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004289 ;}
4290 break;
4291
Chris Lattnerc5320232008-10-15 06:16:57 +00004292 case 155:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004293#line 1408 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004294 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004295 // Allow but ignore attributes on function types; this permits auto-upgrade.
4296 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004297 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4298 if (!FunctionType::isValidReturnType(RetTy))
4299 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00004300
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004301 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004302 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004303 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004304 const Type *Ty = I->Ty->get();
4305 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004306 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004307
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004308 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4309 if (isVarArg) Params.pop_back();
4310
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004311 for (unsigned i = 0; i != Params.size(); ++i)
4312 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4313 GEN_ERROR("Function arguments must be value types!");
4314
4315 CHECK_FOR_ERROR
4316
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004317 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004318 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher329d2672008-09-24 04:55:49 +00004319 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes896f4572008-10-05 16:49:34 +00004320
4321 // Delete the argument list
4322 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4323 delete I->Ty;
4324 }
4325 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4326
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004327 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004328 ;}
4329 break;
4330
Chris Lattnerc5320232008-10-15 06:16:57 +00004331 case 156:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004332#line 1443 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004333 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004334 // Allow but ignore attributes on function types; this permits auto-upgrade.
4335 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004336 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004337 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004338 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004339 const Type* Ty = I->Ty->get();
4340 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004341 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004342
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004343 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4344 if (isVarArg) Params.pop_back();
4345
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004346 for (unsigned i = 0; i != Params.size(); ++i)
4347 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4348 GEN_ERROR("Function arguments must be value types!");
4349
4350 CHECK_FOR_ERROR
4351
Dan Gohman54392c12008-04-19 00:24:39 +00004352 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher329d2672008-09-24 04:55:49 +00004353 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes896f4572008-10-05 16:49:34 +00004354
4355 // Delete the argument list
4356 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4357 delete I->Ty;
4358 }
4359 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4360
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004361 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004362 ;}
4363 break;
4364
Chris Lattnerc5320232008-10-15 06:16:57 +00004365 case 157:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004366#line 1474 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004367 { // Sized array type?
Dan Gohmane5febe42008-05-31 00:58:22 +00004368 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohman54392c12008-04-19 00:24:39 +00004369 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004370 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004371 ;}
4372 break;
4373
Chris Lattnerc5320232008-10-15 06:16:57 +00004374 case 158:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004375#line 1479 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004376 { // Vector type?
4377 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4378 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004379 GEN_ERROR("Unsigned result not equal to signed result");
4380 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4381 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004382 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4383 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004384 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004385 ;}
4386 break;
4387
Chris Lattnerc5320232008-10-15 06:16:57 +00004388 case 159:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004389#line 1489 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004390 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004391 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004392 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4393 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004394 Elements.push_back(*I);
4395
Dan Gohman54392c12008-04-19 00:24:39 +00004396 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4397 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004398 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004399 ;}
4400 break;
4401
Chris Lattnerc5320232008-10-15 06:16:57 +00004402 case 160:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004403#line 1499 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004404 { // Empty structure type?
4405 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004406 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004407 ;}
4408 break;
4409
Chris Lattnerc5320232008-10-15 06:16:57 +00004410 case 161:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004411#line 1503 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004412 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004413 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004414 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4415 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004416 Elements.push_back(*I);
4417
Dan Gohman54392c12008-04-19 00:24:39 +00004418 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4419 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004420 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004421 ;}
4422 break;
4423
Chris Lattnerc5320232008-10-15 06:16:57 +00004424 case 162:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004425#line 1513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004426 { // Empty structure type?
4427 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004428 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004429 ;}
4430 break;
4431
Chris Lattnerc5320232008-10-15 06:16:57 +00004432 case 163:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004433#line 1520 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004434 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004435 // Allow but ignore attributes on function types; this permits auto-upgrade.
4436 // FIXME: remove in LLVM 3.0.
Eric Christopher329d2672008-09-24 04:55:49 +00004437 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Pateld222f862008-09-25 21:00:45 +00004438 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00004439 ;}
4440 break;
4441
Chris Lattnerc5320232008-10-15 06:16:57 +00004442 case 164:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004443#line 1529 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004444 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004445 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004446 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4447 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004448 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004449 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4450 ;}
4451 break;
4452
Chris Lattnerc5320232008-10-15 06:16:57 +00004453 case 165:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004454#line 1536 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004455 {
4456 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4457 ;}
4458 break;
4459
Chris Lattnerc5320232008-10-15 06:16:57 +00004460 case 166:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004461#line 1541 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004462 {
4463 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4464 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004465 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004466 ;}
4467 break;
4468
Chris Lattnerc5320232008-10-15 06:16:57 +00004469 case 167:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004470#line 1546 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004471 {
4472 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004473 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004474 ;}
4475 break;
4476
Chris Lattnerc5320232008-10-15 06:16:57 +00004477 case 169:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004478#line 1554 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004479 {
4480 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Pateld222f862008-09-25 21:00:45 +00004481 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004482 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004483 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004484 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004485 ;}
4486 break;
4487
Chris Lattnerc5320232008-10-15 06:16:57 +00004488 case 170:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004489#line 1561 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004490 {
4491 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Pateld222f862008-09-25 21:00:45 +00004492 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004493 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004494 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004495 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004496 ;}
4497 break;
4498
Chris Lattnerc5320232008-10-15 06:16:57 +00004499 case 171:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004500#line 1568 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004501 {
4502 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004503 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004504 ;}
4505 break;
4506
Chris Lattnerc5320232008-10-15 06:16:57 +00004507 case 172:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004508#line 1576 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004509 {
4510 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher329d2672008-09-24 04:55:49 +00004511 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004512 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004513 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004514 ;}
4515 break;
4516
Chris Lattnerc5320232008-10-15 06:16:57 +00004517 case 173:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004518#line 1582 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004519 {
Eric Christopher329d2672008-09-24 04:55:49 +00004520 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004521 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004522 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004523 ;}
4524 break;
4525
Chris Lattnerc5320232008-10-15 06:16:57 +00004526 case 174:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004527#line 1594 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004528 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004529 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4531 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004532 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004533 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004534 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004535 const Type *ETy = ATy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004536 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004537
4538 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004539 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004540 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004541 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004542 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004543
4544 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004545 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4546 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004547 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004548 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004549 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004550 }
4551
Dan Gohman54392c12008-04-19 00:24:39 +00004552 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4553 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004554 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004555 ;}
4556 break;
4557
Chris Lattnerc5320232008-10-15 06:16:57 +00004558 case 175:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004559#line 1622 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004560 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004561 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004562 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4563 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004564 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004565 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004566 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004567
Dan Gohman7185e4b2008-06-23 18:43:26 +00004568 uint64_t NumElements = ATy->getNumElements();
Eric Christopher329d2672008-09-24 04:55:49 +00004569 if (NumElements != uint64_t(-1) && NumElements != 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004570 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004571 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004572 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4573 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004574 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004575 ;}
4576 break;
4577
Chris Lattnerc5320232008-10-15 06:16:57 +00004578 case 176:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004579#line 1638 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004580 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004581 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004582 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4583 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004584 if (ATy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004585 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004586 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004587
Dan Gohman7185e4b2008-06-23 18:43:26 +00004588 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004589 const Type *ETy = ATy->getElementType();
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004590 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher329d2672008-09-24 04:55:49 +00004591 GEN_ERROR("Can't build string constant of size " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004592 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4593 " when array has size " + utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004594 std::vector<Constant*> Vals;
4595 if (ETy == Type::Int8Ty) {
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004596 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohman54392c12008-04-19 00:24:39 +00004597 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004598 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004599 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004600 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4601 }
Dan Gohman54392c12008-04-19 00:24:39 +00004602 delete (yyvsp[(3) - (3)].StrVal);
4603 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4604 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004605 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004606 ;}
4607 break;
4608
Chris Lattnerc5320232008-10-15 06:16:57 +00004609 case 177:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004610#line 1665 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004611 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004612 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004613 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4614 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004615 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004616 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004617 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004618 const Type *ETy = PTy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004619 unsigned NumElements = PTy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004620
4621 // Verify that we have the correct size...
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004622 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004623 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher329d2672008-09-24 04:55:49 +00004624 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang6bde9ec2008-06-25 08:15:39 +00004625 utostr(NumElements) + "");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004626
4627 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004628 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4629 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004630 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004631 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004632 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004633 }
4634
Dan Gohman54392c12008-04-19 00:24:39 +00004635 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4636 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004637 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004638 ;}
4639 break;
4640
Chris Lattnerc5320232008-10-15 06:16:57 +00004641 case 178:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004642#line 1693 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004643 {
4644 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004645 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004646 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004647 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004648
Dan Gohman54392c12008-04-19 00:24:39 +00004649 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650 GEN_ERROR("Illegal number of initializers for structure type");
4651
4652 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004653 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4654 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004655 GEN_ERROR("Expected type '" +
4656 STy->getElementType(i)->getDescription() +
4657 "' for element #" + utostr(i) +
4658 " of structure initializer");
4659
4660 // Check to ensure that Type is not packed
4661 if (STy->isPacked())
4662 GEN_ERROR("Unpacked Initializer to vector type '" +
4663 STy->getDescription() + "'");
4664
Dan Gohman54392c12008-04-19 00:24:39 +00004665 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4666 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004667 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004668 ;}
4669 break;
4670
Chris Lattnerc5320232008-10-15 06:16:57 +00004671 case 179:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004672#line 1719 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004673 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004674 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004675 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4676 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004677 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004678 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004679 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004680
4681 if (STy->getNumContainedTypes() != 0)
4682 GEN_ERROR("Illegal number of initializers for structure type");
4683
4684 // Check to ensure that Type is not packed
4685 if (STy->isPacked())
4686 GEN_ERROR("Unpacked Initializer to vector type '" +
4687 STy->getDescription() + "'");
4688
Dan Gohman54392c12008-04-19 00:24:39 +00004689 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4690 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004691 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004692 ;}
4693 break;
4694
Chris Lattnerc5320232008-10-15 06:16:57 +00004695 case 180:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004696#line 1739 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004697 {
4698 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004699 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004700 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004701 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004702
Dan Gohman54392c12008-04-19 00:24:39 +00004703 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004704 GEN_ERROR("Illegal number of initializers for structure type");
4705
4706 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004707 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4708 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004709 GEN_ERROR("Expected type '" +
4710 STy->getElementType(i)->getDescription() +
4711 "' for element #" + utostr(i) +
4712 " of structure initializer");
4713
4714 // Check to ensure that Type is packed
4715 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004716 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004717 STy->getDescription() + "'");
4718
Dan Gohman54392c12008-04-19 00:24:39 +00004719 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4720 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004721 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004722 ;}
4723 break;
4724
Chris Lattnerc5320232008-10-15 06:16:57 +00004725 case 181:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004726#line 1765 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004727 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004728 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004729 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4730 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004731 if (STy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004732 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004733 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004734
4735 if (STy->getNumContainedTypes() != 0)
4736 GEN_ERROR("Illegal number of initializers for structure type");
4737
4738 // Check to ensure that Type is packed
4739 if (!STy->isPacked())
Eric Christopher329d2672008-09-24 04:55:49 +00004740 GEN_ERROR("Vector initializer to non-vector type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741 STy->getDescription() + "'");
4742
Dan Gohman54392c12008-04-19 00:24:39 +00004743 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4744 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004745 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004746 ;}
4747 break;
4748
Chris Lattnerc5320232008-10-15 06:16:57 +00004749 case 182:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004750#line 1785 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004751 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004752 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004753 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4754 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004755 if (PTy == 0)
Eric Christopher329d2672008-09-24 04:55:49 +00004756 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004757 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004758
Dan Gohman54392c12008-04-19 00:24:39 +00004759 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4760 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004761 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004762 ;}
4763 break;
4764
Chris Lattnerc5320232008-10-15 06:16:57 +00004765 case 183:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004766#line 1797 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004767 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004768 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004769 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4770 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4771 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004772 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Chris Lattnerc5320232008-10-15 06:16:57 +00004776 case 184:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004777#line 1804 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004778 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004779 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4781 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004782 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004783 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004784
4785 // ConstExprs can exist in the body of a function, thus creating
4786 // GlobalValues whenever they refer to a variable. Because we are in
4787 // the context of a function, getExistingVal will search the functions
4788 // symbol table instead of the module symbol table for the global symbol,
4789 // which throws things all off. To get around this, we just tell
4790 // getExistingVal that we are at global scope here.
4791 //
4792 Function *SavedCurFn = CurFun.CurrentFunction;
4793 CurFun.CurrentFunction = 0;
4794
Dan Gohman54392c12008-04-19 00:24:39 +00004795 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004796 CHECK_FOR_ERROR
4797
4798 CurFun.CurrentFunction = SavedCurFn;
4799
4800 // If this is an initializer for a constant pointer, which is referencing a
4801 // (currently) undefined variable, create a stub now that shall be replaced
4802 // in the future with the right type of variable.
4803 //
4804 if (V == 0) {
4805 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4806 const PointerType *PT = cast<PointerType>(Ty);
4807
4808 // First check to see if the forward references value is already created!
4809 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004810 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher329d2672008-09-24 04:55:49 +00004811
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004812 if (I != CurModule.GlobalRefs.end()) {
4813 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004814 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004815 } else {
4816 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004817 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4818 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4819 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004820 GEN_ERROR("Invalid reference to global");
4821
4822 // Create the forward referenced global.
4823 GlobalValue *GV;
Eric Christopher329d2672008-09-24 04:55:49 +00004824 if (const FunctionType *FTy =
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004825 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004826 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4827 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004828 } else {
4829 GV = new GlobalVariable(PT->getElementType(), false,
4830 GlobalValue::ExternalWeakLinkage, 0,
4831 Name, CurModule.CurrentModule);
4832 }
4833
4834 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004835 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004836 V = GV;
4837 }
4838 }
4839
Dan Gohman54392c12008-04-19 00:24:39 +00004840 (yyval.ConstVal) = cast<GlobalValue>(V);
4841 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004842 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004843 ;}
4844 break;
4845
Chris Lattnerc5320232008-10-15 06:16:57 +00004846 case 185:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004847#line 1870 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004848 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004849 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004850 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4851 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00004852 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004853 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4854 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4855 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004856 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004857 ;}
4858 break;
4859
Chris Lattnerc5320232008-10-15 06:16:57 +00004860 case 186:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004861#line 1880 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004862 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004863 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004864 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4865 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004866 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4867 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004868 (yyval.ConstVal) = Constant::getNullValue(Ty);
4869 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004870 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004871 ;}
4872 break;
4873
Chris Lattnerc5320232008-10-15 06:16:57 +00004874 case 187:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004875#line 1890 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004876 { // integral constants
Chris Lattnerc5320232008-10-15 06:16:57 +00004877 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4878 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val)))
4879 GEN_ERROR("Constant value doesn't fit in type");
4880 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true);
4881 } else {
4882 GEN_ERROR("integer constant must have integer type");
4883 }
4884 delete (yyvsp[(1) - (2)].TypeVal);
4885 CHECK_FOR_ERROR
4886 ;}
4887 break;
4888
4889 case 188:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004890#line 1901 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004891 { // arbitrary precision integer constants
4892 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4893 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4894 GEN_ERROR("Constant value does not fit in type");
4895 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth());
4896 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4897 } else {
4898 GEN_ERROR("integer constant must have integer type");
4899 }
4900 delete (yyvsp[(1) - (2)].TypeVal);
4901 delete (yyvsp[(2) - (2)].APIntVal);
4902 CHECK_FOR_ERROR
4903 ;}
4904 break;
4905
4906 case 189:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004907#line 1914 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004908 { // integral constants
4909 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4910 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val)))
4911 GEN_ERROR("Constant value doesn't fit in type");
4912 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false);
4913 } else {
4914 GEN_ERROR("integer constant must have integer type");
4915 }
4916 delete (yyvsp[(1) - (2)].TypeVal);
4917 CHECK_FOR_ERROR
4918 ;}
4919 break;
4920
4921 case 190:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004922#line 1925 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004923 { // arbitrary precision integer constants
4924 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4925 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4926 GEN_ERROR("Constant value does not fit in type");
4927 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth());
4928 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4929 } else {
4930 GEN_ERROR("integer constant must have integer type");
4931 }
4932
4933 delete (yyvsp[(2) - (2)].APIntVal);
4934 delete (yyvsp[(1) - (2)].TypeVal);
4935 CHECK_FOR_ERROR
4936 ;}
4937 break;
4938
4939 case 191:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004940#line 1939 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004941 { // Boolean constants
4942 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4943 GEN_ERROR("Constant true must have type i1");
4944 (yyval.ConstVal) = ConstantInt::getTrue();
4945 delete (yyvsp[(1) - (2)].TypeVal);
4946 CHECK_FOR_ERROR
4947 ;}
4948 break;
4949
4950 case 192:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004951#line 1946 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerc5320232008-10-15 06:16:57 +00004952 { // Boolean constants
4953 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4954 GEN_ERROR("Constant false must have type i1");
4955 (yyval.ConstVal) = ConstantInt::getFalse();
4956 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004957 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004958 ;}
4959 break;
4960
Chris Lattner8f5544c2008-10-15 06:03:48 +00004961 case 193:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004962#line 1953 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004963 { // Floating point constants
Chris Lattnerc5320232008-10-15 06:16:57 +00004964 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004965 GEN_ERROR("Floating point constant invalid for type");
Chris Lattnerc5320232008-10-15 06:16:57 +00004966
Eric Christopher329d2672008-09-24 04:55:49 +00004967 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004968 // as double. Fix this here. Long double is done right.
Chris Lattnerc5320232008-10-15 06:16:57 +00004969 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].TypeVal)->get()==Type::FloatTy) {
Dale Johannesen5ba85fd2008-10-09 23:01:34 +00004970 bool ignored;
4971 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
4972 &ignored);
4973 }
Chris Lattner05ba86e2008-04-20 00:41:19 +00004974 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Chris Lattnerc5320232008-10-15 06:16:57 +00004975 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00004976 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004977 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004978 ;}
4979 break;
4980
Chris Lattnerc5320232008-10-15 06:16:57 +00004981 case 194:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004982#line 1971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004983 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004984 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004985 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4986 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4987 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4988 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004989 GEN_ERROR("invalid cast opcode for cast from '" +
4990 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00004991 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004992 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4993 delete (yyvsp[(5) - (6)].TypeVal);
4994 ;}
4995 break;
4996
Chris Lattnerc5320232008-10-15 06:16:57 +00004997 case 195:
Nuno Lopes97cf0032008-11-04 14:43:20 +00004998#line 1983 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004999 {
5000 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005001 GEN_ERROR("GetElementPtr requires a pointer operand");
5002
5003 const Type *IdxTy =
Dan Gohman8055f772008-05-15 19:50:34 +00005004 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005005 if (!IdxTy)
5006 GEN_ERROR("Index list invalid for constant getelementptr");
5007
5008 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00005009 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
5010 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005011 IdxVec.push_back(C);
5012 else
5013 GEN_ERROR("Indices to constant getelementptr must be constants");
5014
Dan Gohman54392c12008-04-19 00:24:39 +00005015 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005016
Dan Gohman54392c12008-04-19 00:24:39 +00005017 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005018 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005019 ;}
5020 break;
5021
Chris Lattnerc5320232008-10-15 06:16:57 +00005022 case 196:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005023#line 2004 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005024 {
5025 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005026 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00005027 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005028 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005029 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005030 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005031 ;}
5032 break;
5033
Chris Lattnerc5320232008-10-15 06:16:57 +00005034 case 197:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005035#line 2012 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005036 {
5037 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005038 GEN_ERROR("Binary operator types must match");
5039 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00005040 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5041 ;}
5042 break;
5043
Chris Lattnerc5320232008-10-15 06:16:57 +00005044 case 198:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005045#line 2018 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005046 {
5047 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005048 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005049 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher329d2672008-09-24 04:55:49 +00005050 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00005051 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005052 GEN_ERROR("Logical operator requires integral operands");
5053 }
Dan Gohman54392c12008-04-19 00:24:39 +00005054 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005055 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005056 ;}
5057 break;
5058
Chris Lattnerc5320232008-10-15 06:16:57 +00005059 case 199:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005060#line 2029 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005061 {
5062 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005063 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005064 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5065 ;}
5066 break;
5067
Chris Lattnerc5320232008-10-15 06:16:57 +00005068 case 200:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005069#line 2034 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005070 {
5071 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005072 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00005073 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5074 ;}
5075 break;
5076
Chris Lattnerc5320232008-10-15 06:16:57 +00005077 case 201:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005078#line 2039 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005079 {
5080 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5081 GEN_ERROR("vicmp operand types must match");
5082 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5083 ;}
5084 break;
5085
Chris Lattnerc5320232008-10-15 06:16:57 +00005086 case 202:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005087#line 2044 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00005088 {
5089 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5090 GEN_ERROR("vfcmp operand types must match");
5091 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5092 ;}
5093 break;
5094
Chris Lattnerc5320232008-10-15 06:16:57 +00005095 case 203:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005096#line 2049 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005097 {
5098 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005099 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005100 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005101 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005102 ;}
5103 break;
5104
Chris Lattnerc5320232008-10-15 06:16:57 +00005105 case 204:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005106#line 2055 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005107 {
5108 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005109 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005110 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005111 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005112 ;}
5113 break;
5114
Chris Lattnerc5320232008-10-15 06:16:57 +00005115 case 205:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005116#line 2061 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005117 {
5118 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005119 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00005120 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005121 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005122 ;}
5123 break;
5124
Chris Lattnerc5320232008-10-15 06:16:57 +00005125 case 206:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005126#line 2067 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005127 {
5128 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5129 GEN_ERROR("ExtractValue requires an aggregate operand");
5130
Dan Gohmane5febe42008-05-31 00:58:22 +00005131 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5132 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005133 CHECK_FOR_ERROR
5134 ;}
5135 break;
5136
Chris Lattnerc5320232008-10-15 06:16:57 +00005137 case 207:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005138#line 2075 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005139 {
5140 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5141 GEN_ERROR("InsertValue requires an aggregate operand");
5142
Dan Gohmane5febe42008-05-31 00:58:22 +00005143 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5144 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005145 CHECK_FOR_ERROR
5146 ;}
5147 break;
5148
Chris Lattnerc5320232008-10-15 06:16:57 +00005149 case 208:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005150#line 2086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005151 {
5152 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005153 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005154 ;}
5155 break;
5156
Chris Lattnerc5320232008-10-15 06:16:57 +00005157 case 209:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005158#line 2090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005159 {
5160 (yyval.ConstVector) = new std::vector<Constant*>();
5161 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005162 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005163 ;}
5164 break;
5165
Chris Lattnerc5320232008-10-15 06:16:57 +00005166 case 210:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005167#line 2098 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005168 { (yyval.BoolVal) = false; ;}
Nate Begeman646fa482008-05-12 19:01:56 +00005169 break;
5170
Chris Lattnerc5320232008-10-15 06:16:57 +00005171 case 211:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005172#line 2098 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner8f5544c2008-10-15 06:03:48 +00005173 { (yyval.BoolVal) = true; ;}
5174 break;
5175
Chris Lattnerc5320232008-10-15 06:16:57 +00005176 case 212:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005177#line 2101 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005178 { (yyval.BoolVal) = true; ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005179 break;
5180
Chris Lattnerc5320232008-10-15 06:16:57 +00005181 case 213:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005182#line 2101 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005183 { (yyval.BoolVal) = false; ;}
5184 break;
5185
Chris Lattnerc5320232008-10-15 06:16:57 +00005186 case 214:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005187#line 2104 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005188 {
5189 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5190 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00005191 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005192 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5193 if (!Aliasee)
5194 GEN_ERROR("Aliases can be created only to global values");
5195
Dan Gohman54392c12008-04-19 00:24:39 +00005196 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005197 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005198 delete (yyvsp[(1) - (2)].TypeVal);
5199 ;}
5200 break;
5201
Chris Lattnerc5320232008-10-15 06:16:57 +00005202 case 215:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005203#line 2116 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005204 {
5205 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5206 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5207 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005208 GEN_ERROR("invalid cast opcode for cast from '" +
5209 Val->getType()->getDescription() + "' to '" +
5210 DestTy->getDescription() + "'");
Eric Christopher329d2672008-09-24 04:55:49 +00005211
Dan Gohman54392c12008-04-19 00:24:39 +00005212 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005213 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005214 delete (yyvsp[(5) - (6)].TypeVal);
5215 ;}
5216 break;
5217
Chris Lattnerc5320232008-10-15 06:16:57 +00005218 case 216:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005219#line 2137 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner8f5544c2008-10-15 06:03:48 +00005220 {
5221 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5222 CurModule.ModuleDone();
5223 CHECK_FOR_ERROR;
5224 ;}
5225 break;
5226
Chris Lattnerc5320232008-10-15 06:16:57 +00005227 case 217:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005228#line 2142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005229 {
5230 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5231 CurModule.ModuleDone();
5232 CHECK_FOR_ERROR;
5233 ;}
Dale Johannesen9cdf0652008-08-13 18:41:46 +00005234 break;
5235
Chris Lattnerc5320232008-10-15 06:16:57 +00005236 case 220:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005237#line 2155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcd842482008-09-29 20:49:50 +00005238 { CurFun.isDeclare = false; ;}
5239 break;
5240
Chris Lattnerc5320232008-10-15 06:16:57 +00005241 case 221:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005242#line 2155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005243 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005244 CurFun.FunctionDone();
5245 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005246 ;}
5247 break;
5248
Chris Lattnerc5320232008-10-15 06:16:57 +00005249 case 222:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005250#line 2159 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005251 { CurFun.isDeclare = true; ;}
5252 break;
5253
Chris Lattnerc5320232008-10-15 06:16:57 +00005254 case 223:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005255#line 2159 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner8f5544c2008-10-15 06:03:48 +00005256 {
5257 CHECK_FOR_ERROR
5258 ;}
5259 break;
5260
Chris Lattnerc5320232008-10-15 06:16:57 +00005261 case 224:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005262#line 2162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00005263 {
5264 CHECK_FOR_ERROR
5265 ;}
5266 break;
5267
Chris Lattnerc5320232008-10-15 06:16:57 +00005268 case 225:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005269#line 2165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005270 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005271 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005272 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005273 // Eagerly resolve types. This is not an optimization, this is a
5274 // requirement that is due to the fact that we could have this:
5275 //
5276 // %list = type { %list * }
5277 // %list = type { %list * } ; repeated type decl
5278 //
5279 // If types are not resolved eagerly, then the two types will not be
5280 // determined to be the same type!
5281 //
Dan Gohman54392c12008-04-19 00:24:39 +00005282 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005283
Dan Gohman54392c12008-04-19 00:24:39 +00005284 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005285 CHECK_FOR_ERROR
5286 // If this is a named type that is not a redefinition, add it to the slot
5287 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005288 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005289 }
5290
Dan Gohman54392c12008-04-19 00:24:39 +00005291 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005292 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005293 ;}
5294 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005295
Chris Lattnerc5320232008-10-15 06:16:57 +00005296 case 226:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005297#line 2189 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005298 {
5299 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5300
5301 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005302 CHECK_FOR_ERROR
5303 // If this is a named type that is not a redefinition, add it to the slot
5304 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005305 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005306 }
5307 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005308 ;}
5309 break;
5310
Chris Lattnerc5320232008-10-15 06:16:57 +00005311 case 227:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005312#line 2201 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005313 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005314 /* "Externally Visible" Linkage */
Eric Christopher329d2672008-09-24 04:55:49 +00005315 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005316 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005317 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5318 (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 +00005319 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005320 ;}
5321 break;
5322
Chris Lattnerc5320232008-10-15 06:16:57 +00005323 case 228:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005324#line 2208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005325 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005326 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005327 ;}
5328 break;
5329
Chris Lattnerc5320232008-10-15 06:16:57 +00005330 case 229:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005331#line 2212 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005332 {
Eric Christopher329d2672008-09-24 04:55:49 +00005333 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005334 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005335 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 +00005336 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005337 ;}
5338 break;
5339
Chris Lattnerc5320232008-10-15 06:16:57 +00005340 case 230:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005341#line 2217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005342 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005343 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005344 ;}
5345 break;
5346
Chris Lattnerc5320232008-10-15 06:16:57 +00005347 case 231:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005348#line 2221 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005349 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005350 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005351 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5352 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 +00005353 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005354 delete (yyvsp[(6) - (7)].TypeVal);
5355 ;}
5356 break;
5357
Chris Lattnerc5320232008-10-15 06:16:57 +00005358 case 232:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005359#line 2227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005360 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005361 CurGV = 0;
5362 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005363 ;}
5364 break;
5365
Chris Lattnerc5320232008-10-15 06:16:57 +00005366 case 233:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005367#line 2231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005368 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005369 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005370 if ((yyvsp[(1) - (5)].StrVal)) {
5371 Name = *(yyvsp[(1) - (5)].StrVal);
5372 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005373 }
5374 if (Name.empty())
5375 GEN_ERROR("Alias name cannot be empty");
Eric Christopher329d2672008-09-24 04:55:49 +00005376
Dan Gohman54392c12008-04-19 00:24:39 +00005377 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005378 if (Aliasee == 0)
5379 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5380
Dan Gohman54392c12008-04-19 00:24:39 +00005381 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005382 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005383 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005384 InsertValue(GA, CurModule.Values);
Eric Christopher329d2672008-09-24 04:55:49 +00005385
5386
Chris Lattner5eefce32007-09-10 23:24:14 +00005387 // If there was a forward reference of this alias, resolve it now.
Eric Christopher329d2672008-09-24 04:55:49 +00005388
Chris Lattner5eefce32007-09-10 23:24:14 +00005389 ValID ID;
5390 if (!Name.empty())
5391 ID = ValID::createGlobalName(Name);
5392 else
5393 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher329d2672008-09-24 04:55:49 +00005394
Chris Lattner5eefce32007-09-10 23:24:14 +00005395 if (GlobalValue *FWGV =
5396 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5397 // Replace uses of the fwdref with the actual alias.
5398 FWGV->replaceAllUsesWith(GA);
5399 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5400 GV->eraseFromParent();
5401 else
5402 cast<Function>(FWGV)->eraseFromParent();
5403 }
5404 ID.destroy();
Eric Christopher329d2672008-09-24 04:55:49 +00005405
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005406 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005407 ;}
5408 break;
5409
Chris Lattnerc5320232008-10-15 06:16:57 +00005410 case 234:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005411#line 2271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner8f5544c2008-10-15 06:03:48 +00005412 {
5413 CHECK_FOR_ERROR
5414 ;}
5415 break;
5416
Chris Lattnerc5320232008-10-15 06:16:57 +00005417 case 235:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005418#line 2274 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00005419 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005420 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005421 ;}
5422 break;
5423
Chris Lattnerc5320232008-10-15 06:16:57 +00005424 case 236:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005425#line 2280 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005426 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005427 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5428 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005429 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005430 else
Dan Gohman54392c12008-04-19 00:24:39 +00005431 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5432 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005433 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005434;}
5435 break;
5436
Chris Lattnerc5320232008-10-15 06:16:57 +00005437 case 237:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005438#line 2290 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005439 {
5440 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5441 delete (yyvsp[(3) - (3)].StrVal);
5442 ;}
5443 break;
5444
Chris Lattnerc5320232008-10-15 06:16:57 +00005445 case 238:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005446#line 2294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005447 {
5448 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5449 delete (yyvsp[(3) - (3)].StrVal);
5450 ;}
5451 break;
5452
Chris Lattnerc5320232008-10-15 06:16:57 +00005453 case 240:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005454#line 2301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005455 {
5456 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5457 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005458 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005459 ;}
5460 break;
5461
Chris Lattnerc5320232008-10-15 06:16:57 +00005462 case 241:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005463#line 2306 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005464 {
5465 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5466 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005467 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005468 ;}
5469 break;
5470
Chris Lattnerc5320232008-10-15 06:16:57 +00005471 case 242:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005472#line 2311 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005473 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005474 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005475 ;}
5476 break;
5477
Chris Lattnerc5320232008-10-15 06:16:57 +00005478 case 243:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005479#line 2320 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005480 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005481 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005482 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005483 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5484 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005485 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 +00005486 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5487 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005488 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005489 ;}
5490 break;
5491
Chris Lattnerc5320232008-10-15 06:16:57 +00005492 case 244:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005493#line 2330 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005494 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005495 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005496 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005497 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5498 GEN_ERROR("Argument types must be first-class");
Devang Pateld222f862008-09-25 21:00:45 +00005499 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 +00005500 (yyval.ArgList) = new ArgListType;
5501 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005502 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005503 ;}
5504 break;
5505
Chris Lattnerc5320232008-10-15 06:16:57 +00005506 case 245:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005507#line 2341 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005508 {
5509 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005510 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005511 ;}
5512 break;
5513
Chris Lattnerc5320232008-10-15 06:16:57 +00005514 case 246:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005515#line 2345 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005516 {
5517 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005518 struct ArgListEntry E;
5519 E.Ty = new PATypeHolder(Type::VoidTy);
5520 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005521 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005522 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005523 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005524 ;}
5525 break;
5526
Chris Lattnerc5320232008-10-15 06:16:57 +00005527 case 247:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005528#line 2354 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005529 {
5530 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005531 struct ArgListEntry E;
5532 E.Ty = new PATypeHolder(Type::VoidTy);
5533 E.Name = 0;
Devang Pateld222f862008-09-25 21:00:45 +00005534 E.Attrs = Attribute::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005535 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005536 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005537 ;}
5538 break;
5539
Chris Lattnerc5320232008-10-15 06:16:57 +00005540 case 248:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005541#line 2363 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005542 {
5543 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005544 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005545 ;}
5546 break;
5547
Chris Lattnerc5320232008-10-15 06:16:57 +00005548 case 249:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005549#line 2369 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005550 {
Devang Patelcd842482008-09-29 20:49:50 +00005551 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5552 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher329d2672008-09-24 04:55:49 +00005553
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005554 // Check the function result for abstractness if this is a define. We should
5555 // have no abstract types at this point
Devang Patelcd842482008-09-29 20:49:50 +00005556 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5557 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005558
Devang Patelcd842482008-09-29 20:49:50 +00005559 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00005560 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher329d2672008-09-24 04:55:49 +00005561
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005562 std::vector<const Type*> ParamTypeList;
Devang Pateld222f862008-09-25 21:00:45 +00005563 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005564 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5565 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00005566 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5567 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5568 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005569 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00005570 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005571 }
Devang Patelcd842482008-09-29 20:49:50 +00005572 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005573 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00005574 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005575 }
Devang Patelcd842482008-09-29 20:49:50 +00005576 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00005577 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00005578 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00005579 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00005580 }
Devang Patelcd842482008-09-29 20:49:50 +00005581 if (RetAttrs != Attribute::None)
5582 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5583 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005584 unsigned index = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005585 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005586 const Type* Ty = I->Ty->get();
5587 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5588 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5589 ParamTypeList.push_back(Ty);
Devang Pateld222f862008-09-25 21:00:45 +00005590 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5591 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005592 }
5593 }
Devang Patelcd842482008-09-29 20:49:50 +00005594 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5595 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005596
5597 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5598 if (isVarArg) ParamTypeList.pop_back();
5599
Devang Pateld222f862008-09-25 21:00:45 +00005600 AttrListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005601 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00005602 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005603
Devang Patelcd842482008-09-29 20:49:50 +00005604 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005605 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patelcd842482008-09-29 20:49:50 +00005606 delete (yyvsp[(3) - (11)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005607
5608 ValID ID;
5609 if (!FunctionName.empty()) {
5610 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5611 } else {
5612 ID = ValID::createGlobalID(CurModule.Values.size());
5613 }
5614
5615 Function *Fn = 0;
5616 // See if this function was forward referenced. If so, recycle the object.
5617 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher329d2672008-09-24 04:55:49 +00005618 // Move the function to the end of the list, from whereever it was
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005619 // previously inserted.
5620 Fn = cast<Function>(FWRef);
Devang Pateld222f862008-09-25 21:00:45 +00005621 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner1c8733e2008-03-12 17:45:29 +00005622 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005623 CurModule.CurrentModule->getFunctionList().remove(Fn);
5624 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5625 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5626 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005627 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005628 // The existing function doesn't have the same type. This is an overload
5629 // error.
5630 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Pateld222f862008-09-25 21:00:45 +00005631 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005632 // The existing function doesn't have the same parameter attributes.
5633 // This is an overload error.
5634 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005635 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5636 // Neither the existing or the current function is a declaration and they
5637 // have the same name and same type. Clearly this is a redefinition.
5638 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005639 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005640 // Make sure to strip off any argument names so we can't get conflicts.
5641 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5642 AI != AE; ++AI)
5643 AI->setName("");
5644 }
5645 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005646 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5647 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005648 InsertValue(Fn, CurModule.Values);
5649 }
5650
Nuno Lopese20dbca2008-10-03 15:45:58 +00005651 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005652 CurFun.FunctionStart(Fn);
5653
5654 if (CurFun.isDeclare) {
5655 // If we have declaration, always overwrite linkage. This will allow us to
5656 // correctly handle cases, when pointer to function is passed as argument to
5657 // another function.
5658 Fn->setLinkage(CurFun.Linkage);
5659 Fn->setVisibility(CurFun.Visibility);
5660 }
Devang Patel5df692d2008-09-02 20:52:40 +00005661 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00005662 Fn->setAttributes(PAL);
Devang Patelcd842482008-09-29 20:49:50 +00005663 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5664 if ((yyvsp[(9) - (11)].StrVal)) {
5665 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5666 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005667 }
Devang Patelcd842482008-09-29 20:49:50 +00005668 if ((yyvsp[(11) - (11)].StrVal)) {
5669 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5670 delete (yyvsp[(11) - (11)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005671 }
5672
5673 // Add all of the arguments we parsed to the function...
Devang Patelcd842482008-09-29 20:49:50 +00005674 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005675 if (isVarArg) { // Nuke the last entry
Devang Patelcd842482008-09-29 20:49:50 +00005676 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005677 "Not a varargs marker!");
Devang Patelcd842482008-09-29 20:49:50 +00005678 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5679 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005680 }
5681 Function::arg_iterator ArgIt = Fn->arg_begin();
5682 Function::arg_iterator ArgEnd = Fn->arg_end();
5683 unsigned Idx = 1;
Devang Patelcd842482008-09-29 20:49:50 +00005684 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5685 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005686 delete I->Ty; // Delete the typeholder...
5687 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5688 CHECK_FOR_ERROR
5689 InsertValue(ArgIt);
5690 Idx++;
5691 }
5692
Devang Patelcd842482008-09-29 20:49:50 +00005693 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005694 }
5695 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005696;}
5697 break;
5698
Chris Lattnerc5320232008-10-15 06:16:57 +00005699 case 252:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005700#line 2519 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005701 {
5702 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005703
5704 // Make sure that we keep track of the linkage type even if there was a
5705 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005706 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5707 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5708;}
5709 break;
5710
Chris Lattnerc5320232008-10-15 06:16:57 +00005711 case 255:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005712#line 2530 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005713 {
5714 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005715 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005716;}
5717 break;
5718
Chris Lattnerc5320232008-10-15 06:16:57 +00005719 case 256:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005720#line 2535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005721 {
5722 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5723 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5724 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005725 CurFun.FunctionDone();
5726 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005727 ;}
5728 break;
5729
Chris Lattnerc5320232008-10-15 06:16:57 +00005730 case 257:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005731#line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005732 {
5733 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005734 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005735 ;}
5736 break;
5737
Chris Lattnerc5320232008-10-15 06:16:57 +00005738 case 258:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005739#line 2551 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005740 {
5741 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005742 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005743 ;}
5744 break;
5745
Chris Lattnerc5320232008-10-15 06:16:57 +00005746 case 259:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005747#line 2556 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005748 { // A reference to a direct constant
5749 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005750 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005751 ;}
5752 break;
5753
Chris Lattnerc5320232008-10-15 06:16:57 +00005754 case 260:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005755#line 2560 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005756 {
5757 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005758 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005759 ;}
5760 break;
5761
Chris Lattnerc5320232008-10-15 06:16:57 +00005762 case 261:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005763#line 2564 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005764 { // arbitrary precision integer constants
5765 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5766 delete (yyvsp[(1) - (1)].APIntVal);
5767 CHECK_FOR_ERROR
5768 ;}
5769 break;
5770
Chris Lattnerc5320232008-10-15 06:16:57 +00005771 case 262:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005772#line 2569 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf3d40022008-07-11 00:30:39 +00005773 { // arbitrary precision integer constants
5774 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5775 delete (yyvsp[(1) - (1)].APIntVal);
5776 CHECK_FOR_ERROR
5777 ;}
5778 break;
5779
Chris Lattnerc5320232008-10-15 06:16:57 +00005780 case 263:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005781#line 2574 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005782 { // Perhaps it's an FP constant?
5783 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005784 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005785 ;}
5786 break;
5787
Chris Lattnerc5320232008-10-15 06:16:57 +00005788 case 264:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005789#line 2578 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005790 {
5791 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005792 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005793 ;}
5794 break;
5795
Chris Lattnerc5320232008-10-15 06:16:57 +00005796 case 265:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005797#line 2582 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005798 {
5799 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005800 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005801 ;}
5802 break;
5803
Chris Lattnerc5320232008-10-15 06:16:57 +00005804 case 266:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005805#line 2586 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005806 {
5807 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005808 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005809 ;}
5810 break;
5811
Chris Lattnerc5320232008-10-15 06:16:57 +00005812 case 267:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005813#line 2590 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005814 {
5815 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005816 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005817 ;}
5818 break;
5819
Chris Lattnerc5320232008-10-15 06:16:57 +00005820 case 268:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005821#line 2594 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005822 { // A vector zero constant.
5823 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005824 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005825 ;}
5826 break;
5827
Chris Lattnerc5320232008-10-15 06:16:57 +00005828 case 269:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005829#line 2598 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005830 { // Nonempty unsized packed vector
5831 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005832 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmane5febe42008-05-31 00:58:22 +00005833
5834 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5835 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00005836
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005837 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005838 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher329d2672008-09-24 04:55:49 +00005839
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005840 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005841 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5842 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005843 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005844 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005845 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005846 }
5847
Dan Gohman54392c12008-04-19 00:24:39 +00005848 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5849 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005850 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005851 ;}
5852 break;
5853
Chris Lattnerc5320232008-10-15 06:16:57 +00005854 case 270:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005855#line 2620 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005856 { // Nonempty unsized arr
5857 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher329d2672008-09-24 04:55:49 +00005858 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005859
5860 if (!ETy->isFirstClassType())
5861 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5862
5863 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5864 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5865
5866 // Verify all elements are correct type!
5867 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5868 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher329d2672008-09-24 04:55:49 +00005869 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005870 ETy->getDescription() +"' as required!\nIt is of type '"+
5871 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5872 }
5873
5874 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5875 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5876 CHECK_FOR_ERROR
5877 ;}
5878 break;
5879
Chris Lattnerc5320232008-10-15 06:16:57 +00005880 case 271:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005881#line 2642 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005882 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005883 // Use undef instead of an array because it's inconvenient to determine
5884 // the element type at this point, there being no elements to examine.
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005885 (yyval.ValIDVal) = ValID::createUndef();
5886 CHECK_FOR_ERROR
5887 ;}
5888 break;
5889
Chris Lattnerc5320232008-10-15 06:16:57 +00005890 case 272:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005891#line 2648 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005892 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005893 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005894 const Type *ETy = Type::Int8Ty;
5895
5896 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5897
5898 std::vector<Constant*> Vals;
5899 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5900 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5901 delete (yyvsp[(2) - (2)].StrVal);
5902 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5903 CHECK_FOR_ERROR
5904 ;}
5905 break;
5906
Chris Lattnerc5320232008-10-15 06:16:57 +00005907 case 273:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005908#line 2661 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005909 {
5910 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5911 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5912 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5913
5914 const StructType *STy = StructType::get(Elements);
5915 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5916
5917 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5918 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5919 CHECK_FOR_ERROR
5920 ;}
5921 break;
5922
Chris Lattnerc5320232008-10-15 06:16:57 +00005923 case 274:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005924#line 2673 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005925 {
5926 const StructType *STy = StructType::get(std::vector<const Type*>());
5927 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5928 CHECK_FOR_ERROR
5929 ;}
5930 break;
5931
Chris Lattnerc5320232008-10-15 06:16:57 +00005932 case 275:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005933#line 2678 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005934 {
5935 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5936 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5937 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5938
5939 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5940 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5941
5942 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5943 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5944 CHECK_FOR_ERROR
5945 ;}
5946 break;
5947
Chris Lattnerc5320232008-10-15 06:16:57 +00005948 case 276:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005949#line 2690 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005950 {
5951 const StructType *STy = StructType::get(std::vector<const Type*>(),
5952 /*isPacked=*/true);
5953 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5954 CHECK_FOR_ERROR
5955 ;}
5956 break;
5957
Chris Lattnerc5320232008-10-15 06:16:57 +00005958 case 277:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005959#line 2696 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005960 {
5961 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005962 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005963 ;}
5964 break;
5965
Chris Lattnerc5320232008-10-15 06:16:57 +00005966 case 278:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005967#line 2700 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005968 {
5969 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5970 delete (yyvsp[(3) - (5)].StrVal);
5971 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005972 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005973 ;}
5974 break;
5975
Chris Lattnerc5320232008-10-15 06:16:57 +00005976 case 279:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005977#line 2710 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005978 { // Is it an integer reference...?
5979 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005980 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005981 ;}
5982 break;
5983
Chris Lattnerc5320232008-10-15 06:16:57 +00005984 case 280:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005985#line 2714 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005986 {
5987 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005988 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005989 ;}
5990 break;
5991
Chris Lattnerc5320232008-10-15 06:16:57 +00005992 case 281:
Nuno Lopes97cf0032008-11-04 14:43:20 +00005993#line 2718 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005994 { // Is it a named reference...?
5995 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5996 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005997 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005998 ;}
5999 break;
6000
Chris Lattnerc5320232008-10-15 06:16:57 +00006001 case 282:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006002#line 2723 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006003 { // Is it a named reference...?
6004 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
6005 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006006 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006007 ;}
6008 break;
6009
Chris Lattnerc5320232008-10-15 06:16:57 +00006010 case 285:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006011#line 2736 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006012 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006013 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006014 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00006015 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohman54392c12008-04-19 00:24:39 +00006016 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006017 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006018 ;}
6019 break;
6020
Chris Lattnerc5320232008-10-15 06:16:57 +00006021 case 286:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006022#line 2745 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006023 {
6024 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher329d2672008-09-24 04:55:49 +00006025 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00006026 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006027 ;}
6028 break;
6029
Chris Lattnerc5320232008-10-15 06:16:57 +00006030 case 287:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006031#line 2750 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006032 {
Eric Christopher329d2672008-09-24 04:55:49 +00006033 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00006034 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006035 ;}
6036 break;
6037
Chris Lattnerc5320232008-10-15 06:16:57 +00006038 case 288:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006039#line 2755 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006040 {
6041 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006042 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006043 ;}
6044 break;
6045
Chris Lattnerc5320232008-10-15 06:16:57 +00006046 case 289:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006047#line 2759 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006048 { // Do not allow functions with 0 basic blocks
Dan Gohman54392c12008-04-19 00:24:39 +00006049 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006050 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006051 ;}
6052 break;
6053
Chris Lattnerc5320232008-10-15 06:16:57 +00006054 case 290:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006055#line 2768 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006056 {
6057 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006058 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006059 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6060 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6061 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006062 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006063 ;}
6064 break;
6065
Chris Lattnerc5320232008-10-15 06:16:57 +00006066 case 291:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006067#line 2777 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006068 {
6069 CHECK_FOR_ERROR
6070 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6071 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6072 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6073 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher329d2672008-09-24 04:55:49 +00006074
Chris Lattner906773a2008-08-29 17:20:18 +00006075 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6076 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6077 CHECK_FOR_ERROR
6078;}
6079 break;
6080
Chris Lattnerc5320232008-10-15 06:16:57 +00006081 case 292:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006082#line 2790 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006083 {
6084 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006085 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6086 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00006087 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6088 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6089 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006090 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006091 ;}
6092 break;
Chris Lattner59363a32008-02-19 04:36:25 +00006093
Chris Lattnerc5320232008-10-15 06:16:57 +00006094 case 293:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006095#line 2799 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006096 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00006097 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00006098 CHECK_FOR_ERROR
6099 ;}
6100 break;
6101
Chris Lattnerc5320232008-10-15 06:16:57 +00006102 case 294:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006103#line 2803 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00006104 { // Labelled (named) basic block
6105 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6106 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006107 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00006108
Dan Gohman54392c12008-04-19 00:24:39 +00006109 ;}
6110 break;
6111
Chris Lattnerc5320232008-10-15 06:16:57 +00006112 case 295:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006113#line 2811 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006114 { // Return with a result...
6115 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6116 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006117 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6118 if (VL.size() > 1 ||
6119 (isa<StructType>(ReturnType) &&
6120 (VL.empty() || VL[0]->getType() != ReturnType))) {
6121 Value *RV = UndefValue::get(ReturnType);
6122 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6123 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6124 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6125 RV = I;
6126 }
6127 (yyval.TermInstVal) = ReturnInst::Create(RV);
6128 } else {
6129 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6130 }
Dan Gohman54392c12008-04-19 00:24:39 +00006131 delete (yyvsp[(2) - (2)].ValueList);
6132 CHECK_FOR_ERROR
6133 ;}
6134 break;
6135
Chris Lattnerc5320232008-10-15 06:16:57 +00006136 case 296:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006137#line 2831 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006138 { // Return with no result...
6139 (yyval.TermInstVal) = ReturnInst::Create();
6140 CHECK_FOR_ERROR
6141 ;}
6142 break;
6143
Chris Lattnerc5320232008-10-15 06:16:57 +00006144 case 297:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006145#line 2835 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006146 { // Unconditional Branch...
6147 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6148 CHECK_FOR_ERROR
6149 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6150 ;}
6151 break;
6152
Chris Lattnerc5320232008-10-15 06:16:57 +00006153 case 298:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006154#line 2840 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher329d2672008-09-24 04:55:49 +00006155 {
Dan Gohmane5febe42008-05-31 00:58:22 +00006156 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6157 GEN_ERROR("Branch condition must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00006158 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6159 CHECK_FOR_ERROR
6160 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6161 CHECK_FOR_ERROR
6162 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6163 CHECK_FOR_ERROR
6164 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6165 ;}
6166 break;
6167
Chris Lattnerc5320232008-10-15 06:16:57 +00006168 case 299:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006169#line 2851 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006170 {
6171 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6172 CHECK_FOR_ERROR
6173 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6174 CHECK_FOR_ERROR
6175 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6176 (yyval.TermInstVal) = S;
6177
6178 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6179 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006180 for (; I != E; ++I) {
6181 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6182 S->addCase(CI, I->second);
6183 else
6184 GEN_ERROR("Switch case is constant, but not a simple integer");
6185 }
Dan Gohman54392c12008-04-19 00:24:39 +00006186 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006187 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006188 ;}
6189 break;
6190
Chris Lattnerc5320232008-10-15 06:16:57 +00006191 case 300:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006192#line 2870 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006193 {
6194 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006195 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006196 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006197 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00006198 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00006199 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006200 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006201 ;}
6202 break;
6203
Chris Lattnerc5320232008-10-15 06:16:57 +00006204 case 301:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006205#line 2880 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006206 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006207
6208 // Handle the short syntax
6209 const PointerType *PFTy = 0;
6210 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006211 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006212 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6213 // Pull out the types of all of the arguments...
6214 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006215 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006216 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006217 const Type *Ty = I->Val->getType();
6218 if (Ty == Type::VoidTy)
6219 GEN_ERROR("Short call syntax cannot be used with varargs");
6220 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006221 }
Eric Christopher329d2672008-09-24 04:55:49 +00006222
Devang Patelcd842482008-09-29 20:49:50 +00006223 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006224 GEN_ERROR("Invalid result type for LLVM function");
6225
Devang Patelcd842482008-09-29 20:49:50 +00006226 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006227 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006228 }
6229
Devang Patelcd842482008-09-29 20:49:50 +00006230 delete (yyvsp[(4) - (15)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006231
Devang Patelcd842482008-09-29 20:49:50 +00006232 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006233 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006234 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006235 CHECK_FOR_ERROR
Devang Patelcd842482008-09-29 20:49:50 +00006236 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006237 CHECK_FOR_ERROR
6238
Devang Pateld222f862008-09-25 21:00:45 +00006239 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006240 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6241 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006242 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6243 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6244 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006245 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006246 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006247 }
Devang Patelcd842482008-09-29 20:49:50 +00006248 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006249 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006250 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006251 }
Devang Patelcd842482008-09-29 20:49:50 +00006252 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006253 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006254 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006255 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006256 }
Devang Patelcd842482008-09-29 20:49:50 +00006257 if (RetAttrs != Attribute::None)
6258 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006259
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006260 // Check the arguments
6261 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006262 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006263 // Make sure no arguments is a good thing!
6264 if (Ty->getNumParams() != 0)
6265 GEN_ERROR("No arguments passed to a function that "
6266 "expects arguments");
6267 } else { // Has arguments?
6268 // Loop through FunctionType's arguments and ensure they are specified
6269 // correctly!
6270 FunctionType::param_iterator I = Ty->param_begin();
6271 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006272 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006273 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006274
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006275 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006276 if (ArgI->Val->getType() != *I)
6277 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6278 (*I)->getDescription() + "'");
6279 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006280 if (ArgI->Attrs != Attribute::None)
6281 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006282 }
6283
6284 if (Ty->isVarArg()) {
6285 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006286 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006287 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006288 if (ArgI->Attrs != Attribute::None)
6289 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006290 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006291 } else if (I != E || ArgI != ArgE)
6292 GEN_ERROR("Invalid number of parameters detected");
6293 }
Devang Patelcd842482008-09-29 20:49:50 +00006294 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6295 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Pateld222f862008-09-25 21:00:45 +00006296 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006297 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006298 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006299
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006300 // Create the InvokeInst
Dan Gohman8055f772008-05-15 19:50:34 +00006301 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6302 Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006303 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006304 II->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006305 (yyval.TermInstVal) = II;
Devang Patelcd842482008-09-29 20:49:50 +00006306 delete (yyvsp[(7) - (15)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006307 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006308 ;}
6309 break;
6310
Chris Lattnerc5320232008-10-15 06:16:57 +00006311 case 302:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006312#line 2983 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006313 {
6314 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006315 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006316 ;}
6317 break;
6318
Chris Lattnerc5320232008-10-15 06:16:57 +00006319 case 303:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006320#line 2987 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006321 {
6322 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006323 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006324 ;}
6325 break;
6326
Chris Lattnerc5320232008-10-15 06:16:57 +00006327 case 304:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006328#line 2994 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006329 {
6330 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6331 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006332 CHECK_FOR_ERROR
6333 if (V == 0)
6334 GEN_ERROR("May only switch on a constant pool value");
6335
Dan Gohman54392c12008-04-19 00:24:39 +00006336 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006337 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006338 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6339 ;}
6340 break;
6341
Chris Lattnerc5320232008-10-15 06:16:57 +00006342 case 305:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006343#line 3005 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006344 {
6345 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6346 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006347 CHECK_FOR_ERROR
6348
6349 if (V == 0)
6350 GEN_ERROR("May only switch on a constant pool value");
6351
Dan Gohman54392c12008-04-19 00:24:39 +00006352 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006353 CHECK_FOR_ERROR
Eric Christopher329d2672008-09-24 04:55:49 +00006354 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohman54392c12008-04-19 00:24:39 +00006355 ;}
6356 break;
6357
Chris Lattnerc5320232008-10-15 06:16:57 +00006358 case 306:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006359#line 3018 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006360 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006361 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00006362 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006363 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006364 InsertValue((yyvsp[(2) - (2)].InstVal));
6365 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006366 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006367 ;}
6368 break;
6369
Chris Lattnerc5320232008-10-15 06:16:57 +00006370 case 307:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006371#line 3027 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner906773a2008-08-29 17:20:18 +00006372 {
6373 CHECK_FOR_ERROR
6374 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher329d2672008-09-24 04:55:49 +00006375
Chris Lattner906773a2008-08-29 17:20:18 +00006376 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6377 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6378 " is incorrect, expected %" + utostr((unsigned)ValNum));
6379
6380 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6381 CHECK_FOR_ERROR
6382 ;}
6383 break;
6384
Chris Lattnerc5320232008-10-15 06:16:57 +00006385 case 308:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006386#line 3040 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006387 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006388 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006389 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6390 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6391 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006392 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006393 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006394 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006395 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6396 delete (yyvsp[(1) - (6)].TypeVal);
6397 ;}
6398 break;
6399
Chris Lattnerc5320232008-10-15 06:16:57 +00006400 case 309:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006401#line 3051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006402 {
6403 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6404 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006405 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006406 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006407 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006408 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6409 ;}
6410 break;
6411
Chris Lattnerc5320232008-10-15 06:16:57 +00006412 case 310:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006413#line 3061 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006414 {
Devang Pateld222f862008-09-25 21:00:45 +00006415 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006416 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006417 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006418 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00006419 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006420 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 +00006421 (yyval.ParamList)->push_back(E);
6422 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006423 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006424 ;}
6425 break;
6426
Chris Lattnerc5320232008-10-15 06:16:57 +00006427 case 311:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006428#line 3072 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006429 {
Devang Pateld222f862008-09-25 21:00:45 +00006430 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00006431 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00006432 (yyval.ParamList) = new ParamList();
Devang Pateld222f862008-09-25 21:00:45 +00006433 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 +00006434 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006435 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006436 ;}
6437 break;
6438
Chris Lattnerc5320232008-10-15 06:16:57 +00006439 case 312:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006440#line 3080 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006441 {
Devang Pateld222f862008-09-25 21:00:45 +00006442 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006443 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006444 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6445 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006446 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 +00006447 (yyval.ParamList)->push_back(E);
6448 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006449 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006450 ;}
6451 break;
6452
Chris Lattnerc5320232008-10-15 06:16:57 +00006453 case 313:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006454#line 3090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006455 {
Devang Pateld222f862008-09-25 21:00:45 +00006456 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00006457 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Pateld222f862008-09-25 21:00:45 +00006458 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 +00006459 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00006460 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006461 ;}
6462 break;
6463
Chris Lattnerc5320232008-10-15 06:16:57 +00006464 case 314:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006465#line 3097 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006466 { (yyval.ParamList) = new ParamList(); ;}
6467 break;
6468
Chris Lattnerc5320232008-10-15 06:16:57 +00006469 case 315:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006470#line 3100 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006471 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6472 break;
6473
Chris Lattnerc5320232008-10-15 06:16:57 +00006474 case 316:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006475#line 3101 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006476 {
6477 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6478 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006479 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006480 ;}
6481 break;
6482
Chris Lattnerc5320232008-10-15 06:16:57 +00006483 case 317:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006484#line 3109 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006485 {
6486 (yyval.ConstantList) = new std::vector<unsigned>();
6487 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6488 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6489 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6490 ;}
6491 break;
6492
Chris Lattnerc5320232008-10-15 06:16:57 +00006493 case 318:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006494#line 3115 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006495 {
6496 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6497 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6498 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6499 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6500 CHECK_FOR_ERROR
6501 ;}
6502 break;
6503
Chris Lattnerc5320232008-10-15 06:16:57 +00006504 case 319:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006505#line 3124 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006506 {
6507 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006508 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006509 ;}
6510 break;
6511
Chris Lattnerc5320232008-10-15 06:16:57 +00006512 case 320:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006513#line 3128 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006514 {
6515 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006516 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006517 ;}
6518 break;
6519
Chris Lattnerc5320232008-10-15 06:16:57 +00006520 case 321:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006521#line 3133 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006522 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006523 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006524 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher329d2672008-09-24 04:55:49 +00006525 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohman54392c12008-04-19 00:24:39 +00006526 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006527 GEN_ERROR(
6528 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher329d2672008-09-24 04:55:49 +00006529 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006530 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006531 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006532 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006533 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohman54392c12008-04-19 00:24:39 +00006534 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006535 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006536 delete (yyvsp[(2) - (5)].TypeVal);
6537 ;}
6538 break;
6539
Chris Lattnerc5320232008-10-15 06:16:57 +00006540 case 322:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006541#line 3149 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006542 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006543 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006544 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6545 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begemanbb1ce942008-07-29 15:49:41 +00006546 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohman54392c12008-04-19 00:24:39 +00006547 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006548 GEN_ERROR("Logical operator requires integral operands");
6549 }
Dan Gohman54392c12008-04-19 00:24:39 +00006550 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006551 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006552 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006553 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006554 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006555 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006556 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006557 delete (yyvsp[(2) - (5)].TypeVal);
6558 ;}
6559 break;
6560
Chris Lattnerc5320232008-10-15 06:16:57 +00006561 case 323:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006562#line 3166 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006563 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006564 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006565 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006566 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006567 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006568 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006569 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006570 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006571 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006572 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006573 delete (yyvsp[(3) - (6)].TypeVal);
6574 ;}
6575 break;
6576
Chris Lattnerc5320232008-10-15 06:16:57 +00006577 case 324:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006578#line 3178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006579 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006580 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006581 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohman54392c12008-04-19 00:24:39 +00006582 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006583 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006584 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006585 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006586 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006587 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006588 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006589 delete (yyvsp[(3) - (6)].TypeVal);
6590 ;}
6591 break;
6592
Chris Lattnerc5320232008-10-15 06:16:57 +00006593 case 325:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006594#line 3190 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006595 {
6596 if (!UpRefs.empty())
6597 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6598 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6599 GEN_ERROR("Scalar types not supported by vicmp instruction");
6600 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6601 CHECK_FOR_ERROR
6602 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6603 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006604 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006605 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006606 GEN_ERROR("vicmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006607 delete (yyvsp[(3) - (6)].TypeVal);
6608 ;}
6609 break;
6610
Chris Lattnerc5320232008-10-15 06:16:57 +00006611 case 326:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006612#line 3204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006613 {
6614 if (!UpRefs.empty())
6615 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6616 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6617 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6618 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6619 CHECK_FOR_ERROR
6620 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6621 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006622 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006623 if ((yyval.InstVal) == 0)
Dan Gohman181f4e42008-09-09 01:13:24 +00006624 GEN_ERROR("vfcmp operator returned null");
Nate Begeman646fa482008-05-12 19:01:56 +00006625 delete (yyvsp[(3) - (6)].TypeVal);
6626 ;}
6627 break;
6628
Chris Lattnerc5320232008-10-15 06:16:57 +00006629 case 327:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006630#line 3218 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006631 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006632 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006633 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6634 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6635 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6636 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006637 GEN_ERROR("invalid cast opcode for cast from '" +
6638 Val->getType()->getDescription() + "' to '" +
Eric Christopher329d2672008-09-24 04:55:49 +00006639 DestTy->getDescription() + "'");
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006640 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohman54392c12008-04-19 00:24:39 +00006641 delete (yyvsp[(4) - (4)].TypeVal);
6642 ;}
6643 break;
6644
Chris Lattnerc5320232008-10-15 06:16:57 +00006645 case 328:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006646#line 3230 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006647 {
Dan Gohman181f4e42008-09-09 01:13:24 +00006648 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6649 // vector select
6650 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6651 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6652 GEN_ERROR("vector select value types must be vector types");
6653 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6654 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6655 if (cond_type->getElementType() != Type::Int1Ty)
6656 GEN_ERROR("vector select condition element type must be boolean");
6657 if (cond_type->getNumElements() != select_type->getNumElements())
6658 GEN_ERROR("vector select number of elements must be the same");
6659 } else {
6660 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6661 GEN_ERROR("select condition must be boolean");
6662 }
Dan Gohman54392c12008-04-19 00:24:39 +00006663 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohman181f4e42008-09-09 01:13:24 +00006664 GEN_ERROR("select value types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00006665 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006666 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006667 ;}
6668 break;
6669
Chris Lattnerc5320232008-10-15 06:16:57 +00006670 case 329:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006671#line 3251 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006672 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006673 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006674 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6675 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6676 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006677 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006678 ;}
6679 break;
6680
Chris Lattnerc5320232008-10-15 06:16:57 +00006681 case 330:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006682#line 3258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006683 {
6684 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006685 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006686 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006687 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006688 ;}
6689 break;
6690
Chris Lattnerc5320232008-10-15 06:16:57 +00006691 case 331:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006692#line 3264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006693 {
6694 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006695 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006696 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006697 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006698 ;}
6699 break;
6700
Chris Lattnerc5320232008-10-15 06:16:57 +00006701 case 332:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006702#line 3270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006703 {
6704 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006705 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006706 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006707 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006708 ;}
6709 break;
6710
Chris Lattnerc5320232008-10-15 06:16:57 +00006711 case 333:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006712#line 3276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006713 {
6714 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006715 if (!Ty->isFirstClassType())
6716 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006717 (yyval.InstVal) = PHINode::Create(Ty);
6718 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6719 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher329d2672008-09-24 04:55:49 +00006720 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006721 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006722 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6723 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006724 }
Dan Gohman54392c12008-04-19 00:24:39 +00006725 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006726 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006727 ;}
6728 break;
6729
Chris Lattnerc5320232008-10-15 06:16:57 +00006730 case 334:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006731#line 3292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006732 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006733
6734 // Handle the short syntax
6735 const PointerType *PFTy = 0;
6736 const FunctionType *Ty = 0;
Devang Patelcd842482008-09-29 20:49:50 +00006737 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006738 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6739 // Pull out the types of all of the arguments...
6740 std::vector<const Type*> ParamTypes;
Devang Patelcd842482008-09-29 20:49:50 +00006741 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006742 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006743 const Type *Ty = I->Val->getType();
6744 if (Ty == Type::VoidTy)
6745 GEN_ERROR("Short call syntax cannot be used with varargs");
6746 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006747 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006748
Devang Patelcd842482008-09-29 20:49:50 +00006749 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattner73de3c02008-04-23 05:37:08 +00006750 GEN_ERROR("Invalid result type for LLVM function");
6751
Devang Patelcd842482008-09-29 20:49:50 +00006752 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006753 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006754 }
6755
Devang Patelcd842482008-09-29 20:49:50 +00006756 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006757 CHECK_FOR_ERROR
6758
6759 // Check for call to invalid intrinsic to avoid crashing later.
6760 if (Function *theF = dyn_cast<Function>(V)) {
6761 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6762 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6763 !theF->getIntrinsicID(true))
6764 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6765 theF->getName() + "'");
6766 }
6767
Devang Pateld222f862008-09-25 21:00:45 +00006768 // Set up the Attributes for the function
6769 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006770 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6771 //attributes.
Devang Patelcd842482008-09-29 20:49:50 +00006772 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6773 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6774 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006775 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patelcd842482008-09-29 20:49:50 +00006776 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006777 }
Devang Patelcd842482008-09-29 20:49:50 +00006778 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006779 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patelcd842482008-09-29 20:49:50 +00006780 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006781 }
Devang Patelcd842482008-09-29 20:49:50 +00006782 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesen38ee4102008-09-26 23:46:20 +00006783 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patelcd842482008-09-29 20:49:50 +00006784 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesen38ee4102008-09-26 23:46:20 +00006785 }
Dale Johannesen38ee4102008-09-26 23:46:20 +00006786 }
Devang Patelcd842482008-09-29 20:49:50 +00006787 if (RetAttrs != Attribute::None)
6788 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesen38ee4102008-09-26 23:46:20 +00006789
Eric Christopher329d2672008-09-24 04:55:49 +00006790 // Check the arguments
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006791 ValueList Args;
Devang Patelcd842482008-09-29 20:49:50 +00006792 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006793 // Make sure no arguments is a good thing!
6794 if (Ty->getNumParams() != 0)
6795 GEN_ERROR("No arguments passed to a function that "
6796 "expects arguments");
6797 } else { // Has arguments?
6798 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006799 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006800 FunctionType::param_iterator I = Ty->param_begin();
6801 FunctionType::param_iterator E = Ty->param_end();
Devang Patelcd842482008-09-29 20:49:50 +00006802 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006803 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006804
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006805 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006806 if (ArgI->Val->getType() != *I)
6807 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6808 (*I)->getDescription() + "'");
6809 Args.push_back(ArgI->Val);
Devang Pateld222f862008-09-25 21:00:45 +00006810 if (ArgI->Attrs != Attribute::None)
6811 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006812 }
6813 if (Ty->isVarArg()) {
6814 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006815 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006816 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Pateld222f862008-09-25 21:00:45 +00006817 if (ArgI->Attrs != Attribute::None)
6818 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006819 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006820 } else if (I != E || ArgI != ArgE)
6821 GEN_ERROR("Invalid number of parameters detected");
6822 }
Devang Patelcd842482008-09-29 20:49:50 +00006823 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6824 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006825
Devang Pateld222f862008-09-25 21:00:45 +00006826 // Finish off the Attributes and check them
6827 AttrListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006828 if (!Attrs.empty())
Devang Pateld222f862008-09-25 21:00:45 +00006829 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006830
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006831 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006832 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patelcd842482008-09-29 20:49:50 +00006833 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6834 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Pateld222f862008-09-25 21:00:45 +00006835 CI->setAttributes(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006836 (yyval.InstVal) = CI;
Devang Patelcd842482008-09-29 20:49:50 +00006837 delete (yyvsp[(7) - (9)].ParamList);
6838 delete (yyvsp[(4) - (9)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006839 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006840 ;}
6841 break;
6842
Chris Lattnerc5320232008-10-15 06:16:57 +00006843 case 335:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006844#line 3401 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006845 {
6846 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006847 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006848 ;}
6849 break;
6850
Chris Lattnerc5320232008-10-15 06:16:57 +00006851 case 336:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006852#line 3406 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006853 {
6854 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006855 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006856 ;}
6857 break;
6858
Chris Lattnerc5320232008-10-15 06:16:57 +00006859 case 337:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006860#line 3410 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006861 {
6862 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006863 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006864 ;}
6865 break;
6866
Chris Lattnerc5320232008-10-15 06:16:57 +00006867 case 338:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006868#line 3417 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006869 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006870 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006871 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6872 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6873 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006874 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006875 ;}
6876 break;
6877
Chris Lattnerc5320232008-10-15 06:16:57 +00006878 case 339:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006879#line 3424 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006880 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006881 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006882 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006883 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6884 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006885 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006886 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006887 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6888 delete (yyvsp[(2) - (6)].TypeVal);
6889 ;}
6890 break;
6891
Chris Lattnerc5320232008-10-15 06:16:57 +00006892 case 340:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006893#line 3434 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006894 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006895 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006896 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6897 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6898 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006899 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006900 ;}
6901 break;
6902
Chris Lattnerc5320232008-10-15 06:16:57 +00006903 case 341:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006904#line 3441 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006905 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006906 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006907 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006908 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6909 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006910 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006911 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006912 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6913 delete (yyvsp[(2) - (6)].TypeVal);
6914 ;}
6915 break;
6916
Chris Lattnerc5320232008-10-15 06:16:57 +00006917 case 342:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006918#line 3451 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006919 {
6920 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher329d2672008-09-24 04:55:49 +00006921 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006922 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6923 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006924 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006925 ;}
6926 break;
6927
Chris Lattnerc5320232008-10-15 06:16:57 +00006928 case 343:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006929#line 3459 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006930 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006931 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006932 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6933 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006934 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006935 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6936 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006937 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006938 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6939 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006940 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006941 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6942 delete (yyvsp[(3) - (5)].TypeVal);
6943 ;}
6944 break;
6945
Chris Lattnerc5320232008-10-15 06:16:57 +00006946 case 344:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006947#line 3473 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006948 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006949 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006950 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6951 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006952 if (!PT)
6953 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006954 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006955 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006956 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6957 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006958 "' into space of type '" + ElTy->getDescription() + "'");
6959
Dan Gohman54392c12008-04-19 00:24:39 +00006960 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006961 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006962 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6963 delete (yyvsp[(5) - (7)].TypeVal);
6964 ;}
6965 break;
6966
Chris Lattnerc5320232008-10-15 06:16:57 +00006967 case 345:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006968#line 3490 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006969 {
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006970 if (!UpRefs.empty())
6971 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6972 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6973 GEN_ERROR("getresult insn requires an aggregate operand");
6974 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6975 GEN_ERROR("Invalid getresult index for type '" +
6976 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6977
6978 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel3b8849c2008-02-19 22:27:01 +00006979 CHECK_FOR_ERROR
Dan Gohmanb94a0ba2008-07-23 00:54:54 +00006980 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6981 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00006982 ;}
6983 break;
6984
Chris Lattnerc5320232008-10-15 06:16:57 +00006985 case 346:
Nuno Lopes97cf0032008-11-04 14:43:20 +00006986#line 3504 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006987 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006988 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006989 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6990 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006991 GEN_ERROR("getelementptr insn requires pointer operand");
6992
Dan Gohman8055f772008-05-15 19:50:34 +00006993 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006994 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006995 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6996 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006997 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006998 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00006999 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman54392c12008-04-19 00:24:39 +00007000 delete (yyvsp[(4) - (4)].ValueList);
7001 ;}
7002 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007003
Chris Lattnerc5320232008-10-15 06:16:57 +00007004 case 347:
Nuno Lopes97cf0032008-11-04 14:43:20 +00007005#line 3519 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007006 {
7007 if (!UpRefs.empty())
7008 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7009 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
7010 GEN_ERROR("extractvalue insn requires an aggregate operand");
7011
Dan Gohmane5febe42008-05-31 00:58:22 +00007012 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007013 GEN_ERROR("Invalid extractvalue indices for type '" +
7014 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7015 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7016 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00007017 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007018 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00007019 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007020 ;}
7021 break;
7022
Chris Lattnerc5320232008-10-15 06:16:57 +00007023 case 348:
Nuno Lopes97cf0032008-11-04 14:43:20 +00007024#line 3534 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007025 {
7026 if (!UpRefs.empty())
7027 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7028 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7029 GEN_ERROR("extractvalue insn requires an aggregate operand");
7030
Dan Gohmane5febe42008-05-31 00:58:22 +00007031 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 +00007032 GEN_ERROR("Invalid insertvalue indices for type '" +
7033 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7034 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7035 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7036 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00007037 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher329d2672008-09-24 04:55:49 +00007038 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007039 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00007040 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00007041 ;}
7042 break;
7043
Dan Gohman54392c12008-04-19 00:24:39 +00007044
7045/* Line 1267 of yacc.c. */
Nuno Lopes97cf0032008-11-04 14:43:20 +00007046#line 7047 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00007047 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00007048 }
Dan Gohman54392c12008-04-19 00:24:39 +00007049 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7050
7051 YYPOPSTACK (yylen);
7052 yylen = 0;
7053 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007054
7055 *++yyvsp = yyval;
7056
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007057
Dan Gohman54392c12008-04-19 00:24:39 +00007058 /* Now `shift' the result of the reduction. Determine what state
7059 that goes to, based on the state we popped back to and the rule
7060 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007061
7062 yyn = yyr1[yyn];
7063
Dan Gohman54392c12008-04-19 00:24:39 +00007064 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7065 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007066 yystate = yytable[yystate];
7067 else
Dan Gohman54392c12008-04-19 00:24:39 +00007068 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007069
7070 goto yynewstate;
7071
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007072
Dan Gohman54392c12008-04-19 00:24:39 +00007073/*------------------------------------.
7074| yyerrlab -- here on detecting error |
7075`------------------------------------*/
7076yyerrlab:
7077 /* If not already recovering from an error, report this error. */
7078 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007079 {
7080 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00007081#if ! YYERROR_VERBOSE
7082 yyerror (YY_("syntax error"));
7083#else
7084 {
7085 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7086 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7087 {
7088 YYSIZE_T yyalloc = 2 * yysize;
7089 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7090 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7091 if (yymsg != yymsgbuf)
7092 YYSTACK_FREE (yymsg);
7093 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7094 if (yymsg)
7095 yymsg_alloc = yyalloc;
7096 else
7097 {
7098 yymsg = yymsgbuf;
7099 yymsg_alloc = sizeof yymsgbuf;
7100 }
7101 }
Dale Johannesen3afee192007-09-07 21:07:57 +00007102
Dan Gohman54392c12008-04-19 00:24:39 +00007103 if (0 < yysize && yysize <= yymsg_alloc)
7104 {
7105 (void) yysyntax_error (yymsg, yystate, yychar);
7106 yyerror (yymsg);
7107 }
7108 else
7109 {
7110 yyerror (YY_("syntax error"));
7111 if (yysize != 0)
7112 goto yyexhaustedlab;
7113 }
7114 }
7115#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007116 }
7117
Dan Gohman54392c12008-04-19 00:24:39 +00007118
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007119
7120 if (yyerrstatus == 3)
7121 {
Dan Gohman54392c12008-04-19 00:24:39 +00007122 /* If just tried and failed to reuse look-ahead token after an
7123 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007124
Dan Gohman54392c12008-04-19 00:24:39 +00007125 if (yychar <= YYEOF)
7126 {
7127 /* Return failure if at end of input. */
7128 if (yychar == YYEOF)
7129 YYABORT;
7130 }
7131 else
7132 {
7133 yydestruct ("Error: discarding",
7134 yytoken, &yylval);
7135 yychar = YYEMPTY;
7136 }
7137 }
7138
7139 /* Else will try to reuse look-ahead token after shifting the error
7140 token. */
7141 goto yyerrlab1;
7142
7143
7144/*---------------------------------------------------.
7145| yyerrorlab -- error raised explicitly by YYERROR. |
7146`---------------------------------------------------*/
7147yyerrorlab:
7148
7149 /* Pacify compilers like GCC when the user code never invokes
7150 YYERROR and the label yyerrorlab therefore never appears in user
7151 code. */
7152 if (/*CONSTCOND*/ 0)
7153 goto yyerrorlab;
7154
7155 /* Do not reclaim the symbols of the rule which action triggered
7156 this YYERROR. */
7157 YYPOPSTACK (yylen);
7158 yylen = 0;
7159 YY_STACK_PRINT (yyss, yyssp);
7160 yystate = *yyssp;
7161 goto yyerrlab1;
7162
7163
7164/*-------------------------------------------------------------.
7165| yyerrlab1 -- common code for both syntax error and YYERROR. |
7166`-------------------------------------------------------------*/
7167yyerrlab1:
7168 yyerrstatus = 3; /* Each real token shifted decrements this. */
7169
7170 for (;;)
7171 {
7172 yyn = yypact[yystate];
7173 if (yyn != YYPACT_NINF)
7174 {
7175 yyn += YYTERROR;
7176 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7177 {
7178 yyn = yytable[yyn];
7179 if (0 < yyn)
7180 break;
7181 }
7182 }
7183
7184 /* Pop the current state because it cannot handle the error token. */
7185 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007186 YYABORT;
7187
Dale Johannesen3afee192007-09-07 21:07:57 +00007188
Dan Gohman54392c12008-04-19 00:24:39 +00007189 yydestruct ("Error: popping",
7190 yystos[yystate], yyvsp);
7191 YYPOPSTACK (1);
7192 yystate = *yyssp;
7193 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007194 }
7195
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007196 if (yyn == YYFINAL)
7197 YYACCEPT;
7198
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007199 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00007200
7201
7202 /* Shift the error token. */
7203 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00007204
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007205 yystate = yyn;
7206 goto yynewstate;
7207
Gabor Greif89f01162008-04-06 23:07:54 +00007208
Dan Gohman54392c12008-04-19 00:24:39 +00007209/*-------------------------------------.
7210| yyacceptlab -- YYACCEPT comes here. |
7211`-------------------------------------*/
7212yyacceptlab:
7213 yyresult = 0;
7214 goto yyreturn;
7215
7216/*-----------------------------------.
7217| yyabortlab -- YYABORT comes here. |
7218`-----------------------------------*/
7219yyabortlab:
7220 yyresult = 1;
7221 goto yyreturn;
7222
7223#ifndef yyoverflow
7224/*-------------------------------------------------.
7225| yyexhaustedlab -- memory exhaustion comes here. |
7226`-------------------------------------------------*/
7227yyexhaustedlab:
7228 yyerror (YY_("memory exhausted"));
7229 yyresult = 2;
7230 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00007231#endif
Dan Gohman54392c12008-04-19 00:24:39 +00007232
7233yyreturn:
7234 if (yychar != YYEOF && yychar != YYEMPTY)
7235 yydestruct ("Cleanup: discarding lookahead",
7236 yytoken, &yylval);
7237 /* Do not reclaim the symbols of the rule which action triggered
7238 this YYABORT or YYACCEPT. */
7239 YYPOPSTACK (yylen);
7240 YY_STACK_PRINT (yyss, yyssp);
7241 while (yyssp != yyss)
7242 {
7243 yydestruct ("Cleanup: popping",
7244 yystos[*yyssp], yyvsp);
7245 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00007246 }
Dan Gohman54392c12008-04-19 00:24:39 +00007247#ifndef yyoverflow
7248 if (yyss != yyssa)
7249 YYSTACK_FREE (yyss);
7250#endif
7251#if YYERROR_VERBOSE
7252 if (yymsg != yymsgbuf)
7253 YYSTACK_FREE (yymsg);
7254#endif
7255 /* Make sure YYID is used. */
7256 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007257}
Dan Gohman54392c12008-04-19 00:24:39 +00007258
7259
Nuno Lopes97cf0032008-11-04 14:43:20 +00007260#line 3553 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007261
7262
7263// common code from the two 'RunVMAsmParser' functions
7264static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007265 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007266 // Check to make sure the parser succeeded
7267 if (yyparse()) {
7268 if (ParserResult)
7269 delete ParserResult;
7270 return 0;
7271 }
7272
7273 // Emit an error if there are any unresolved types left.
7274 if (!CurModule.LateResolveTypes.empty()) {
7275 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7276 if (DID.Type == ValID::LocalName) {
7277 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7278 } else {
7279 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7280 }
7281 if (ParserResult)
7282 delete ParserResult;
7283 return 0;
7284 }
7285
7286 // Emit an error if there are any unresolved values left.
7287 if (!CurModule.LateResolveValues.empty()) {
7288 Value *V = CurModule.LateResolveValues.back();
7289 std::map<Value*, std::pair<ValID, int> >::iterator I =
7290 CurModule.PlaceHolderInfo.find(V);
7291
7292 if (I != CurModule.PlaceHolderInfo.end()) {
7293 ValID &DID = I->second.first;
7294 if (DID.Type == ValID::LocalName) {
7295 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7296 } else {
7297 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7298 }
7299 if (ParserResult)
7300 delete ParserResult;
7301 return 0;
7302 }
7303 }
7304
7305 // Check to make sure that parsing produced a result
7306 if (!ParserResult)
7307 return 0;
7308
7309 // Reset ParserResult variable while saving its value for the result.
7310 Module *Result = ParserResult;
7311 ParserResult = 0;
7312
7313 return Result;
7314}
7315
7316void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007317 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007318 // TODO: column number in exception
7319 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007320 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007321 TriggerError = 1;
7322}
7323
7324int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007325 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007326 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007327 if (yychar != YYEMPTY && yychar != 0) {
7328 errMsg += " while reading token: '";
Eric Christopher329d2672008-09-24 04:55:49 +00007329 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007330 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7331 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007332 GenerateError(errMsg);
7333 return 0;
7334}
Dan Gohman54392c12008-04-19 00:24:39 +00007335