blob: 6321c6f6a1010f943a914036fccc8eb7142f2eb4 [file] [log] [blame]
Dan Gohmanf4423b12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Dan Gohmanf4423b12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004
Dan Gohmanf4423b12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Anton Korobeynikov178a3522007-01-12 19:22:51 +00007
Dan Gohmanf4423b12008-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. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000062#define yyparse llvmAsmparse
Dan Gohmanf4423b12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Dan Gohmanf4423b12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Dan Gohmanf4423b12008-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 Johannesenc7071cc2008-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,
142 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,
Dan Gohmane4977cf2008-05-23 01:55:30 +0000213 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,
227 DEFAULT = 408,
228 HIDDEN = 409,
229 PROTECTED = 410
Dan Gohmanf4423b12008-04-19 00:24:39 +0000230 };
231#endif
232/* Tokens. */
233#define ESINT64VAL 258
234#define EUINT64VAL 259
235#define ESAPINTVAL 260
236#define EUAPINTVAL 261
237#define LOCALVAL_ID 262
238#define GLOBALVAL_ID 263
239#define FPVAL 264
240#define VOID 265
241#define INTTYPE 266
242#define FLOAT 267
243#define DOUBLE 268
244#define X86_FP80 269
245#define FP128 270
246#define PPC_FP128 271
247#define LABEL 272
248#define TYPE 273
249#define LOCALVAR 274
250#define GLOBALVAR 275
251#define LABELSTR 276
252#define STRINGCONSTANT 277
253#define ATSTRINGCONSTANT 278
254#define PCTSTRINGCONSTANT 279
255#define ZEROINITIALIZER 280
256#define TRUETOK 281
257#define FALSETOK 282
258#define BEGINTOK 283
259#define ENDTOK 284
260#define DECLARE 285
261#define DEFINE 286
262#define GLOBAL 287
263#define CONSTANT 288
264#define SECTION 289
265#define ALIAS 290
266#define VOLATILE 291
267#define THREAD_LOCAL 292
268#define TO 293
269#define DOTDOTDOT 294
270#define NULL_TOK 295
271#define UNDEF 296
272#define INTERNAL 297
273#define LINKONCE 298
274#define WEAK 299
275#define APPENDING 300
276#define DLLIMPORT 301
277#define DLLEXPORT 302
278#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000279#define COMMON 304
280#define OPAQUE 305
281#define EXTERNAL 306
282#define TARGET 307
283#define TRIPLE 308
284#define ALIGN 309
285#define ADDRSPACE 310
286#define DEPLIBS 311
287#define CALL 312
288#define TAIL 313
289#define ASM_TOK 314
290#define MODULE 315
291#define SIDEEFFECT 316
292#define CC_TOK 317
293#define CCC_TOK 318
294#define FASTCC_TOK 319
295#define COLDCC_TOK 320
296#define X86_STDCALLCC_TOK 321
297#define X86_FASTCALLCC_TOK 322
298#define DATALAYOUT 323
299#define RET 324
300#define BR 325
301#define SWITCH 326
302#define INVOKE 327
303#define UNWIND 328
304#define UNREACHABLE 329
305#define ADD 330
306#define SUB 331
307#define MUL 332
308#define UDIV 333
309#define SDIV 334
310#define FDIV 335
311#define UREM 336
312#define SREM 337
313#define FREM 338
314#define AND 339
315#define OR 340
316#define XOR 341
317#define SHL 342
318#define LSHR 343
319#define ASHR 344
320#define ICMP 345
321#define FCMP 346
322#define VICMP 347
323#define VFCMP 348
324#define EQ 349
325#define NE 350
326#define SLT 351
327#define SGT 352
328#define SLE 353
329#define SGE 354
330#define ULT 355
331#define UGT 356
332#define ULE 357
333#define UGE 358
334#define OEQ 359
335#define ONE 360
336#define OLT 361
337#define OGT 362
338#define OLE 363
339#define OGE 364
340#define ORD 365
341#define UNO 366
342#define UEQ 367
343#define UNE 368
344#define MALLOC 369
345#define ALLOCA 370
346#define FREE 371
347#define LOAD 372
348#define STORE 373
349#define GETELEMENTPTR 374
350#define TRUNC 375
351#define ZEXT 376
352#define SEXT 377
353#define FPTRUNC 378
354#define FPEXT 379
355#define BITCAST 380
356#define UITOFP 381
357#define SITOFP 382
358#define FPTOUI 383
359#define FPTOSI 384
360#define INTTOPTR 385
361#define PTRTOINT 386
362#define PHI_TOK 387
363#define SELECT 388
364#define VAARG 389
365#define EXTRACTELEMENT 390
366#define INSERTELEMENT 391
367#define SHUFFLEVECTOR 392
368#define GETRESULT 393
Dan Gohmane4977cf2008-05-23 01:55:30 +0000369#define EXTRACTVALUE 394
370#define INSERTVALUE 395
371#define SIGNEXT 396
372#define ZEROEXT 397
373#define NORETURN 398
374#define INREG 399
375#define SRET 400
376#define NOUNWIND 401
377#define NOALIAS 402
378#define BYVAL 403
379#define NEST 404
380#define READNONE 405
381#define READONLY 406
382#define GC 407
383#define DEFAULT 408
384#define HIDDEN 409
385#define PROTECTED 410
Dan Gohmanf4423b12008-04-19 00:24:39 +0000386
387
388
389
390/* Copy the first part of user declarations. */
Nate Begeman5bc1ea02008-07-29 15:49:41 +0000391#line 14 "/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000392
393#include "ParserInternals.h"
394#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000395#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000396#include "llvm/Instructions.h"
397#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000398#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000399#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000400#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000401#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000402#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000403#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000404#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000405#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000406#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000407#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000408#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000409#include <utility>
410
Reid Spencere4f47592006-08-18 17:32:55 +0000411// The following is a gross hack. In order to rid the libAsmParser library of
412// exceptions, we have to have a way of getting the yyparse function to go into
413// an error situation. So, whenever we want an error to occur, the GenerateError
414// function (see bottom of file) sets TriggerError. Then, at the end of each
415// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
416// (a goto) to put YACC in error state. Furthermore, several calls to
417// GenerateError are made from inside productions and they must simulate the
418// previous exception behavior by exiting the production immediately. We have
419// replaced these with the GEN_ERROR macro which calls GeneratError and then
420// immediately invokes YYERROR. This would be so much cleaner if it was a
421// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000422static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000423#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000424#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
425
Reid Spencer68a24bd2005-08-27 18:50:39 +0000426int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
427int yylex(); // declaration" of xxx warnings.
428int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000429using namespace llvm;
430
431static Module *ParserResult;
432
433// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
434// relating to upreferences in the input stream.
435//
436//#define DEBUG_UPREFS 1
437#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000438#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000439#else
440#define UR_OUT(X)
441#endif
442
443#define YYERROR_VERBOSE 1
444
Chris Lattnerb475c422005-11-12 18:22:38 +0000445static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000446
447
448// This contains info used when building the body of a function. It is
449// destroyed when the function is completed.
450//
451typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000452
Reid Spencer68a24bd2005-08-27 18:50:39 +0000453static void
Reid Spencer93c40032007-03-19 18:40:50 +0000454ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000455
456static struct PerModuleInfo {
457 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000458 ValueList Values; // Module level numbered definitions
459 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000460 std::vector<PATypeHolder> Types;
461 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000462
463 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000464 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000465 /// that we can resolve them later and print error messages as appropriate.
466 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
467
468 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
469 // references to global values. Global values may be referenced before they
470 // are defined, and if so, the temporary object that they represent is held
471 // here. This is used for forward references of GlobalValues.
472 //
473 typedef std::map<std::pair<const PointerType *,
474 ValID>, GlobalValue*> GlobalRefsType;
475 GlobalRefsType GlobalRefs;
476
477 void ModuleDone() {
478 // If we could not resolve some functions at function compilation time
479 // (calls to functions before they are defined), resolve them now... Types
480 // are resolved when the constant pool has been completely parsed.
481 //
482 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000483 if (TriggerError)
484 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000485
486 // Check to make sure that all global value forward references have been
487 // resolved!
488 //
489 if (!GlobalRefs.empty()) {
490 std::string UndefinedReferences = "Unresolved global references exist:\n";
491
492 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
493 I != E; ++I) {
494 UndefinedReferences += " " + I->first.first->getDescription() + " " +
495 I->first.second.getName() + "\n";
496 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000497 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000498 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000499 }
500
Chandler Carruth02202192007-08-04 01:56:21 +0000501 // Look for intrinsic functions and CallInst that need to be upgraded
502 for (Module::iterator FI = CurrentModule->begin(),
503 FE = CurrentModule->end(); FI != FE; )
504 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
505
Reid Spencer68a24bd2005-08-27 18:50:39 +0000506 Values.clear(); // Clear out function local definitions
507 Types.clear();
508 CurrentModule = 0;
509 }
510
Reid Spencer68a24bd2005-08-27 18:50:39 +0000511 // GetForwardRefForGlobal - Check to see if there is a forward reference
512 // for this global. If so, remove it from the GlobalRefs map and return it.
513 // If not, just return null.
514 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
515 // Check to see if there is a forward reference to this global variable...
516 // if there is, eliminate it and patch the reference to use the new def'n.
517 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
518 GlobalValue *Ret = 0;
519 if (I != GlobalRefs.end()) {
520 Ret = I->second;
521 GlobalRefs.erase(I);
522 }
523 return Ret;
524 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000525
526 bool TypeIsUnresolved(PATypeHolder* PATy) {
527 // If it isn't abstract, its resolved
528 const Type* Ty = PATy->get();
529 if (!Ty->isAbstract())
530 return false;
531 // Traverse the type looking for abstract types. If it isn't abstract then
532 // we don't need to traverse that leg of the type.
533 std::vector<const Type*> WorkList, SeenList;
534 WorkList.push_back(Ty);
535 while (!WorkList.empty()) {
536 const Type* Ty = WorkList.back();
537 SeenList.push_back(Ty);
538 WorkList.pop_back();
539 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
540 // Check to see if this is an unresolved type
541 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
542 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
543 for ( ; I != E; ++I) {
544 if (I->second.get() == OpTy)
545 return true;
546 }
547 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
548 const Type* TheTy = SeqTy->getElementType();
549 if (TheTy->isAbstract() && TheTy != Ty) {
550 std::vector<const Type*>::iterator I = SeenList.begin(),
551 E = SeenList.end();
552 for ( ; I != E; ++I)
553 if (*I == TheTy)
554 break;
555 if (I == E)
556 WorkList.push_back(TheTy);
557 }
558 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
559 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
560 const Type* TheTy = StrTy->getElementType(i);
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
563 E = SeenList.end();
564 for ( ; I != E; ++I)
565 if (*I == TheTy)
566 break;
567 if (I == E)
568 WorkList.push_back(TheTy);
569 }
570 }
571 }
572 }
573 return false;
574 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000575} CurModule;
576
577static struct PerFunctionInfo {
578 Function *CurrentFunction; // Pointer to current function being created
579
Reid Spencer93c40032007-03-19 18:40:50 +0000580 ValueList Values; // Keep track of #'d definitions
581 unsigned NextValNum;
582 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000583 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000584 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000585 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000586
587 /// BBForwardRefs - When we see forward references to basic blocks, keep
588 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000589 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000590
591 inline PerFunctionInfo() {
592 CurrentFunction = 0;
593 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000594 Linkage = GlobalValue::ExternalLinkage;
595 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000596 }
597
598 inline void FunctionStart(Function *M) {
599 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000600 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000601 }
602
603 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000604 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000605 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000606 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000607 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000608 return;
609 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000610
611 // Resolve all forward references now.
612 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
613
614 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000615 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616 CurrentFunction = 0;
617 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000618 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000619 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000620 }
621} CurFun; // Info for the current function...
622
623static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
624
625
626//===----------------------------------------------------------------------===//
627// Code to handle definitions of all the types
628//===----------------------------------------------------------------------===//
629
Reid Spencer93c40032007-03-19 18:40:50 +0000630static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
631 // Things that have names or are void typed don't get slot numbers
632 if (V->hasName() || (V->getType() == Type::VoidTy))
633 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000634
Reid Spencer93c40032007-03-19 18:40:50 +0000635 // In the case of function values, we have to allow for the forward reference
636 // of basic blocks, which are included in the numbering. Consequently, we keep
637 // track of the next insertion location with NextValNum. When a BB gets
638 // inserted, it could change the size of the CurFun.Values vector.
639 if (&ValueTab == &CurFun.Values) {
640 if (ValueTab.size() <= CurFun.NextValNum)
641 ValueTab.resize(CurFun.NextValNum+1);
642 ValueTab[CurFun.NextValNum++] = V;
643 return;
644 }
645 // For all other lists, its okay to just tack it on the back of the vector.
646 ValueTab.push_back(V);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000647}
648
649static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
650 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000651 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000652 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000653 if (D.Num < CurModule.Types.size())
654 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000655 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000656 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000657 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000658 D.destroy(); // Free old strdup'd memory...
659 return N;
660 }
661 break;
662 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000663 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000664 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000665 }
666
667 // If we reached here, we referenced either a symbol that we don't know about
668 // or an id number that hasn't been read yet. We may be referencing something
669 // forward, so just create an entry to be resolved later and get to it...
670 //
671 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
672
673
674 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000675 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000676 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000677 return 0;
678 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000679 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000680 return 0;
681 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000682 }
683
Reid Spencer861d9d62006-11-28 07:29:44 +0000684 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000685 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000686 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000687
Reid Spencer861d9d62006-11-28 07:29:44 +0000688 Type *Typ = OpaqueType::get();
689 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
690 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000691 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000692
Reid Spencer93c40032007-03-19 18:40:50 +0000693// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000694// the provided ValID. If the value exists and has already been defined, return
695// it. Otherwise return null.
696//
Reid Spencer93c40032007-03-19 18:40:50 +0000697static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000698 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000699 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000700 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000701 return 0;
702 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703
704 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000705 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000706 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000707 if (D.Num >= CurFun.Values.size())
708 return 0;
709 Value *Result = CurFun.Values[D.Num];
710 if (Ty != Result->getType()) {
711 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
712 Result->getType()->getDescription() + "' does not match "
713 "expected type, '" + Ty->getDescription() + "'");
714 return 0;
715 }
716 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000717 }
718 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000719 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000720 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000721 Value *Result = CurModule.Values[D.Num];
722 if (Ty != Result->getType()) {
723 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
724 Result->getType()->getDescription() + "' does not match "
725 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000726 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000727 }
728 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000729 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000730
731 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000732 if (!inFunctionScope())
733 return 0;
734 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000735 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000736 if (N == 0)
737 return 0;
738 if (N->getType() != Ty)
739 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000740
741 D.destroy(); // Free old strdup'd memory...
742 return N;
743 }
744 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000745 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000746 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000747 if (N == 0)
748 return 0;
749 if (N->getType() != Ty)
750 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000751
752 D.destroy(); // Free old strdup'd memory...
753 return N;
754 }
755
756 // Check to make sure that "Ty" is an integral type, and that our
757 // value will fit into the specified type...
758 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000759 if (!isa<IntegerType>(Ty) ||
760 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000761 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000762 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000763 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000764 return 0;
765 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000766 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000767
768 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000769 if (isa<IntegerType>(Ty) &&
770 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000771 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000772
773 if (!isa<IntegerType>(Ty) ||
774 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
775 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
776 "' is invalid or out of range for type '" +
777 Ty->getDescription() + "'");
778 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000779 }
Chris Lattner38905612008-02-19 04:36:25 +0000780 // This is really a signed reference. Transmogrify.
781 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000782
Chris Lattner1913b942008-07-11 00:30:39 +0000783 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
784 if (!isa<IntegerType>(Ty)) {
785 GenerateError("Integral constant '" + D.getName() +
786 "' is invalid or out of range for type '" +
787 Ty->getDescription() + "'");
788 return 0;
789 }
790
791 {
792 APSInt Tmp = *D.ConstPoolInt;
793 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
794 return ConstantInt::get(Tmp);
795 }
796
Reid Spencer68a24bd2005-08-27 18:50:39 +0000797 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000798 if (!Ty->isFloatingPoint() ||
799 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000800 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000801 return 0;
802 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000803 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000804 // as double. Fix this here. Long double does not need this.
805 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
806 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000807 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000808 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000809
810 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000811 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000812 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000813 return 0;
814 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000815 return ConstantPointerNull::get(cast<PointerType>(Ty));
816
817 case ValID::ConstUndefVal: // Is it an undef value?
818 return UndefValue::get(Ty);
819
Chris Lattner7aa61892005-12-21 17:53:23 +0000820 case ValID::ConstZeroVal: // Is it a zero value?
821 return Constant::getNullValue(Ty);
822
Reid Spencer68a24bd2005-08-27 18:50:39 +0000823 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000824 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000825 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000826 return 0;
827 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000828 return D.ConstantValue;
829
Chris Lattner0e9c3762006-01-25 22:27:16 +0000830 case ValID::InlineAsmVal: { // Inline asm expression
831 const PointerType *PTy = dyn_cast<PointerType>(Ty);
832 const FunctionType *FTy =
833 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000834 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000835 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000836 return 0;
837 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000838 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
839 D.IAD->HasSideEffects);
840 D.destroy(); // Free InlineAsmDescriptor.
841 return IA;
842 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000843 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000844 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000845 return 0;
846 } // End of switch
847
Reid Spencera9720f52007-02-05 17:04:00 +0000848 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000849 return 0;
850}
851
Reid Spencer93c40032007-03-19 18:40:50 +0000852// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000853// value is not already defined, it "improvises" by creating a placeholder var
854// that looks and acts just like the requested variable. When the value is
855// defined later, all uses of the placeholder variable are replaced with the
856// real thing.
857//
858static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000859 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000860 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000861 return 0;
862 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000863
864 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000865 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000866 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000867 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000868
Reid Spencer5b7e7532006-09-28 19:28:24 +0000869 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000870 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000871 return 0;
872 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000873
874 // If we reached here, we referenced either a symbol that we don't know about
875 // or an id number that hasn't been read yet. We may be referencing something
876 // forward, so just create an entry to be resolved later and get to it...
877 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000878 switch (ID.Type) {
879 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000880 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000881 const PointerType *PTy = dyn_cast<PointerType>(Ty);
882 if (!PTy) {
883 GenerateError("Invalid type for reference to global" );
884 return 0;
885 }
886 const Type* ElTy = PTy->getElementType();
887 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000888 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000889 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000890 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
891 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000892 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000893 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000894 default:
895 V = new Argument(Ty);
896 }
897
Reid Spencer68a24bd2005-08-27 18:50:39 +0000898 // Remember where this forward reference came from. FIXME, shouldn't we try
899 // to recycle these things??
900 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000901 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000902
903 if (inFunctionScope())
904 InsertValue(V, CurFun.LateResolveValues);
905 else
906 InsertValue(V, CurModule.LateResolveValues);
907 return V;
908}
909
Reid Spencer93c40032007-03-19 18:40:50 +0000910/// defineBBVal - This is a definition of a new basic block with the specified
911/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000912static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000913 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000914
Reid Spencer68a24bd2005-08-27 18:50:39 +0000915 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000916
Reid Spencer93c40032007-03-19 18:40:50 +0000917 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000918
Reid Spencer93c40032007-03-19 18:40:50 +0000919 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
920 if (BBI != CurFun.BBForwardRefs.end()) {
921 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000922 // The forward declaration could have been inserted anywhere in the
923 // function: insert it into the correct place now.
924 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
925 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000926
Reid Spencer66728ef2007-03-20 01:13:36 +0000927 // We're about to erase the entry, save the key so we can clean it up.
928 ValID Tmp = BBI->first;
929
Reid Spencer93c40032007-03-19 18:40:50 +0000930 // Erase the forward ref from the map as its no longer "forward"
931 CurFun.BBForwardRefs.erase(ID);
932
Reid Spencer66728ef2007-03-20 01:13:36 +0000933 // The key has been removed from the map but so we don't want to leave
934 // strdup'd memory around so destroy it too.
935 Tmp.destroy();
936
Reid Spencer93c40032007-03-19 18:40:50 +0000937 // If its a numbered definition, bump the number and set the BB value.
938 if (ID.Type == ValID::LocalID) {
939 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
940 InsertValue(BB);
941 }
Devang Patel67909432008-03-03 18:58:47 +0000942 } else {
943 // We haven't seen this BB before and its first mention is a definition.
944 // Just create it and return it.
945 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000946 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000947 if (ID.Type == ValID::LocalID) {
948 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
949 InsertValue(BB);
950 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000951 }
Reid Spencer93c40032007-03-19 18:40:50 +0000952
Devang Patel67909432008-03-03 18:58:47 +0000953 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000954 return BB;
955}
956
957/// getBBVal - get an existing BB value or create a forward reference for it.
958///
959static BasicBlock *getBBVal(const ValID &ID) {
960 assert(inFunctionScope() && "Can't get basic block at global scope!");
961
962 BasicBlock *BB = 0;
963
964 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
965 if (BBI != CurFun.BBForwardRefs.end()) {
966 BB = BBI->second;
967 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000968 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000969 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000970 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000971 if (N->getType()->getTypeID() == Type::LabelTyID)
972 BB = cast<BasicBlock>(N);
973 else
974 GenerateError("Reference to label '" + Name + "' is actually of type '"+
975 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000976 }
Reid Spencer93c40032007-03-19 18:40:50 +0000977 } else if (ID.Type == ValID::LocalID) {
978 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
979 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
980 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
981 else
982 GenerateError("Reference to label '%" + utostr(ID.Num) +
983 "' is actually of type '"+
984 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
985 }
986 } else {
987 GenerateError("Illegal label reference " + ID.getName());
988 return 0;
989 }
990
991 // If its already been defined, return it now.
992 if (BB) {
993 ID.destroy(); // Free strdup'd memory.
994 return BB;
995 }
996
997 // Otherwise, this block has not been seen before, create it.
998 std::string Name;
999 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001000 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001001 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001002
1003 // Insert it in the forward refs map.
1004 CurFun.BBForwardRefs[ID] = BB;
1005
Reid Spencer68a24bd2005-08-27 18:50:39 +00001006 return BB;
1007}
1008
1009
1010//===----------------------------------------------------------------------===//
1011// Code to handle forward references in instructions
1012//===----------------------------------------------------------------------===//
1013//
1014// This code handles the late binding needed with statements that reference
1015// values not defined yet... for example, a forward branch, or the PHI node for
1016// a loop body.
1017//
1018// This keeps a table (CurFun.LateResolveValues) of all such forward references
1019// and back patchs after we are done.
1020//
1021
1022// ResolveDefinitions - If we could not resolve some defs at parsing
1023// time (forward branches, phi functions for loops, etc...) resolve the
1024// defs now...
1025//
1026static void
Reid Spencer93c40032007-03-19 18:40:50 +00001027ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001028 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001029 while (!LateResolvers.empty()) {
1030 Value *V = LateResolvers.back();
1031 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001032
Reid Spencer93c40032007-03-19 18:40:50 +00001033 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1034 CurModule.PlaceHolderInfo.find(V);
1035 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001036
Reid Spencer93c40032007-03-19 18:40:50 +00001037 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001038
Reid Spencer93c40032007-03-19 18:40:50 +00001039 Value *TheRealValue = getExistingVal(V->getType(), DID);
1040 if (TriggerError)
1041 return;
1042 if (TheRealValue) {
1043 V->replaceAllUsesWith(TheRealValue);
1044 delete V;
1045 CurModule.PlaceHolderInfo.erase(PHI);
1046 } else if (FutureLateResolvers) {
1047 // Functions have their unresolved items forwarded to the module late
1048 // resolver table
1049 InsertValue(V, *FutureLateResolvers);
1050 } else {
1051 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1052 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1053 "' of type '" + V->getType()->getDescription() + "'",
1054 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001055 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001056 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001057 GenerateError("Reference to an invalid definition: #" +
1058 itostr(DID.Num) + " of type '" +
1059 V->getType()->getDescription() + "'",
1060 PHI->second.second);
1061 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001062 }
1063 }
1064 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001065 LateResolvers.clear();
1066}
1067
1068// ResolveTypeTo - A brand new type was just declared. This means that (if
1069// name is not null) things referencing Name can be resolved. Otherwise, things
1070// refering to the number can be resolved. Do this now.
1071//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001072static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001073 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001074 if (Name)
1075 D = ValID::createLocalName(*Name);
1076 else
1077 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001078
Reid Spencer861d9d62006-11-28 07:29:44 +00001079 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001080 CurModule.LateResolveTypes.find(D);
1081 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001082 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001083 CurModule.LateResolveTypes.erase(I);
1084 }
1085}
1086
1087// setValueName - Set the specified value to the name given. The name may be
1088// null potentially, in which case this is a noop. The string passed in is
1089// assumed to be a malloc'd string buffer, and is free'd by this function.
1090//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001091static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001092 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001093 std::string Name(*NameStr); // Copy string
1094 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001095
Reid Spencer41dff5e2007-01-26 08:05:27 +00001096 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001097 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001098 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001099 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001100
Reid Spencera9720f52007-02-05 17:04:00 +00001101 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001102 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1103 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001104 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001105 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001106 return;
1107 }
1108
1109 // Set the name.
1110 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001111}
1112
1113/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1114/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001115static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001116ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001117 GlobalValue::LinkageTypes Linkage,
1118 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001119 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001120 Constant *Initializer, bool IsThreadLocal,
1121 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001122 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001123 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001124 return 0;
1125 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001126 if (Ty == Type::LabelTy) {
1127 GenerateError("Cannot declare global vars of label type");
1128 return 0;
1129 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001130
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001131 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001132
1133 std::string Name;
1134 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001135 Name = *NameStr; // Copy string
1136 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001137 }
1138
1139 // See if this global value was forward referenced. If so, recycle the
1140 // object.
1141 ValID ID;
1142 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001143 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001144 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001145 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001146 }
1147
1148 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1149 // Move the global to the end of the list, from whereever it was
1150 // previously inserted.
1151 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1152 CurModule.CurrentModule->getGlobalList().remove(GV);
1153 CurModule.CurrentModule->getGlobalList().push_back(GV);
1154 GV->setInitializer(Initializer);
1155 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001156 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001157 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001158 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001160 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001161 }
1162
Reid Spenceref9b9a72007-02-05 20:47:22 +00001163 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001164 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001165 // if the global we're parsing has an initializer (is a definition) and
1166 // has external linkage.
1167 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1168 // If there is already a global with external linkage with this name
1169 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1170 // If we allow this GVar to get created, it will be renamed in the
1171 // symbol table because it conflicts with an existing GVar. We can't
1172 // allow redefinition of GVars whose linking indicates that their name
1173 // must stay the same. Issue the error.
1174 GenerateError("Redefinition of global variable named '" + Name +
1175 "' of type '" + Ty->getDescription() + "'");
1176 return 0;
1177 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001178 }
1179
1180 // Otherwise there is no existing GV to use, create one now.
1181 GlobalVariable *GV =
1182 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001183 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001184 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001185 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001186 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001187}
1188
1189// setTypeName - Set the specified type to the name given. The name may be
1190// null potentially, in which case this is a noop. The string passed in is
1191// assumed to be a malloc'd string buffer, and is freed by this function.
1192//
1193// This function returns true if the type has already been defined, but is
1194// allowed to be redefined in the specified context. If the name is a new name
1195// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001196static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001197 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001198 if (NameStr == 0) return false;
1199
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001200 std::string Name(*NameStr); // Copy string
1201 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001202
1203 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001204 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001205 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001206 return false;
1207 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001208
1209 // Set the type name, checking for conflicts as we do so.
1210 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1211
1212 if (AlreadyExists) { // Inserting a name that is already defined???
1213 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001214 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001215
1216 // There is only one case where this is allowed: when we are refining an
1217 // opaque type. In this case, Existing will be an opaque type.
1218 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1219 // We ARE replacing an opaque type!
1220 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1221 return true;
1222 }
1223
1224 // Otherwise, this is an attempt to redefine a type. That's okay if
1225 // the redefinition is identical to the original. This will be so if
1226 // Existing and T point to the same Type object. In this one case we
1227 // allow the equivalent redefinition.
1228 if (Existing == T) return true; // Yes, it's equal.
1229
1230 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001231 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001232 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001233 }
1234
1235 return false;
1236}
1237
1238//===----------------------------------------------------------------------===//
1239// Code for handling upreferences in type names...
1240//
1241
1242// TypeContains - Returns true if Ty directly contains E in it.
1243//
1244static bool TypeContains(const Type *Ty, const Type *E) {
1245 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1246 E) != Ty->subtype_end();
1247}
1248
1249namespace {
1250 struct UpRefRecord {
1251 // NestingLevel - The number of nesting levels that need to be popped before
1252 // this type is resolved.
1253 unsigned NestingLevel;
1254
1255 // LastContainedTy - This is the type at the current binding level for the
1256 // type. Every time we reduce the nesting level, this gets updated.
1257 const Type *LastContainedTy;
1258
1259 // UpRefTy - This is the actual opaque type that the upreference is
1260 // represented with.
1261 OpaqueType *UpRefTy;
1262
1263 UpRefRecord(unsigned NL, OpaqueType *URTy)
1264 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1265 };
1266}
1267
1268// UpRefs - A list of the outstanding upreferences that need to be resolved.
1269static std::vector<UpRefRecord> UpRefs;
1270
1271/// HandleUpRefs - Every time we finish a new layer of types, this function is
1272/// called. It loops through the UpRefs vector, which is a list of the
1273/// currently active types. For each type, if the up reference is contained in
1274/// the newly completed type, we decrement the level count. When the level
1275/// count reaches zero, the upreferenced type is the type that is passed in:
1276/// thus we can complete the cycle.
1277///
1278static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001279 // If Ty isn't abstract, or if there are no up-references in it, then there is
1280 // nothing to resolve here.
1281 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1282
Reid Spencer68a24bd2005-08-27 18:50:39 +00001283 PATypeHolder Ty(ty);
1284 UR_OUT("Type '" << Ty->getDescription() <<
1285 "' newly formed. Resolving upreferences.\n" <<
1286 UpRefs.size() << " upreferences active!\n");
1287
1288 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1289 // to zero), we resolve them all together before we resolve them to Ty. At
1290 // the end of the loop, if there is anything to resolve to Ty, it will be in
1291 // this variable.
1292 OpaqueType *TypeToResolve = 0;
1293
1294 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1295 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1296 << UpRefs[i].second->getDescription() << ") = "
1297 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1298 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1299 // Decrement level of upreference
1300 unsigned Level = --UpRefs[i].NestingLevel;
1301 UpRefs[i].LastContainedTy = Ty;
1302 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1303 if (Level == 0) { // Upreference should be resolved!
1304 if (!TypeToResolve) {
1305 TypeToResolve = UpRefs[i].UpRefTy;
1306 } else {
1307 UR_OUT(" * Resolving upreference for "
1308 << UpRefs[i].second->getDescription() << "\n";
1309 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1310 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1311 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1312 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1313 }
1314 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1315 --i; // Do not skip the next element...
1316 }
1317 }
1318 }
1319
1320 if (TypeToResolve) {
1321 UR_OUT(" * Resolving upreference for "
1322 << UpRefs[i].second->getDescription() << "\n";
1323 std::string OldName = TypeToResolve->getDescription());
1324 TypeToResolve->refineAbstractTypeTo(Ty);
1325 }
1326
1327 return Ty;
1328}
1329
Reid Spencer68a24bd2005-08-27 18:50:39 +00001330//===----------------------------------------------------------------------===//
1331// RunVMAsmParser - Define an interface to this parser
1332//===----------------------------------------------------------------------===//
1333//
Reid Spencer14310612006-12-31 05:40:51 +00001334static Module* RunParser(Module * M);
1335
Duncan Sandsdc024672007-11-27 13:23:08 +00001336Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1337 InitLLLexer(MB);
1338 Module *M = RunParser(new Module(LLLgetFilename()));
1339 FreeLexer();
1340 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001341}
1342
1343
Dan Gohmanf4423b12008-04-19 00:24:39 +00001344
1345/* Enabling traces. */
1346#ifndef YYDEBUG
1347# define YYDEBUG 0
1348#endif
1349
1350/* Enabling verbose error messages. */
1351#ifdef YYERROR_VERBOSE
1352# undef YYERROR_VERBOSE
1353# define YYERROR_VERBOSE 1
1354#else
1355# define YYERROR_VERBOSE 0
1356#endif
1357
1358/* Enabling the token table. */
1359#ifndef YYTOKEN_TABLE
1360# define YYTOKEN_TABLE 0
1361#endif
1362
1363#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1364typedef union YYSTYPE
Nate Begeman5bc1ea02008-07-29 15:49:41 +00001365#line 967 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001366{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001367 llvm::Module *ModuleVal;
1368 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001369 llvm::BasicBlock *BasicBlockVal;
1370 llvm::TerminatorInst *TermInstVal;
1371 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001372 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001373
Reid Spencera132e042006-12-03 05:46:11 +00001374 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001375 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001376 llvm::PATypeHolder *TypeVal;
1377 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001378 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001379 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001380 llvm::ArgListType *ArgList;
1381 llvm::TypeWithAttrs TypeWithAttrs;
1382 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001383 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001384
Reid Spencer68a24bd2005-08-27 18:50:39 +00001385 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001386 std::list<std::pair<llvm::Value*,
1387 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001388 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001389 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001390
1391 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001392 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001393 llvm::ParameterAttributes ParamAttrs;
Reid Spencer38c91a92007-02-28 02:24:54 +00001394 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001395 int64_t SInt64Val;
1396 uint64_t UInt64Val;
1397 int SIntVal;
1398 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001399 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400 bool BoolVal;
1401
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001402 std::string *StrVal; // This memory must be deleted
1403 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001404
Reid Spencera132e042006-12-03 05:46:11 +00001405 llvm::Instruction::BinaryOps BinaryOpVal;
1406 llvm::Instruction::TermOps TermOpVal;
1407 llvm::Instruction::MemoryOps MemOpVal;
1408 llvm::Instruction::CastOps CastOpVal;
1409 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001410 llvm::ICmpInst::Predicate IPredicate;
1411 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001412}
Dan Gohman180c1692008-06-23 18:43:26 +00001413/* Line 193 of yacc.c. */
Chris Lattner1913b942008-07-11 00:30:39 +00001414#line 1415 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001415 YYSTYPE;
1416# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1417# define YYSTYPE_IS_DECLARED 1
1418# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001419#endif
1420
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001421
Reid Spencer68a24bd2005-08-27 18:50:39 +00001422
Dan Gohmanf4423b12008-04-19 00:24:39 +00001423/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001424
1425
Dan Gohmanf4423b12008-04-19 00:24:39 +00001426/* Line 216 of yacc.c. */
Chris Lattner1913b942008-07-11 00:30:39 +00001427#line 1428 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001428
Dan Gohmanf4423b12008-04-19 00:24:39 +00001429#ifdef short
1430# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001431#endif
1432
Dan Gohmanf4423b12008-04-19 00:24:39 +00001433#ifdef YYTYPE_UINT8
1434typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001435#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001436typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001437#endif
1438
Dan Gohmanf4423b12008-04-19 00:24:39 +00001439#ifdef YYTYPE_INT8
1440typedef YYTYPE_INT8 yytype_int8;
1441#elif (defined __STDC__ || defined __C99__FUNC__ \
1442 || defined __cplusplus || defined _MSC_VER)
1443typedef signed char yytype_int8;
1444#else
1445typedef short int yytype_int8;
1446#endif
1447
1448#ifdef YYTYPE_UINT16
1449typedef YYTYPE_UINT16 yytype_uint16;
1450#else
1451typedef unsigned short int yytype_uint16;
1452#endif
1453
1454#ifdef YYTYPE_INT16
1455typedef YYTYPE_INT16 yytype_int16;
1456#else
1457typedef short int yytype_int16;
1458#endif
1459
1460#ifndef YYSIZE_T
1461# ifdef __SIZE_TYPE__
1462# define YYSIZE_T __SIZE_TYPE__
1463# elif defined size_t
1464# define YYSIZE_T size_t
1465# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1466 || defined __cplusplus || defined _MSC_VER)
1467# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1468# define YYSIZE_T size_t
1469# else
1470# define YYSIZE_T unsigned int
1471# endif
1472#endif
1473
1474#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1475
1476#ifndef YY_
Dan Gohman180c1692008-06-23 18:43:26 +00001477# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001478# if ENABLE_NLS
1479# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1480# define YY_(msgid) dgettext ("bison-runtime", msgid)
1481# endif
1482# endif
1483# ifndef YY_
1484# define YY_(msgid) msgid
1485# endif
1486#endif
1487
1488/* Suppress unused-variable warnings by "using" E. */
1489#if ! defined lint || defined __GNUC__
1490# define YYUSE(e) ((void) (e))
1491#else
1492# define YYUSE(e) /* empty */
1493#endif
1494
1495/* Identity function, used to suppress warnings about constant conditions. */
1496#ifndef lint
1497# define YYID(n) (n)
1498#else
1499#if (defined __STDC__ || defined __C99__FUNC__ \
1500 || defined __cplusplus || defined _MSC_VER)
1501static int
1502YYID (int i)
1503#else
1504static int
1505YYID (i)
1506 int i;
1507#endif
1508{
1509 return i;
1510}
1511#endif
1512
1513#if ! defined yyoverflow || YYERROR_VERBOSE
1514
1515/* The parser invokes alloca or malloc; define the necessary symbols. */
1516
1517# ifdef YYSTACK_USE_ALLOCA
1518# if YYSTACK_USE_ALLOCA
1519# ifdef __GNUC__
1520# define YYSTACK_ALLOC __builtin_alloca
1521# elif defined __BUILTIN_VA_ARG_INCR
1522# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1523# elif defined _AIX
1524# define YYSTACK_ALLOC __alloca
1525# elif defined _MSC_VER
1526# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1527# define alloca _alloca
1528# else
1529# define YYSTACK_ALLOC alloca
1530# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1531 || defined __cplusplus || defined _MSC_VER)
1532# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1533# ifndef _STDLIB_H
1534# define _STDLIB_H 1
1535# endif
1536# endif
1537# endif
1538# endif
1539# endif
1540
1541# ifdef YYSTACK_ALLOC
1542 /* Pacify GCC's `empty if-body' warning. */
1543# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1544# ifndef YYSTACK_ALLOC_MAXIMUM
1545 /* The OS might guarantee only one guard page at the bottom of the stack,
1546 and a page size can be as small as 4096 bytes. So we cannot safely
1547 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1548 to allow for a few compiler-allocated temporary stack slots. */
1549# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1550# endif
1551# else
1552# define YYSTACK_ALLOC YYMALLOC
1553# define YYSTACK_FREE YYFREE
1554# ifndef YYSTACK_ALLOC_MAXIMUM
1555# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1556# endif
1557# if (defined __cplusplus && ! defined _STDLIB_H \
1558 && ! ((defined YYMALLOC || defined malloc) \
1559 && (defined YYFREE || defined free)))
1560# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1561# ifndef _STDLIB_H
1562# define _STDLIB_H 1
1563# endif
1564# endif
1565# ifndef YYMALLOC
1566# define YYMALLOC malloc
1567# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1568 || defined __cplusplus || defined _MSC_VER)
1569void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1570# endif
1571# endif
1572# ifndef YYFREE
1573# define YYFREE free
1574# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1575 || defined __cplusplus || defined _MSC_VER)
1576void free (void *); /* INFRINGES ON USER NAME SPACE */
1577# endif
1578# endif
1579# endif
1580#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1581
1582
1583#if (! defined yyoverflow \
1584 && (! defined __cplusplus \
1585 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1586
1587/* A type that is properly aligned for any stack member. */
1588union yyalloc
1589{
1590 yytype_int16 yyss;
1591 YYSTYPE yyvs;
1592 };
1593
1594/* The size of the maximum gap between one aligned stack and the next. */
1595# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1596
1597/* The size of an array large to enough to hold all stacks, each with
1598 N elements. */
1599# define YYSTACK_BYTES(N) \
1600 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1601 + YYSTACK_GAP_MAXIMUM)
1602
1603/* Copy COUNT objects from FROM to TO. The source and destination do
1604 not overlap. */
1605# ifndef YYCOPY
1606# if defined __GNUC__ && 1 < __GNUC__
1607# define YYCOPY(To, From, Count) \
1608 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1609# else
1610# define YYCOPY(To, From, Count) \
1611 do \
1612 { \
1613 YYSIZE_T yyi; \
1614 for (yyi = 0; yyi < (Count); yyi++) \
1615 (To)[yyi] = (From)[yyi]; \
1616 } \
1617 while (YYID (0))
1618# endif
1619# endif
1620
1621/* Relocate STACK from its old location to the new one. The
1622 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1623 elements in the stack, and YYPTR gives the new location of the
1624 stack. Advance YYPTR to a properly aligned location for the next
1625 stack. */
1626# define YYSTACK_RELOCATE(Stack) \
1627 do \
1628 { \
1629 YYSIZE_T yynewbytes; \
1630 YYCOPY (&yyptr->Stack, Stack, yysize); \
1631 Stack = &yyptr->Stack; \
1632 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1633 yyptr += yynewbytes / sizeof (*yyptr); \
1634 } \
1635 while (YYID (0))
1636
1637#endif
1638
1639/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001640#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001641/* YYLAST -- Last index in YYTABLE. */
Chris Lattner1913b942008-07-11 00:30:39 +00001642#define YYLAST 2360
Dan Gohmanf4423b12008-04-19 00:24:39 +00001643
1644/* YYNTOKENS -- Number of terminals. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001645#define YYNTOKENS 170
Dan Gohmanf4423b12008-04-19 00:24:39 +00001646/* YYNNTS -- Number of nonterminals. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001647#define YYNNTS 86
Dan Gohmanf4423b12008-04-19 00:24:39 +00001648/* YYNRULES -- Number of rules. */
Chris Lattner1913b942008-07-11 00:30:39 +00001649#define YYNRULES 342
Dan Gohmanf4423b12008-04-19 00:24:39 +00001650/* YYNRULES -- Number of states. */
Chris Lattner1913b942008-07-11 00:30:39 +00001651#define YYNSTATES 701
Dan Gohmanf4423b12008-04-19 00:24:39 +00001652
1653/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1654#define YYUNDEFTOK 2
Dan Gohmane4977cf2008-05-23 01:55:30 +00001655#define YYMAXUTOK 410
Dan Gohmanf4423b12008-04-19 00:24:39 +00001656
1657#define YYTRANSLATE(YYX) \
1658 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1659
1660/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1661static const yytype_uint8 yytranslate[] =
1662{
1663 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1665 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001667 156, 157, 160, 2, 159, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001669 165, 158, 166, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001670 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1671 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001672 2, 162, 161, 164, 2, 2, 2, 2, 2, 169,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1674 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001675 163, 2, 2, 167, 2, 168, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001676 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1677 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1678 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1689 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1690 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1691 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1692 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1693 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1694 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1695 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1696 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1697 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1698 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1699 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1700 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1701 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1702 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001703 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1704 155
Dan Gohmanf4423b12008-04-19 00:24:39 +00001705};
1706
1707#if YYDEBUG
1708/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1709 YYRHS. */
1710static const yytype_uint16 yyprhs[] =
1711{
1712 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1713 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1714 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1715 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1716 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1717 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1718 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1719 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001720 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1721 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1722 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1723 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1724 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1725 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1726 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1727 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1728 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1729 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1730 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1731 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001732 526, 535, 544, 550, 558, 562, 564, 566, 568, 570,
1733 571, 574, 581, 583, 584, 586, 589, 590, 594, 595,
1734 599, 603, 607, 611, 612, 621, 622, 632, 633, 643,
1735 649, 652, 656, 658, 662, 666, 670, 674, 676, 677,
1736 683, 687, 689, 693, 695, 696, 707, 709, 711, 716,
1737 718, 720, 723, 727, 728, 730, 732, 734, 736, 738,
Chris Lattner1913b942008-07-11 00:30:39 +00001738 740, 742, 744, 746, 748, 750, 754, 758, 761, 764,
1739 768, 771, 777, 782, 784, 790, 792, 794, 796, 798,
1740 800, 802, 805, 807, 811, 814, 817, 821, 824, 825,
1741 827, 830, 833, 837, 847, 857, 866, 881, 883, 885,
1742 892, 898, 901, 908, 916, 921, 926, 933, 940, 941,
1743 942, 946, 949, 953, 956, 958, 964, 970, 977, 984,
1744 991, 998, 1003, 1010, 1015, 1020, 1027, 1034, 1037, 1046,
1745 1048, 1050, 1051, 1055, 1062, 1066, 1073, 1076, 1082, 1090,
1746 1096, 1101, 1106
Dan Gohmanf4423b12008-04-19 00:24:39 +00001747};
1748
1749/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1750static const yytype_int16 yyrhs[] =
1751{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001752 216, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001753 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1754 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1755 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1756 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1757 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1758 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1759 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1760 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1761 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1762 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001763 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001764 -1, 19, -1, 22, -1, 24, -1, 178, -1, -1,
1765 55, 156, 4, 157, -1, -1, 178, 158, -1, -1,
1766 20, -1, 23, -1, 184, -1, -1, 182, 158, -1,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001767 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001768 49, -1, 46, -1, 48, -1, 51, -1, -1, 153,
1769 -1, 154, -1, 155, -1, -1, 46, -1, 48, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001770 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1771 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001772 -1, 66, -1, 67, -1, 62, 4, -1, 142, -1,
1773 121, -1, 141, -1, 122, -1, 144, -1, 145, -1,
1774 147, -1, 148, -1, 149, -1, 54, 4, -1, -1,
1775 193, 192, -1, 143, -1, 146, -1, 142, -1, 141,
1776 -1, 150, -1, 151, -1, -1, 195, 194, -1, -1,
1777 152, 22, -1, -1, 54, 4, -1, -1, 159, 54,
1778 4, -1, 34, 22, -1, -1, 199, -1, -1, 159,
1779 202, 201, -1, 199, -1, 54, 4, -1, 11, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001780 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001781 17, -1, 50, -1, 203, -1, 204, 180, 160, -1,
1782 238, -1, 161, 4, -1, 204, 156, 208, 157, 195,
1783 -1, 10, 156, 208, 157, 195, -1, 162, 4, 163,
1784 204, 164, -1, 165, 4, 163, 204, 166, -1, 167,
1785 209, 168, -1, 167, 168, -1, 165, 167, 209, 168,
1786 166, -1, 165, 167, 168, 166, -1, 204, 193, -1,
1787 204, -1, 10, -1, 205, -1, 207, 159, 205, -1,
1788 207, -1, 207, 159, 39, -1, 39, -1, -1, 204,
1789 -1, 209, 159, 204, -1, 204, 162, 212, 164, -1,
1790 204, 162, 164, -1, 204, 169, 22, -1, 204, 165,
1791 212, 166, -1, 204, 167, 212, 168, -1, 204, 167,
1792 168, -1, 204, 165, 167, 212, 168, 166, -1, 204,
1793 165, 167, 168, 166, -1, 204, 40, -1, 204, 41,
1794 -1, 204, 238, -1, 204, 211, -1, 204, 25, -1,
1795 176, 3, -1, 176, 5, -1, 176, 4, -1, 176,
1796 6, -1, 11, 26, -1, 11, 27, -1, 177, 9,
1797 -1, 173, 156, 210, 38, 204, 157, -1, 119, 156,
1798 210, 250, 157, -1, 133, 156, 210, 159, 210, 159,
1799 210, 157, -1, 171, 156, 210, 159, 210, 157, -1,
1800 172, 156, 210, 159, 210, 157, -1, 90, 174, 156,
1801 210, 159, 210, 157, -1, 91, 175, 156, 210, 159,
1802 210, 157, -1, 92, 174, 156, 210, 159, 210, 157,
1803 -1, 93, 175, 156, 210, 159, 210, 157, -1, 135,
1804 156, 210, 159, 210, 157, -1, 136, 156, 210, 159,
1805 210, 159, 210, 157, -1, 137, 156, 210, 159, 210,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001806 159, 210, 157, -1, 139, 156, 210, 251, 157, -1,
1807 140, 156, 210, 159, 210, 251, 157, -1, 212, 159,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001808 210, -1, 210, -1, 32, -1, 33, -1, 37, -1,
1809 -1, 206, 238, -1, 125, 156, 215, 38, 204, 157,
1810 -1, 217, -1, -1, 218, -1, 217, 218, -1, -1,
1811 31, 219, 234, -1, -1, 30, 220, 235, -1, 60,
1812 59, 224, -1, 181, 18, 204, -1, 181, 18, 10,
1813 -1, -1, 183, 187, 214, 213, 210, 180, 221, 201,
1814 -1, -1, 183, 185, 187, 214, 213, 210, 180, 222,
1815 201, -1, -1, 183, 186, 187, 214, 213, 204, 180,
1816 223, 201, -1, 183, 187, 35, 190, 215, -1, 52,
1817 225, -1, 56, 158, 226, -1, 22, -1, 53, 158,
1818 22, -1, 68, 158, 22, -1, 162, 227, 164, -1,
1819 227, 159, 22, -1, 22, -1, -1, 228, 159, 204,
1820 193, 179, -1, 204, 193, 179, -1, 228, -1, 228,
1821 159, 39, -1, 39, -1, -1, 191, 206, 182, 156,
1822 229, 157, 195, 200, 197, 196, -1, 28, -1, 167,
1823 -1, 189, 187, 230, 231, -1, 29, -1, 168, -1,
1824 242, 233, -1, 188, 187, 230, -1, -1, 61, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00001825 3, -1, 4, -1, 5, -1, 6, -1, 9, -1,
1826 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
1827 165, 212, 166, -1, 162, 212, 164, -1, 162, 164,
1828 -1, 169, 22, -1, 167, 212, 168, -1, 167, 168,
1829 -1, 165, 167, 212, 168, 166, -1, 165, 167, 168,
1830 166, -1, 211, -1, 59, 236, 22, 159, 22, -1,
1831 7, -1, 8, -1, 178, -1, 182, -1, 238, -1,
1832 237, -1, 204, 239, -1, 240, -1, 241, 159, 240,
1833 -1, 242, 243, -1, 232, 243, -1, 244, 181, 245,
1834 -1, 244, 247, -1, -1, 21, -1, 69, 241, -1,
1835 69, 10, -1, 70, 17, 239, -1, 70, 11, 239,
1836 159, 17, 239, 159, 17, 239, -1, 71, 176, 239,
1837 159, 17, 239, 162, 246, 164, -1, 71, 176, 239,
1838 159, 17, 239, 162, 164, -1, 72, 191, 206, 239,
1839 156, 249, 157, 195, 38, 17, 239, 73, 17, 239,
1840 -1, 73, -1, 74, -1, 246, 176, 237, 159, 17,
1841 239, -1, 176, 237, 159, 17, 239, -1, 181, 253,
1842 -1, 204, 162, 239, 159, 239, 164, -1, 248, 159,
1843 162, 239, 159, 239, 164, -1, 204, 193, 239, 193,
1844 -1, 17, 193, 239, 193, -1, 249, 159, 204, 193,
1845 239, 193, -1, 249, 159, 17, 193, 239, 193, -1,
1846 -1, -1, 250, 159, 240, -1, 159, 4, -1, 251,
1847 159, 4, -1, 58, 57, -1, 57, -1, 171, 204,
1848 239, 159, 239, -1, 172, 204, 239, 159, 239, -1,
1849 90, 174, 204, 239, 159, 239, -1, 91, 175, 204,
1850 239, 159, 239, -1, 92, 174, 204, 239, 159, 239,
1851 -1, 93, 175, 204, 239, 159, 239, -1, 173, 240,
1852 38, 204, -1, 133, 240, 159, 240, 159, 240, -1,
1853 134, 240, 159, 204, -1, 135, 240, 159, 240, -1,
1854 136, 240, 159, 240, 159, 240, -1, 137, 240, 159,
1855 240, 159, 240, -1, 132, 248, -1, 252, 191, 206,
1856 239, 156, 249, 157, 195, -1, 255, -1, 36, -1,
1857 -1, 114, 204, 198, -1, 114, 204, 159, 11, 239,
1858 198, -1, 115, 204, 198, -1, 115, 204, 159, 11,
1859 239, 198, -1, 116, 240, -1, 254, 117, 204, 239,
1860 198, -1, 254, 118, 240, 159, 204, 239, 198, -1,
1861 138, 204, 239, 159, 4, -1, 119, 204, 239, 250,
1862 -1, 139, 204, 239, 251, -1, 140, 204, 239, 159,
1863 204, 239, 251, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001864};
1865
1866/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1867static const yytype_uint16 yyrline[] =
1868{
Chris Lattner1913b942008-07-11 00:30:39 +00001869 0, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132,
1870 1132, 1133, 1133, 1133, 1133, 1133, 1133, 1134, 1134, 1134,
1871 1134, 1134, 1134, 1135, 1135, 1135, 1135, 1135, 1135, 1138,
1872 1138, 1139, 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1146,
1873 1146, 1147, 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1151,
1874 1151, 1152, 1152, 1153, 1154, 1159, 1160, 1160, 1160, 1160,
1875 1160, 1162, 1162, 1162, 1163, 1163, 1165, 1166, 1170, 1174,
1876 1179, 1179, 1181, 1182, 1187, 1193, 1194, 1195, 1196, 1197,
1877 1198, 1202, 1203, 1204, 1208, 1209, 1210, 1211, 1215, 1216,
1878 1217, 1221, 1222, 1223, 1224, 1225, 1229, 1230, 1231, 1234,
1879 1235, 1236, 1237, 1238, 1239, 1240, 1247, 1248, 1249, 1250,
1880 1251, 1252, 1253, 1254, 1255, 1256, 1260, 1261, 1266, 1267,
1881 1268, 1269, 1270, 1271, 1274, 1275, 1280, 1281, 1288, 1289,
1882 1295, 1296, 1305, 1313, 1314, 1319, 1320, 1321, 1326, 1339,
1883 1339, 1339, 1339, 1339, 1339, 1339, 1342, 1346, 1350, 1357,
1884 1362, 1370, 1399, 1424, 1429, 1439, 1449, 1453, 1463, 1470,
1885 1479, 1486, 1491, 1496, 1503, 1504, 1511, 1518, 1526, 1532,
1886 1544, 1572, 1588, 1615, 1643, 1669, 1689, 1715, 1735, 1747,
1887 1754, 1820, 1830, 1840, 1846, 1856, 1862, 1872, 1878, 1884,
1888 1897, 1909, 1930, 1938, 1944, 1955, 1960, 1965, 1970, 1975,
1889 1981, 1987, 1993, 2001, 2012, 2016, 2024, 2024, 2027, 2027,
1890 2030, 2042, 2063, 2068, 2076, 2077, 2081, 2081, 2085, 2085,
1891 2088, 2091, 2115, 2127, 2126, 2138, 2137, 2147, 2146, 2157,
1892 2197, 2200, 2206, 2216, 2220, 2225, 2227, 2232, 2237, 2246,
1893 2256, 2267, 2271, 2280, 2289, 2294, 2423, 2423, 2425, 2434,
1894 2434, 2436, 2441, 2453, 2457, 2462, 2466, 2470, 2475, 2480,
1895 2484, 2488, 2492, 2496, 2500, 2504, 2526, 2548, 2554, 2567,
1896 2579, 2584, 2596, 2602, 2606, 2616, 2620, 2624, 2629, 2636,
1897 2636, 2642, 2651, 2656, 2661, 2665, 2674, 2683, 2692, 2696,
Dan Gohman1a570242008-07-23 00:54:54 +00001898 2704, 2724, 2728, 2733, 2744, 2763, 2772, 2858, 2862, 2869,
1899 2880, 2893, 2903, 2914, 2924, 2935, 2943, 2953, 2960, 2963,
1900 2964, 2972, 2978, 2987, 2991, 2996, 3012, 3029, 3043, 3057,
1901 3071, 3085, 3097, 3105, 3112, 3118, 3124, 3130, 3145, 3235,
1902 3240, 3244, 3251, 3258, 3268, 3275, 3285, 3293, 3307, 3324,
1903 3338, 3353, 3368
Dan Gohmanf4423b12008-04-19 00:24:39 +00001904};
1905#endif
1906
1907#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1908/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1909 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1910static const char *const yytname[] =
1911{
1912 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1913 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1914 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1915 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1916 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1917 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1918 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1919 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001920 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001921 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1922 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1923 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnercc81d152008-05-04 17:18:47 +00001924 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1925 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begemanac80ade2008-05-12 19:01:56 +00001926 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1927 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1928 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1929 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1930 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1931 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1932 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
Dan Gohmane4977cf2008-05-23 01:55:30 +00001933 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1934 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1935 "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1936 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1937 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1938 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1939 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1940 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1941 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1942 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1943 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1944 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001945 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1946 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1947 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1948 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1949 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1950 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1951 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1952 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1953 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001954 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList",
1955 "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile",
1956 "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001957};
1958#endif
1959
1960# ifdef YYPRINT
1961/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1962 token YYLEX-NUM. */
1963static const yytype_uint16 yytoknum[] =
1964{
1965 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1966 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1967 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1968 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1969 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1970 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1971 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1972 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1973 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1974 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1975 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1976 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1977 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1978 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1979 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001980 405, 406, 407, 408, 409, 410, 40, 41, 61, 44,
1981 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00001982};
1983# endif
1984
1985/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1986static const yytype_uint8 yyr1[] =
1987{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001988 0, 170, 171, 171, 171, 171, 171, 171, 171, 171,
1989 171, 172, 172, 172, 172, 172, 172, 173, 173, 173,
1990 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1991 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1992 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1993 175, 175, 175, 175, 175, 176, 177, 177, 177, 177,
1994 177, 178, 178, 178, 179, 179, 180, 180, 181, 181,
1995 182, 182, 183, 183, 184, 185, 185, 185, 185, 185,
1996 185, 186, 186, 186, 187, 187, 187, 187, 188, 188,
1997 188, 189, 189, 189, 189, 189, 190, 190, 190, 191,
1998 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1999 192, 192, 192, 192, 192, 192, 193, 193, 194, 194,
2000 194, 194, 194, 194, 195, 195, 196, 196, 197, 197,
2001 198, 198, 199, 200, 200, 201, 201, 202, 202, 203,
2002 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
2003 204, 204, 204, 204, 204, 204, 204, 204, 204, 205,
2004 206, 206, 207, 207, 208, 208, 208, 208, 209, 209,
2005 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
2006 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
2007 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
2008 211, 211, 211, 211, 212, 212, 213, 213, 214, 214,
2009 215, 215, 216, 216, 217, 217, 219, 218, 220, 218,
2010 218, 218, 218, 221, 218, 222, 218, 223, 218, 218,
2011 218, 218, 224, 225, 225, 226, 227, 227, 227, 228,
2012 228, 229, 229, 229, 229, 230, 231, 231, 232, 233,
2013 233, 234, 235, 236, 236, 237, 237, 237, 237, 237,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002014 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
Chris Lattner1913b942008-07-11 00:30:39 +00002015 237, 237, 237, 237, 237, 238, 238, 238, 238, 239,
2016 239, 240, 241, 241, 242, 242, 243, 244, 244, 244,
2017 245, 245, 245, 245, 245, 245, 245, 245, 245, 246,
2018 246, 247, 248, 248, 249, 249, 249, 249, 249, 250,
2019 250, 251, 251, 252, 252, 253, 253, 253, 253, 253,
2020 253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
2021 254, 254, 255, 255, 255, 255, 255, 255, 255, 255,
2022 255, 255, 255
Dan Gohmanf4423b12008-04-19 00:24:39 +00002023};
2024
2025/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2026static const yytype_uint8 yyr2[] =
2027{
2028 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2029 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2030 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2031 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2032 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2033 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2034 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2035 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002036 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2037 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2038 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2039 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2040 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2041 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2042 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2043 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2044 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2045 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2046 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2047 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002048 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2049 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2050 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2051 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2052 3, 1, 3, 1, 0, 10, 1, 1, 4, 1,
2053 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
Chris Lattner1913b942008-07-11 00:30:39 +00002054 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2055 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2056 1, 2, 1, 3, 2, 2, 3, 2, 0, 1,
2057 2, 2, 3, 9, 9, 8, 14, 1, 1, 6,
2058 5, 2, 6, 7, 4, 4, 6, 6, 0, 0,
2059 3, 2, 3, 2, 1, 5, 5, 6, 6, 6,
2060 6, 4, 6, 4, 4, 6, 6, 2, 8, 1,
2061 1, 0, 3, 6, 3, 6, 2, 5, 7, 5,
2062 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002063};
2064
2065/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2066 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2067 means the default is an error. */
2068static const yytype_uint16 yydefact[] =
2069{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002070 73, 61, 70, 62, 71, 63, 218, 216, 0, 0,
2071 0, 0, 0, 0, 84, 72, 0, 73, 214, 88,
2072 91, 0, 0, 230, 0, 0, 68, 0, 74, 75,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002073 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002074 87, 84, 84, 209, 1, 215, 89, 90, 84, 219,
Chris Lattner1913b942008-07-11 00:30:39 +00002075 92, 93, 94, 95, 84, 288, 217, 288, 0, 0,
2076 238, 231, 232, 220, 275, 276, 222, 139, 140, 141,
2077 144, 143, 142, 145, 146, 0, 0, 0, 0, 277,
2078 278, 147, 221, 149, 209, 209, 96, 208, 0, 99,
2079 99, 289, 285, 69, 249, 250, 251, 284, 233, 234,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002080 237, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2081 0, 0, 167, 0, 0, 0, 98, 97, 0, 206,
2082 207, 0, 0, 100, 101, 102, 103, 104, 0, 252,
Chris Lattner1913b942008-07-11 00:30:39 +00002083 0, 331, 287, 0, 235, 166, 116, 162, 164, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002084 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002085 0, 161, 0, 160, 0, 229, 139, 140, 141, 144,
2086 143, 142, 0, 0, 67, 67, 105, 0, 246, 247,
Chris Lattner1913b942008-07-11 00:30:39 +00002087 248, 330, 314, 0, 0, 0, 0, 99, 297, 298,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002088 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2089 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2090 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2091 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002092 0, 0, 0, 0, 0, 0, 0, 286, 99, 301,
2093 0, 329, 236, 159, 0, 124, 67, 67, 158, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002094 169, 0, 124, 67, 67, 0, 210, 187, 188, 183,
2095 185, 184, 186, 189, 182, 178, 179, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002096 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002097 0, 0, 0, 0, 0, 181, 180, 223, 0, 313,
2098 291, 67, 282, 290, 0, 0, 55, 0, 0, 29,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002099 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2100 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2101 43, 44, 45, 46, 47, 48, 0, 0, 0, 130,
Chris Lattner1913b942008-07-11 00:30:39 +00002102 130, 336, 67, 67, 327, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002103 67, 67, 67, 67, 67, 0, 0, 0, 0, 0,
2104 107, 109, 108, 106, 110, 111, 112, 113, 114, 117,
2105 165, 163, 152, 153, 154, 157, 66, 151, 225, 227,
2106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 171, 205, 0, 0, 0, 175, 0, 172,
Chris Lattner1913b942008-07-11 00:30:39 +00002108 0, 0, 0, 135, 244, 255, 256, 257, 258, 259,
2109 264, 260, 261, 262, 263, 253, 0, 0, 0, 0,
2110 273, 280, 279, 281, 0, 0, 292, 0, 0, 67,
2111 67, 67, 67, 0, 332, 0, 334, 309, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002113 0, 0, 67, 0, 115, 121, 120, 118, 119, 122,
2114 123, 125, 135, 135, 0, 0, 0, 0, 0, 309,
2115 0, 0, 0, 0, 0, 0, 0, 170, 156, 168,
2116 0, 173, 174, 0, 0, 0, 0, 224, 243, 116,
2117 241, 0, 254, 0, 267, 0, 0, 0, 270, 0,
2118 268, 283, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 340, 0, 0, 0, 323, 324, 0, 0,
2120 0, 0, 341, 0, 0, 0, 321, 0, 130, 0,
2121 226, 228, 67, 0, 0, 0, 0, 0, 0, 0,
2122 0, 0, 0, 0, 204, 177, 0, 0, 0, 0,
2123 0, 0, 137, 135, 65, 0, 124, 0, 266, 156,
2124 0, 265, 269, 0, 0, 308, 0, 0, 0, 0,
2125 130, 131, 130, 0, 0, 0, 0, 0, 0, 339,
2126 311, 0, 67, 315, 316, 308, 0, 337, 67, 211,
2127 0, 0, 0, 0, 191, 0, 0, 0, 0, 202,
2128 0, 176, 0, 0, 67, 132, 138, 136, 64, 240,
2129 242, 116, 133, 0, 272, 0, 0, 0, 116, 116,
2130 0, 317, 318, 319, 320, 333, 335, 310, 0, 0,
2131 322, 325, 326, 312, 0, 0, 130, 0, 0, 0,
2132 0, 0, 199, 0, 0, 0, 193, 194, 190, 65,
2133 134, 128, 274, 271, 0, 0, 0, 0, 124, 0,
2134 302, 0, 342, 124, 338, 195, 196, 197, 198, 0,
2135 0, 0, 203, 239, 0, 126, 0, 295, 0, 0,
2136 107, 109, 116, 116, 0, 116, 116, 303, 328, 192,
2137 200, 201, 129, 0, 245, 293, 0, 294, 0, 305,
2138 304, 0, 0, 0, 127, 0, 0, 0, 116, 116,
2139 0, 0, 0, 307, 306, 300, 0, 0, 299, 0,
2140 296
Dan Gohmanf4423b12008-04-19 00:24:39 +00002141};
2142
2143/* YYDEFGOTO[NTERM-NUM]. */
2144static const yytype_int16 yydefgoto[] =
2145{
Chris Lattner1913b942008-07-11 00:30:39 +00002146 -1, 272, 273, 274, 299, 316, 162, 163, 79, 589,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002147 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
Chris Lattner1913b942008-07-11 00:30:39 +00002148 118, 128, 349, 233, 441, 352, 674, 655, 414, 532,
2149 631, 467, 533, 81, 164, 137, 154, 138, 139, 110,
2150 373, 400, 374, 121, 88, 155, 16, 17, 18, 20,
2151 19, 383, 442, 443, 63, 23, 61, 101, 470, 471,
2152 129, 170, 55, 96, 56, 49, 473, 401, 83, 403,
2153 282, 283, 57, 92, 93, 227, 659, 132, 324, 600,
2154 492, 502, 228, 229, 230, 231
Dan Gohmanf4423b12008-04-19 00:24:39 +00002155};
2156
2157/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2158 STATE-NUM. */
Chris Lattner1913b942008-07-11 00:30:39 +00002159#define YYPACT_NINF -608
Dan Gohmanf4423b12008-04-19 00:24:39 +00002160static const yytype_int16 yypact[] =
2161{
Chris Lattner1913b942008-07-11 00:30:39 +00002162 492, -608, -608, -608, -608, -608, -608, -608, 1, -93,
2163 14, -48, 39, -39, -3, -608, 132, 926, -608, 61,
2164 261, -14, 6, -608, -15, 148, -608, 1840, -608, -608,
2165 -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,
2166 -608, 69, 69, 88, -608, -608, -608, -608, 69, -608,
2167 -608, -608, -608, -608, 69, 120, -608, -11, 158, 166,
2168 184, -608, -608, -608, -608, -608, 53, -608, -608, -608,
2169 -608, -608, -608, -608, -608, 212, 222, 10, 812, -608,
2170 -608, -608, 9, -608, 201, 201, 168, -608, 56, 253,
2171 253, -608, -608, 323, -608, -608, -608, -608, -608, -608,
2172 -608, 66, 1570, -608, 85, 93, 1260, 53, -608, 9,
2173 -101, 121, 1570, 133, 56, 56, -608, -608, 1588, -608,
2174 -608, 1869, 305, -608, -608, -608, -608, -608, 1915, -608,
2175 -12, 2220, -608, 303, -608, -608, 9, -608, 176, 170,
2176 2001, 2001, 177, -91, 2001, -608, 344, 193, -608, 1869,
2177 2001, 53, 199, 9, 432, -608, 296, 347, 348, 354,
2178 356, 357, 283, 362, 1365, 317, -608, 55, -608, -608,
2179 -608, -608, -608, 316, 2033, 94, 363, 253, -608, -608,
2180 -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,
2181 -608, -608, -608, -608, -608, 464, 280, 464, 280, 2001,
2182 2001, 2001, 2001, -608, -608, -608, -608, -608, -608, -608,
2183 -608, -608, -608, -608, -608, 2001, 2001, 2001, 2001, 2001,
2184 2001, 2001, 2001, 2001, 2001, 2001, 2001, -608, 253, -608,
2185 43, -608, -608, 192, 1620, -608, -35, -40, -608, 209,
2186 9, 219, -608, 317, -23, 1588, -608, -608, -608, -608,
2187 -608, -608, -608, -608, -608, -608, -608, 464, 280, 464,
2188 280, 221, 243, 245, 246, 247, 250, 251, 1749, 2051,
2189 1305, 386, 254, 256, 257, -608, -608, -608, 259, -608,
2190 53, 913, -608, 258, 1080, 1080, -608, 1080, 1915, -608,
2191 -608, -608, -608, -608, -608, -608, -608, -608, -608, 2001,
2192 -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,
2193 -608, -608, -608, -608, -608, -608, 2001, 2001, 2001, -29,
2194 -17, -608, 913, -34, 260, 262, 263, 264, 267, 268,
2195 913, 913, 913, 913, 913, 378, 1915, 2001, 2001, 416,
2196 -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,
2197 -608, -608, 124, -608, -608, -608, -608, 124, -608, 133,
2198 390, 273, 274, 275, 282, 1869, 1869, 1869, 1869, 1869,
2199 1869, 1869, -608, -608, 81, 1500, -104, -608, -89, -608,
2200 1869, 1869, 1869, 277, 1781, -608, -608, -608, -608, -608,
2201 -608, -608, -608, -608, -608, 382, 1799, 2080, 1529, 422,
2202 -608, -608, -608, -608, 2001, 286, -608, 287, 1080, 913,
2203 913, 913, 913, 36, -608, 49, -608, -608, 1080, 285,
2204 2001, 2001, 2001, 2001, 2001, 289, 290, 294, 298, 301,
2205 2001, 1080, 913, 311, -608, -608, -608, -608, -608, -608,
2206 -608, -608, 277, 277, 2001, 1869, 1869, 1869, 1869, -608,
2207 312, 313, 314, 319, 290, 320, 1869, -608, 309, 1214,
2208 -87, -608, -608, 321, 322, 424, -1, -608, -608, 9,
2209 331, 334, -608, 454, -608, 99, 1547, -21, -608, -64,
2210 -608, -608, 476, 477, 339, 338, 340, 341, 342, 1080,
2211 494, 1080, 343, 358, 1080, 359, 9, -608, 361, 365,
2212 509, 517, 366, 2001, 1080, 1080, 9, 370, 369, 2001,
2213 -608, -608, 11, 374, 377, 381, 383, 82, 1869, 1869,
2214 1869, 1869, 90, 1869, -608, -608, 375, 1869, 1869, 2001,
2215 521, 541, -608, 277, 37, 1822, -608, 387, -608, 384,
2216 -51, -608, -608, 1080, 1080, 2098, 1080, 1080, 1080, 1080,
2217 369, -608, 369, 2001, 1080, 388, 2001, 2001, 2001, -608,
2218 -608, 545, 913, -608, -608, 2098, 497, -608, 913, -608,
2219 1869, 1869, 1869, 1869, -608, 394, 397, 396, 409, -608,
2220 290, -608, 412, 413, 46, -608, -608, -608, -608, -608,
2221 -608, 9, 86, 553, -608, 414, 419, 417, 27, 9,
2222 119, -608, -608, -608, -608, -608, -608, -608, 423, 1080,
2223 -608, -608, -608, -608, 290, 167, 369, 431, 433, 434,
2224 439, 1869, -608, 1869, 1869, 187, -608, -608, -608, 37,
2225 -608, 527, -608, -608, 572, -2, 762, 762, -608, 2121,
2226 -608, 435, 366, -608, -608, -608, -608, -608, -608, 440,
2227 441, 443, -608, -608, 597, 452, 1080, -608, 568, 2,
2228 455, 456, -608, -608, 118, 27, 9, -608, 124, -608,
2229 -608, -608, -608, 592, -608, -608, 458, -608, 568, 192,
2230 192, 598, 762, 762, -608, 601, 461, 1080, -608, -608,
2231 1080, 604, 549, 192, 192, -608, 1080, 606, -608, 1080,
2232 -608
Dan Gohmanf4423b12008-04-19 00:24:39 +00002233};
2234
2235/* YYPGOTO[NTERM-NUM]. */
2236static const yytype_int16 yypgoto[] =
2237{
Chris Lattner1913b942008-07-11 00:30:39 +00002238 -608, 493, 495, 499, -174, -164, -170, -608, 0, -4,
2239 -146, 535, 5, -608, -608, -608, -608, 58, -608, -608,
2240 -608, -141, -608, -445, -608, -238, -608, -608, -295, 40,
2241 -608, -393, -608, -608, -26, 399, -125, -608, 519, 528,
2242 -86, -162, -262, 157, 269, 391, -608, -608, 618, -608,
2243 -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,
2244 547, -608, -608, -608, -608, -608, -608, -607, -80, 174,
2245 -189, -608, -608, 581, -608, -608, -608, -608, -608, 74,
2246 191, -443, -608, -608, -608, -608
Dan Gohmanf4423b12008-04-19 00:24:39 +00002247};
2248
2249/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2250 positive, shift that token. If negative, reduce the rule which
2251 number is the opposite. If zero, do what YYDEFACT says.
2252 If YYTABLE_NINF, syntax error. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00002253#define YYTABLE_NINF -214
Dan Gohmanf4423b12008-04-19 00:24:39 +00002254static const yytype_int16 yytable[] =
2255{
Chris Lattner1913b942008-07-11 00:30:39 +00002256 11, 82, 275, 167, 357, 13, 287, 376, 378, 286,
2257 91, 522, 321, 286, 105, 111, 168, 11, 94, 277,
2258 111, 111, 13, 317, 534, 416, 111, 325, 326, 327,
2259 328, 329, 111, 530, 318, 165, 288, 335, 111, 29,
2260 30, 31, 32, 33, 34, 35, 36, 489, 37, 510,
2261 511, 676, 109, 531, 21, 456, 1, 27, 144, 3,
2262 491, 5, 461, 243, 111, 24, 111, 145, 144, 22,
2263 456, 686, 456, 25, 246, 2, 136, 239, 4, 462,
2264 109, 526, -145, 361, 276, 363, 136, 336, 119, 120,
2265 490, 339, 153, 11, 362, 456, 364, 358, 359, 84,
2266 85, 111, 153, 490, 542, 284, 89, 46, 456, 47,
2267 26, 285, 90, 460, 236, 237, 112, 595, 240, 28,
2268 530, 112, 112, 86, 244, 87, 354, 112, 418, 353,
2269 413, -67, 44, 112, 475, 477, 479, 625, 456, 112,
2270 587, 91, 415, -67, 58, 541, 629, 60, 281, 433,
2271 38, 39, 40, 636, 637, 169, 681, 95, 340, 341,
2272 337, 338, 657, 408, 59, 112, 677, 112, 569, -67,
2273 62, 642, 278, 319, 320, 281, 322, 106, 342, 343,
2274 98, 344, 345, -145, 346, 347, 348, -145, 99, 323,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002275 281, 281, 281, 281, 281, 330, 331, 332, 333, 334,
Chris Lattner1913b942008-07-11 00:30:39 +00002276 281, 402, 112, 628, 402, 402, 100, 402, 136, 102,
2277 116, 431, 117, 567, 540, 481, 103, 679, 680, 153,
2278 682, 683, 38, 39, 40, 133, 104, 435, 436, 437,
2279 134, 495, 438, 497, 498, 499, 439, 440, 87, 574,
2280 456, 553, 402, 693, 694, 457, 339, 579, 140, 561,
2281 402, 402, 402, 402, 402, 605, 141, 606, 456, 435,
2282 436, 437, 153, 538, 438, 435, 436, 437, 439, 440,
2283 438, 149, 150, 409, 439, 440, 638, 146, 639, 449,
2284 450, 451, 452, 453, 454, 455, 249, 250, 251, 252,
2285 410, 411, 412, 148, 463, 464, 465, 275, 592, -55,
2286 -55, -55, -55, 50, 51, 52, 300, 301, 53, 166,
2287 153, 432, 281, 340, 341, 122, 123, 124, 125, 126,
2288 127, 644, 247, 248, 643, 232, 639, 235, 402, 402,
2289 402, 402, 402, 342, 343, 234, 344, 345, 402, 346,
2290 347, 348, 1, 238, 652, 3, 561, 5, 241, 459,
2291 242, 402, 402, 114, 115, 245, -56, -57, 469, 513,
2292 514, 515, 516, -60, 607, -59, -58, 610, 611, 612,
2293 524, 253, 111, 279, 286, 355, 356, 365, 281, 276,
2294 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
2295 312, 313, 314, 315, 281, 496, 281, 281, 281, 366,
2296 664, 367, 368, 369, 506, 668, 370, 371, 379, 402,
2297 380, 402, 381, 382, 402, 384, 430, 404, 512, 419,
2298 434, 420, 421, 422, 402, 402, 423, 424, 444, 445,
2299 446, 447, 575, 576, 577, 578, 466, 580, 448, 64,
2300 65, 582, 583, 472, 480, 482, 483, 494, 500, 501,
2301 459, 1, 2, 503, 3, 4, 5, 504, 405, 406,
2302 505, 407, 529, 402, 402, 658, 402, 402, 402, 402,
2303 509, 518, 519, 520, 402, 525, 537, 562, 521, 523,
2304 527, 528, 402, 568, 617, 618, 619, 620, 402, 678,
2305 535, 536, -213, 543, 544, 545, 417, 546, 551, 547,
2306 548, 549, 553, 584, 425, 426, 427, 428, 429, 591,
2307 -69, 1, 2, 559, 3, 4, 5, 554, 556, 599,
2308 557, 560, 6, 7, 558, 561, 565, 281, 566, 402,
2309 281, 281, 281, 570, 588, 649, 571, 650, 651, 599,
2310 572, 581, 573, 585, 8, 586, 593, 609, 9, 613,
2311 594, 490, 10, 621, 622, 623, 402, 402, 289, 290,
2312 291, 292, 293, 294, 295, 296, 297, 298, 624, 626,
2313 627, 385, 386, 387, 388, 632, 402, 389, 634, 635,
2314 633, 654, 484, 485, 486, 487, 488, 640, 645, 656,
2315 646, 647, 493, 390, 391, 392, 648, 669, 670, 667,
2316 671, 672, 402, 402, 673, 507, 508, 402, 393, 394,
2317 402, -18, -19, 666, 684, 687, 402, 685, 690, 402,
2318 691, 696, 697, 699, 224, 653, 225, 395, 131, 588,
2319 226, 147, 630, 351, 143, 45, 360, 130, 97, 615,
2320 517, 0, 0, 180, 181, 182, 183, 184, 185, 186,
2321 187, 188, 189, 190, 191, 192, 193, 194, 257, 258,
2322 259, 260, 0, 550, 0, 552, 0, 0, 555, 0,
2323 0, 0, 0, 0, 0, 0, 0, 0, 563, 564,
2324 0, 0, 0, 0, 0, 0, 0, 261, 203, 204,
2325 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2326 0, 262, 0, 263, 264, 265, 0, 266, 267, 0,
2327 0, 0, 0, 0, 0, 0, 0, 596, 597, 0,
2328 601, 602, 603, 604, 0, 0, 0, 0, 608, 0,
2329 396, 0, 0, 397, 0, 398, 614, 399, 0, 0,
2330 0, 0, 616, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002332 0, 0, 0, 0, 0, 385, 386, 387, 388, 64,
2333 65, 389, 0, 0, 0, 0, 0, 0, 0, 0,
2334 0, 1, 2, 641, 3, 4, 5, 390, 391, 392,
2335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2336 0, 0, 393, 394, 0, 0, 0, 0, 0, 0,
2337 662, 663, 0, 0, 0, 0, 339, 0, 0, 64,
2338 65, 395, 107, 67, 68, 69, 70, 71, 72, 73,
2339 675, 1, 2, 0, 3, 4, 5, 180, 181, 182,
2340 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2341 193, 194, 257, 258, 259, 260, 688, 689, 0, 0,
2342 0, 692, 74, 0, 695, 0, 0, 0, 0, 0,
2343 698, 0, 0, 700, 0, 0, 0, 0, 0, 0,
2344 0, 261, 203, 660, 661, 206, 207, 208, 209, 210,
2345 211, 212, 213, 214, 0, 262, 0, 263, 264, 265,
2346 0, 266, 267, 342, 343, 0, 344, 345, 0, 346,
2347 347, 348, 0, 0, 0, 0, 385, 386, 387, 388,
2348 64, 65, 389, 0, 396, 0, -212, 397, 0, 398,
2349 0, 399, 1, 2, 0, 3, 4, 5, 390, 391,
2350 392, 0, 0, 0, -69, 1, 2, 0, 3, 4,
2351 5, 0, 0, 393, 394, 0, 6, 7, 0, 0,
2352 0, 0, 0, 0, 0, 0, 0, 0, 111, 0,
2353 0, 0, 395, 75, 76, 0, 0, 77, 8, 78,
2354 108, 0, 9, 0, 0, 0, 10, 0, 180, 181,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002355 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2356 192, 193, 194, 257, 258, 259, 260, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002357 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002358 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002359 0, 0, 261, 203, 204, 205, 206, 207, 208, 209,
2360 210, 211, 212, 213, 214, 0, 262, 0, 263, 264,
2361 265, 0, 266, 267, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002362 0, 0, 0, 0, 0, 0, 0, 0, 0, 112,
2363 0, 0, 0, 0, 0, 396, 0, 0, 397, 0,
2364 398, 0, 399, 385, 386, 387, 388, 64, 65, 389,
2365 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2366 2, 0, 3, 4, 5, 390, 391, 392, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002368 393, 394, 0, 0, 0, 0, 0, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 0, 0, 395,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002371 0, 0, 0, 0, 0, 180, 181, 182, 183, 184,
2372 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2373 257, 258, 259, 260, 0, 0, 0, 0, 0, 0,
2374 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2375 0, 0, 0, 0, 0, 0, 0, 0, 0, 261,
2376 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2377 213, 214, 0, 262, 0, 263, 264, 265, 0, 266,
2378 267, 64, 65, 0, 0, 0, 0, 0, 0, 0,
2379 0, 0, 0, 1, 2, 0, 3, 4, 5, 254,
2380 0, 0, 396, 0, 0, 397, 0, 398, 0, 399,
2381 0, 0, 0, 0, 255, 256, 0, 0, 0, 0,
2382 0, 0, 0, 0, 0, 0, 0, 64, 65, 111,
2383 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2384 2, 0, 3, 4, 5, 0, 0, 0, 0, 180,
2385 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2386 191, 192, 193, 194, 257, 258, 259, 260, 0, 0,
2387 74, 0, 64, 65, 0, 107, 156, 157, 158, 159,
2388 160, 161, 73, 0, 1, 2, 0, 3, 4, 5,
2389 0, 0, 0, 261, 203, 204, 205, 206, 207, 208,
2390 209, 210, 211, 212, 213, 214, 0, 262, 0, 263,
2391 264, 265, 0, 266, 267, 74, 0, 0, 0, 0,
2392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2393 112, 0, 64, 65, -67, 0, 268, 0, 0, 269,
2394 0, 270, 0, 271, 1, 2, 0, 3, 4, 5,
2395 254, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2396 0, 0, 0, 0, 0, 255, 256, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2398 111, 75, 76, 0, 0, 77, 0, 78, 142, 0,
2399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2400 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2401 190, 191, 192, 193, 194, 257, 258, 259, 260, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002402 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002403 77, 0, 78, 377, 0, 0, 0, 0, 0, 0,
2404 0, 0, 0, 0, 261, 203, 204, 205, 206, 207,
2405 208, 209, 210, 211, 212, 213, 214, 0, 262, 0,
2406 263, 264, 265, 0, 266, 267, 0, 64, 65, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002407 107, 156, 157, 158, 159, 160, 161, 73, 0, 1,
Chris Lattner1913b942008-07-11 00:30:39 +00002408 2, 112, 3, 4, 5, 0, 0, 268, 0, 0,
2409 269, 0, 270, 0, 271, 0, 64, 65, 0, 107,
2410 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
2411 74, 3, 4, 5, 64, 65, 0, 107, 156, 157,
2412 158, 159, 160, 161, 73, 0, 1, 2, 0, 3,
2413 4, 5, 0, 0, 0, 0, 0, 64, 65, 74,
2414 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002415 2, 0, 3, 4, 5, 64, 65, 74, 151, 67,
Chris Lattner1913b942008-07-11 00:30:39 +00002416 68, 69, 70, 71, 72, 73, 0, 1, 2, 135,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002417 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002418 74, 0, 0, 0, 0, 0, 0, 64, 65, 0,
2419 107, 67, 68, 69, 70, 71, 72, 73, 74, 1,
2420 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2421 0, 0, 0, 0, 0, 0, 0, 0, 0, 350,
2422 0, 75, 76, 0, 0, 77, 0, 78, 458, 0,
2423 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2424 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2425 75, 76, 0, 0, 77, 0, 78, 478, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002426 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
Chris Lattner1913b942008-07-11 00:30:39 +00002427 0, 0, 77, 152, 78, 539, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002428 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2429 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2430 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2431 76, 0, 0, 77, 0, 78, 64, 65, 0, 107,
2432 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
Chris Lattner1913b942008-07-11 00:30:39 +00002433 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2434 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
2435 0, 107, 67, 68, 69, 70, 71, 72, 73, 74,
2436 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2437 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
2438 468, 3, 4, 5, 0, 0, 0, 0, 0, 64,
2439 65, 74, 107, 67, 68, 69, 70, 71, 72, 73,
2440 0, 1, 2, 0, 3, 4, 5, 64, 65, 74,
2441 66, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2442 2, 590, 3, 4, 5, 0, 0, 0, 0, 0,
2443 0, 0, 74, 0, 0, 0, 64, 65, 0, 107,
2444 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
2445 74, 3, 4, 5, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002447 75, 76, 0, 372, 77, 0, 78, 0, 0, 74,
2448 0, 0, 64, 65, 0, 151, 67, 68, 69, 70,
2449 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2450 0, 0, 75, 76, 0, 0, 77, 0, 78, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002451 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002452 75, 76, 0, 474, 77, 74, 78, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002454 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002456 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
2457 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2458 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2459 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2460 64, 65, 0, 280, 67, 68, 69, 70, 71, 72,
2461 73, 74, 1, 2, 0, 3, 4, 5, 64, 65,
2462 0, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2463 1, 2, 0, 3, 4, 5, 75, 76, 0, 0,
2464 77, 0, 78, 74, 0, 0, 0, 64, 65, 0,
2465 107, 156, 157, 158, 159, 160, 161, 73, 0, 1,
2466 2, 74, 3, 4, 5, 64, 65, 0, 107, 67,
2467 68, 69, 70, 71, 72, 598, 0, 1, 2, 0,
2468 3, 4, 5, 0, 0, 0, 0, 0, 64, 65,
2469 74, 107, 67, 68, 69, 70, 71, 72, 665, 0,
2470 1, 2, 0, 3, 4, 5, 0, 0, 74, 0,
2471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2472 0, 0, 75, 76, 0, 0, 77, 0, 78, 0,
2473 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2474 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2475 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2476 78, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2477 0, 0, 75, 76, 0, 0, 77, 0, 375, 0,
2478 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2479 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2480 0, 75, 76, 0, 0, 77, 0, 476, 0, 0,
2481 0, 0, 0, 0, 0, 0, 171, 0, 0, 75,
2482 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2483 0, 0, 0, 0, 0, 0, 0, 172, 173, 0,
2484 0, 0, 75, 76, 0, 0, 77, 0, 78, 174,
2485 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2486 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2487 195, 196, 197, 198, 0, 0, 0, 0, 0, 0,
2488 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2489 0, 0, 0, 0, 199, 200, 201, 0, 0, 202,
2490 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2491 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
2492 223
Dan Gohmanf4423b12008-04-19 00:24:39 +00002493};
2494
2495static const yytype_int16 yycheck[] =
2496{
Chris Lattner1913b942008-07-11 00:30:39 +00002497 0, 27, 164, 128, 242, 0, 176, 269, 270, 11,
2498 21, 454, 201, 11, 4, 55, 28, 17, 29, 165,
2499 55, 55, 17, 197, 469, 320, 55, 216, 217, 218,
2500 219, 220, 55, 34, 198, 121, 177, 226, 55, 42,
2501 43, 44, 45, 46, 47, 48, 49, 11, 51, 442,
2502 443, 658, 78, 54, 53, 159, 19, 18, 159, 22,
2503 11, 24, 166, 149, 55, 158, 55, 168, 159, 68,
2504 159, 678, 159, 59, 154, 20, 102, 168, 23, 168,
2505 106, 168, 55, 257, 164, 259, 112, 228, 32, 33,
2506 54, 54, 118, 93, 258, 159, 260, 243, 244, 41,
2507 42, 55, 128, 54, 168, 11, 48, 46, 159, 48,
2508 158, 17, 54, 375, 140, 141, 156, 168, 144, 158,
2509 34, 156, 156, 35, 150, 37, 166, 156, 162, 164,
2510 159, 160, 0, 156, 396, 397, 398, 580, 159, 156,
2511 533, 21, 159, 160, 158, 166, 591, 162, 174, 338,
2512 153, 154, 155, 598, 599, 167, 38, 168, 121, 122,
2513 117, 118, 164, 288, 158, 156, 164, 156, 157, 160,
2514 22, 614, 167, 199, 200, 201, 202, 167, 141, 142,
2515 22, 144, 145, 156, 147, 148, 149, 160, 22, 215,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002516 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
Chris Lattner1913b942008-07-11 00:30:39 +00002517 226, 281, 156, 157, 284, 285, 22, 287, 234, 156,
2518 42, 336, 44, 508, 476, 404, 4, 662, 663, 245,
2519 665, 666, 153, 154, 155, 159, 4, 141, 142, 143,
2520 164, 420, 146, 422, 423, 424, 150, 151, 37, 157,
2521 159, 159, 322, 688, 689, 164, 54, 157, 163, 159,
2522 330, 331, 332, 333, 334, 550, 163, 552, 159, 141,
2523 142, 143, 288, 164, 146, 141, 142, 143, 150, 151,
2524 146, 114, 115, 299, 150, 151, 157, 156, 159, 365,
2525 366, 367, 368, 369, 370, 371, 3, 4, 5, 6,
2526 316, 317, 318, 160, 380, 381, 382, 459, 536, 3,
2527 4, 5, 6, 42, 43, 44, 26, 27, 47, 4,
2528 336, 337, 338, 121, 122, 62, 63, 64, 65, 66,
2529 67, 616, 26, 27, 157, 22, 159, 157, 408, 409,
2530 410, 411, 412, 141, 142, 159, 144, 145, 418, 147,
2531 148, 149, 19, 166, 157, 22, 159, 24, 4, 375,
2532 157, 431, 432, 84, 85, 156, 9, 9, 384, 445,
2533 446, 447, 448, 9, 553, 9, 9, 556, 557, 558,
2534 456, 9, 55, 57, 11, 166, 157, 156, 404, 459,
2535 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2536 110, 111, 112, 113, 420, 421, 422, 423, 424, 156,
2537 638, 156, 156, 156, 430, 643, 156, 156, 22, 489,
2538 156, 491, 156, 156, 494, 156, 38, 159, 444, 159,
2539 4, 159, 159, 159, 504, 505, 159, 159, 38, 156,
2540 156, 156, 518, 519, 520, 521, 159, 523, 156, 7,
2541 8, 527, 528, 61, 22, 159, 159, 162, 159, 159,
2542 476, 19, 20, 159, 22, 23, 24, 159, 284, 285,
2543 159, 287, 38, 543, 544, 635, 546, 547, 548, 549,
2544 159, 159, 159, 159, 554, 166, 22, 503, 159, 159,
2545 159, 159, 562, 509, 570, 571, 572, 573, 568, 659,
2546 159, 157, 0, 17, 17, 156, 322, 159, 4, 159,
2547 159, 159, 159, 529, 330, 331, 332, 333, 334, 535,
2548 18, 19, 20, 4, 22, 23, 24, 159, 159, 545,
2549 159, 4, 30, 31, 159, 159, 156, 553, 159, 609,
2550 556, 557, 558, 159, 534, 621, 159, 623, 624, 565,
2551 159, 166, 159, 22, 52, 4, 159, 159, 56, 4,
2552 166, 54, 60, 159, 157, 159, 636, 637, 94, 95,
2553 96, 97, 98, 99, 100, 101, 102, 103, 159, 157,
2554 157, 3, 4, 5, 6, 22, 656, 9, 159, 162,
2555 166, 54, 408, 409, 410, 411, 412, 164, 157, 17,
2556 157, 157, 418, 25, 26, 27, 157, 157, 157, 164,
2557 157, 4, 682, 683, 152, 431, 432, 687, 40, 41,
2558 690, 156, 156, 639, 22, 17, 696, 159, 17, 699,
2559 159, 17, 73, 17, 131, 629, 131, 59, 93, 629,
2560 131, 112, 592, 234, 106, 17, 245, 90, 57, 565,
2561 449, -1, -1, 75, 76, 77, 78, 79, 80, 81,
2562 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2563 92, 93, -1, 489, -1, 491, -1, -1, 494, -1,
2564 -1, -1, -1, -1, -1, -1, -1, -1, 504, 505,
2565 -1, -1, -1, -1, -1, -1, -1, 119, 120, 121,
2566 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2567 -1, 133, -1, 135, 136, 137, -1, 139, 140, -1,
2568 -1, -1, -1, -1, -1, -1, -1, 543, 544, -1,
2569 546, 547, 548, 549, -1, -1, -1, -1, 554, -1,
2570 162, -1, -1, 165, -1, 167, 562, 169, -1, -1,
2571 -1, -1, 568, -1, -1, -1, -1, -1, -1, -1,
2572 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2573 -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
2574 8, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2575 -1, 19, 20, 609, 22, 23, 24, 25, 26, 27,
2576 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2577 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2578 636, 637, -1, -1, -1, -1, 54, -1, -1, 7,
2579 8, 59, 10, 11, 12, 13, 14, 15, 16, 17,
2580 656, 19, 20, -1, 22, 23, 24, 75, 76, 77,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002581 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
Chris Lattner1913b942008-07-11 00:30:39 +00002582 88, 89, 90, 91, 92, 93, 682, 683, -1, -1,
2583 -1, 687, 50, -1, 690, -1, -1, -1, -1, -1,
2584 696, -1, -1, 699, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002585 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2586 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
Chris Lattner1913b942008-07-11 00:30:39 +00002587 -1, 139, 140, 141, 142, -1, 144, 145, -1, 147,
2588 148, 149, -1, -1, -1, -1, 3, 4, 5, 6,
2589 7, 8, 9, -1, 162, -1, 0, 165, -1, 167,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002590 -1, 169, 19, 20, -1, 22, 23, 24, 25, 26,
Chris Lattner1913b942008-07-11 00:30:39 +00002591 27, -1, -1, -1, 18, 19, 20, -1, 22, 23,
2592 24, -1, -1, 40, 41, -1, 30, 31, -1, -1,
2593 -1, -1, -1, -1, -1, -1, -1, -1, 55, -1,
2594 -1, -1, 59, 161, 162, -1, -1, 165, 52, 167,
2595 168, -1, 56, -1, -1, -1, 60, -1, 75, 76,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002596 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2597 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002598 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002599 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002600 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2601 127, 128, 129, 130, 131, -1, 133, -1, 135, 136,
2602 137, -1, 139, 140, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002603 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002604 -1, -1, -1, -1, -1, 162, -1, -1, 165, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002605 167, -1, 169, 3, 4, 5, 6, 7, 8, 9,
2606 -1, -1, -1, -1, -1, -1, -1, -1, -1, 19,
2607 20, -1, 22, 23, 24, 25, 26, 27, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002608 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002609 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2610 -1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002611 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002612 -1, -1, -1, -1, -1, 75, 76, 77, 78, 79,
2613 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2614 90, 91, 92, 93, -1, -1, -1, -1, -1, -1,
2615 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2616 -1, -1, -1, -1, -1, -1, -1, -1, -1, 119,
2617 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2618 130, 131, -1, 133, -1, 135, 136, 137, -1, 139,
2619 140, 7, 8, -1, -1, -1, -1, -1, -1, -1,
2620 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2621 -1, -1, 162, -1, -1, 165, -1, 167, -1, 169,
2622 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2623 -1, -1, -1, -1, -1, -1, -1, 7, 8, 55,
2624 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2625 20, -1, 22, 23, 24, -1, -1, -1, -1, 75,
2626 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2627 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2628 50, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2629 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2630 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2631 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2632 136, 137, -1, 139, 140, 50, -1, -1, -1, -1,
2633 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2634 156, -1, 7, 8, 160, -1, 162, -1, -1, 165,
2635 -1, 167, -1, 169, 19, 20, -1, 22, 23, 24,
2636 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2637 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2638 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2639 55, 161, 162, -1, -1, 165, -1, 167, 168, -1,
2640 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2641 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2642 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002643 -1, -1, -1, -1, -1, -1, 161, 162, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002644 165, -1, 167, 168, -1, -1, -1, -1, -1, -1,
2645 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2646 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2647 135, 136, 137, -1, 139, 140, -1, 7, 8, -1,
2648 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2649 20, 156, 22, 23, 24, -1, -1, 162, -1, -1,
2650 165, -1, 167, -1, 169, -1, 7, 8, -1, 10,
2651 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2652 50, 22, 23, 24, 7, 8, -1, 10, 11, 12,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002653 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002654 23, 24, -1, -1, -1, -1, -1, 7, 8, 50,
2655 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2656 20, -1, 22, 23, 24, 7, 8, 50, 10, 11,
Chris Lattner1913b942008-07-11 00:30:39 +00002657 12, 13, 14, 15, 16, 17, -1, 19, 20, 39,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002658 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002659 50, -1, -1, -1, -1, -1, -1, 7, 8, -1,
2660 10, 11, 12, 13, 14, 15, 16, 17, 50, 19,
2661 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2662 -1, -1, -1, -1, -1, -1, -1, -1, -1, 39,
2663 -1, 161, 162, -1, -1, 165, -1, 167, 168, -1,
2664 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2665 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2666 161, 162, -1, -1, 165, -1, 167, 168, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002667 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
Chris Lattner1913b942008-07-11 00:30:39 +00002668 -1, -1, 165, 125, 167, 168, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002669 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2670 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2671 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2672 162, -1, -1, 165, -1, 167, 7, 8, -1, 10,
2673 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Chris Lattner1913b942008-07-11 00:30:39 +00002674 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2675 -1, 161, 162, -1, -1, 165, -1, 167, 7, 8,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002676 -1, 10, 11, 12, 13, 14, 15, 16, 17, 50,
Chris Lattner1913b942008-07-11 00:30:39 +00002677 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2678 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2679 39, 22, 23, 24, -1, -1, -1, -1, -1, 7,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002680 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
Chris Lattner1913b942008-07-11 00:30:39 +00002681 -1, 19, 20, -1, 22, 23, 24, 7, 8, 50,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002682 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Chris Lattner1913b942008-07-11 00:30:39 +00002683 20, 39, 22, 23, 24, -1, -1, -1, -1, -1,
2684 -1, -1, 50, -1, -1, -1, 7, 8, -1, 10,
2685 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2686 50, 22, 23, 24, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002687 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002688 161, 162, -1, 164, 165, -1, 167, -1, -1, 50,
2689 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2690 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2691 -1, -1, 161, 162, -1, -1, 165, -1, 167, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002692 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002693 161, 162, -1, 164, 165, 50, 167, -1, -1, -1,
2694 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2695 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2696 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2697 -1, 161, 162, -1, -1, 165, -1, 167, 7, 8,
2698 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2699 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002700 161, 162, -1, -1, 165, -1, 167, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002701 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2702 17, 50, 19, 20, -1, 22, 23, 24, 7, 8,
2703 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2704 19, 20, -1, 22, 23, 24, 161, 162, -1, -1,
2705 165, -1, 167, 50, -1, -1, -1, 7, 8, -1,
2706 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2707 20, 50, 22, 23, 24, 7, 8, -1, 10, 11,
2708 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2709 22, 23, 24, -1, -1, -1, -1, -1, 7, 8,
2710 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2711 19, 20, -1, 22, 23, 24, -1, -1, 50, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002712 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002713 -1, -1, 161, 162, -1, -1, 165, -1, 167, -1,
2714 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002715 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002716 -1, -1, -1, -1, 161, 162, -1, -1, 165, -1,
2717 167, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002718 -1, -1, 161, 162, -1, -1, 165, -1, 167, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002719 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2720 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002721 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2722 -1, -1, -1, -1, -1, -1, 36, -1, -1, 161,
2723 162, -1, -1, 165, -1, 167, -1, -1, -1, -1,
2724 -1, -1, -1, -1, -1, -1, -1, 57, 58, -1,
2725 -1, -1, 161, 162, -1, -1, 165, -1, 167, 69,
2726 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2727 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2728 90, 91, 92, 93, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002729 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002730 -1, -1, -1, -1, 114, 115, 116, -1, -1, 119,
2731 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2732 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2733 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002734};
2735
2736/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2737 symbol of state STATE-NUM. */
2738static const yytype_uint8 yystos[] =
2739{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002740 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002741 60, 178, 181, 182, 183, 184, 216, 217, 218, 220,
2742 219, 53, 68, 225, 158, 59, 158, 18, 158, 42,
2743 43, 44, 45, 46, 47, 48, 49, 51, 153, 154,
2744 155, 185, 186, 187, 0, 218, 46, 48, 188, 235,
2745 42, 43, 44, 47, 189, 232, 234, 242, 158, 158,
2746 162, 226, 22, 224, 7, 8, 10, 11, 12, 13,
2747 14, 15, 16, 17, 50, 161, 162, 165, 167, 178,
2748 182, 203, 204, 238, 187, 187, 35, 37, 214, 187,
2749 187, 21, 243, 244, 29, 168, 233, 243, 22, 22,
2750 22, 227, 156, 4, 4, 4, 167, 10, 168, 204,
2751 209, 55, 156, 180, 214, 214, 42, 44, 190, 32,
2752 33, 213, 62, 63, 64, 65, 66, 67, 191, 230,
2753 230, 181, 247, 159, 164, 39, 204, 205, 207, 208,
2754 163, 163, 168, 209, 159, 168, 156, 208, 160, 213,
2755 213, 10, 125, 204, 206, 215, 11, 12, 13, 14,
2756 15, 16, 176, 177, 204, 210, 4, 206, 28, 167,
2757 231, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnercc81d152008-05-04 17:18:47 +00002758 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002759 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2760 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begemanac80ade2008-05-12 19:01:56 +00002761 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002762 137, 138, 139, 140, 171, 172, 173, 245, 252, 253,
2763 254, 255, 22, 193, 159, 157, 204, 204, 166, 168,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002764 204, 4, 157, 210, 204, 156, 238, 26, 27, 3,
2765 4, 5, 6, 9, 25, 40, 41, 90, 91, 92,
2766 93, 119, 133, 135, 136, 137, 139, 140, 162, 165,
2767 167, 169, 171, 172, 173, 211, 238, 180, 182, 57,
2768 10, 204, 240, 241, 11, 17, 11, 176, 191, 94,
2769 95, 96, 97, 98, 99, 100, 101, 102, 103, 174,
2770 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2771 108, 109, 110, 111, 112, 113, 175, 174, 175, 204,
2772 204, 240, 204, 204, 248, 240, 240, 240, 240, 240,
2773 204, 204, 204, 204, 204, 240, 191, 117, 118, 54,
2774 121, 122, 141, 142, 144, 145, 147, 148, 149, 192,
2775 39, 205, 195, 164, 166, 166, 157, 195, 180, 180,
2776 215, 174, 175, 174, 175, 156, 156, 156, 156, 156,
2777 156, 156, 164, 210, 212, 167, 212, 168, 212, 22,
Chris Lattner1913b942008-07-11 00:30:39 +00002778 156, 156, 156, 221, 156, 3, 4, 5, 6, 9,
2779 25, 26, 27, 40, 41, 59, 162, 165, 167, 169,
2780 211, 237, 238, 239, 159, 239, 239, 239, 206, 204,
2781 204, 204, 204, 159, 198, 159, 198, 239, 162, 159,
2782 159, 159, 159, 159, 159, 239, 239, 239, 239, 239,
2783 38, 206, 204, 240, 4, 141, 142, 143, 146, 150,
2784 151, 194, 222, 223, 38, 156, 156, 156, 156, 210,
2785 210, 210, 210, 210, 210, 210, 159, 164, 168, 204,
2786 212, 166, 168, 210, 210, 210, 159, 201, 39, 204,
2787 228, 229, 61, 236, 164, 212, 167, 212, 168, 212,
2788 22, 240, 159, 159, 239, 239, 239, 239, 239, 11,
2789 54, 11, 250, 239, 162, 240, 204, 240, 240, 240,
2790 159, 159, 251, 159, 159, 159, 204, 239, 239, 159,
2791 201, 201, 204, 210, 210, 210, 210, 250, 159, 159,
2792 159, 159, 251, 159, 210, 166, 168, 159, 159, 38,
2793 34, 54, 199, 202, 193, 159, 157, 22, 164, 168,
2794 212, 166, 168, 17, 17, 156, 159, 159, 159, 159,
2795 239, 4, 239, 159, 159, 239, 159, 159, 159, 4,
2796 4, 159, 204, 239, 239, 156, 159, 198, 204, 157,
2797 159, 159, 159, 159, 157, 210, 210, 210, 210, 157,
2798 210, 166, 210, 210, 204, 22, 4, 201, 178, 179,
2799 39, 204, 195, 159, 166, 168, 239, 239, 17, 204,
2800 249, 239, 239, 239, 239, 198, 198, 240, 239, 159,
2801 240, 240, 240, 4, 239, 249, 239, 210, 210, 210,
2802 210, 159, 157, 159, 159, 251, 157, 157, 157, 193,
2803 199, 200, 22, 166, 159, 162, 193, 193, 157, 159,
2804 164, 239, 251, 157, 198, 157, 157, 157, 157, 210,
2805 210, 210, 157, 179, 54, 197, 17, 164, 176, 246,
2806 121, 122, 239, 239, 195, 17, 204, 164, 195, 157,
2807 157, 157, 4, 152, 196, 239, 237, 164, 176, 193,
2808 193, 38, 193, 193, 22, 159, 237, 17, 239, 239,
2809 17, 159, 239, 193, 193, 239, 17, 73, 239, 17,
2810 239
Dan Gohmanf4423b12008-04-19 00:24:39 +00002811};
David Greene718fda32007-08-01 03:59:32 +00002812
Reid Spencer68a24bd2005-08-27 18:50:39 +00002813#define yyerrok (yyerrstatus = 0)
2814#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002815#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002816#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002817
Reid Spencer68a24bd2005-08-27 18:50:39 +00002818#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002819#define YYABORT goto yyabortlab
2820#define YYERROR goto yyerrorlab
2821
2822
2823/* Like YYERROR except do call yyerror. This remains here temporarily
2824 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002825 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002826
Reid Spencer68a24bd2005-08-27 18:50:39 +00002827#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002828
Reid Spencer68a24bd2005-08-27 18:50:39 +00002829#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002830
2831#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002832do \
2833 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002834 { \
2835 yychar = (Token); \
2836 yylval = (Value); \
2837 yytoken = YYTRANSLATE (yychar); \
2838 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002839 goto yybackup; \
2840 } \
2841 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002842 { \
2843 yyerror (YY_("syntax error: cannot back up")); \
2844 YYERROR; \
2845 } \
2846while (YYID (0))
2847
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002848
Reid Spencer68a24bd2005-08-27 18:50:39 +00002849#define YYTERROR 1
2850#define YYERRCODE 256
2851
Dan Gohmanf4423b12008-04-19 00:24:39 +00002852
2853/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2854 If N is 0, then set CURRENT to the empty location which ends
2855 the previous symbol: RHS[0] (always defined). */
2856
2857#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2858#ifndef YYLLOC_DEFAULT
2859# define YYLLOC_DEFAULT(Current, Rhs, N) \
2860 do \
2861 if (YYID (N)) \
2862 { \
2863 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2864 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2865 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2866 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2867 } \
2868 else \
2869 { \
2870 (Current).first_line = (Current).last_line = \
2871 YYRHSLOC (Rhs, 0).last_line; \
2872 (Current).first_column = (Current).last_column = \
2873 YYRHSLOC (Rhs, 0).last_column; \
2874 } \
2875 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002876#endif
2877
Dan Gohmanf4423b12008-04-19 00:24:39 +00002878
2879/* YY_LOCATION_PRINT -- Print the location on the stream.
2880 This macro was not mandated originally: define only if we know
2881 we won't break user code: when these are the locations we know. */
2882
2883#ifndef YY_LOCATION_PRINT
Dan Gohman180c1692008-06-23 18:43:26 +00002884# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002885# define YY_LOCATION_PRINT(File, Loc) \
2886 fprintf (File, "%d.%d-%d.%d", \
2887 (Loc).first_line, (Loc).first_column, \
2888 (Loc).last_line, (Loc).last_column)
2889# else
2890# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2891# endif
2892#endif
2893
2894
2895/* YYLEX -- calling `yylex' with the right arguments. */
2896
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002897#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002898# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002899#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002900# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002901#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002902
2903/* Enable debugging if requested. */
2904#if YYDEBUG
2905
2906# ifndef YYFPRINTF
2907# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2908# define YYFPRINTF fprintf
2909# endif
2910
2911# define YYDPRINTF(Args) \
2912do { \
2913 if (yydebug) \
2914 YYFPRINTF Args; \
2915} while (YYID (0))
2916
2917# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2918do { \
2919 if (yydebug) \
2920 { \
2921 YYFPRINTF (stderr, "%s ", Title); \
2922 yy_symbol_print (stderr, \
2923 Type, Value); \
2924 YYFPRINTF (stderr, "\n"); \
2925 } \
2926} while (YYID (0))
2927
2928
2929/*--------------------------------.
2930| Print this symbol on YYOUTPUT. |
2931`--------------------------------*/
2932
2933/*ARGSUSED*/
2934#if (defined __STDC__ || defined __C99__FUNC__ \
2935 || defined __cplusplus || defined _MSC_VER)
2936static void
2937yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002938#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002939static void
2940yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2941 FILE *yyoutput;
2942 int yytype;
2943 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002944#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002945{
2946 if (!yyvaluep)
2947 return;
2948# ifdef YYPRINT
2949 if (yytype < YYNTOKENS)
2950 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2951# else
2952 YYUSE (yyoutput);
2953# endif
2954 switch (yytype)
2955 {
2956 default:
2957 break;
2958 }
2959}
2960
2961
2962/*--------------------------------.
2963| Print this symbol on YYOUTPUT. |
2964`--------------------------------*/
2965
2966#if (defined __STDC__ || defined __C99__FUNC__ \
2967 || defined __cplusplus || defined _MSC_VER)
2968static void
2969yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2970#else
2971static void
2972yy_symbol_print (yyoutput, yytype, yyvaluep)
2973 FILE *yyoutput;
2974 int yytype;
2975 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002976#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002977{
2978 if (yytype < YYNTOKENS)
2979 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2980 else
2981 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00002982
Dan Gohmanf4423b12008-04-19 00:24:39 +00002983 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2984 YYFPRINTF (yyoutput, ")");
2985}
Chris Lattner38905612008-02-19 04:36:25 +00002986
Dan Gohmanf4423b12008-04-19 00:24:39 +00002987/*------------------------------------------------------------------.
2988| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2989| TOP (included). |
2990`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00002991
Dan Gohmanf4423b12008-04-19 00:24:39 +00002992#if (defined __STDC__ || defined __C99__FUNC__ \
2993 || defined __cplusplus || defined _MSC_VER)
2994static void
2995yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2996#else
2997static void
2998yy_stack_print (bottom, top)
2999 yytype_int16 *bottom;
3000 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003001#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003002{
3003 YYFPRINTF (stderr, "Stack now");
3004 for (; bottom <= top; ++bottom)
3005 YYFPRINTF (stderr, " %d", *bottom);
3006 YYFPRINTF (stderr, "\n");
3007}
Chris Lattner38905612008-02-19 04:36:25 +00003008
Dan Gohmanf4423b12008-04-19 00:24:39 +00003009# define YY_STACK_PRINT(Bottom, Top) \
3010do { \
3011 if (yydebug) \
3012 yy_stack_print ((Bottom), (Top)); \
3013} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003014
Dan Gohmanf4423b12008-04-19 00:24:39 +00003015
3016/*------------------------------------------------.
3017| Report that the YYRULE is going to be reduced. |
3018`------------------------------------------------*/
3019
3020#if (defined __STDC__ || defined __C99__FUNC__ \
3021 || defined __cplusplus || defined _MSC_VER)
3022static void
3023yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3024#else
3025static void
3026yy_reduce_print (yyvsp, yyrule)
3027 YYSTYPE *yyvsp;
3028 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003029#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003030{
3031 int yynrhs = yyr2[yyrule];
3032 int yyi;
3033 unsigned long int yylno = yyrline[yyrule];
3034 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3035 yyrule - 1, yylno);
3036 /* The symbols being reduced. */
3037 for (yyi = 0; yyi < yynrhs; yyi++)
3038 {
3039 fprintf (stderr, " $%d = ", yyi + 1);
3040 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3041 &(yyvsp[(yyi + 1) - (yynrhs)])
3042 );
3043 fprintf (stderr, "\n");
3044 }
3045}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003046
Dan Gohmanf4423b12008-04-19 00:24:39 +00003047# define YY_REDUCE_PRINT(Rule) \
3048do { \
3049 if (yydebug) \
3050 yy_reduce_print (yyvsp, Rule); \
3051} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003052
Dan Gohmanf4423b12008-04-19 00:24:39 +00003053/* Nonzero means print parse trace. It is left uninitialized so that
3054 multiple parsers can coexist. */
3055int yydebug;
3056#else /* !YYDEBUG */
3057# define YYDPRINTF(Args)
3058# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3059# define YY_STACK_PRINT(Bottom, Top)
3060# define YY_REDUCE_PRINT(Rule)
3061#endif /* !YYDEBUG */
3062
3063
3064/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003065#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003066# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003067#endif
3068
Dan Gohmanf4423b12008-04-19 00:24:39 +00003069/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3070 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003071
Dan Gohmanf4423b12008-04-19 00:24:39 +00003072 Do not make this value too large; the results are undefined if
3073 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3074 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003075
Reid Spencer68a24bd2005-08-27 18:50:39 +00003076#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003077# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003078#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003079
Reid Spencer68a24bd2005-08-27 18:50:39 +00003080
3081
Dan Gohmanf4423b12008-04-19 00:24:39 +00003082#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003083
Dan Gohmanf4423b12008-04-19 00:24:39 +00003084# ifndef yystrlen
3085# if defined __GLIBC__ && defined _STRING_H
3086# define yystrlen strlen
3087# else
3088/* Return the length of YYSTR. */
3089#if (defined __STDC__ || defined __C99__FUNC__ \
3090 || defined __cplusplus || defined _MSC_VER)
3091static YYSIZE_T
3092yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003093#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003094static YYSIZE_T
3095yystrlen (yystr)
3096 const char *yystr;
3097#endif
3098{
3099 YYSIZE_T yylen;
3100 for (yylen = 0; yystr[yylen]; yylen++)
3101 continue;
3102 return yylen;
3103}
3104# endif
3105# endif
3106
3107# ifndef yystpcpy
3108# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3109# define yystpcpy stpcpy
3110# else
3111/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3112 YYDEST. */
3113#if (defined __STDC__ || defined __C99__FUNC__ \
3114 || defined __cplusplus || defined _MSC_VER)
3115static char *
3116yystpcpy (char *yydest, const char *yysrc)
3117#else
3118static char *
3119yystpcpy (yydest, yysrc)
3120 char *yydest;
3121 const char *yysrc;
3122#endif
3123{
3124 char *yyd = yydest;
3125 const char *yys = yysrc;
3126
3127 while ((*yyd++ = *yys++) != '\0')
3128 continue;
3129
3130 return yyd - 1;
3131}
3132# endif
3133# endif
3134
3135# ifndef yytnamerr
3136/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3137 quotes and backslashes, so that it's suitable for yyerror. The
3138 heuristic is that double-quoting is unnecessary unless the string
3139 contains an apostrophe, a comma, or backslash (other than
3140 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3141 null, do not copy; instead, return the length of what the result
3142 would have been. */
3143static YYSIZE_T
3144yytnamerr (char *yyres, const char *yystr)
3145{
3146 if (*yystr == '"')
3147 {
3148 YYSIZE_T yyn = 0;
3149 char const *yyp = yystr;
3150
3151 for (;;)
3152 switch (*++yyp)
3153 {
3154 case '\'':
3155 case ',':
3156 goto do_not_strip_quotes;
3157
3158 case '\\':
3159 if (*++yyp != '\\')
3160 goto do_not_strip_quotes;
3161 /* Fall through. */
3162 default:
3163 if (yyres)
3164 yyres[yyn] = *yyp;
3165 yyn++;
3166 break;
3167
3168 case '"':
3169 if (yyres)
3170 yyres[yyn] = '\0';
3171 return yyn;
3172 }
3173 do_not_strip_quotes: ;
3174 }
3175
3176 if (! yyres)
3177 return yystrlen (yystr);
3178
3179 return yystpcpy (yyres, yystr) - yyres;
3180}
3181# endif
3182
3183/* Copy into YYRESULT an error message about the unexpected token
3184 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3185 including the terminating null byte. If YYRESULT is null, do not
3186 copy anything; just return the number of bytes that would be
3187 copied. As a special case, return 0 if an ordinary "syntax error"
3188 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3189 size calculation. */
3190static YYSIZE_T
3191yysyntax_error (char *yyresult, int yystate, int yychar)
3192{
3193 int yyn = yypact[yystate];
3194
3195 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3196 return 0;
3197 else
3198 {
3199 int yytype = YYTRANSLATE (yychar);
3200 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3201 YYSIZE_T yysize = yysize0;
3202 YYSIZE_T yysize1;
3203 int yysize_overflow = 0;
3204 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3205 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3206 int yyx;
3207
3208# if 0
3209 /* This is so xgettext sees the translatable formats that are
3210 constructed on the fly. */
3211 YY_("syntax error, unexpected %s");
3212 YY_("syntax error, unexpected %s, expecting %s");
3213 YY_("syntax error, unexpected %s, expecting %s or %s");
3214 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3215 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3216# endif
3217 char *yyfmt;
3218 char const *yyf;
3219 static char const yyunexpected[] = "syntax error, unexpected %s";
3220 static char const yyexpecting[] = ", expecting %s";
3221 static char const yyor[] = " or %s";
3222 char yyformat[sizeof yyunexpected
3223 + sizeof yyexpecting - 1
3224 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3225 * (sizeof yyor - 1))];
3226 char const *yyprefix = yyexpecting;
3227
3228 /* Start YYX at -YYN if negative to avoid negative indexes in
3229 YYCHECK. */
3230 int yyxbegin = yyn < 0 ? -yyn : 0;
3231
3232 /* Stay within bounds of both yycheck and yytname. */
3233 int yychecklim = YYLAST - yyn + 1;
3234 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3235 int yycount = 1;
3236
3237 yyarg[0] = yytname[yytype];
3238 yyfmt = yystpcpy (yyformat, yyunexpected);
3239
3240 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3241 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3242 {
3243 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3244 {
3245 yycount = 1;
3246 yysize = yysize0;
3247 yyformat[sizeof yyunexpected - 1] = '\0';
3248 break;
3249 }
3250 yyarg[yycount++] = yytname[yyx];
3251 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3252 yysize_overflow |= (yysize1 < yysize);
3253 yysize = yysize1;
3254 yyfmt = yystpcpy (yyfmt, yyprefix);
3255 yyprefix = yyor;
3256 }
3257
3258 yyf = YY_(yyformat);
3259 yysize1 = yysize + yystrlen (yyf);
3260 yysize_overflow |= (yysize1 < yysize);
3261 yysize = yysize1;
3262
3263 if (yysize_overflow)
3264 return YYSIZE_MAXIMUM;
3265
3266 if (yyresult)
3267 {
3268 /* Avoid sprintf, as that infringes on the user's name space.
3269 Don't have undefined behavior even if the translation
3270 produced a string with the wrong number of "%s"s. */
3271 char *yyp = yyresult;
3272 int yyi = 0;
3273 while ((*yyp = *yyf) != '\0')
3274 {
3275 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3276 {
3277 yyp += yytnamerr (yyp, yyarg[yyi++]);
3278 yyf += 2;
3279 }
3280 else
3281 {
3282 yyp++;
3283 yyf++;
3284 }
3285 }
3286 }
3287 return yysize;
3288 }
3289}
3290#endif /* YYERROR_VERBOSE */
3291
3292
3293/*-----------------------------------------------.
3294| Release the memory associated to this symbol. |
3295`-----------------------------------------------*/
3296
3297/*ARGSUSED*/
3298#if (defined __STDC__ || defined __C99__FUNC__ \
3299 || defined __cplusplus || defined _MSC_VER)
3300static void
3301yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3302#else
3303static void
3304yydestruct (yymsg, yytype, yyvaluep)
3305 const char *yymsg;
3306 int yytype;
3307 YYSTYPE *yyvaluep;
3308#endif
3309{
3310 YYUSE (yyvaluep);
3311
3312 if (!yymsg)
3313 yymsg = "Deleting";
3314 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3315
3316 switch (yytype)
3317 {
3318
3319 default:
3320 break;
3321 }
3322}
3323
3324
3325/* Prevent warnings from -Wmissing-prototypes. */
3326
3327#ifdef YYPARSE_PARAM
3328#if defined __STDC__ || defined __cplusplus
3329int yyparse (void *YYPARSE_PARAM);
3330#else
3331int yyparse ();
3332#endif
3333#else /* ! YYPARSE_PARAM */
3334#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003335int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003336#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003337int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003338#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003339#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003340
Chris Lattner38905612008-02-19 04:36:25 +00003341
Dan Gohmanf4423b12008-04-19 00:24:39 +00003342
3343/* The look-ahead symbol. */
3344int yychar;
3345
3346/* The semantic value of the look-ahead symbol. */
3347YYSTYPE yylval;
3348
3349/* Number of syntax errors so far. */
3350int yynerrs;
3351
3352
3353
3354/*----------.
3355| yyparse. |
3356`----------*/
3357
3358#ifdef YYPARSE_PARAM
3359#if (defined __STDC__ || defined __C99__FUNC__ \
3360 || defined __cplusplus || defined _MSC_VER)
3361int
3362yyparse (void *YYPARSE_PARAM)
3363#else
3364int
3365yyparse (YYPARSE_PARAM)
3366 void *YYPARSE_PARAM;
3367#endif
3368#else /* ! YYPARSE_PARAM */
3369#if (defined __STDC__ || defined __C99__FUNC__ \
3370 || defined __cplusplus || defined _MSC_VER)
3371int
3372yyparse (void)
3373#else
3374int
3375yyparse ()
3376
Gabor Greife64d2482008-04-06 23:07:54 +00003377#endif
3378#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003379{
3380
3381 int yystate;
3382 int yyn;
3383 int yyresult;
3384 /* Number of tokens to shift before error messages enabled. */
3385 int yyerrstatus;
3386 /* Look-ahead token as an internal (translated) token number. */
3387 int yytoken = 0;
3388#if YYERROR_VERBOSE
3389 /* Buffer for error messages, and its allocated size. */
3390 char yymsgbuf[128];
3391 char *yymsg = yymsgbuf;
3392 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003393#endif
Chris Lattner38905612008-02-19 04:36:25 +00003394
Dan Gohmanf4423b12008-04-19 00:24:39 +00003395 /* Three stacks and their tools:
3396 `yyss': related to states,
3397 `yyvs': related to semantic values,
3398 `yyls': related to locations.
3399
3400 Refer to the stacks thru separate pointers, to allow yyoverflow
3401 to reallocate them elsewhere. */
3402
3403 /* The state stack. */
3404 yytype_int16 yyssa[YYINITDEPTH];
3405 yytype_int16 *yyss = yyssa;
3406 yytype_int16 *yyssp;
3407
3408 /* The semantic value stack. */
3409 YYSTYPE yyvsa[YYINITDEPTH];
3410 YYSTYPE *yyvs = yyvsa;
3411 YYSTYPE *yyvsp;
3412
3413
3414
3415#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3416
3417 YYSIZE_T yystacksize = YYINITDEPTH;
3418
3419 /* The variables used to return semantic value and location from the
3420 action routines. */
3421 YYSTYPE yyval;
3422
3423
3424 /* The number of symbols on the RHS of the reduced rule.
3425 Keep to zero when no symbol should be popped. */
3426 int yylen = 0;
3427
3428 YYDPRINTF ((stderr, "Starting parse\n"));
3429
Reid Spencer68a24bd2005-08-27 18:50:39 +00003430 yystate = 0;
3431 yyerrstatus = 0;
3432 yynerrs = 0;
3433 yychar = YYEMPTY; /* Cause a token to be read. */
3434
3435 /* Initialize stack pointers.
3436 Waste one element of value and location stack
3437 so that they stay on the same level as the state stack.
3438 The wasted elements are never initialized. */
3439
Dan Gohmanf4423b12008-04-19 00:24:39 +00003440 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003441 yyvsp = yyvs;
3442
Dan Gohmanf4423b12008-04-19 00:24:39 +00003443 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003444
Dan Gohmanf4423b12008-04-19 00:24:39 +00003445/*------------------------------------------------------------.
3446| yynewstate -- Push a new state, which is found in yystate. |
3447`------------------------------------------------------------*/
3448 yynewstate:
3449 /* In all cases, when you get here, the value and location stacks
3450 have just been pushed. So pushing a state here evens the stacks. */
3451 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003452
Dan Gohmanf4423b12008-04-19 00:24:39 +00003453 yysetstate:
3454 *yyssp = yystate;
3455
3456 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003457 {
3458 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003459 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003460
3461#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003462 {
3463 /* Give user a chance to reallocate the stack. Use copies of
3464 these so that the &'s don't force the real ones into
3465 memory. */
3466 YYSTYPE *yyvs1 = yyvs;
3467 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003468
Dan Gohmanf4423b12008-04-19 00:24:39 +00003469
3470 /* Each stack pointer address is followed by the size of the
3471 data in use in that stack, in bytes. This used to be a
3472 conditional around just the two extra args, but that might
3473 be undefined if yyoverflow is a macro. */
3474 yyoverflow (YY_("memory exhausted"),
3475 &yyss1, yysize * sizeof (*yyssp),
3476 &yyvs1, yysize * sizeof (*yyvsp),
3477
3478 &yystacksize);
3479
3480 yyss = yyss1;
3481 yyvs = yyvs1;
3482 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003483#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003484# ifndef YYSTACK_RELOCATE
3485 goto yyexhaustedlab;
3486# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003487 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003488 if (YYMAXDEPTH <= yystacksize)
3489 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003490 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003491 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003492 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003493
3494 {
3495 yytype_int16 *yyss1 = yyss;
3496 union yyalloc *yyptr =
3497 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3498 if (! yyptr)
3499 goto yyexhaustedlab;
3500 YYSTACK_RELOCATE (yyss);
3501 YYSTACK_RELOCATE (yyvs);
3502
3503# undef YYSTACK_RELOCATE
3504 if (yyss1 != yyssa)
3505 YYSTACK_FREE (yyss1);
3506 }
3507# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003508#endif /* no yyoverflow */
3509
Dan Gohmanf4423b12008-04-19 00:24:39 +00003510 yyssp = yyss + yysize - 1;
3511 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003512
3513
Dan Gohmanf4423b12008-04-19 00:24:39 +00003514 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3515 (unsigned long int) yystacksize));
3516
3517 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003518 YYABORT;
3519 }
3520
Dan Gohmanf4423b12008-04-19 00:24:39 +00003521 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003522
3523 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003524
Dan Gohmanf4423b12008-04-19 00:24:39 +00003525/*-----------.
3526| yybackup. |
3527`-----------*/
3528yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003529
Dan Gohmanf4423b12008-04-19 00:24:39 +00003530 /* Do appropriate processing given the current state. Read a
3531 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003532
Dan Gohmanf4423b12008-04-19 00:24:39 +00003533 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003534 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003535 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003536 goto yydefault;
3537
Dan Gohmanf4423b12008-04-19 00:24:39 +00003538 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003539
Dan Gohmanf4423b12008-04-19 00:24:39 +00003540 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003541 if (yychar == YYEMPTY)
3542 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003543 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003544 yychar = YYLEX;
3545 }
3546
Dan Gohmanf4423b12008-04-19 00:24:39 +00003547 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003548 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003549 yychar = yytoken = YYEOF;
3550 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003551 }
3552 else
3553 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003554 yytoken = YYTRANSLATE (yychar);
3555 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003556 }
3557
Dan Gohmanf4423b12008-04-19 00:24:39 +00003558 /* If the proper action on seeing token YYTOKEN is to reduce or to
3559 detect an error, take that action. */
3560 yyn += yytoken;
3561 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003562 goto yydefault;
3563 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003564 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003565 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003566 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003567 goto yyerrlab;
3568 yyn = -yyn;
3569 goto yyreduce;
3570 }
3571
3572 if (yyn == YYFINAL)
3573 YYACCEPT;
3574
Dan Gohmanf4423b12008-04-19 00:24:39 +00003575 /* Count tokens shifted since error; after three, turn off error
3576 status. */
3577 if (yyerrstatus)
3578 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003579
Dan Gohmanf4423b12008-04-19 00:24:39 +00003580 /* Shift the look-ahead token. */
3581 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003582
Dan Gohmanf4423b12008-04-19 00:24:39 +00003583 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003584 if (yychar != YYEOF)
3585 yychar = YYEMPTY;
3586
Gabor Greife64d2482008-04-06 23:07:54 +00003587 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003588 *++yyvsp = yylval;
3589
Reid Spencer68a24bd2005-08-27 18:50:39 +00003590 goto yynewstate;
3591
Gabor Greife64d2482008-04-06 23:07:54 +00003592
Dan Gohmanf4423b12008-04-19 00:24:39 +00003593/*-----------------------------------------------------------.
3594| yydefault -- do the default action for the current state. |
3595`-----------------------------------------------------------*/
3596yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003597 yyn = yydefact[yystate];
3598 if (yyn == 0)
3599 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003601
Dan Gohmanf4423b12008-04-19 00:24:39 +00003602
3603/*-----------------------------.
3604| yyreduce -- Do a reduction. |
3605`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003606yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003607 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003608 yylen = yyr2[yyn];
3609
Dan Gohmanf4423b12008-04-19 00:24:39 +00003610 /* If YYLEN is nonzero, implement the default value of the action:
3611 `$$ = $1'.
3612
3613 Otherwise, the following line sets YYVAL to garbage.
3614 This behavior is undocumented and Bison
3615 users should not rely upon it. Assigning to YYVAL
3616 unconditionally makes the parser a bit smaller, and it avoids a
3617 GCC warning that YYVAL may be used uninitialized. */
3618 yyval = yyvsp[1-yylen];
3619
3620
3621 YY_REDUCE_PRINT (yyn);
3622 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003623 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003624 case 29:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003625#line 1138 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003626 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3627 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003628
Dan Gohmanf4423b12008-04-19 00:24:39 +00003629 case 30:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003630#line 1138 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003631 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3632 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003633
Dan Gohmanf4423b12008-04-19 00:24:39 +00003634 case 31:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003635#line 1139 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003636 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3637 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003638
Dan Gohmanf4423b12008-04-19 00:24:39 +00003639 case 32:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003640#line 1139 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003641 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3642 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003643
Dan Gohmanf4423b12008-04-19 00:24:39 +00003644 case 33:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003645#line 1140 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003646 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3647 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003648
Dan Gohmanf4423b12008-04-19 00:24:39 +00003649 case 34:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003650#line 1140 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003651 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3652 break;
3653
3654 case 35:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003655#line 1141 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003656 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3657 break;
3658
3659 case 36:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003660#line 1141 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003661 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3662 break;
3663
3664 case 37:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003665#line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003666 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3667 break;
3668
3669 case 38:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003670#line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003671 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3672 break;
3673
3674 case 39:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003675#line 1146 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003676 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3677 break;
3678
3679 case 40:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003680#line 1146 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003681 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3682 break;
3683
3684 case 41:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003685#line 1147 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003686 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3687 break;
3688
3689 case 42:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003690#line 1147 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003691 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3692 break;
3693
3694 case 43:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003695#line 1148 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003696 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3697 break;
3698
3699 case 44:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003700#line 1148 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003701 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3702 break;
3703
3704 case 45:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003705#line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003706 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3707 break;
3708
3709 case 46:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003710#line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003711 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3712 break;
3713
3714 case 47:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003715#line 1150 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003716 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3717 break;
3718
3719 case 48:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003720#line 1150 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003721 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3722 break;
3723
3724 case 49:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003725#line 1151 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003726 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3727 break;
3728
3729 case 50:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003730#line 1151 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003731 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3732 break;
3733
3734 case 51:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003735#line 1152 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003736 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3737 break;
3738
3739 case 52:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003740#line 1152 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003741 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3742 break;
3743
3744 case 53:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003745#line 1153 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003746 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3747 break;
3748
3749 case 54:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003750#line 1154 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003751 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3752 break;
3753
3754 case 65:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003755#line 1163 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003756 { (yyval.StrVal) = 0; ;}
3757 break;
3758
3759 case 66:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003760#line 1165 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003761 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3762 break;
3763
3764 case 67:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003765#line 1166 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003766 { (yyval.UIntVal)=0; ;}
3767 break;
3768
3769 case 68:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003770#line 1170 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003771 {
3772 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003773 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003774 ;}
3775 break;
3776
3777 case 69:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003778#line 1174 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003779 {
3780 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003781 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003782 ;}
3783 break;
3784
3785 case 73:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003786#line 1182 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003787 {
3788 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003789 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003790 ;}
3791 break;
3792
3793 case 74:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003794#line 1187 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003795 {
3796 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003797 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003798 ;}
3799 break;
3800
3801 case 75:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003802#line 1193 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003803 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3804 break;
3805
3806 case 76:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003807#line 1194 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003808 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3809 break;
3810
3811 case 77:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003812#line 1195 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003813 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3814 break;
3815
3816 case 78:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003817#line 1196 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003818 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3819 break;
3820
3821 case 79:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003822#line 1197 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003823 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3824 break;
3825
3826 case 80:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003827#line 1198 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003828 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003829 break;
3830
3831 case 81:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003832#line 1202 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003833 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003834 break;
3835
3836 case 82:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003837#line 1203 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003838 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003839 break;
3840
3841 case 83:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003842#line 1204 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003843 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003844 break;
3845
3846 case 84:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003847#line 1208 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003848 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3849 break;
3850
3851 case 85:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003852#line 1209 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003853 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003854 break;
3855
3856 case 86:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003857#line 1210 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003858 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003859 break;
3860
3861 case 87:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003862#line 1211 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003863 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003864 break;
3865
3866 case 88:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003867#line 1215 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003868 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3869 break;
3870
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003871 case 89:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003872#line 1216 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003873 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3874 break;
3875
3876 case 90:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003877#line 1217 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003878 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3879 break;
3880
3881 case 91:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003882#line 1221 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003883 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3884 break;
3885
3886 case 92:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003887#line 1222 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003888 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3889 break;
3890
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003891 case 93:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003892#line 1223 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003893 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3894 break;
3895
3896 case 94:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003897#line 1224 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003898 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3899 break;
3900
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003901 case 95:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003902#line 1225 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003903 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3904 break;
3905
3906 case 96:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003907#line 1229 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003908 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3909 break;
3910
3911 case 97:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003912#line 1230 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003913 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3914 break;
3915
3916 case 98:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003917#line 1231 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003918 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003919 break;
3920
3921 case 99:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003922#line 1234 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003923 { (yyval.UIntVal) = CallingConv::C; ;}
3924 break;
3925
3926 case 100:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003927#line 1235 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003928 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003929 break;
3930
3931 case 101:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003932#line 1236 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003933 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003934 break;
3935
3936 case 102:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003937#line 1237 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003938 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003939 break;
3940
3941 case 103:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003942#line 1238 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003943 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003944 break;
3945
3946 case 104:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003947#line 1239 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003948 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3949 break;
3950
3951 case 105:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003952#line 1240 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003953 {
3954 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003955 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003956 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003957 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003958 ;}
3959 break;
3960
Dan Gohmanf4423b12008-04-19 00:24:39 +00003961 case 106:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003962#line 1247 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003963 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3964 break;
3965
3966 case 107:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003967#line 1248 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003968 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003969 break;
3970
3971 case 108:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003972#line 1249 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003973 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3974 break;
3975
3976 case 109:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003977#line 1250 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003978 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003979 break;
3980
3981 case 110:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003982#line 1251 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003983 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003984 break;
3985
3986 case 111:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003987#line 1252 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003988 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003989 break;
3990
3991 case 112:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003992#line 1253 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003993 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003994 break;
3995
3996 case 113:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00003997#line 1254 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003998 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003999 break;
4000
4001 case 114:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004002#line 1255 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004003 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
4004 break;
4005
4006 case 115:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004007#line 1256 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004008 { (yyval.ParamAttrs) =
4009 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4010 break;
4011
Dan Gohmanf4423b12008-04-19 00:24:39 +00004012 case 116:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004013#line 1260 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004014 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004015 break;
4016
4017 case 117:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004018#line 1261 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004019 {
4020 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4021 ;}
4022 break;
4023
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004024 case 118:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004025#line 1266 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004026 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4027 break;
4028
4029 case 119:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004030#line 1267 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004031 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4032 break;
4033
4034 case 120:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004035#line 1268 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004036 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4037 break;
4038
4039 case 121:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004040#line 1269 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004041 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4042 break;
4043
4044 case 122:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004045#line 1270 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004046 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
4047 break;
4048
4049 case 123:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004050#line 1271 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004051 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
4052 break;
4053
4054 case 124:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004055#line 1274 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004056 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4057 break;
4058
Dan Gohmanf4423b12008-04-19 00:24:39 +00004059 case 125:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004060#line 1275 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004061 {
4062 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4063 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004064 break;
4065
4066 case 126:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004067#line 1280 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004068 { (yyval.StrVal) = 0; ;}
4069 break;
4070
4071 case 127:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004072#line 1281 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004073 {
4074 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4075 ;}
4076 break;
4077
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004078 case 128:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004079#line 1288 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004080 { (yyval.UIntVal) = 0; ;}
4081 break;
4082
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004083 case 129:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004084#line 1289 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004085 {
4086 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4087 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004088 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004089 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004090;}
4091 break;
4092
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004093 case 130:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004094#line 1295 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004095 { (yyval.UIntVal) = 0; ;}
4096 break;
4097
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004098 case 131:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004099#line 1296 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004100 {
4101 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4102 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004103 GEN_ERROR("Alignment must be a power of two");
4104 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004105;}
4106 break;
4107
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004108 case 132:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004109#line 1305 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004110 {
4111 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4112 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004113 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004114 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004115 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004116;}
4117 break;
4118
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004119 case 133:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004120#line 1313 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004121 { (yyval.StrVal) = 0; ;}
4122 break;
4123
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004124 case 134:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004125#line 1314 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004126 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4127 break;
4128
Dan Gohmanf4423b12008-04-19 00:24:39 +00004129 case 135:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004130#line 1319 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004131 {;}
4132 break;
4133
4134 case 136:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004135#line 1320 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004136 {;}
4137 break;
4138
4139 case 137:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004140#line 1321 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004141 {
4142 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4143 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004144 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004145 ;}
4146 break;
4147
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004148 case 138:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004149#line 1326 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004150 {
4151 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004152 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004153 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004154 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004155 ;}
4156 break;
4157
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004158 case 146:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004159#line 1342 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004160 {
4161 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004162 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004163 ;}
4164 break;
4165
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004166 case 147:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004167#line 1346 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004168 {
4169 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004170 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004171 ;}
4172 break;
4173
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004174 case 148:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004175#line 1350 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004176 { // Pointer type?
4177 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004178 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004179 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4180 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004181 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004182 ;}
4183 break;
4184
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004185 case 149:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004186#line 1357 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004187 { // Named types are also simple types...
4188 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004189 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004190 (yyval.TypeVal) = new PATypeHolder(tmp);
4191 ;}
4192 break;
4193
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004194 case 150:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004195#line 1362 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004196 { // Type UpReference
4197 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004198 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004199 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4200 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004201 UR_OUT("New Upreference!\n");
4202 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004203 ;}
4204 break;
4205
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004206 case 151:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004207#line 1370 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004208 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004209 // Allow but ignore attributes on function types; this permits auto-upgrade.
4210 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004211 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4212 if (!FunctionType::isValidReturnType(RetTy))
4213 GEN_ERROR("Invalid result type for LLVM function");
4214
Reid Spencer41dff5e2007-01-26 08:05:27 +00004215 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004216 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004217 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004218 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004219 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004220 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004221
Reid Spencer41dff5e2007-01-26 08:05:27 +00004222 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4223 if (isVarArg) Params.pop_back();
4224
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004225 for (unsigned i = 0; i != Params.size(); ++i)
4226 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4227 GEN_ERROR("Function arguments must be value types!");
4228
4229 CHECK_FOR_ERROR
4230
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004231 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004232 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4233 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4234 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004235 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004236 ;}
4237 break;
4238
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004239 case 152:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004240#line 1399 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004241 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004242 // Allow but ignore attributes on function types; this permits auto-upgrade.
4243 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004244 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004245 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004246 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004247 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004248 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004249 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004250
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004251 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4252 if (isVarArg) Params.pop_back();
4253
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004254 for (unsigned i = 0; i != Params.size(); ++i)
4255 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4256 GEN_ERROR("Function arguments must be value types!");
4257
4258 CHECK_FOR_ERROR
4259
Dan Gohmanf4423b12008-04-19 00:24:39 +00004260 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4261 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4262 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004263 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004264 ;}
4265 break;
4266
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004267 case 153:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004268#line 1424 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004269 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004270 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004271 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004272 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004273 ;}
4274 break;
4275
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004276 case 154:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004277#line 1429 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004278 { // Vector type?
4279 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4280 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004281 GEN_ERROR("Unsigned result not equal to signed result");
4282 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4283 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004284 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4285 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004286 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004287 ;}
4288 break;
4289
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004290 case 155:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004291#line 1439 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004292 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004293 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004294 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4295 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004296 Elements.push_back(*I);
4297
Dan Gohmanf4423b12008-04-19 00:24:39 +00004298 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4299 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004300 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004301 ;}
4302 break;
4303
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004304 case 156:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004305#line 1449 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004306 { // Empty structure type?
4307 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004308 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004309 ;}
4310 break;
4311
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004312 case 157:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004313#line 1453 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004314 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004315 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004316 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4317 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004318 Elements.push_back(*I);
4319
Dan Gohmanf4423b12008-04-19 00:24:39 +00004320 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4321 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004322 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004323 ;}
4324 break;
4325
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004326 case 158:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004327#line 1463 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004328 { // Empty structure type?
4329 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004330 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004331 ;}
4332 break;
4333
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004334 case 159:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004335#line 1470 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004336 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004337 // Allow but ignore attributes on function types; this permits auto-upgrade.
4338 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004339 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4340 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4341 ;}
4342 break;
4343
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004344 case 160:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004345#line 1479 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004346 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004347 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004348 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4349 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004350 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004351 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4352 ;}
4353 break;
4354
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004355 case 161:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004356#line 1486 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004357 {
4358 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4359 ;}
4360 break;
4361
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004362 case 162:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004363#line 1491 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004364 {
4365 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4366 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004367 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004368 ;}
4369 break;
4370
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004371 case 163:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004372#line 1496 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004373 {
4374 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004375 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004376 ;}
4377 break;
4378
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004379 case 165:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004380#line 1504 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004381 {
4382 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004383 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004384 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004385 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004386 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004387 ;}
4388 break;
4389
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004390 case 166:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004391#line 1511 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004392 {
4393 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004394 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4395 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004396 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004397 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004398 ;}
4399 break;
4400
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004401 case 167:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004402#line 1518 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004403 {
4404 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004405 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004406 ;}
4407 break;
4408
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004409 case 168:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004410#line 1526 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004411 {
4412 (yyval.TypeList) = new std::list<PATypeHolder>();
4413 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4414 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004415 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004416 ;}
4417 break;
4418
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004419 case 169:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004420#line 1532 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004421 {
4422 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4423 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004424 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004425 ;}
4426 break;
4427
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004428 case 170:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004429#line 1544 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004430 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004431 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004432 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4433 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004434 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004435 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004436 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004437 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004438 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004439
4440 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004441 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004442 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004443 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004444 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004445
4446 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004447 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4448 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004449 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4450 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004451 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004452 }
4453
Dan Gohmanf4423b12008-04-19 00:24:39 +00004454 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4455 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004456 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004457 ;}
4458 break;
4459
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004460 case 171:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004461#line 1572 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004462 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004463 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004464 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4465 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004466 if (ATy == 0)
4467 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004468 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004469
Dan Gohman180c1692008-06-23 18:43:26 +00004470 uint64_t NumElements = ATy->getNumElements();
Mon P Wang28873102008-06-25 08:15:39 +00004471 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004472 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004473 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4475 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004476 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004477 ;}
4478 break;
4479
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004480 case 172:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004481#line 1588 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004482 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004483 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004484 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4485 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004486 if (ATy == 0)
4487 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004488 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004489
Dan Gohman180c1692008-06-23 18:43:26 +00004490 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004491 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004492 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004493 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004494 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4495 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004496 std::vector<Constant*> Vals;
4497 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004498 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004499 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004500 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004501 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004502 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4503 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004504 delete (yyvsp[(3) - (3)].StrVal);
4505 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4506 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004507 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004508 ;}
4509 break;
4510
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004511 case 173:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004512#line 1615 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004513 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004514 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004515 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4516 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004517 if (PTy == 0)
4518 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004519 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004520 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004521 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004522
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004523 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004524 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004525 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004526 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004527 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004528
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004529 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004530 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4531 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004532 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4533 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004534 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004535 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004536
Dan Gohmanf4423b12008-04-19 00:24:39 +00004537 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4538 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004539 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004540 ;}
4541 break;
4542
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004543 case 174:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004544#line 1643 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004545 {
4546 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004547 if (STy == 0)
4548 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004549 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004550
Dan Gohmanf4423b12008-04-19 00:24:39 +00004551 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004552 GEN_ERROR("Illegal number of initializers for structure type");
4553
4554 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004555 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4556 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004557 GEN_ERROR("Expected type '" +
4558 STy->getElementType(i)->getDescription() +
4559 "' for element #" + utostr(i) +
4560 " of structure initializer");
4561
4562 // Check to ensure that Type is not packed
4563 if (STy->isPacked())
4564 GEN_ERROR("Unpacked Initializer to vector type '" +
4565 STy->getDescription() + "'");
4566
Dan Gohmanf4423b12008-04-19 00:24:39 +00004567 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4568 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004569 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004570 ;}
4571 break;
4572
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004573 case 175:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004574#line 1669 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004575 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004576 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004577 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4578 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004579 if (STy == 0)
4580 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004581 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004582
4583 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004584 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004585
4586 // Check to ensure that Type is not packed
4587 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004588 GEN_ERROR("Unpacked Initializer to vector type '" +
4589 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004590
Dan Gohmanf4423b12008-04-19 00:24:39 +00004591 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4592 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004593 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004594 ;}
4595 break;
4596
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004597 case 176:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004598#line 1689 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004599 {
4600 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004601 if (STy == 0)
4602 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004603 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004604
Dan Gohmanf4423b12008-04-19 00:24:39 +00004605 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004606 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004607
4608 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004609 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4610 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004611 GEN_ERROR("Expected type '" +
4612 STy->getElementType(i)->getDescription() +
4613 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004614 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004615
4616 // Check to ensure that Type is packed
4617 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004618 GEN_ERROR("Vector initializer to non-vector type '" +
4619 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004620
Dan Gohmanf4423b12008-04-19 00:24:39 +00004621 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4622 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004623 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004624 ;}
4625 break;
4626
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004627 case 177:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004628#line 1715 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004629 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004630 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004631 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4632 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004633 if (STy == 0)
4634 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004635 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004636
4637 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004638 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004639
4640 // Check to ensure that Type is packed
4641 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004642 GEN_ERROR("Vector initializer to non-vector type '" +
4643 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004644
Dan Gohmanf4423b12008-04-19 00:24:39 +00004645 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4646 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004647 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004648 ;}
4649 break;
4650
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004651 case 178:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004652#line 1735 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004653 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004654 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004655 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4656 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004657 if (PTy == 0)
4658 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004659 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004660
Dan Gohmanf4423b12008-04-19 00:24:39 +00004661 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4662 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004663 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004664 ;}
4665 break;
4666
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004667 case 179:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004668#line 1747 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004669 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004670 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004671 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4672 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4673 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004674 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004675 ;}
4676 break;
4677
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004678 case 180:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004679#line 1754 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004680 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004681 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004682 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4683 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004684 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004685 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004686
4687 // ConstExprs can exist in the body of a function, thus creating
4688 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004689 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004690 // symbol table instead of the module symbol table for the global symbol,
4691 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004692 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004693 //
4694 Function *SavedCurFn = CurFun.CurrentFunction;
4695 CurFun.CurrentFunction = 0;
4696
Dan Gohmanf4423b12008-04-19 00:24:39 +00004697 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004698 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004699
4700 CurFun.CurrentFunction = SavedCurFn;
4701
4702 // If this is an initializer for a constant pointer, which is referencing a
4703 // (currently) undefined variable, create a stub now that shall be replaced
4704 // in the future with the right type of variable.
4705 //
4706 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004707 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004708 const PointerType *PT = cast<PointerType>(Ty);
4709
4710 // First check to see if the forward references value is already created!
4711 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004712 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004713
4714 if (I != CurModule.GlobalRefs.end()) {
4715 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004716 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004717 } else {
4718 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004719 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4720 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4721 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004722 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004723
4724 // Create the forward referenced global.
4725 GlobalValue *GV;
4726 if (const FunctionType *FTy =
4727 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004728 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4729 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004730 } else {
4731 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004732 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004733 Name, CurModule.CurrentModule);
4734 }
4735
4736 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004737 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004738 V = GV;
4739 }
4740 }
4741
Dan Gohmanf4423b12008-04-19 00:24:39 +00004742 (yyval.ConstVal) = cast<GlobalValue>(V);
4743 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004744 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004745 ;}
4746 break;
4747
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004748 case 181:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004749#line 1820 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004750 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004751 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004752 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4753 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004754 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004755 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4756 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4757 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004758 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004759 ;}
4760 break;
4761
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004762 case 182:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004763#line 1830 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004764 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004765 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004766 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4767 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004768 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4769 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004770 (yyval.ConstVal) = Constant::getNullValue(Ty);
4771 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004772 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004776 case 183:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004777#line 1840 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 { // integral constants
4779 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004780 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004781 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004782 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004783 ;}
4784 break;
4785
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004786 case 184:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004787#line 1846 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004788 { // arbitrary precision integer constants
4789 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4790 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004791 GEN_ERROR("Constant value does not fit in type");
4792 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004793 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4794 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4795 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004796 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004797 ;}
4798 break;
4799
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004800 case 185:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004801#line 1856 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004802 { // integral constants
4803 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004804 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004805 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004806 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004807 ;}
4808 break;
4809
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004810 case 186:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004811#line 1862 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004812 { // arbitrary precision integer constants
4813 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4814 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004815 GEN_ERROR("Constant value does not fit in type");
4816 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004817 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4818 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4819 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004820 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004821 ;}
4822 break;
4823
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004824 case 187:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004825#line 1872 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004826 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004827 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4828 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004829 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004830 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004831 ;}
4832 break;
4833
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004834 case 188:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004835#line 1878 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004836 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004837 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4838 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004839 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004840 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004841 ;}
4842 break;
4843
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004844 case 189:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004845#line 1884 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004846 { // Floating point constants
4847 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004848 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004849 // Lexer has no type info, so builds all float and double FP constants
4850 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004851 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4852 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004853 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004854 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004855 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004856 ;}
4857 break;
4858
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004859 case 190:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004860#line 1897 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004861 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004862 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004863 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4864 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4865 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4866 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004867 GEN_ERROR("invalid cast opcode for cast from '" +
4868 Val->getType()->getDescription() + "' to '" +
4869 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004870 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4871 delete (yyvsp[(5) - (6)].TypeVal);
4872 ;}
4873 break;
4874
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004875 case 191:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004876#line 1909 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004877 {
4878 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004879 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004880
4881 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004882 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004883 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004884 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004885
Chris Lattnerf7469af2007-01-31 04:44:08 +00004886 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004887 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4888 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004889 IdxVec.push_back(C);
4890 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004891 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004892
Dan Gohmanf4423b12008-04-19 00:24:39 +00004893 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004894
Dan Gohmanf4423b12008-04-19 00:24:39 +00004895 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004896 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004897 ;}
4898 break;
4899
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004900 case 192:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004901#line 1930 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004902 {
4903 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004904 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004905 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004906 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004907 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004908 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004909 ;}
4910 break;
4911
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004912 case 193:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004913#line 1938 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004914 {
4915 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004916 GEN_ERROR("Binary operator types must match");
4917 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004918 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4919 ;}
4920 break;
4921
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004922 case 194:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004923#line 1944 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004924 {
4925 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004926 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004927 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004928 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00004929 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004930 GEN_ERROR("Logical operator requires integral operands");
4931 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004932 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004933 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004934 ;}
4935 break;
4936
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004937 case 195:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004938#line 1955 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004939 {
4940 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004941 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004942 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4943 ;}
4944 break;
4945
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004946 case 196:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004947#line 1960 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004948 {
4949 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004950 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004951 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4952 ;}
4953 break;
4954
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004955 case 197:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004956#line 1965 "/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004957 {
4958 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4959 GEN_ERROR("vicmp operand types must match");
4960 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4961 ;}
4962 break;
4963
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004964 case 198:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004965#line 1970 "/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004966 {
4967 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4968 GEN_ERROR("vfcmp operand types must match");
4969 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4970 ;}
4971 break;
4972
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004973 case 199:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004974#line 1975 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004975 {
4976 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004977 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004978 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004979 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004980 ;}
4981 break;
4982
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004983 case 200:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004984#line 1981 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004985 {
4986 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004987 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004988 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004989 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004990 ;}
4991 break;
4992
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004993 case 201:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004994#line 1987 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004995 {
4996 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004997 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004998 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004999 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005000 ;}
5001 break;
5002
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005003 case 202:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005004#line 1993 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005005 {
5006 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5007 GEN_ERROR("ExtractValue requires an aggregate operand");
5008
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005009 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5010 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005011 CHECK_FOR_ERROR
5012 ;}
5013 break;
5014
5015 case 203:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005016#line 2001 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005017 {
5018 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5019 GEN_ERROR("InsertValue requires an aggregate operand");
5020
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005021 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5022 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005023 CHECK_FOR_ERROR
5024 ;}
5025 break;
5026
5027 case 204:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005028#line 2012 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005029 {
5030 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005031 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005032 ;}
5033 break;
5034
Dan Gohmane4977cf2008-05-23 01:55:30 +00005035 case 205:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005036#line 2016 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005037 {
5038 (yyval.ConstVector) = new std::vector<Constant*>();
5039 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005040 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 ;}
5042 break;
5043
Nate Begemanac80ade2008-05-12 19:01:56 +00005044 case 206:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005045#line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005046 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005047 break;
5048
5049 case 207:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005050#line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005051 { (yyval.BoolVal) = true; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005052 break;
5053
5054 case 208:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005055#line 2027 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005056 { (yyval.BoolVal) = true; ;}
5057 break;
5058
5059 case 209:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005060#line 2027 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005061 { (yyval.BoolVal) = false; ;}
5062 break;
5063
5064 case 210:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005065#line 2030 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005066 {
5067 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5068 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005069 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005070 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5071 if (!Aliasee)
5072 GEN_ERROR("Aliases can be created only to global values");
5073
Dan Gohmanf4423b12008-04-19 00:24:39 +00005074 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005075 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005076 delete (yyvsp[(1) - (2)].TypeVal);
5077 ;}
5078 break;
5079
Dan Gohmane4977cf2008-05-23 01:55:30 +00005080 case 211:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005081#line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005082 {
5083 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5084 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5085 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005086 GEN_ERROR("invalid cast opcode for cast from '" +
5087 Val->getType()->getDescription() + "' to '" +
5088 DestTy->getDescription() + "'");
5089
Dan Gohmanf4423b12008-04-19 00:24:39 +00005090 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005091 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005092 delete (yyvsp[(5) - (6)].TypeVal);
5093 ;}
5094 break;
5095
Dan Gohmane4977cf2008-05-23 01:55:30 +00005096 case 212:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005097#line 2063 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005098 {
5099 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesen172f3112008-02-20 21:15:43 +00005100 CurModule.ModuleDone();
5101 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005102 ;}
5103 break;
5104
Dan Gohmane4977cf2008-05-23 01:55:30 +00005105 case 213:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005106#line 2068 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005107 {
5108 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5109 CurModule.ModuleDone();
5110 CHECK_FOR_ERROR;
5111 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00005112 break;
5113
Dan Gohmane4977cf2008-05-23 01:55:30 +00005114 case 216:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005115#line 2081 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005116 { CurFun.isDeclare = false; ;}
5117 break;
5118
Dan Gohmane4977cf2008-05-23 01:55:30 +00005119 case 217:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005120#line 2081 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005121 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005122 CurFun.FunctionDone();
5123 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005124 ;}
5125 break;
5126
Dan Gohmane4977cf2008-05-23 01:55:30 +00005127 case 218:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005128#line 2085 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005129 { CurFun.isDeclare = true; ;}
5130 break;
5131
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005132 case 219:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005133#line 2085 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005134 {
5135 CHECK_FOR_ERROR
5136 ;}
5137 break;
5138
5139 case 220:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005140#line 2088 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005141 {
5142 CHECK_FOR_ERROR
5143 ;}
5144 break;
5145
5146 case 221:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005147#line 2091 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005148 {
Reid Spencer14310612006-12-31 05:40:51 +00005149 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005150 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005151 // Eagerly resolve types. This is not an optimization, this is a
5152 // requirement that is due to the fact that we could have this:
5153 //
5154 // %list = type { %list * }
5155 // %list = type { %list * } ; repeated type decl
5156 //
5157 // If types are not resolved eagerly, then the two types will not be
5158 // determined to be the same type!
5159 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005160 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005161
Dan Gohmanf4423b12008-04-19 00:24:39 +00005162 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005163 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005164 // If this is a named type that is not a redefinition, add it to the slot
5165 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005166 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005167 }
Reid Spencera132e042006-12-03 05:46:11 +00005168
Dan Gohmanf4423b12008-04-19 00:24:39 +00005169 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005170 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005171 ;}
5172 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005173
Dan Gohmane4977cf2008-05-23 01:55:30 +00005174 case 222:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005175#line 2115 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005176 {
5177 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5178
5179 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005180 CHECK_FOR_ERROR
5181 // If this is a named type that is not a redefinition, add it to the slot
5182 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005183 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005184 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005185 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005186 ;}
5187 break;
5188
Dan Gohmane4977cf2008-05-23 01:55:30 +00005189 case 223:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005190#line 2127 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005191 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005192 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005193 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005194 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005195 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5196 (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));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005197 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005198 ;}
5199 break;
5200
Dan Gohmane4977cf2008-05-23 01:55:30 +00005201 case 224:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005202#line 2134 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005203 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005204 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005205 ;}
5206 break;
5207
Dan Gohmane4977cf2008-05-23 01:55:30 +00005208 case 225:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005209#line 2138 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005210 {
5211 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005212 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005213 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 Lambbf3348d2007-12-12 08:45:45 +00005214 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005215 ;}
5216 break;
5217
Dan Gohmane4977cf2008-05-23 01:55:30 +00005218 case 226:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005219#line 2143 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005220 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005221 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005222 ;}
5223 break;
5224
Dan Gohmane4977cf2008-05-23 01:55:30 +00005225 case 227:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005226#line 2147 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005227 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005228 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005229 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5230 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 Lambbf3348d2007-12-12 08:45:45 +00005231 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005232 delete (yyvsp[(6) - (7)].TypeVal);
5233 ;}
5234 break;
5235
Dan Gohmane4977cf2008-05-23 01:55:30 +00005236 case 228:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005237#line 2153 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005238 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005239 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005240 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005241 ;}
5242 break;
5243
Dan Gohmane4977cf2008-05-23 01:55:30 +00005244 case 229:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005245#line 2157 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005246 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005247 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005248 if ((yyvsp[(1) - (5)].StrVal)) {
5249 Name = *(yyvsp[(1) - (5)].StrVal);
5250 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005251 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005252 if (Name.empty())
5253 GEN_ERROR("Alias name cannot be empty");
5254
Dan Gohmanf4423b12008-04-19 00:24:39 +00005255 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005256 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005257 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005258
Dan Gohmanf4423b12008-04-19 00:24:39 +00005259 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005260 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005261 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005262 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005263
5264
5265 // If there was a forward reference of this alias, resolve it now.
5266
5267 ValID ID;
5268 if (!Name.empty())
5269 ID = ValID::createGlobalName(Name);
5270 else
5271 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5272
5273 if (GlobalValue *FWGV =
5274 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5275 // Replace uses of the fwdref with the actual alias.
5276 FWGV->replaceAllUsesWith(GA);
5277 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5278 GV->eraseFromParent();
5279 else
5280 cast<Function>(FWGV)->eraseFromParent();
5281 }
5282 ID.destroy();
5283
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005284 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005285 ;}
5286 break;
5287
Dan Gohmane4977cf2008-05-23 01:55:30 +00005288 case 230:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005289#line 2197 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005290 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005291 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005292 ;}
5293 break;
5294
Dan Gohmane4977cf2008-05-23 01:55:30 +00005295 case 231:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005296#line 2200 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005297 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005298 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005299 ;}
5300 break;
5301
Dan Gohmane4977cf2008-05-23 01:55:30 +00005302 case 232:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005303#line 2206 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005304 {
Chris Lattner66316012006-01-24 04:14:29 +00005305 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005306 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005307 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005308 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005309 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5310 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005311 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005312;}
5313 break;
5314
Dan Gohmane4977cf2008-05-23 01:55:30 +00005315 case 233:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005316#line 2216 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005317 {
5318 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5319 delete (yyvsp[(3) - (3)].StrVal);
5320 ;}
5321 break;
5322
Dan Gohmane4977cf2008-05-23 01:55:30 +00005323 case 234:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005324#line 2220 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005325 {
5326 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5327 delete (yyvsp[(3) - (3)].StrVal);
5328 ;}
5329 break;
5330
Dan Gohmane4977cf2008-05-23 01:55:30 +00005331 case 236:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005332#line 2227 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005333 {
5334 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5335 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005336 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005337 ;}
5338 break;
5339
Dan Gohmane4977cf2008-05-23 01:55:30 +00005340 case 237:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005341#line 2232 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005342 {
5343 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5344 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005345 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005346 ;}
5347 break;
5348
Dan Gohmane4977cf2008-05-23 01:55:30 +00005349 case 238:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005350#line 2237 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005351 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005352 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005353 ;}
5354 break;
5355
Dan Gohmane4977cf2008-05-23 01:55:30 +00005356 case 239:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005357#line 2246 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005358 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005359 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005360 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005361 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5362 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005363 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5364 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5365 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005366 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005367 ;}
5368 break;
5369
Dan Gohmane4977cf2008-05-23 01:55:30 +00005370 case 240:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005371#line 2256 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005372 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005373 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005374 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005375 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5376 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005377 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5378 (yyval.ArgList) = new ArgListType;
5379 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005380 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005381 ;}
5382 break;
5383
Dan Gohmane4977cf2008-05-23 01:55:30 +00005384 case 241:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005385#line 2267 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005386 {
5387 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005388 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 ;}
5390 break;
5391
Dan Gohmane4977cf2008-05-23 01:55:30 +00005392 case 242:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005393#line 2271 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005394 {
5395 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005396 struct ArgListEntry E;
5397 E.Ty = new PATypeHolder(Type::VoidTy);
5398 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005399 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005400 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005401 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005402 ;}
5403 break;
5404
Dan Gohmane4977cf2008-05-23 01:55:30 +00005405 case 243:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005406#line 2280 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005407 {
5408 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005409 struct ArgListEntry E;
5410 E.Ty = new PATypeHolder(Type::VoidTy);
5411 E.Name = 0;
5412 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005413 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005414 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005415 ;}
5416 break;
5417
Dan Gohmane4977cf2008-05-23 01:55:30 +00005418 case 244:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005419#line 2289 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005420 {
5421 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005422 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005423 ;}
5424 break;
5425
Dan Gohmane4977cf2008-05-23 01:55:30 +00005426 case 245:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005427#line 2295 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005428 {
5429 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5430 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005431
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005432 // Check the function result for abstractness if this is a define. We should
5433 // have no abstract types at this point
Dan Gohmanf4423b12008-04-19 00:24:39 +00005434 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5435 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005436
Chris Lattnera925a142008-04-23 05:37:08 +00005437 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5438 GEN_ERROR("Invalid result type for LLVM function");
5439
Reid Spencer68a24bd2005-08-27 18:50:39 +00005440 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005441 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005442 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5443 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5444 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005445 unsigned index = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005446 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005447 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005448 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5449 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005450 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005451 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5452 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005453 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005454 }
5455
5456 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5457 if (isVarArg) ParamTypeList.pop_back();
5458
Chris Lattner58d74912008-03-12 17:45:29 +00005459 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005460 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005461 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005462
Dan Gohmanf4423b12008-04-19 00:24:39 +00005463 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005464 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005465 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005466
5467 ValID ID;
5468 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005469 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005470 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005471 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005472 }
5473
5474 Function *Fn = 0;
5475 // See if this function was forward referenced. If so, recycle the object.
5476 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5477 // Move the function to the end of the list, from whereever it was
5478 // previously inserted.
5479 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005480 assert(Fn->getParamAttrs().isEmpty() &&
5481 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005482 CurModule.CurrentModule->getFunctionList().remove(Fn);
5483 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5484 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005485 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005486 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005487 // The existing function doesn't have the same type. This is an overload
5488 // error.
5489 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005490 } else if (Fn->getParamAttrs() != PAL) {
5491 // The existing function doesn't have the same parameter attributes.
5492 // This is an overload error.
5493 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005494 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005495 // Neither the existing or the current function is a declaration and they
5496 // have the same name and same type. Clearly this is a redefinition.
5497 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005498 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005499 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005500 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5501 AI != AE; ++AI)
5502 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005503 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005504 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005505 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5506 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005507 InsertValue(Fn, CurModule.Values);
5508 }
5509
5510 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005511
5512 if (CurFun.isDeclare) {
5513 // If we have declaration, always overwrite linkage. This will allow us to
5514 // correctly handle cases, when pointer to function is passed as argument to
5515 // another function.
5516 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005517 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005518 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005519 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005520 Fn->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005521 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5522 if ((yyvsp[(8) - (10)].StrVal)) {
5523 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5524 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005525 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005526 if ((yyvsp[(10) - (10)].StrVal)) {
5527 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5528 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005529 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005530
5531 // Add all of the arguments we parsed to the function...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005532 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005533 if (isVarArg) { // Nuke the last entry
Dan Gohmanf4423b12008-04-19 00:24:39 +00005534 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005535 "Not a varargs marker!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005536 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5537 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005538 }
5539 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005540 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005541 unsigned Idx = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005542 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5543 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005544 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005545 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005546 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005547 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005548 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005549 }
Reid Spencera132e042006-12-03 05:46:11 +00005550
Dan Gohmanf4423b12008-04-19 00:24:39 +00005551 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005552 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005553 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005554;}
5555 break;
5556
Dan Gohmane4977cf2008-05-23 01:55:30 +00005557 case 248:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005558#line 2425 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005559 {
5560 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005561
5562 // Make sure that we keep track of the linkage type even if there was a
5563 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005564 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5565 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5566;}
5567 break;
5568
Dan Gohmane4977cf2008-05-23 01:55:30 +00005569 case 251:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005570#line 2436 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005571 {
5572 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005573 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005574;}
5575 break;
5576
Dan Gohmane4977cf2008-05-23 01:55:30 +00005577 case 252:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005578#line 2441 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005579 {
5580 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5581 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5582 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005583 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005584 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005585 ;}
5586 break;
5587
Dan Gohmane4977cf2008-05-23 01:55:30 +00005588 case 253:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005589#line 2453 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005590 {
5591 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005592 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005593 ;}
5594 break;
5595
Dan Gohmane4977cf2008-05-23 01:55:30 +00005596 case 254:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005597#line 2457 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005598 {
5599 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005600 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005601 ;}
5602 break;
5603
Dan Gohmane4977cf2008-05-23 01:55:30 +00005604 case 255:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005605#line 2462 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005606 { // A reference to a direct constant
5607 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005608 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005609 ;}
5610 break;
5611
Dan Gohmane4977cf2008-05-23 01:55:30 +00005612 case 256:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005613#line 2466 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005614 {
5615 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005616 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005617 ;}
5618 break;
5619
Dan Gohmane4977cf2008-05-23 01:55:30 +00005620 case 257:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005621#line 2470 "/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005622 { // arbitrary precision integer constants
5623 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5624 delete (yyvsp[(1) - (1)].APIntVal);
5625 CHECK_FOR_ERROR
5626 ;}
5627 break;
5628
5629 case 258:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005630#line 2475 "/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005631 { // arbitrary precision integer constants
5632 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5633 delete (yyvsp[(1) - (1)].APIntVal);
5634 CHECK_FOR_ERROR
5635 ;}
5636 break;
5637
5638 case 259:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005639#line 2480 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005640 { // Perhaps it's an FP constant?
5641 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005642 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005643 ;}
5644 break;
5645
Chris Lattner1913b942008-07-11 00:30:39 +00005646 case 260:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005647#line 2484 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005648 {
5649 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005650 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005651 ;}
5652 break;
5653
Chris Lattner1913b942008-07-11 00:30:39 +00005654 case 261:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005655#line 2488 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005656 {
5657 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005658 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005659 ;}
5660 break;
5661
Chris Lattner1913b942008-07-11 00:30:39 +00005662 case 262:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005663#line 2492 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005664 {
5665 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005666 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005667 ;}
5668 break;
5669
Chris Lattner1913b942008-07-11 00:30:39 +00005670 case 263:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005671#line 2496 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005672 {
5673 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005674 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005675 ;}
5676 break;
5677
Chris Lattner1913b942008-07-11 00:30:39 +00005678 case 264:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005679#line 2500 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005680 { // A vector zero constant.
5681 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005682 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005683 ;}
5684 break;
5685
Chris Lattner1913b942008-07-11 00:30:39 +00005686 case 265:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005687#line 2504 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005688 { // Nonempty unsized packed vector
5689 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005690 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005691
5692 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5693 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005694
Reid Spencer9d6565a2007-02-15 02:26:10 +00005695 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005696 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005697
5698 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005699 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5700 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005701 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005702 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005703 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005704 }
5705
Dan Gohmanf4423b12008-04-19 00:24:39 +00005706 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5707 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005708 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005709 ;}
5710 break;
5711
Chris Lattner1913b942008-07-11 00:30:39 +00005712 case 266:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005713#line 2526 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005714 { // Nonempty unsized arr
5715 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005716 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005717
5718 if (!ETy->isFirstClassType())
5719 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5720
5721 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5722 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5723
5724 // Verify all elements are correct type!
5725 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5726 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5727 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5728 ETy->getDescription() +"' as required!\nIt is of type '"+
5729 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5730 }
5731
5732 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5733 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5734 CHECK_FOR_ERROR
5735 ;}
5736 break;
5737
Chris Lattner1913b942008-07-11 00:30:39 +00005738 case 267:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005739#line 2548 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005740 {
Dan Gohman180c1692008-06-23 18:43:26 +00005741 // Use undef instead of an array because it's inconvenient to determine
5742 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005743 (yyval.ValIDVal) = ValID::createUndef();
5744 CHECK_FOR_ERROR
5745 ;}
5746 break;
5747
Chris Lattner1913b942008-07-11 00:30:39 +00005748 case 268:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005749#line 2554 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005750 {
Dan Gohman180c1692008-06-23 18:43:26 +00005751 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005752 const Type *ETy = Type::Int8Ty;
5753
5754 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5755
5756 std::vector<Constant*> Vals;
5757 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5758 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5759 delete (yyvsp[(2) - (2)].StrVal);
5760 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5761 CHECK_FOR_ERROR
5762 ;}
5763 break;
5764
Chris Lattner1913b942008-07-11 00:30:39 +00005765 case 269:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005766#line 2567 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005767 {
5768 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5769 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5770 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5771
5772 const StructType *STy = StructType::get(Elements);
5773 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5774
5775 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5776 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5777 CHECK_FOR_ERROR
5778 ;}
5779 break;
5780
Chris Lattner1913b942008-07-11 00:30:39 +00005781 case 270:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005782#line 2579 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005783 {
5784 const StructType *STy = StructType::get(std::vector<const Type*>());
5785 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5786 CHECK_FOR_ERROR
5787 ;}
5788 break;
5789
Chris Lattner1913b942008-07-11 00:30:39 +00005790 case 271:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005791#line 2584 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005792 {
5793 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5794 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5795 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5796
5797 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5798 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5799
5800 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5801 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5802 CHECK_FOR_ERROR
5803 ;}
5804 break;
5805
Chris Lattner1913b942008-07-11 00:30:39 +00005806 case 272:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005807#line 2596 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005808 {
5809 const StructType *STy = StructType::get(std::vector<const Type*>(),
5810 /*isPacked=*/true);
5811 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5812 CHECK_FOR_ERROR
5813 ;}
5814 break;
5815
Chris Lattner1913b942008-07-11 00:30:39 +00005816 case 273:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005817#line 2602 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005818 {
5819 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005820 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005821 ;}
5822 break;
5823
Chris Lattner1913b942008-07-11 00:30:39 +00005824 case 274:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005825#line 2606 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005826 {
5827 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5828 delete (yyvsp[(3) - (5)].StrVal);
5829 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005830 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005831 ;}
5832 break;
5833
Chris Lattner1913b942008-07-11 00:30:39 +00005834 case 275:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005835#line 2616 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005836 { // Is it an integer reference...?
5837 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005838 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005839 ;}
5840 break;
5841
Chris Lattner1913b942008-07-11 00:30:39 +00005842 case 276:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005843#line 2620 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005844 {
5845 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005846 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005847 ;}
5848 break;
5849
Chris Lattner1913b942008-07-11 00:30:39 +00005850 case 277:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005851#line 2624 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005852 { // Is it a named reference...?
5853 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5854 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005855 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005856 ;}
5857 break;
5858
Chris Lattner1913b942008-07-11 00:30:39 +00005859 case 278:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005860#line 2629 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005861 { // Is it a named reference...?
5862 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5863 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005864 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005865 ;}
5866 break;
5867
Chris Lattner1913b942008-07-11 00:30:39 +00005868 case 281:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005869#line 2642 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005870 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005871 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005872 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5873 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5874 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005875 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005876 ;}
5877 break;
5878
Chris Lattner1913b942008-07-11 00:30:39 +00005879 case 282:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005880#line 2651 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005881 {
5882 (yyval.ValueList) = new std::vector<Value *>();
5883 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005884 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005885 ;}
5886 break;
5887
Chris Lattner1913b942008-07-11 00:30:39 +00005888 case 283:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005889#line 2656 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005890 {
5891 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005892 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005893 ;}
5894 break;
5895
Chris Lattner1913b942008-07-11 00:30:39 +00005896 case 284:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005897#line 2661 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005898 {
5899 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005900 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005901 ;}
5902 break;
5903
Chris Lattner1913b942008-07-11 00:30:39 +00005904 case 285:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005905#line 2665 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005906 { // Do not allow functions with 0 basic blocks
5907 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005908 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005909 ;}
5910 break;
5911
Chris Lattner1913b942008-07-11 00:30:39 +00005912 case 286:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005913#line 2674 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005914 {
5915 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005916 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005917 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5918 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5919 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005920 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005921 ;}
5922 break;
5923
Chris Lattner1913b942008-07-11 00:30:39 +00005924 case 287:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005925#line 2683 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005926 {
5927 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005928 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5929 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00005930 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5931 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5932 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005933 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005934 ;}
5935 break;
Chris Lattner38905612008-02-19 04:36:25 +00005936
Chris Lattner1913b942008-07-11 00:30:39 +00005937 case 288:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005938#line 2692 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005939 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00005940 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00005941 CHECK_FOR_ERROR
5942 ;}
5943 break;
5944
Chris Lattner1913b942008-07-11 00:30:39 +00005945 case 289:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005946#line 2696 "/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00005947 { // Labelled (named) basic block
5948 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5949 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005950 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00005951
Dan Gohmanf4423b12008-04-19 00:24:39 +00005952 ;}
5953 break;
5954
Chris Lattner1913b942008-07-11 00:30:39 +00005955 case 290:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005956#line 2704 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005957 { // Return with a result...
5958 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5959 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00005960 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
5961 if (VL.size() > 1 ||
5962 (isa<StructType>(ReturnType) &&
5963 (VL.empty() || VL[0]->getType() != ReturnType))) {
5964 Value *RV = UndefValue::get(ReturnType);
5965 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
5966 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
5967 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
5968 RV = I;
5969 }
5970 (yyval.TermInstVal) = ReturnInst::Create(RV);
5971 } else {
5972 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
5973 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005974 delete (yyvsp[(2) - (2)].ValueList);
5975 CHECK_FOR_ERROR
5976 ;}
5977 break;
5978
Chris Lattner1913b942008-07-11 00:30:39 +00005979 case 291:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005980#line 2724 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005981 { // Return with no result...
5982 (yyval.TermInstVal) = ReturnInst::Create();
5983 CHECK_FOR_ERROR
5984 ;}
5985 break;
5986
Chris Lattner1913b942008-07-11 00:30:39 +00005987 case 292:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005988#line 2728 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005989 { // Unconditional Branch...
5990 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5991 CHECK_FOR_ERROR
5992 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5993 ;}
5994 break;
5995
Chris Lattner1913b942008-07-11 00:30:39 +00005996 case 293:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005997#line 2733 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005998 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005999 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6000 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006001 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6002 CHECK_FOR_ERROR
6003 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6004 CHECK_FOR_ERROR
6005 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6006 CHECK_FOR_ERROR
6007 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6008 ;}
6009 break;
6010
Chris Lattner1913b942008-07-11 00:30:39 +00006011 case 294:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006012#line 2744 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006013 {
6014 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6015 CHECK_FOR_ERROR
6016 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6017 CHECK_FOR_ERROR
6018 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6019 (yyval.TermInstVal) = S;
6020
6021 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6022 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006023 for (; I != E; ++I) {
6024 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6025 S->addCase(CI, I->second);
6026 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006027 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006028 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006029 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006030 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006031 ;}
6032 break;
6033
Chris Lattner1913b942008-07-11 00:30:39 +00006034 case 295:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006035#line 2763 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006036 {
6037 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006038 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006039 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006040 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006041 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006042 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006043 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006044 ;}
6045 break;
6046
Chris Lattner1913b942008-07-11 00:30:39 +00006047 case 296:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006048#line 2773 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006049 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006050
Reid Spencer14310612006-12-31 05:40:51 +00006051 // Handle the short syntax
6052 const PointerType *PFTy = 0;
6053 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006054 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006055 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6056 // Pull out the types of all of the arguments...
6057 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006058 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006059 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006060 const Type *Ty = I->Val->getType();
6061 if (Ty == Type::VoidTy)
6062 GEN_ERROR("Short call syntax cannot be used with varargs");
6063 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006064 }
Chris Lattnera925a142008-04-23 05:37:08 +00006065
6066 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6067 GEN_ERROR("Invalid result type for LLVM function");
6068
Dan Gohmanf4423b12008-04-19 00:24:39 +00006069 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006070 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006071 }
6072
Dan Gohmanf4423b12008-04-19 00:24:39 +00006073 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006074
Dan Gohmanf4423b12008-04-19 00:24:39 +00006075 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006076 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006077 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006078 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006079 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006080 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006081
Chris Lattner58d74912008-03-12 17:45:29 +00006082 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006083 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6084 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006085
Reid Spencer14310612006-12-31 05:40:51 +00006086 // Check the arguments
6087 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006088 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006089 // Make sure no arguments is a good thing!
6090 if (Ty->getNumParams() != 0)
6091 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006092 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006093 } else { // Has arguments?
6094 // Loop through FunctionType's arguments and ensure they are specified
6095 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006096 FunctionType::param_iterator I = Ty->param_begin();
6097 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006098 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006099 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006100
Duncan Sandsdc024672007-11-27 13:23:08 +00006101 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006102 if (ArgI->Val->getType() != *I)
6103 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006104 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006105 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006106 if (ArgI->Attrs != ParamAttr::None)
6107 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006108 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006109
Reid Spencer14310612006-12-31 05:40:51 +00006110 if (Ty->isVarArg()) {
6111 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006112 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006113 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006114 if (ArgI->Attrs != ParamAttr::None)
6115 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006116 }
Reid Spencer14310612006-12-31 05:40:51 +00006117 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006118 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006119 }
Reid Spencer14310612006-12-31 05:40:51 +00006120
Chris Lattner58d74912008-03-12 17:45:29 +00006121 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006122 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006123 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006124
Reid Spencer14310612006-12-31 05:40:51 +00006125 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006126 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6127 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006128 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006129 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006130 (yyval.TermInstVal) = II;
6131 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006132 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006133 ;}
6134 break;
6135
Chris Lattner1913b942008-07-11 00:30:39 +00006136 case 297:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006137#line 2858 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006138 {
6139 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006140 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006141 ;}
6142 break;
6143
Chris Lattner1913b942008-07-11 00:30:39 +00006144 case 298:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006145#line 2862 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006146 {
6147 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006148 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006149 ;}
6150 break;
6151
Chris Lattner1913b942008-07-11 00:30:39 +00006152 case 299:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006153#line 2869 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006154 {
6155 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6156 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006157 CHECK_FOR_ERROR
6158 if (V == 0)
6159 GEN_ERROR("May only switch on a constant pool value");
6160
Dan Gohmanf4423b12008-04-19 00:24:39 +00006161 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006162 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006163 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6164 ;}
6165 break;
6166
Chris Lattner1913b942008-07-11 00:30:39 +00006167 case 300:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006168#line 2880 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006169 {
6170 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6171 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006172 CHECK_FOR_ERROR
6173
6174 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006175 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006176
Dan Gohmanf4423b12008-04-19 00:24:39 +00006177 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006178 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006179 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6180 ;}
6181 break;
6182
Chris Lattner1913b942008-07-11 00:30:39 +00006183 case 301:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006184#line 2893 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006185 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006186 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006187 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006188 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006189 InsertValue((yyvsp[(2) - (2)].InstVal));
6190 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006191 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006192 ;}
6193 break;
6194
Chris Lattner1913b942008-07-11 00:30:39 +00006195 case 302:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006196#line 2903 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006197 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006198 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006199 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6200 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6201 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006202 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006203 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006204 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006205 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6206 delete (yyvsp[(1) - (6)].TypeVal);
6207 ;}
6208 break;
6209
Chris Lattner1913b942008-07-11 00:30:39 +00006210 case 303:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006211#line 2914 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006212 {
6213 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6214 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006215 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006216 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006217 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006218 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6219 ;}
6220 break;
6221
Chris Lattner1913b942008-07-11 00:30:39 +00006222 case 304:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006223#line 2924 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006224 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006225 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006226 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006227 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006228 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006229 (yyval.ParamList) = new ParamList();
6230 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6231 (yyval.ParamList)->push_back(E);
6232 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006233 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006234 ;}
6235 break;
6236
Chris Lattner1913b942008-07-11 00:30:39 +00006237 case 305:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006238#line 2935 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006239 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006240 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006241 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006242 (yyval.ParamList) = new ParamList();
6243 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6244 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006245 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006246 ;}
6247 break;
6248
Chris Lattner1913b942008-07-11 00:30:39 +00006249 case 306:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006250#line 2943 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006251 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006252 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006253 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006254 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6255 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6256 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6257 (yyval.ParamList)->push_back(E);
6258 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006259 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006260 ;}
6261 break;
6262
Chris Lattner1913b942008-07-11 00:30:39 +00006263 case 307:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006264#line 2953 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006265 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006266 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006267 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6268 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6269 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006270 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006271 ;}
6272 break;
6273
Chris Lattner1913b942008-07-11 00:30:39 +00006274 case 308:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006275#line 2960 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006276 { (yyval.ParamList) = new ParamList(); ;}
6277 break;
6278
Chris Lattner1913b942008-07-11 00:30:39 +00006279 case 309:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006280#line 2963 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006281 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6282 break;
6283
Chris Lattner1913b942008-07-11 00:30:39 +00006284 case 310:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006285#line 2964 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006286 {
6287 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6288 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006289 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006290 ;}
6291 break;
6292
Chris Lattner1913b942008-07-11 00:30:39 +00006293 case 311:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006294#line 2972 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006295 {
6296 (yyval.ConstantList) = new std::vector<unsigned>();
6297 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6298 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6299 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6300 ;}
6301 break;
6302
Chris Lattner1913b942008-07-11 00:30:39 +00006303 case 312:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006304#line 2978 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006305 {
6306 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6307 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6308 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6309 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6310 CHECK_FOR_ERROR
6311 ;}
6312 break;
6313
Chris Lattner1913b942008-07-11 00:30:39 +00006314 case 313:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006315#line 2987 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006316 {
6317 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006318 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006319 ;}
6320 break;
6321
Chris Lattner1913b942008-07-11 00:30:39 +00006322 case 314:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006323#line 2991 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006324 {
6325 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006326 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006327 ;}
6328 break;
6329
Chris Lattner1913b942008-07-11 00:30:39 +00006330 case 315:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006331#line 2996 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006332 {
Reid Spencer14310612006-12-31 05:40:51 +00006333 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006334 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6335 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6336 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006337 GEN_ERROR(
6338 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006339 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006340 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006341 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006342 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006343 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006344 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006345 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006346 delete (yyvsp[(2) - (5)].TypeVal);
6347 ;}
6348 break;
6349
Chris Lattner1913b942008-07-11 00:30:39 +00006350 case 316:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006351#line 3012 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006352 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006353 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006354 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6355 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006356 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006357 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006358 GEN_ERROR("Logical operator requires integral operands");
6359 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006360 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006361 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006362 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006363 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006364 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006365 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006366 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006367 delete (yyvsp[(2) - (5)].TypeVal);
6368 ;}
6369 break;
6370
Chris Lattner1913b942008-07-11 00:30:39 +00006371 case 317:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006372#line 3029 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006373 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006374 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006375 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6376 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006377 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006378 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006379 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006380 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006381 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006382 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006383 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006384 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 delete (yyvsp[(3) - (6)].TypeVal);
6386 ;}
6387 break;
6388
Chris Lattner1913b942008-07-11 00:30:39 +00006389 case 318:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006390#line 3043 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006391 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006392 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006393 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6394 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006395 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006396 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006397 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006398 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006399 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006400 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006401 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006402 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006403 delete (yyvsp[(3) - (6)].TypeVal);
6404 ;}
6405 break;
6406
Chris Lattner1913b942008-07-11 00:30:39 +00006407 case 319:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006408#line 3057 "/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006409 {
6410 if (!UpRefs.empty())
6411 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6412 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6413 GEN_ERROR("Scalar types not supported by vicmp instruction");
6414 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6415 CHECK_FOR_ERROR
6416 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6417 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006418 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006419 if ((yyval.InstVal) == 0)
6420 GEN_ERROR("icmp operator returned null");
6421 delete (yyvsp[(3) - (6)].TypeVal);
6422 ;}
6423 break;
6424
Chris Lattner1913b942008-07-11 00:30:39 +00006425 case 320:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006426#line 3071 "/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006427 {
6428 if (!UpRefs.empty())
6429 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6430 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6431 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6432 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6433 CHECK_FOR_ERROR
6434 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6435 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006436 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006437 if ((yyval.InstVal) == 0)
6438 GEN_ERROR("fcmp operator returned null");
6439 delete (yyvsp[(3) - (6)].TypeVal);
6440 ;}
6441 break;
6442
Chris Lattner1913b942008-07-11 00:30:39 +00006443 case 321:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006444#line 3085 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006445 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006446 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6448 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6449 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6450 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006451 GEN_ERROR("invalid cast opcode for cast from '" +
6452 Val->getType()->getDescription() + "' to '" +
6453 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006454 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006455 delete (yyvsp[(4) - (4)].TypeVal);
6456 ;}
6457 break;
6458
Chris Lattner1913b942008-07-11 00:30:39 +00006459 case 322:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006460#line 3097 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006461 {
6462 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006463 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006464 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006465 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006466 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006467 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006468 ;}
6469 break;
6470
Chris Lattner1913b942008-07-11 00:30:39 +00006471 case 323:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006472#line 3105 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006473 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006474 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006475 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6476 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6477 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006478 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006479 ;}
6480 break;
6481
Chris Lattner1913b942008-07-11 00:30:39 +00006482 case 324:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006483#line 3112 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006484 {
6485 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006486 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006487 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006488 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006489 ;}
6490 break;
6491
Chris Lattner1913b942008-07-11 00:30:39 +00006492 case 325:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006493#line 3118 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006494 {
6495 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006496 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006497 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006498 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006499 ;}
6500 break;
6501
Chris Lattner1913b942008-07-11 00:30:39 +00006502 case 326:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006503#line 3124 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006504 {
6505 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006506 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006507 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006508 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006509 ;}
6510 break;
6511
Chris Lattner1913b942008-07-11 00:30:39 +00006512 case 327:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006513#line 3130 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006514 {
6515 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006516 if (!Ty->isFirstClassType())
6517 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006518 (yyval.InstVal) = PHINode::Create(Ty);
6519 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6520 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6521 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006522 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006523 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6524 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006525 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006526 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006527 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006528 ;}
6529 break;
6530
Chris Lattner1913b942008-07-11 00:30:39 +00006531 case 328:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006532#line 3146 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006533 {
Reid Spencer14310612006-12-31 05:40:51 +00006534
6535 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006536 const PointerType *PFTy = 0;
6537 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006538 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006539 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6540 // Pull out the types of all of the arguments...
6541 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006542 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006543 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006544 const Type *Ty = I->Val->getType();
6545 if (Ty == Type::VoidTy)
6546 GEN_ERROR("Short call syntax cannot be used with varargs");
6547 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006548 }
Chris Lattnera925a142008-04-23 05:37:08 +00006549
6550 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6551 GEN_ERROR("Invalid result type for LLVM function");
6552
Dan Gohmanf4423b12008-04-19 00:24:39 +00006553 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006554 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006555 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006556
Dan Gohmanf4423b12008-04-19 00:24:39 +00006557 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006558 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006559
Reid Spencer7780acb2007-04-16 06:56:07 +00006560 // Check for call to invalid intrinsic to avoid crashing later.
6561 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006562 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006563 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6564 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006565 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6566 theF->getName() + "'");
6567 }
6568
Duncan Sandsdc024672007-11-27 13:23:08 +00006569 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006570 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006571 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6572 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006573 // Check the arguments
6574 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006575 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006576 // Make sure no arguments is a good thing!
6577 if (Ty->getNumParams() != 0)
6578 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006579 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006580 } else { // Has arguments?
6581 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006582 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006583 FunctionType::param_iterator I = Ty->param_begin();
6584 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006585 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006586 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006587
Duncan Sandsdc024672007-11-27 13:23:08 +00006588 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006589 if (ArgI->Val->getType() != *I)
6590 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006591 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006592 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006593 if (ArgI->Attrs != ParamAttr::None)
6594 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006595 }
6596 if (Ty->isVarArg()) {
6597 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006598 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006599 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006600 if (ArgI->Attrs != ParamAttr::None)
6601 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006602 }
Reid Spencer14310612006-12-31 05:40:51 +00006603 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006604 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006605 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006606
6607 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006608 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006609 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006610 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006611
Reid Spencer14310612006-12-31 05:40:51 +00006612 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006613 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006614 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6615 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006616 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006617 (yyval.InstVal) = CI;
6618 delete (yyvsp[(6) - (8)].ParamList);
6619 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006620 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006621 ;}
6622 break;
6623
Chris Lattner1913b942008-07-11 00:30:39 +00006624 case 329:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006625#line 3235 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006626 {
6627 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006628 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006629 ;}
6630 break;
6631
Chris Lattner1913b942008-07-11 00:30:39 +00006632 case 330:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006633#line 3240 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006634 {
6635 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006636 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006637 ;}
6638 break;
6639
Chris Lattner1913b942008-07-11 00:30:39 +00006640 case 331:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006641#line 3244 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006642 {
6643 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006644 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006645 ;}
6646 break;
6647
Chris Lattner1913b942008-07-11 00:30:39 +00006648 case 332:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006649#line 3251 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006650 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006651 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006652 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6653 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6654 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006655 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006656 ;}
6657 break;
6658
Chris Lattner1913b942008-07-11 00:30:39 +00006659 case 333:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006660#line 3258 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006661 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006662 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006663 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006664 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6665 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006666 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006667 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006668 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6669 delete (yyvsp[(2) - (6)].TypeVal);
6670 ;}
6671 break;
6672
Chris Lattner1913b942008-07-11 00:30:39 +00006673 case 334:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006674#line 3268 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006675 {
Reid Spencer14310612006-12-31 05:40:51 +00006676 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006677 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6678 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6679 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006680 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006681 ;}
6682 break;
6683
Chris Lattner1913b942008-07-11 00:30:39 +00006684 case 335:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006685#line 3275 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006686 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006687 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006688 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006689 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6690 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006691 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006692 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006693 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6694 delete (yyvsp[(2) - (6)].TypeVal);
6695 ;}
6696 break;
6697
Chris Lattner1913b942008-07-11 00:30:39 +00006698 case 336:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006699#line 3285 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006700 {
6701 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006702 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006703 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6704 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006705 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006706 ;}
6707 break;
6708
Chris Lattner1913b942008-07-11 00:30:39 +00006709 case 337:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006710#line 3293 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006711 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006712 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006713 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6714 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006715 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006716 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6717 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006718 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006719 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6720 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006721 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006722 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6723 delete (yyvsp[(3) - (5)].TypeVal);
6724 ;}
6725 break;
6726
Chris Lattner1913b942008-07-11 00:30:39 +00006727 case 338:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006728#line 3307 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006729 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006730 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006731 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6732 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006733 if (!PT)
6734 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006735 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006736 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006737 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6738 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006739 "' into space of type '" + ElTy->getDescription() + "'");
6740
Dan Gohmanf4423b12008-04-19 00:24:39 +00006741 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006742 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006743 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6744 delete (yyvsp[(5) - (7)].TypeVal);
6745 ;}
6746 break;
6747
Chris Lattner1913b942008-07-11 00:30:39 +00006748 case 339:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006749#line 3324 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006750 {
Dan Gohman1a570242008-07-23 00:54:54 +00006751 if (!UpRefs.empty())
6752 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6753 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6754 GEN_ERROR("getresult insn requires an aggregate operand");
6755 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6756 GEN_ERROR("Invalid getresult index for type '" +
6757 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6758
6759 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00006760 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00006761 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6762 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006763 ;}
6764 break;
6765
Chris Lattner1913b942008-07-11 00:30:39 +00006766 case 340:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006767#line 3338 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006768 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006769 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006770 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6771 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006772 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006773
Dan Gohman041e2eb2008-05-15 19:50:34 +00006774 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006775 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006776 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6777 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006778 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006779 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6780 delete (yyvsp[(2) - (4)].TypeVal);
6781 delete (yyvsp[(4) - (4)].ValueList);
6782 ;}
6783 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006784
Chris Lattner1913b942008-07-11 00:30:39 +00006785 case 341:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006786#line 3353 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006787 {
6788 if (!UpRefs.empty())
6789 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6790 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6791 GEN_ERROR("extractvalue insn requires an aggregate operand");
6792
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006793 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00006794 GEN_ERROR("Invalid extractvalue indices for type '" +
6795 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6796 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6797 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006798 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006799 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006800 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006801 ;}
6802 break;
6803
Chris Lattner1913b942008-07-11 00:30:39 +00006804 case 342:
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006805#line 3368 "/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006806 {
6807 if (!UpRefs.empty())
6808 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6809 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6810 GEN_ERROR("extractvalue insn requires an aggregate operand");
6811
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006812 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
Dan Gohmane4977cf2008-05-23 01:55:30 +00006813 GEN_ERROR("Invalid insertvalue indices for type '" +
6814 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6815 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6816 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6817 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006818 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006819 delete (yyvsp[(2) - (7)].TypeVal);
6820 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006821 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006822 ;}
6823 break;
6824
Dan Gohmanf4423b12008-04-19 00:24:39 +00006825
6826/* Line 1267 of yacc.c. */
Dan Gohman1a570242008-07-23 00:54:54 +00006827#line 6828 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006828 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006829 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006830 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6831
6832 YYPOPSTACK (yylen);
6833 yylen = 0;
6834 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006835
6836 *++yyvsp = yyval;
6837
6838
Dan Gohmanf4423b12008-04-19 00:24:39 +00006839 /* Now `shift' the result of the reduction. Determine what state
6840 that goes to, based on the state we popped back to and the rule
6841 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006842
6843 yyn = yyr1[yyn];
6844
Dan Gohmanf4423b12008-04-19 00:24:39 +00006845 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6846 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006847 yystate = yytable[yystate];
6848 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006849 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006850
6851 goto yynewstate;
6852
6853
Dan Gohmanf4423b12008-04-19 00:24:39 +00006854/*------------------------------------.
6855| yyerrlab -- here on detecting error |
6856`------------------------------------*/
6857yyerrlab:
6858 /* If not already recovering from an error, report this error. */
6859 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006860 {
6861 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006862#if ! YYERROR_VERBOSE
6863 yyerror (YY_("syntax error"));
6864#else
6865 {
6866 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6867 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6868 {
6869 YYSIZE_T yyalloc = 2 * yysize;
6870 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6871 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6872 if (yymsg != yymsgbuf)
6873 YYSTACK_FREE (yymsg);
6874 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6875 if (yymsg)
6876 yymsg_alloc = yyalloc;
6877 else
6878 {
6879 yymsg = yymsgbuf;
6880 yymsg_alloc = sizeof yymsgbuf;
6881 }
6882 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006883
Dan Gohmanf4423b12008-04-19 00:24:39 +00006884 if (0 < yysize && yysize <= yymsg_alloc)
6885 {
6886 (void) yysyntax_error (yymsg, yystate, yychar);
6887 yyerror (yymsg);
6888 }
6889 else
6890 {
6891 yyerror (YY_("syntax error"));
6892 if (yysize != 0)
6893 goto yyexhaustedlab;
6894 }
6895 }
6896#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006897 }
6898
Dan Gohmanf4423b12008-04-19 00:24:39 +00006899
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006900
6901 if (yyerrstatus == 3)
6902 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00006903 /* If just tried and failed to reuse look-ahead token after an
6904 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006905
Dan Gohmanf4423b12008-04-19 00:24:39 +00006906 if (yychar <= YYEOF)
6907 {
6908 /* Return failure if at end of input. */
6909 if (yychar == YYEOF)
6910 YYABORT;
6911 }
6912 else
6913 {
6914 yydestruct ("Error: discarding",
6915 yytoken, &yylval);
6916 yychar = YYEMPTY;
6917 }
6918 }
6919
6920 /* Else will try to reuse look-ahead token after shifting the error
6921 token. */
6922 goto yyerrlab1;
6923
6924
6925/*---------------------------------------------------.
6926| yyerrorlab -- error raised explicitly by YYERROR. |
6927`---------------------------------------------------*/
6928yyerrorlab:
6929
6930 /* Pacify compilers like GCC when the user code never invokes
6931 YYERROR and the label yyerrorlab therefore never appears in user
6932 code. */
6933 if (/*CONSTCOND*/ 0)
6934 goto yyerrorlab;
6935
6936 /* Do not reclaim the symbols of the rule which action triggered
6937 this YYERROR. */
6938 YYPOPSTACK (yylen);
6939 yylen = 0;
6940 YY_STACK_PRINT (yyss, yyssp);
6941 yystate = *yyssp;
6942 goto yyerrlab1;
6943
6944
6945/*-------------------------------------------------------------.
6946| yyerrlab1 -- common code for both syntax error and YYERROR. |
6947`-------------------------------------------------------------*/
6948yyerrlab1:
6949 yyerrstatus = 3; /* Each real token shifted decrements this. */
6950
6951 for (;;)
6952 {
6953 yyn = yypact[yystate];
6954 if (yyn != YYPACT_NINF)
6955 {
6956 yyn += YYTERROR;
6957 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6958 {
6959 yyn = yytable[yyn];
6960 if (0 < yyn)
6961 break;
6962 }
6963 }
6964
6965 /* Pop the current state because it cannot handle the error token. */
6966 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006967 YYABORT;
6968
Dale Johannesencdd509a2007-09-07 21:07:57 +00006969
Dan Gohmanf4423b12008-04-19 00:24:39 +00006970 yydestruct ("Error: popping",
6971 yystos[yystate], yyvsp);
6972 YYPOPSTACK (1);
6973 yystate = *yyssp;
6974 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006975 }
6976
6977 if (yyn == YYFINAL)
6978 YYACCEPT;
6979
Reid Spencer68a24bd2005-08-27 18:50:39 +00006980 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006981
6982
6983 /* Shift the error token. */
6984 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006985
Reid Spencer68a24bd2005-08-27 18:50:39 +00006986 yystate = yyn;
6987 goto yynewstate;
6988
Gabor Greife64d2482008-04-06 23:07:54 +00006989
Dan Gohmanf4423b12008-04-19 00:24:39 +00006990/*-------------------------------------.
6991| yyacceptlab -- YYACCEPT comes here. |
6992`-------------------------------------*/
6993yyacceptlab:
6994 yyresult = 0;
6995 goto yyreturn;
6996
6997/*-----------------------------------.
6998| yyabortlab -- YYABORT comes here. |
6999`-----------------------------------*/
7000yyabortlab:
7001 yyresult = 1;
7002 goto yyreturn;
7003
7004#ifndef yyoverflow
7005/*-------------------------------------------------.
7006| yyexhaustedlab -- memory exhaustion comes here. |
7007`-------------------------------------------------*/
7008yyexhaustedlab:
7009 yyerror (YY_("memory exhausted"));
7010 yyresult = 2;
7011 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007012#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007013
7014yyreturn:
7015 if (yychar != YYEOF && yychar != YYEMPTY)
7016 yydestruct ("Cleanup: discarding lookahead",
7017 yytoken, &yylval);
7018 /* Do not reclaim the symbols of the rule which action triggered
7019 this YYABORT or YYACCEPT. */
7020 YYPOPSTACK (yylen);
7021 YY_STACK_PRINT (yyss, yyssp);
7022 while (yyssp != yyss)
7023 {
7024 yydestruct ("Cleanup: popping",
7025 yystos[*yyssp], yyvsp);
7026 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007027 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007028#ifndef yyoverflow
7029 if (yyss != yyssa)
7030 YYSTACK_FREE (yyss);
7031#endif
7032#if YYERROR_VERBOSE
7033 if (yymsg != yymsgbuf)
7034 YYSTACK_FREE (yymsg);
7035#endif
7036 /* Make sure YYID is used. */
7037 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007038}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007039
7040
Nate Begeman5bc1ea02008-07-29 15:49:41 +00007041#line 3387 "/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007042
7043
Reid Spencer14310612006-12-31 05:40:51 +00007044// common code from the two 'RunVMAsmParser' functions
7045static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007046 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007047 // Check to make sure the parser succeeded
7048 if (yyparse()) {
7049 if (ParserResult)
7050 delete ParserResult;
7051 return 0;
7052 }
7053
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007054 // Emit an error if there are any unresolved types left.
7055 if (!CurModule.LateResolveTypes.empty()) {
7056 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7057 if (DID.Type == ValID::LocalName) {
7058 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7059 } else {
7060 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7061 }
7062 if (ParserResult)
7063 delete ParserResult;
7064 return 0;
7065 }
7066
7067 // Emit an error if there are any unresolved values left.
7068 if (!CurModule.LateResolveValues.empty()) {
7069 Value *V = CurModule.LateResolveValues.back();
7070 std::map<Value*, std::pair<ValID, int> >::iterator I =
7071 CurModule.PlaceHolderInfo.find(V);
7072
7073 if (I != CurModule.PlaceHolderInfo.end()) {
7074 ValID &DID = I->second.first;
7075 if (DID.Type == ValID::LocalName) {
7076 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7077 } else {
7078 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7079 }
7080 if (ParserResult)
7081 delete ParserResult;
7082 return 0;
7083 }
7084 }
7085
Reid Spencer14310612006-12-31 05:40:51 +00007086 // Check to make sure that parsing produced a result
7087 if (!ParserResult)
7088 return 0;
7089
7090 // Reset ParserResult variable while saving its value for the result.
7091 Module *Result = ParserResult;
7092 ParserResult = 0;
7093
7094 return Result;
7095}
7096
Reid Spencer61c83e02006-08-18 08:43:06 +00007097void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007098 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007099 // TODO: column number in exception
7100 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007101 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007102 TriggerError = 1;
7103}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007104
7105int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007106 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007107 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007108 if (yychar != YYEMPTY && yychar != 0) {
7109 errMsg += " while reading token: '";
7110 errMsg += std::string(LLLgetTokenStart(),
7111 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7112 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007113 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007114 return 0;
7115}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007116