blob: 336ae7e9af3e47275945f70231c743073f166d63 [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,
213 SIGNEXT = 394,
214 ZEROEXT = 395,
215 NORETURN = 396,
216 INREG = 397,
217 SRET = 398,
218 NOUNWIND = 399,
219 NOALIAS = 400,
220 BYVAL = 401,
221 NEST = 402,
222 READNONE = 403,
223 READONLY = 404,
224 GC = 405,
225 DEFAULT = 406,
226 HIDDEN = 407,
227 PROTECTED = 408
Dan Gohmanf4423b12008-04-19 00:24:39 +0000228 };
229#endif
230/* Tokens. */
231#define ESINT64VAL 258
232#define EUINT64VAL 259
233#define ESAPINTVAL 260
234#define EUAPINTVAL 261
235#define LOCALVAL_ID 262
236#define GLOBALVAL_ID 263
237#define FPVAL 264
238#define VOID 265
239#define INTTYPE 266
240#define FLOAT 267
241#define DOUBLE 268
242#define X86_FP80 269
243#define FP128 270
244#define PPC_FP128 271
245#define LABEL 272
246#define TYPE 273
247#define LOCALVAR 274
248#define GLOBALVAR 275
249#define LABELSTR 276
250#define STRINGCONSTANT 277
251#define ATSTRINGCONSTANT 278
252#define PCTSTRINGCONSTANT 279
253#define ZEROINITIALIZER 280
254#define TRUETOK 281
255#define FALSETOK 282
256#define BEGINTOK 283
257#define ENDTOK 284
258#define DECLARE 285
259#define DEFINE 286
260#define GLOBAL 287
261#define CONSTANT 288
262#define SECTION 289
263#define ALIAS 290
264#define VOLATILE 291
265#define THREAD_LOCAL 292
266#define TO 293
267#define DOTDOTDOT 294
268#define NULL_TOK 295
269#define UNDEF 296
270#define INTERNAL 297
271#define LINKONCE 298
272#define WEAK 299
273#define APPENDING 300
274#define DLLIMPORT 301
275#define DLLEXPORT 302
276#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000277#define COMMON 304
278#define OPAQUE 305
279#define EXTERNAL 306
280#define TARGET 307
281#define TRIPLE 308
282#define ALIGN 309
283#define ADDRSPACE 310
284#define DEPLIBS 311
285#define CALL 312
286#define TAIL 313
287#define ASM_TOK 314
288#define MODULE 315
289#define SIDEEFFECT 316
290#define CC_TOK 317
291#define CCC_TOK 318
292#define FASTCC_TOK 319
293#define COLDCC_TOK 320
294#define X86_STDCALLCC_TOK 321
295#define X86_FASTCALLCC_TOK 322
296#define DATALAYOUT 323
297#define RET 324
298#define BR 325
299#define SWITCH 326
300#define INVOKE 327
301#define UNWIND 328
302#define UNREACHABLE 329
303#define ADD 330
304#define SUB 331
305#define MUL 332
306#define UDIV 333
307#define SDIV 334
308#define FDIV 335
309#define UREM 336
310#define SREM 337
311#define FREM 338
312#define AND 339
313#define OR 340
314#define XOR 341
315#define SHL 342
316#define LSHR 343
317#define ASHR 344
318#define ICMP 345
319#define FCMP 346
320#define VICMP 347
321#define VFCMP 348
322#define EQ 349
323#define NE 350
324#define SLT 351
325#define SGT 352
326#define SLE 353
327#define SGE 354
328#define ULT 355
329#define UGT 356
330#define ULE 357
331#define UGE 358
332#define OEQ 359
333#define ONE 360
334#define OLT 361
335#define OGT 362
336#define OLE 363
337#define OGE 364
338#define ORD 365
339#define UNO 366
340#define UEQ 367
341#define UNE 368
342#define MALLOC 369
343#define ALLOCA 370
344#define FREE 371
345#define LOAD 372
346#define STORE 373
347#define GETELEMENTPTR 374
348#define TRUNC 375
349#define ZEXT 376
350#define SEXT 377
351#define FPTRUNC 378
352#define FPEXT 379
353#define BITCAST 380
354#define UITOFP 381
355#define SITOFP 382
356#define FPTOUI 383
357#define FPTOSI 384
358#define INTTOPTR 385
359#define PTRTOINT 386
360#define PHI_TOK 387
361#define SELECT 388
362#define VAARG 389
363#define EXTRACTELEMENT 390
364#define INSERTELEMENT 391
365#define SHUFFLEVECTOR 392
366#define GETRESULT 393
367#define SIGNEXT 394
368#define ZEROEXT 395
369#define NORETURN 396
370#define INREG 397
371#define SRET 398
372#define NOUNWIND 399
373#define NOALIAS 400
374#define BYVAL 401
375#define NEST 402
376#define READNONE 403
377#define READONLY 404
378#define GC 405
379#define DEFAULT 406
380#define HIDDEN 407
381#define PROTECTED 408
Dan Gohmanf4423b12008-04-19 00:24:39 +0000382
383
384
385
386/* Copy the first part of user declarations. */
Gordon Henriksen83eaae12008-05-19 05:47:10 +0000387#line 14 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000388
389#include "ParserInternals.h"
390#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000391#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000392#include "llvm/Instructions.h"
393#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000394#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000395#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000396#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000397#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000398#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000399#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000400#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000401#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000402#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000403#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000404#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000405#include <utility>
406
Reid Spencere4f47592006-08-18 17:32:55 +0000407// The following is a gross hack. In order to rid the libAsmParser library of
408// exceptions, we have to have a way of getting the yyparse function to go into
409// an error situation. So, whenever we want an error to occur, the GenerateError
410// function (see bottom of file) sets TriggerError. Then, at the end of each
411// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
412// (a goto) to put YACC in error state. Furthermore, several calls to
413// GenerateError are made from inside productions and they must simulate the
414// previous exception behavior by exiting the production immediately. We have
415// replaced these with the GEN_ERROR macro which calls GeneratError and then
416// immediately invokes YYERROR. This would be so much cleaner if it was a
417// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000418static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000419#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000420#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
421
Reid Spencer68a24bd2005-08-27 18:50:39 +0000422int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
423int yylex(); // declaration" of xxx warnings.
424int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000425using namespace llvm;
426
427static Module *ParserResult;
428
429// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
430// relating to upreferences in the input stream.
431//
432//#define DEBUG_UPREFS 1
433#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000434#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000435#else
436#define UR_OUT(X)
437#endif
438
439#define YYERROR_VERBOSE 1
440
Chris Lattnerb475c422005-11-12 18:22:38 +0000441static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000442
443
444// This contains info used when building the body of a function. It is
445// destroyed when the function is completed.
446//
447typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000448
Reid Spencer68a24bd2005-08-27 18:50:39 +0000449static void
Reid Spencer93c40032007-03-19 18:40:50 +0000450ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000451
452static struct PerModuleInfo {
453 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000454 ValueList Values; // Module level numbered definitions
455 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000456 std::vector<PATypeHolder> Types;
457 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000458
459 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000460 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000461 /// that we can resolve them later and print error messages as appropriate.
462 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
463
464 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
465 // references to global values. Global values may be referenced before they
466 // are defined, and if so, the temporary object that they represent is held
467 // here. This is used for forward references of GlobalValues.
468 //
469 typedef std::map<std::pair<const PointerType *,
470 ValID>, GlobalValue*> GlobalRefsType;
471 GlobalRefsType GlobalRefs;
472
473 void ModuleDone() {
474 // If we could not resolve some functions at function compilation time
475 // (calls to functions before they are defined), resolve them now... Types
476 // are resolved when the constant pool has been completely parsed.
477 //
478 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000479 if (TriggerError)
480 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000481
482 // Check to make sure that all global value forward references have been
483 // resolved!
484 //
485 if (!GlobalRefs.empty()) {
486 std::string UndefinedReferences = "Unresolved global references exist:\n";
487
488 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
489 I != E; ++I) {
490 UndefinedReferences += " " + I->first.first->getDescription() + " " +
491 I->first.second.getName() + "\n";
492 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000493 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000494 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000495 }
496
Chandler Carruth02202192007-08-04 01:56:21 +0000497 // Look for intrinsic functions and CallInst that need to be upgraded
498 for (Module::iterator FI = CurrentModule->begin(),
499 FE = CurrentModule->end(); FI != FE; )
500 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
501
Reid Spencer68a24bd2005-08-27 18:50:39 +0000502 Values.clear(); // Clear out function local definitions
503 Types.clear();
504 CurrentModule = 0;
505 }
506
Reid Spencer68a24bd2005-08-27 18:50:39 +0000507 // GetForwardRefForGlobal - Check to see if there is a forward reference
508 // for this global. If so, remove it from the GlobalRefs map and return it.
509 // If not, just return null.
510 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
511 // Check to see if there is a forward reference to this global variable...
512 // if there is, eliminate it and patch the reference to use the new def'n.
513 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
514 GlobalValue *Ret = 0;
515 if (I != GlobalRefs.end()) {
516 Ret = I->second;
517 GlobalRefs.erase(I);
518 }
519 return Ret;
520 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000521
522 bool TypeIsUnresolved(PATypeHolder* PATy) {
523 // If it isn't abstract, its resolved
524 const Type* Ty = PATy->get();
525 if (!Ty->isAbstract())
526 return false;
527 // Traverse the type looking for abstract types. If it isn't abstract then
528 // we don't need to traverse that leg of the type.
529 std::vector<const Type*> WorkList, SeenList;
530 WorkList.push_back(Ty);
531 while (!WorkList.empty()) {
532 const Type* Ty = WorkList.back();
533 SeenList.push_back(Ty);
534 WorkList.pop_back();
535 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
536 // Check to see if this is an unresolved type
537 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
538 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
539 for ( ; I != E; ++I) {
540 if (I->second.get() == OpTy)
541 return true;
542 }
543 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
544 const Type* TheTy = SeqTy->getElementType();
545 if (TheTy->isAbstract() && TheTy != Ty) {
546 std::vector<const Type*>::iterator I = SeenList.begin(),
547 E = SeenList.end();
548 for ( ; I != E; ++I)
549 if (*I == TheTy)
550 break;
551 if (I == E)
552 WorkList.push_back(TheTy);
553 }
554 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
555 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
556 const Type* TheTy = StrTy->getElementType(i);
557 if (TheTy->isAbstract() && TheTy != Ty) {
558 std::vector<const Type*>::iterator I = SeenList.begin(),
559 E = SeenList.end();
560 for ( ; I != E; ++I)
561 if (*I == TheTy)
562 break;
563 if (I == E)
564 WorkList.push_back(TheTy);
565 }
566 }
567 }
568 }
569 return false;
570 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000571} CurModule;
572
573static struct PerFunctionInfo {
574 Function *CurrentFunction; // Pointer to current function being created
575
Reid Spencer93c40032007-03-19 18:40:50 +0000576 ValueList Values; // Keep track of #'d definitions
577 unsigned NextValNum;
578 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000579 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000580 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000581 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000582
583 /// BBForwardRefs - When we see forward references to basic blocks, keep
584 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000585 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000586
587 inline PerFunctionInfo() {
588 CurrentFunction = 0;
589 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000590 Linkage = GlobalValue::ExternalLinkage;
591 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000592 }
593
594 inline void FunctionStart(Function *M) {
595 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000596 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000597 }
598
599 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000600 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000601 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000602 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000603 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000604 return;
605 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000606
607 // Resolve all forward references now.
608 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
609
610 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000611 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000612 CurrentFunction = 0;
613 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000614 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000615 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616 }
617} CurFun; // Info for the current function...
618
619static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
620
621
622//===----------------------------------------------------------------------===//
623// Code to handle definitions of all the types
624//===----------------------------------------------------------------------===//
625
Reid Spencer93c40032007-03-19 18:40:50 +0000626static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
627 // Things that have names or are void typed don't get slot numbers
628 if (V->hasName() || (V->getType() == Type::VoidTy))
629 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000630
Reid Spencer93c40032007-03-19 18:40:50 +0000631 // In the case of function values, we have to allow for the forward reference
632 // of basic blocks, which are included in the numbering. Consequently, we keep
633 // track of the next insertion location with NextValNum. When a BB gets
634 // inserted, it could change the size of the CurFun.Values vector.
635 if (&ValueTab == &CurFun.Values) {
636 if (ValueTab.size() <= CurFun.NextValNum)
637 ValueTab.resize(CurFun.NextValNum+1);
638 ValueTab[CurFun.NextValNum++] = V;
639 return;
640 }
641 // For all other lists, its okay to just tack it on the back of the vector.
642 ValueTab.push_back(V);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000643}
644
645static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
646 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000647 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000648 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000649 if (D.Num < CurModule.Types.size())
650 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000651 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000652 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000653 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000654 D.destroy(); // Free old strdup'd memory...
655 return N;
656 }
657 break;
658 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000659 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000660 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000661 }
662
663 // If we reached here, we referenced either a symbol that we don't know about
664 // or an id number that hasn't been read yet. We may be referencing something
665 // forward, so just create an entry to be resolved later and get to it...
666 //
667 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
668
669
670 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000671 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000672 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000673 return 0;
674 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000675 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000676 return 0;
677 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000678 }
679
Reid Spencer861d9d62006-11-28 07:29:44 +0000680 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000681 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000682 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000683
Reid Spencer861d9d62006-11-28 07:29:44 +0000684 Type *Typ = OpaqueType::get();
685 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
686 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000687 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000688
Reid Spencer93c40032007-03-19 18:40:50 +0000689// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000690// the provided ValID. If the value exists and has already been defined, return
691// it. Otherwise return null.
692//
Reid Spencer93c40032007-03-19 18:40:50 +0000693static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000694 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000695 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000696 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000697 return 0;
698 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000699
700 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000701 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000702 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000703 if (D.Num >= CurFun.Values.size())
704 return 0;
705 Value *Result = CurFun.Values[D.Num];
706 if (Ty != Result->getType()) {
707 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
708 Result->getType()->getDescription() + "' does not match "
709 "expected type, '" + Ty->getDescription() + "'");
710 return 0;
711 }
712 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000713 }
714 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000715 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000716 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000717 Value *Result = CurModule.Values[D.Num];
718 if (Ty != Result->getType()) {
719 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
720 Result->getType()->getDescription() + "' does not match "
721 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000722 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000723 }
724 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000725 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000726
727 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000728 if (!inFunctionScope())
729 return 0;
730 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000731 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000732 if (N == 0)
733 return 0;
734 if (N->getType() != Ty)
735 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000736
737 D.destroy(); // Free old strdup'd memory...
738 return N;
739 }
740 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000741 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000742 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000743 if (N == 0)
744 return 0;
745 if (N->getType() != Ty)
746 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000747
748 D.destroy(); // Free old strdup'd memory...
749 return N;
750 }
751
752 // Check to make sure that "Ty" is an integral type, and that our
753 // value will fit into the specified type...
754 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000755 if (!isa<IntegerType>(Ty) ||
756 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000757 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000758 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000759 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000760 return 0;
761 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000762 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000763
764 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000765 if (isa<IntegerType>(Ty) &&
766 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000767 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000768
769 if (!isa<IntegerType>(Ty) ||
770 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
771 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
772 "' is invalid or out of range for type '" +
773 Ty->getDescription() + "'");
774 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000775 }
Chris Lattner38905612008-02-19 04:36:25 +0000776 // This is really a signed reference. Transmogrify.
777 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000778
779 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000780 if (!Ty->isFloatingPoint() ||
781 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000782 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000783 return 0;
784 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000785 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000786 // as double. Fix this here. Long double does not need this.
787 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
788 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000789 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000790 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000791
792 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000793 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000794 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000795 return 0;
796 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000797 return ConstantPointerNull::get(cast<PointerType>(Ty));
798
799 case ValID::ConstUndefVal: // Is it an undef value?
800 return UndefValue::get(Ty);
801
Chris Lattner7aa61892005-12-21 17:53:23 +0000802 case ValID::ConstZeroVal: // Is it a zero value?
803 return Constant::getNullValue(Ty);
804
Reid Spencer68a24bd2005-08-27 18:50:39 +0000805 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000806 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000807 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000808 return 0;
809 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000810 return D.ConstantValue;
811
Chris Lattner0e9c3762006-01-25 22:27:16 +0000812 case ValID::InlineAsmVal: { // Inline asm expression
813 const PointerType *PTy = dyn_cast<PointerType>(Ty);
814 const FunctionType *FTy =
815 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000816 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000817 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000818 return 0;
819 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000820 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
821 D.IAD->HasSideEffects);
822 D.destroy(); // Free InlineAsmDescriptor.
823 return IA;
824 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000825 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000826 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000827 return 0;
828 } // End of switch
829
Reid Spencera9720f52007-02-05 17:04:00 +0000830 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000831 return 0;
832}
833
Reid Spencer93c40032007-03-19 18:40:50 +0000834// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000835// value is not already defined, it "improvises" by creating a placeholder var
836// that looks and acts just like the requested variable. When the value is
837// defined later, all uses of the placeholder variable are replaced with the
838// real thing.
839//
840static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000841 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000842 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000843 return 0;
844 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000845
846 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000847 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000848 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000849 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000850
Reid Spencer5b7e7532006-09-28 19:28:24 +0000851 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000852 GenerateError("Invalid use of a composite type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000853 return 0;
854 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000855
856 // If we reached here, we referenced either a symbol that we don't know about
857 // or an id number that hasn't been read yet. We may be referencing something
858 // forward, so just create an entry to be resolved later and get to it...
859 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000860 switch (ID.Type) {
861 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000862 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000863 const PointerType *PTy = dyn_cast<PointerType>(Ty);
864 if (!PTy) {
865 GenerateError("Invalid type for reference to global" );
866 return 0;
867 }
868 const Type* ElTy = PTy->getElementType();
869 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000870 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000871 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000872 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
873 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000874 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000875 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000876 default:
877 V = new Argument(Ty);
878 }
879
Reid Spencer68a24bd2005-08-27 18:50:39 +0000880 // Remember where this forward reference came from. FIXME, shouldn't we try
881 // to recycle these things??
882 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000883 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000884
885 if (inFunctionScope())
886 InsertValue(V, CurFun.LateResolveValues);
887 else
888 InsertValue(V, CurModule.LateResolveValues);
889 return V;
890}
891
Reid Spencer93c40032007-03-19 18:40:50 +0000892/// defineBBVal - This is a definition of a new basic block with the specified
893/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000894static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000895 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000896
Reid Spencer68a24bd2005-08-27 18:50:39 +0000897 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000898
Reid Spencer93c40032007-03-19 18:40:50 +0000899 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000900
Reid Spencer93c40032007-03-19 18:40:50 +0000901 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
902 if (BBI != CurFun.BBForwardRefs.end()) {
903 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000904 // The forward declaration could have been inserted anywhere in the
905 // function: insert it into the correct place now.
906 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
907 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000908
Reid Spencer66728ef2007-03-20 01:13:36 +0000909 // We're about to erase the entry, save the key so we can clean it up.
910 ValID Tmp = BBI->first;
911
Reid Spencer93c40032007-03-19 18:40:50 +0000912 // Erase the forward ref from the map as its no longer "forward"
913 CurFun.BBForwardRefs.erase(ID);
914
Reid Spencer66728ef2007-03-20 01:13:36 +0000915 // The key has been removed from the map but so we don't want to leave
916 // strdup'd memory around so destroy it too.
917 Tmp.destroy();
918
Reid Spencer93c40032007-03-19 18:40:50 +0000919 // If its a numbered definition, bump the number and set the BB value.
920 if (ID.Type == ValID::LocalID) {
921 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
922 InsertValue(BB);
923 }
Devang Patel67909432008-03-03 18:58:47 +0000924 } else {
925 // We haven't seen this BB before and its first mention is a definition.
926 // Just create it and return it.
927 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000928 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000929 if (ID.Type == ValID::LocalID) {
930 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
931 InsertValue(BB);
932 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000933 }
Reid Spencer93c40032007-03-19 18:40:50 +0000934
Devang Patel67909432008-03-03 18:58:47 +0000935 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000936 return BB;
937}
938
939/// getBBVal - get an existing BB value or create a forward reference for it.
940///
941static BasicBlock *getBBVal(const ValID &ID) {
942 assert(inFunctionScope() && "Can't get basic block at global scope!");
943
944 BasicBlock *BB = 0;
945
946 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
947 if (BBI != CurFun.BBForwardRefs.end()) {
948 BB = BBI->second;
949 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000950 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000951 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000952 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000953 if (N->getType()->getTypeID() == Type::LabelTyID)
954 BB = cast<BasicBlock>(N);
955 else
956 GenerateError("Reference to label '" + Name + "' is actually of type '"+
957 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000958 }
Reid Spencer93c40032007-03-19 18:40:50 +0000959 } else if (ID.Type == ValID::LocalID) {
960 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
961 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
962 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
963 else
964 GenerateError("Reference to label '%" + utostr(ID.Num) +
965 "' is actually of type '"+
966 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
967 }
968 } else {
969 GenerateError("Illegal label reference " + ID.getName());
970 return 0;
971 }
972
973 // If its already been defined, return it now.
974 if (BB) {
975 ID.destroy(); // Free strdup'd memory.
976 return BB;
977 }
978
979 // Otherwise, this block has not been seen before, create it.
980 std::string Name;
981 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000982 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +0000983 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +0000984
985 // Insert it in the forward refs map.
986 CurFun.BBForwardRefs[ID] = BB;
987
Reid Spencer68a24bd2005-08-27 18:50:39 +0000988 return BB;
989}
990
991
992//===----------------------------------------------------------------------===//
993// Code to handle forward references in instructions
994//===----------------------------------------------------------------------===//
995//
996// This code handles the late binding needed with statements that reference
997// values not defined yet... for example, a forward branch, or the PHI node for
998// a loop body.
999//
1000// This keeps a table (CurFun.LateResolveValues) of all such forward references
1001// and back patchs after we are done.
1002//
1003
1004// ResolveDefinitions - If we could not resolve some defs at parsing
1005// time (forward branches, phi functions for loops, etc...) resolve the
1006// defs now...
1007//
1008static void
Reid Spencer93c40032007-03-19 18:40:50 +00001009ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001010 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001011 while (!LateResolvers.empty()) {
1012 Value *V = LateResolvers.back();
1013 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001014
Reid Spencer93c40032007-03-19 18:40:50 +00001015 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1016 CurModule.PlaceHolderInfo.find(V);
1017 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001018
Reid Spencer93c40032007-03-19 18:40:50 +00001019 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001020
Reid Spencer93c40032007-03-19 18:40:50 +00001021 Value *TheRealValue = getExistingVal(V->getType(), DID);
1022 if (TriggerError)
1023 return;
1024 if (TheRealValue) {
1025 V->replaceAllUsesWith(TheRealValue);
1026 delete V;
1027 CurModule.PlaceHolderInfo.erase(PHI);
1028 } else if (FutureLateResolvers) {
1029 // Functions have their unresolved items forwarded to the module late
1030 // resolver table
1031 InsertValue(V, *FutureLateResolvers);
1032 } else {
1033 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1034 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1035 "' of type '" + V->getType()->getDescription() + "'",
1036 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001037 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001038 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001039 GenerateError("Reference to an invalid definition: #" +
1040 itostr(DID.Num) + " of type '" +
1041 V->getType()->getDescription() + "'",
1042 PHI->second.second);
1043 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001044 }
1045 }
1046 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001047 LateResolvers.clear();
1048}
1049
1050// ResolveTypeTo - A brand new type was just declared. This means that (if
1051// name is not null) things referencing Name can be resolved. Otherwise, things
1052// refering to the number can be resolved. Do this now.
1053//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001054static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001055 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001056 if (Name)
1057 D = ValID::createLocalName(*Name);
1058 else
1059 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001060
Reid Spencer861d9d62006-11-28 07:29:44 +00001061 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001062 CurModule.LateResolveTypes.find(D);
1063 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001064 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001065 CurModule.LateResolveTypes.erase(I);
1066 }
1067}
1068
1069// setValueName - Set the specified value to the name given. The name may be
1070// null potentially, in which case this is a noop. The string passed in is
1071// assumed to be a malloc'd string buffer, and is free'd by this function.
1072//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001073static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001074 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001075 std::string Name(*NameStr); // Copy string
1076 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001077
Reid Spencer41dff5e2007-01-26 08:05:27 +00001078 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001079 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001080 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001081 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001082
Reid Spencera9720f52007-02-05 17:04:00 +00001083 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001084 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1085 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001086 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001087 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001088 return;
1089 }
1090
1091 // Set the name.
1092 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001093}
1094
1095/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1096/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001097static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001098ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001099 GlobalValue::LinkageTypes Linkage,
1100 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001101 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001102 Constant *Initializer, bool IsThreadLocal,
1103 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001104 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001105 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001106 return 0;
1107 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001108
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001109 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001110
1111 std::string Name;
1112 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001113 Name = *NameStr; // Copy string
1114 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001115 }
1116
1117 // See if this global value was forward referenced. If so, recycle the
1118 // object.
1119 ValID ID;
1120 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001121 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001122 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001123 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001124 }
1125
1126 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1127 // Move the global to the end of the list, from whereever it was
1128 // previously inserted.
1129 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1130 CurModule.CurrentModule->getGlobalList().remove(GV);
1131 CurModule.CurrentModule->getGlobalList().push_back(GV);
1132 GV->setInitializer(Initializer);
1133 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001134 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001135 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001136 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001137 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001138 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001139 }
1140
Reid Spenceref9b9a72007-02-05 20:47:22 +00001141 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001142 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001143 // if the global we're parsing has an initializer (is a definition) and
1144 // has external linkage.
1145 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1146 // If there is already a global with external linkage with this name
1147 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1148 // If we allow this GVar to get created, it will be renamed in the
1149 // symbol table because it conflicts with an existing GVar. We can't
1150 // allow redefinition of GVars whose linking indicates that their name
1151 // must stay the same. Issue the error.
1152 GenerateError("Redefinition of global variable named '" + Name +
1153 "' of type '" + Ty->getDescription() + "'");
1154 return 0;
1155 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001156 }
1157
1158 // Otherwise there is no existing GV to use, create one now.
1159 GlobalVariable *GV =
1160 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001161 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001162 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001163 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001164 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001165}
1166
1167// setTypeName - Set the specified type to the name given. The name may be
1168// null potentially, in which case this is a noop. The string passed in is
1169// assumed to be a malloc'd string buffer, and is freed by this function.
1170//
1171// This function returns true if the type has already been defined, but is
1172// allowed to be redefined in the specified context. If the name is a new name
1173// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001174static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001175 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001176 if (NameStr == 0) return false;
1177
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001178 std::string Name(*NameStr); // Copy string
1179 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180
1181 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001182 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001183 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001184 return false;
1185 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001186
1187 // Set the type name, checking for conflicts as we do so.
1188 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1189
1190 if (AlreadyExists) { // Inserting a name that is already defined???
1191 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001192 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001193
1194 // There is only one case where this is allowed: when we are refining an
1195 // opaque type. In this case, Existing will be an opaque type.
1196 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1197 // We ARE replacing an opaque type!
1198 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1199 return true;
1200 }
1201
1202 // Otherwise, this is an attempt to redefine a type. That's okay if
1203 // the redefinition is identical to the original. This will be so if
1204 // Existing and T point to the same Type object. In this one case we
1205 // allow the equivalent redefinition.
1206 if (Existing == T) return true; // Yes, it's equal.
1207
1208 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001209 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001210 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001211 }
1212
1213 return false;
1214}
1215
1216//===----------------------------------------------------------------------===//
1217// Code for handling upreferences in type names...
1218//
1219
1220// TypeContains - Returns true if Ty directly contains E in it.
1221//
1222static bool TypeContains(const Type *Ty, const Type *E) {
1223 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1224 E) != Ty->subtype_end();
1225}
1226
1227namespace {
1228 struct UpRefRecord {
1229 // NestingLevel - The number of nesting levels that need to be popped before
1230 // this type is resolved.
1231 unsigned NestingLevel;
1232
1233 // LastContainedTy - This is the type at the current binding level for the
1234 // type. Every time we reduce the nesting level, this gets updated.
1235 const Type *LastContainedTy;
1236
1237 // UpRefTy - This is the actual opaque type that the upreference is
1238 // represented with.
1239 OpaqueType *UpRefTy;
1240
1241 UpRefRecord(unsigned NL, OpaqueType *URTy)
1242 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1243 };
1244}
1245
1246// UpRefs - A list of the outstanding upreferences that need to be resolved.
1247static std::vector<UpRefRecord> UpRefs;
1248
1249/// HandleUpRefs - Every time we finish a new layer of types, this function is
1250/// called. It loops through the UpRefs vector, which is a list of the
1251/// currently active types. For each type, if the up reference is contained in
1252/// the newly completed type, we decrement the level count. When the level
1253/// count reaches zero, the upreferenced type is the type that is passed in:
1254/// thus we can complete the cycle.
1255///
1256static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001257 // If Ty isn't abstract, or if there are no up-references in it, then there is
1258 // nothing to resolve here.
1259 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1260
Reid Spencer68a24bd2005-08-27 18:50:39 +00001261 PATypeHolder Ty(ty);
1262 UR_OUT("Type '" << Ty->getDescription() <<
1263 "' newly formed. Resolving upreferences.\n" <<
1264 UpRefs.size() << " upreferences active!\n");
1265
1266 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1267 // to zero), we resolve them all together before we resolve them to Ty. At
1268 // the end of the loop, if there is anything to resolve to Ty, it will be in
1269 // this variable.
1270 OpaqueType *TypeToResolve = 0;
1271
1272 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1273 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1274 << UpRefs[i].second->getDescription() << ") = "
1275 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1276 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1277 // Decrement level of upreference
1278 unsigned Level = --UpRefs[i].NestingLevel;
1279 UpRefs[i].LastContainedTy = Ty;
1280 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1281 if (Level == 0) { // Upreference should be resolved!
1282 if (!TypeToResolve) {
1283 TypeToResolve = UpRefs[i].UpRefTy;
1284 } else {
1285 UR_OUT(" * Resolving upreference for "
1286 << UpRefs[i].second->getDescription() << "\n";
1287 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1288 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1289 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1290 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1291 }
1292 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1293 --i; // Do not skip the next element...
1294 }
1295 }
1296 }
1297
1298 if (TypeToResolve) {
1299 UR_OUT(" * Resolving upreference for "
1300 << UpRefs[i].second->getDescription() << "\n";
1301 std::string OldName = TypeToResolve->getDescription());
1302 TypeToResolve->refineAbstractTypeTo(Ty);
1303 }
1304
1305 return Ty;
1306}
1307
Reid Spencer68a24bd2005-08-27 18:50:39 +00001308//===----------------------------------------------------------------------===//
1309// RunVMAsmParser - Define an interface to this parser
1310//===----------------------------------------------------------------------===//
1311//
Reid Spencer14310612006-12-31 05:40:51 +00001312static Module* RunParser(Module * M);
1313
Duncan Sandsdc024672007-11-27 13:23:08 +00001314Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1315 InitLLLexer(MB);
1316 Module *M = RunParser(new Module(LLLgetFilename()));
1317 FreeLexer();
1318 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001319}
1320
1321
Dan Gohmanf4423b12008-04-19 00:24:39 +00001322
1323/* Enabling traces. */
1324#ifndef YYDEBUG
1325# define YYDEBUG 0
1326#endif
1327
1328/* Enabling verbose error messages. */
1329#ifdef YYERROR_VERBOSE
1330# undef YYERROR_VERBOSE
1331# define YYERROR_VERBOSE 1
1332#else
1333# define YYERROR_VERBOSE 0
1334#endif
1335
1336/* Enabling the token table. */
1337#ifndef YYTOKEN_TABLE
1338# define YYTOKEN_TABLE 0
1339#endif
1340
1341#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1342typedef union YYSTYPE
Gordon Henriksen83eaae12008-05-19 05:47:10 +00001343#line 949 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001344{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001345 llvm::Module *ModuleVal;
1346 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001347 llvm::BasicBlock *BasicBlockVal;
1348 llvm::TerminatorInst *TermInstVal;
1349 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001350 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001351
Reid Spencera132e042006-12-03 05:46:11 +00001352 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001353 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001354 llvm::PATypeHolder *TypeVal;
1355 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001356 std::vector<llvm::Value*> *ValueList;
Reid Spencer14310612006-12-31 05:40:51 +00001357 llvm::ArgListType *ArgList;
1358 llvm::TypeWithAttrs TypeWithAttrs;
1359 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001360 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001361
Reid Spencer68a24bd2005-08-27 18:50:39 +00001362 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001363 std::list<std::pair<llvm::Value*,
1364 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001365 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001366 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001367
1368 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001369 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001370 llvm::ParameterAttributes ParamAttrs;
Reid Spencer38c91a92007-02-28 02:24:54 +00001371 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001372 int64_t SInt64Val;
1373 uint64_t UInt64Val;
1374 int SIntVal;
1375 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001376 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001377 bool BoolVal;
1378
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001379 std::string *StrVal; // This memory must be deleted
1380 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001381
Reid Spencera132e042006-12-03 05:46:11 +00001382 llvm::Instruction::BinaryOps BinaryOpVal;
1383 llvm::Instruction::TermOps TermOpVal;
1384 llvm::Instruction::MemoryOps MemOpVal;
1385 llvm::Instruction::CastOps CastOpVal;
1386 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001387 llvm::ICmpInst::Predicate IPredicate;
1388 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001389}
1390/* Line 193 of yacc.c. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001391#line 1392 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001392 YYSTYPE;
1393# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1394# define YYSTYPE_IS_DECLARED 1
1395# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001396#endif
1397
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001398
Reid Spencer68a24bd2005-08-27 18:50:39 +00001399
Dan Gohmanf4423b12008-04-19 00:24:39 +00001400/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001401
1402
Dan Gohmanf4423b12008-04-19 00:24:39 +00001403/* Line 216 of yacc.c. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001404#line 1405 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001405
Dan Gohmanf4423b12008-04-19 00:24:39 +00001406#ifdef short
1407# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001408#endif
1409
Dan Gohmanf4423b12008-04-19 00:24:39 +00001410#ifdef YYTYPE_UINT8
1411typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001412#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001413typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001414#endif
1415
Dan Gohmanf4423b12008-04-19 00:24:39 +00001416#ifdef YYTYPE_INT8
1417typedef YYTYPE_INT8 yytype_int8;
1418#elif (defined __STDC__ || defined __C99__FUNC__ \
1419 || defined __cplusplus || defined _MSC_VER)
1420typedef signed char yytype_int8;
1421#else
1422typedef short int yytype_int8;
1423#endif
1424
1425#ifdef YYTYPE_UINT16
1426typedef YYTYPE_UINT16 yytype_uint16;
1427#else
1428typedef unsigned short int yytype_uint16;
1429#endif
1430
1431#ifdef YYTYPE_INT16
1432typedef YYTYPE_INT16 yytype_int16;
1433#else
1434typedef short int yytype_int16;
1435#endif
1436
1437#ifndef YYSIZE_T
1438# ifdef __SIZE_TYPE__
1439# define YYSIZE_T __SIZE_TYPE__
1440# elif defined size_t
1441# define YYSIZE_T size_t
1442# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1443 || defined __cplusplus || defined _MSC_VER)
1444# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1445# define YYSIZE_T size_t
1446# else
1447# define YYSIZE_T unsigned int
1448# endif
1449#endif
1450
1451#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1452
1453#ifndef YY_
1454# if defined YYENABLE_NLS && YYENABLE_NLS
1455# if ENABLE_NLS
1456# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1457# define YY_(msgid) dgettext ("bison-runtime", msgid)
1458# endif
1459# endif
1460# ifndef YY_
1461# define YY_(msgid) msgid
1462# endif
1463#endif
1464
1465/* Suppress unused-variable warnings by "using" E. */
1466#if ! defined lint || defined __GNUC__
1467# define YYUSE(e) ((void) (e))
1468#else
1469# define YYUSE(e) /* empty */
1470#endif
1471
1472/* Identity function, used to suppress warnings about constant conditions. */
1473#ifndef lint
1474# define YYID(n) (n)
1475#else
1476#if (defined __STDC__ || defined __C99__FUNC__ \
1477 || defined __cplusplus || defined _MSC_VER)
1478static int
1479YYID (int i)
1480#else
1481static int
1482YYID (i)
1483 int i;
1484#endif
1485{
1486 return i;
1487}
1488#endif
1489
1490#if ! defined yyoverflow || YYERROR_VERBOSE
1491
1492/* The parser invokes alloca or malloc; define the necessary symbols. */
1493
1494# ifdef YYSTACK_USE_ALLOCA
1495# if YYSTACK_USE_ALLOCA
1496# ifdef __GNUC__
1497# define YYSTACK_ALLOC __builtin_alloca
1498# elif defined __BUILTIN_VA_ARG_INCR
1499# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1500# elif defined _AIX
1501# define YYSTACK_ALLOC __alloca
1502# elif defined _MSC_VER
1503# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1504# define alloca _alloca
1505# else
1506# define YYSTACK_ALLOC alloca
1507# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1508 || defined __cplusplus || defined _MSC_VER)
1509# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1510# ifndef _STDLIB_H
1511# define _STDLIB_H 1
1512# endif
1513# endif
1514# endif
1515# endif
1516# endif
1517
1518# ifdef YYSTACK_ALLOC
1519 /* Pacify GCC's `empty if-body' warning. */
1520# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1521# ifndef YYSTACK_ALLOC_MAXIMUM
1522 /* The OS might guarantee only one guard page at the bottom of the stack,
1523 and a page size can be as small as 4096 bytes. So we cannot safely
1524 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1525 to allow for a few compiler-allocated temporary stack slots. */
1526# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1527# endif
1528# else
1529# define YYSTACK_ALLOC YYMALLOC
1530# define YYSTACK_FREE YYFREE
1531# ifndef YYSTACK_ALLOC_MAXIMUM
1532# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1533# endif
1534# if (defined __cplusplus && ! defined _STDLIB_H \
1535 && ! ((defined YYMALLOC || defined malloc) \
1536 && (defined YYFREE || defined free)))
1537# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1538# ifndef _STDLIB_H
1539# define _STDLIB_H 1
1540# endif
1541# endif
1542# ifndef YYMALLOC
1543# define YYMALLOC malloc
1544# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1545 || defined __cplusplus || defined _MSC_VER)
1546void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1547# endif
1548# endif
1549# ifndef YYFREE
1550# define YYFREE free
1551# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1552 || defined __cplusplus || defined _MSC_VER)
1553void free (void *); /* INFRINGES ON USER NAME SPACE */
1554# endif
1555# endif
1556# endif
1557#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1558
1559
1560#if (! defined yyoverflow \
1561 && (! defined __cplusplus \
1562 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1563
1564/* A type that is properly aligned for any stack member. */
1565union yyalloc
1566{
1567 yytype_int16 yyss;
1568 YYSTYPE yyvs;
1569 };
1570
1571/* The size of the maximum gap between one aligned stack and the next. */
1572# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1573
1574/* The size of an array large to enough to hold all stacks, each with
1575 N elements. */
1576# define YYSTACK_BYTES(N) \
1577 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1578 + YYSTACK_GAP_MAXIMUM)
1579
1580/* Copy COUNT objects from FROM to TO. The source and destination do
1581 not overlap. */
1582# ifndef YYCOPY
1583# if defined __GNUC__ && 1 < __GNUC__
1584# define YYCOPY(To, From, Count) \
1585 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1586# else
1587# define YYCOPY(To, From, Count) \
1588 do \
1589 { \
1590 YYSIZE_T yyi; \
1591 for (yyi = 0; yyi < (Count); yyi++) \
1592 (To)[yyi] = (From)[yyi]; \
1593 } \
1594 while (YYID (0))
1595# endif
1596# endif
1597
1598/* Relocate STACK from its old location to the new one. The
1599 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1600 elements in the stack, and YYPTR gives the new location of the
1601 stack. Advance YYPTR to a properly aligned location for the next
1602 stack. */
1603# define YYSTACK_RELOCATE(Stack) \
1604 do \
1605 { \
1606 YYSIZE_T yynewbytes; \
1607 YYCOPY (&yyptr->Stack, Stack, yysize); \
1608 Stack = &yyptr->Stack; \
1609 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1610 yyptr += yynewbytes / sizeof (*yyptr); \
1611 } \
1612 while (YYID (0))
1613
1614#endif
1615
1616/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001617#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001618/* YYLAST -- Last index in YYTABLE. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001619#define YYLAST 2040
Dan Gohmanf4423b12008-04-19 00:24:39 +00001620
1621/* YYNTOKENS -- Number of terminals. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001622#define YYNTOKENS 168
Dan Gohmanf4423b12008-04-19 00:24:39 +00001623/* YYNNTS -- Number of nonterminals. */
1624#define YYNNTS 85
1625/* YYNRULES -- Number of rules. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001626#define YYNRULES 327
Dan Gohmanf4423b12008-04-19 00:24:39 +00001627/* YYNRULES -- Number of states. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001628#define YYNSTATES 656
Dan Gohmanf4423b12008-04-19 00:24:39 +00001629
1630/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1631#define YYUNDEFTOK 2
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001632#define YYMAXUTOK 408
Dan Gohmanf4423b12008-04-19 00:24:39 +00001633
1634#define YYTRANSLATE(YYX) \
1635 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1636
1637/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1638static const yytype_uint8 yytranslate[] =
1639{
1640 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001644 154, 155, 158, 2, 157, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001646 163, 156, 164, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001649 2, 160, 159, 162, 2, 2, 2, 2, 2, 167,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001652 161, 2, 2, 165, 2, 166, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1663 2, 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, 1, 2, 3, 4,
1666 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1667 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1668 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1669 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1670 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1671 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1672 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1673 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1674 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1675 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1676 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1677 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1678 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1679 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001680 145, 146, 147, 148, 149, 150, 151, 152, 153
Dan Gohmanf4423b12008-04-19 00:24:39 +00001681};
1682
1683#if YYDEBUG
1684/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1685 YYRHS. */
1686static const yytype_uint16 yyprhs[] =
1687{
1688 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1689 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1690 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1691 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1692 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1693 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1694 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1695 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001696 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1697 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1698 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1699 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1700 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1701 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1702 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1703 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1704 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1705 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1706 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1707 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
1708 526, 535, 544, 548, 550, 552, 554, 556, 557, 560,
1709 567, 569, 570, 572, 575, 576, 580, 581, 585, 589,
1710 593, 597, 598, 607, 608, 618, 619, 629, 635, 638,
1711 642, 644, 648, 652, 656, 660, 662, 663, 669, 673,
1712 675, 679, 681, 682, 693, 695, 697, 702, 704, 706,
1713 709, 713, 714, 716, 718, 720, 722, 724, 726, 728,
1714 730, 732, 736, 738, 744, 746, 748, 750, 752, 754,
1715 756, 759, 761, 765, 768, 771, 775, 778, 779, 781,
1716 784, 787, 791, 801, 811, 820, 835, 837, 839, 846,
1717 852, 855, 862, 870, 875, 880, 887, 894, 895, 896,
1718 900, 903, 905, 911, 917, 924, 931, 938, 945, 950,
1719 957, 962, 967, 974, 981, 984, 993, 995, 997, 998,
1720 1002, 1009, 1013, 1020, 1023, 1029, 1037, 1043
Dan Gohmanf4423b12008-04-19 00:24:39 +00001721};
1722
1723/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1724static const yytype_int16 yyrhs[] =
1725{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001726 214, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1727 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1728 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1729 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1730 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1731 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1732 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1733 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1734 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1735 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1736 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001737 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001738 -1, 19, -1, 22, -1, 24, -1, 176, -1, -1,
1739 55, 154, 4, 155, -1, -1, 176, 156, -1, -1,
1740 20, -1, 23, -1, 182, -1, -1, 180, 156, -1,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001741 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001742 49, -1, 46, -1, 48, -1, 51, -1, -1, 151,
1743 -1, 152, -1, 153, -1, -1, 46, -1, 48, -1,
1744 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1745 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
1746 -1, 66, -1, 67, -1, 62, 4, -1, 140, -1,
1747 121, -1, 139, -1, 122, -1, 142, -1, 143, -1,
1748 145, -1, 146, -1, 147, -1, 54, 4, -1, -1,
1749 191, 190, -1, 141, -1, 144, -1, 140, -1, 139,
1750 -1, 148, -1, 149, -1, -1, 193, 192, -1, -1,
1751 150, 22, -1, -1, 54, 4, -1, -1, 157, 54,
1752 4, -1, 34, 22, -1, -1, 197, -1, -1, 157,
1753 200, 199, -1, 197, -1, 54, 4, -1, 11, -1,
1754 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
1755 17, -1, 50, -1, 201, -1, 202, 178, 158, -1,
1756 236, -1, 159, 4, -1, 202, 154, 206, 155, 193,
1757 -1, 10, 154, 206, 155, 193, -1, 160, 4, 161,
1758 202, 162, -1, 163, 4, 161, 202, 164, -1, 165,
1759 207, 166, -1, 165, 166, -1, 163, 165, 207, 166,
1760 164, -1, 163, 165, 166, 164, -1, 202, 191, -1,
1761 202, -1, 10, -1, 203, -1, 205, 157, 203, -1,
1762 205, -1, 205, 157, 39, -1, 39, -1, -1, 202,
1763 -1, 207, 157, 202, -1, 202, 160, 210, 162, -1,
1764 202, 160, 162, -1, 202, 167, 22, -1, 202, 163,
1765 210, 164, -1, 202, 165, 210, 166, -1, 202, 165,
1766 166, -1, 202, 163, 165, 210, 166, 164, -1, 202,
1767 163, 165, 166, 164, -1, 202, 40, -1, 202, 41,
1768 -1, 202, 236, -1, 202, 209, -1, 202, 25, -1,
1769 174, 3, -1, 174, 5, -1, 174, 4, -1, 174,
1770 6, -1, 11, 26, -1, 11, 27, -1, 175, 9,
1771 -1, 171, 154, 208, 38, 202, 155, -1, 119, 154,
1772 208, 248, 155, -1, 133, 154, 208, 157, 208, 157,
1773 208, 155, -1, 169, 154, 208, 157, 208, 155, -1,
1774 170, 154, 208, 157, 208, 155, -1, 90, 172, 154,
1775 208, 157, 208, 155, -1, 91, 173, 154, 208, 157,
1776 208, 155, -1, 92, 172, 154, 208, 157, 208, 155,
1777 -1, 93, 173, 154, 208, 157, 208, 155, -1, 135,
1778 154, 208, 157, 208, 155, -1, 136, 154, 208, 157,
1779 208, 157, 208, 155, -1, 137, 154, 208, 157, 208,
1780 157, 208, 155, -1, 210, 157, 208, -1, 208, -1,
1781 32, -1, 33, -1, 37, -1, -1, 204, 236, -1,
1782 125, 154, 213, 38, 202, 155, -1, 215, -1, -1,
1783 216, -1, 215, 216, -1, -1, 31, 217, 232, -1,
1784 -1, 30, 218, 233, -1, 60, 59, 222, -1, 179,
1785 18, 202, -1, 179, 18, 10, -1, -1, 181, 185,
1786 212, 211, 208, 178, 219, 199, -1, -1, 181, 183,
1787 185, 212, 211, 208, 178, 220, 199, -1, -1, 181,
1788 184, 185, 212, 211, 202, 178, 221, 199, -1, 181,
1789 185, 35, 188, 213, -1, 52, 223, -1, 56, 156,
1790 224, -1, 22, -1, 53, 156, 22, -1, 68, 156,
1791 22, -1, 160, 225, 162, -1, 225, 157, 22, -1,
1792 22, -1, -1, 226, 157, 202, 191, 177, -1, 202,
1793 191, 177, -1, 226, -1, 226, 157, 39, -1, 39,
1794 -1, -1, 189, 204, 180, 154, 227, 155, 193, 198,
1795 195, 194, -1, 28, -1, 165, -1, 187, 185, 228,
1796 229, -1, 29, -1, 166, -1, 240, 231, -1, 186,
1797 185, 228, -1, -1, 61, -1, 3, -1, 4, -1,
1798 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1799 25, -1, 163, 210, 164, -1, 209, -1, 59, 234,
1800 22, 157, 22, -1, 7, -1, 8, -1, 176, -1,
1801 180, -1, 236, -1, 235, -1, 202, 237, -1, 238,
1802 -1, 239, 157, 238, -1, 240, 241, -1, 230, 241,
1803 -1, 242, 179, 243, -1, 242, 245, -1, -1, 21,
1804 -1, 69, 239, -1, 69, 10, -1, 70, 17, 237,
1805 -1, 70, 11, 237, 157, 17, 237, 157, 17, 237,
1806 -1, 71, 174, 237, 157, 17, 237, 160, 244, 162,
1807 -1, 71, 174, 237, 157, 17, 237, 160, 162, -1,
1808 72, 189, 204, 237, 154, 247, 155, 193, 38, 17,
1809 237, 73, 17, 237, -1, 73, -1, 74, -1, 244,
1810 174, 235, 157, 17, 237, -1, 174, 235, 157, 17,
1811 237, -1, 179, 250, -1, 202, 160, 237, 157, 237,
1812 162, -1, 246, 157, 160, 237, 157, 237, 162, -1,
1813 202, 191, 237, 191, -1, 17, 191, 237, 191, -1,
1814 247, 157, 202, 191, 237, 191, -1, 247, 157, 17,
1815 191, 237, 191, -1, -1, -1, 248, 157, 238, -1,
1816 58, 57, -1, 57, -1, 169, 202, 237, 157, 237,
1817 -1, 170, 202, 237, 157, 237, -1, 90, 172, 202,
1818 237, 157, 237, -1, 91, 173, 202, 237, 157, 237,
1819 -1, 92, 172, 202, 237, 157, 237, -1, 93, 173,
1820 202, 237, 157, 237, -1, 171, 238, 38, 202, -1,
1821 133, 238, 157, 238, 157, 238, -1, 134, 238, 157,
1822 202, -1, 135, 238, 157, 238, -1, 136, 238, 157,
1823 238, 157, 238, -1, 137, 238, 157, 238, 157, 238,
1824 -1, 132, 246, -1, 249, 189, 204, 237, 154, 247,
1825 155, 193, -1, 252, -1, 36, -1, -1, 114, 202,
1826 196, -1, 114, 202, 157, 11, 237, 196, -1, 115,
1827 202, 196, -1, 115, 202, 157, 11, 237, 196, -1,
1828 116, 238, -1, 251, 117, 202, 237, 196, -1, 251,
1829 118, 238, 157, 202, 237, 196, -1, 138, 202, 237,
1830 157, 4, -1, 119, 202, 237, 248, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001831};
1832
1833/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1834static const yytype_uint16 yyrline[] =
1835{
Chris Lattnercc81d152008-05-04 17:18:47 +00001836 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1837 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1838 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117,
1839 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1840 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1841 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1139, 1139,
1842 1139, 1141, 1141, 1141, 1142, 1142, 1144, 1145, 1149, 1153,
1843 1158, 1158, 1160, 1161, 1166, 1172, 1173, 1174, 1175, 1176,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001844 1177, 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195,
1845 1196, 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213,
1846 1214, 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229,
1847 1230, 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1245, 1246,
1848 1247, 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268,
1849 1274, 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318,
1850 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336,
1851 1341, 1349, 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449,
1852 1458, 1465, 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511,
1853 1523, 1551, 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726,
1854 1733, 1799, 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861,
Dan Gohman041e2eb2008-05-15 19:50:34 +00001855 1874, 1886, 1907, 1915, 1921, 1932, 1937, 1942, 1947, 1952,
1856 1958, 1964, 1973, 1977, 1985, 1985, 1988, 1988, 1991, 2003,
1857 2024, 2029, 2037, 2038, 2042, 2042, 2046, 2046, 2049, 2052,
1858 2076, 2088, 2087, 2099, 2098, 2108, 2107, 2118, 2158, 2161,
1859 2167, 2177, 2181, 2186, 2188, 2193, 2198, 2207, 2217, 2228,
1860 2232, 2241, 2250, 2255, 2384, 2384, 2386, 2395, 2395, 2397,
1861 2402, 2414, 2418, 2423, 2427, 2431, 2435, 2439, 2443, 2447,
1862 2451, 2455, 2480, 2484, 2494, 2498, 2502, 2507, 2514, 2514,
1863 2520, 2529, 2534, 2539, 2543, 2552, 2561, 2570, 2574, 2582,
1864 2589, 2593, 2598, 2608, 2627, 2636, 2722, 2726, 2733, 2744,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001865 2757, 2767, 2778, 2788, 2799, 2807, 2817, 2824, 2827, 2828,
1866 2835, 2839, 2844, 2860, 2877, 2891, 2905, 2919, 2933, 2945,
1867 2953, 2960, 2966, 2972, 2978, 2993, 3083, 3088, 3092, 3099,
1868 3106, 3114, 3121, 3129, 3137, 3151, 3168, 3176
Dan Gohmanf4423b12008-04-19 00:24:39 +00001869};
1870#endif
1871
1872#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1873/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1874 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1875static const char *const yytname[] =
1876{
1877 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1878 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1879 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1880 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1881 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1882 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1883 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1884 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001885 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001886 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1887 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1888 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnercc81d152008-05-04 17:18:47 +00001889 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1890 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begemanac80ade2008-05-12 19:01:56 +00001891 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1892 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1893 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1894 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1895 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1896 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1897 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1898 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1899 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1900 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1901 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1902 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1903 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1904 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1905 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1906 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1907 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1908 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1909 "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001910 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1911 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1912 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1913 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1914 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1915 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1916 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1917 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1918 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1919 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1920 "InstVal", "OptVolatile", "MemoryInst", 0
1921};
1922#endif
1923
1924# ifdef YYPRINT
1925/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1926 token YYLEX-NUM. */
1927static const yytype_uint16 yytoknum[] =
1928{
1929 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1930 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1931 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1932 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1933 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1934 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1935 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1936 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1937 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1938 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1939 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1940 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1941 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1942 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1943 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001944 405, 406, 407, 408, 40, 41, 61, 44, 42, 92,
1945 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00001946};
1947# endif
1948
1949/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1950static const yytype_uint8 yyr1[] =
1951{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001952 0, 168, 169, 169, 169, 169, 169, 169, 169, 169,
1953 169, 170, 170, 170, 170, 170, 170, 171, 171, 171,
Nate Begemanac80ade2008-05-12 19:01:56 +00001954 171, 171, 171, 171, 171, 171, 171, 171, 171, 172,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001955 172, 172, 172, 172, 172, 172, 172, 172, 172, 173,
1956 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
1957 173, 173, 173, 173, 173, 174, 175, 175, 175, 175,
1958 175, 176, 176, 176, 177, 177, 178, 178, 179, 179,
1959 180, 180, 181, 181, 182, 183, 183, 183, 183, 183,
1960 183, 184, 184, 184, 185, 185, 185, 185, 186, 186,
1961 186, 187, 187, 187, 187, 187, 188, 188, 188, 189,
1962 189, 189, 189, 189, 189, 189, 190, 190, 190, 190,
1963 190, 190, 190, 190, 190, 190, 191, 191, 192, 192,
1964 192, 192, 192, 192, 193, 193, 194, 194, 195, 195,
1965 196, 196, 197, 198, 198, 199, 199, 200, 200, 201,
1966 201, 201, 201, 201, 201, 201, 202, 202, 202, 202,
1967 202, 202, 202, 202, 202, 202, 202, 202, 202, 203,
1968 204, 204, 205, 205, 206, 206, 206, 206, 207, 207,
Nate Begemanac80ade2008-05-12 19:01:56 +00001969 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001970 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
1971 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1972 209, 209, 210, 210, 211, 211, 212, 212, 213, 213,
1973 214, 214, 215, 215, 217, 216, 218, 216, 216, 216,
1974 216, 219, 216, 220, 216, 221, 216, 216, 216, 216,
1975 222, 223, 223, 224, 225, 225, 225, 226, 226, 227,
1976 227, 227, 227, 228, 229, 229, 230, 231, 231, 232,
1977 233, 234, 234, 235, 235, 235, 235, 235, 235, 235,
1978 235, 235, 235, 235, 236, 236, 236, 236, 237, 237,
1979 238, 239, 239, 240, 240, 241, 242, 242, 242, 243,
1980 243, 243, 243, 243, 243, 243, 243, 243, 244, 244,
1981 245, 246, 246, 247, 247, 247, 247, 247, 248, 248,
1982 249, 249, 250, 250, 250, 250, 250, 250, 250, 250,
1983 250, 250, 250, 250, 250, 250, 250, 251, 251, 252,
1984 252, 252, 252, 252, 252, 252, 252, 252
Dan Gohmanf4423b12008-04-19 00:24:39 +00001985};
1986
1987/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1988static const yytype_uint8 yyr2[] =
1989{
1990 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1993 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1994 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1995 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1996 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1997 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001998 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
1999 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2000 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2001 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2002 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2003 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2004 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2005 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2006 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2007 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2008 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2009 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2010 8, 8, 3, 1, 1, 1, 1, 0, 2, 6,
2011 1, 0, 1, 2, 0, 3, 0, 3, 3, 3,
2012 3, 0, 8, 0, 9, 0, 9, 5, 2, 3,
2013 1, 3, 3, 3, 3, 1, 0, 5, 3, 1,
2014 3, 1, 0, 10, 1, 1, 4, 1, 1, 2,
2015 3, 0, 1, 1, 1, 1, 1, 1, 1, 1,
2016 1, 3, 1, 5, 1, 1, 1, 1, 1, 1,
2017 2, 1, 3, 2, 2, 3, 2, 0, 1, 2,
2018 2, 3, 9, 9, 8, 14, 1, 1, 6, 5,
2019 2, 6, 7, 4, 4, 6, 6, 0, 0, 3,
2020 2, 1, 5, 5, 6, 6, 6, 6, 4, 6,
2021 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
2022 6, 3, 6, 2, 5, 7, 5, 4
Dan Gohmanf4423b12008-04-19 00:24:39 +00002023};
2024
2025/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2026 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2027 means the default is an error. */
2028static const yytype_uint16 yydefact[] =
2029{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002030 73, 61, 70, 62, 71, 63, 216, 214, 0, 0,
2031 0, 0, 0, 0, 84, 72, 0, 73, 212, 88,
2032 91, 0, 0, 228, 0, 0, 68, 0, 74, 75,
2033 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
2034 87, 84, 84, 207, 1, 213, 89, 90, 84, 217,
2035 92, 93, 94, 95, 84, 277, 215, 277, 0, 0,
2036 236, 229, 230, 218, 264, 265, 220, 139, 140, 141,
2037 144, 143, 142, 145, 146, 0, 0, 0, 0, 266,
2038 267, 147, 219, 149, 207, 207, 96, 206, 0, 99,
2039 99, 278, 274, 69, 247, 248, 249, 273, 231, 232,
2040 235, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2041 0, 0, 167, 0, 0, 0, 98, 97, 0, 204,
2042 205, 0, 0, 100, 101, 102, 103, 104, 0, 250,
2043 0, 318, 276, 0, 233, 166, 116, 162, 164, 0,
2044 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
2045 0, 161, 0, 160, 0, 227, 139, 140, 141, 144,
2046 143, 142, 0, 0, 67, 67, 105, 0, 244, 245,
2047 246, 317, 301, 0, 0, 0, 0, 99, 286, 287,
2048 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2049 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2050 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2051 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 275, 99, 290, 0, 316,
2053 234, 159, 0, 124, 67, 67, 158, 0, 169, 0,
2054 124, 67, 67, 0, 208, 187, 188, 183, 185, 184,
2055 186, 189, 182, 178, 179, 0, 0, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002056 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002057 0, 181, 180, 221, 0, 300, 280, 67, 271, 279,
2058 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2059 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2060 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
2061 47, 48, 0, 0, 0, 130, 130, 323, 67, 67,
2062 314, 0, 0, 0, 0, 0, 67, 67, 67, 0,
2063 0, 0, 0, 0, 107, 109, 108, 106, 110, 111,
2064 112, 113, 114, 117, 165, 163, 152, 153, 154, 157,
2065 66, 151, 223, 225, 0, 0, 0, 0, 0, 0,
2066 0, 0, 0, 0, 171, 203, 0, 0, 0, 175,
2067 0, 172, 0, 0, 0, 135, 242, 253, 254, 255,
2068 260, 256, 257, 258, 259, 251, 0, 262, 269, 268,
2069 270, 0, 0, 281, 0, 0, 67, 67, 67, 67,
2070 0, 319, 0, 321, 298, 0, 0, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 67, 0, 115,
2072 121, 120, 118, 119, 122, 123, 125, 135, 135, 0,
2073 0, 0, 0, 0, 298, 0, 0, 0, 0, 0,
2074 170, 156, 168, 0, 173, 174, 0, 0, 0, 0,
2075 222, 241, 116, 239, 0, 252, 0, 0, 272, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 327,
2077 0, 0, 0, 310, 311, 0, 0, 0, 0, 0,
2078 308, 0, 130, 0, 224, 226, 67, 0, 0, 0,
2079 0, 0, 0, 0, 0, 0, 202, 177, 0, 0,
2080 0, 0, 0, 0, 137, 135, 65, 0, 124, 0,
2081 261, 0, 0, 297, 0, 0, 0, 0, 130, 131,
2082 130, 0, 0, 0, 0, 0, 0, 326, 302, 303,
2083 297, 0, 324, 67, 209, 0, 0, 0, 0, 191,
2084 0, 0, 0, 0, 176, 0, 0, 67, 132, 138,
2085 136, 64, 238, 240, 116, 133, 0, 0, 0, 116,
2086 116, 0, 304, 305, 306, 307, 320, 322, 299, 0,
2087 0, 309, 312, 313, 0, 130, 0, 0, 0, 0,
2088 0, 199, 0, 0, 193, 194, 190, 65, 134, 128,
2089 263, 0, 0, 0, 0, 124, 0, 291, 0, 124,
2090 325, 195, 196, 197, 198, 0, 0, 0, 237, 0,
2091 126, 0, 284, 0, 0, 107, 109, 116, 116, 0,
2092 116, 116, 292, 315, 192, 200, 201, 129, 0, 243,
2093 282, 0, 283, 0, 294, 293, 0, 0, 0, 127,
2094 0, 0, 0, 116, 116, 0, 0, 0, 296, 295,
2095 289, 0, 0, 288, 0, 285
Dan Gohmanf4423b12008-04-19 00:24:39 +00002096};
2097
2098/* YYDEFGOTO[NTERM-NUM]. */
2099static const yytype_int16 yydefgoto[] =
2100{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002101 -1, 268, 269, 270, 295, 312, 162, 163, 79, 552,
2102 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
2103 118, 128, 343, 231, 426, 346, 629, 610, 401, 504,
2104 589, 450, 505, 81, 164, 137, 154, 138, 139, 110,
2105 365, 387, 366, 121, 88, 155, 16, 17, 18, 20,
2106 19, 375, 427, 428, 63, 23, 61, 101, 453, 454,
2107 129, 170, 55, 96, 56, 49, 456, 388, 83, 390,
2108 278, 279, 57, 92, 93, 225, 614, 132, 320, 561,
2109 469, 226, 227, 228, 229
Dan Gohmanf4423b12008-04-19 00:24:39 +00002110};
2111
2112/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2113 STATE-NUM. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002114#define YYPACT_NINF -560
Dan Gohmanf4423b12008-04-19 00:24:39 +00002115static const yytype_int16 yypact[] =
2116{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002117 590, -560, -560, -560, -560, -560, -560, -560, 9, -119,
2118 23, -66, 80, -43, -1, -560, 132, 897, -560, 131,
2119 219, 16, 43, -560, 48, 203, -560, 1564, -560, -560,
2120 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2121 -560, -6, -6, 230, -560, -560, -560, -560, -6, -560,
2122 -560, -560, -560, -560, -6, 211, -560, -10, 223, 234,
2123 246, -560, -560, -560, -560, -560, 119, -560, -560, -560,
2124 -560, -560, -560, -560, -560, 289, 296, 2, 227, -560,
2125 -560, -560, 3, -560, 266, 266, 247, -560, 34, 121,
2126 121, -560, -560, 233, -560, -560, -560, -560, -560, -560,
2127 -560, 67, 1400, -560, 146, 151, 830, 119, -560, 3,
2128 -102, 171, 1400, 159, 34, 34, -560, -560, 1441, -560,
2129 -560, 1682, 322, -560, -560, -560, -560, -560, 1723, -560,
2130 -16, 1902, -560, 306, -560, -560, 3, -560, 172, 176,
2131 1741, 1741, 168, -101, 1741, -560, 332, 182, -560, 1682,
2132 1741, 119, 184, 3, 252, -560, 102, 335, 339, 340,
2133 343, 345, 106, 346, 1164, 303, -560, 213, -560, -560,
2134 -560, -560, -560, 302, 1764, 52, 349, 121, -560, -560,
2135 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2136 -560, -560, -560, -560, -560, 591, 440, 591, 440, 1741,
2137 1741, 1741, 1741, -560, -560, -560, -560, -560, -560, -560,
2138 -560, -560, -560, -560, -560, 1741, 1741, 1741, 1741, 1741,
2139 1741, 1741, 1741, 1741, 1741, -560, 121, -560, 36, -560,
2140 -560, 200, 1461, -560, -20, -37, -560, 198, 3, 215,
2141 -560, 303, 4, 1441, -560, -560, -560, -560, -560, -560,
2142 -560, -560, -560, -560, -560, 591, 440, 591, 440, 217,
2143 218, 220, 222, 224, 1482, 1782, 1061, 351, 225, 226,
2144 237, -560, -560, -560, 240, -560, 119, 742, -560, 231,
2145 884, 884, -560, 884, 1723, -560, -560, -560, -560, -560,
2146 -560, -560, -560, -560, -560, 1741, -560, -560, -560, -560,
2147 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2148 -560, -560, 1741, 1741, 1741, -21, 24, -560, 742, -35,
2149 238, 241, 249, 254, 255, 256, 742, 742, 742, 366,
2150 1723, 1741, 1741, 373, -560, -560, -560, -560, -560, -560,
2151 -560, -560, -560, -560, -560, -560, 175, -560, -560, -560,
2152 -560, 175, -560, 159, 371, 260, 261, 262, 263, 1682,
2153 1682, 1682, 1682, 1682, -560, -560, 91, 1105, -96, -560,
2154 -69, -560, 1682, 1682, 1682, 264, 1502, -560, -560, -560,
2155 -560, -560, -560, -560, -560, 359, 1682, -560, -560, -560,
2156 -560, 1741, 265, -560, 267, 884, 742, 742, 742, 742,
2157 21, -560, 40, -560, -560, 884, 272, 1741, 1741, 1741,
2158 1741, 1741, 268, 269, 270, 1741, 884, 742, 276, -560,
2159 -560, -560, -560, -560, -560, -560, -560, 264, 264, 1741,
2160 1682, 1682, 1682, 1682, -560, 277, 280, 281, 282, 1682,
2161 -560, 259, 1015, -62, -560, -560, 287, 290, 408, 19,
2162 -560, -560, 3, 291, 294, -560, 428, -61, -560, 434,
2163 435, 299, 297, 301, 304, 305, 884, 452, 884, 307,
2164 308, 884, 311, 3, -560, 312, 313, 455, 884, 884,
2165 3, 309, 319, 1741, -560, -560, -15, 320, 325, 326,
2166 327, 137, 1682, 1682, 1682, 1682, -560, -560, 321, 1682,
2167 1682, 1741, 438, 482, -560, 264, 386, 1523, -560, 334,
2168 -560, 884, 884, 1805, 884, 884, 884, 884, 319, -560,
2169 319, 1741, 884, 336, 1741, 1741, 1741, -560, -560, -560,
2170 1805, 443, -560, 742, -560, 1682, 1682, 1682, 1682, -560,
2171 337, 347, 344, 348, -560, 354, 355, 15, -560, -560,
2172 -560, -560, -560, -560, 3, -18, 470, 356, 352, 5,
2173 3, 156, -560, -560, -560, -560, -560, -560, -560, 341,
2174 884, -560, -560, -560, 163, 319, 360, 362, 365, 369,
2175 1682, -560, 1682, 1682, -560, -560, -560, 386, -560, 457,
2176 -560, 497, -7, 577, 577, -560, 1846, -560, 372, -560,
2177 -560, -560, -560, -560, -560, 380, 382, 383, -560, 517,
2178 404, 884, -560, 1307, -2, 401, 402, -560, -560, 82,
2179 5, 3, -560, 175, -560, -560, -560, -560, 540, -560,
2180 -560, 406, -560, 1307, 200, 200, 547, 577, 577, -560,
2181 548, 409, 884, -560, -560, 884, 551, 496, 200, 200,
2182 -560, 884, 554, -560, 884, -560
Dan Gohmanf4423b12008-04-19 00:24:39 +00002183};
2184
2185/* YYPGOTO[NTERM-NUM]. */
2186static const yytype_int16 yypgoto[] =
2187{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002188 -560, 441, 442, 444, -174, -167, -173, -560, 0, -13,
2189 -141, 483, 13, -560, -560, -560, -560, 30, -560, -560,
2190 -560, -139, -560, -416, -560, -238, -560, -560, -311, 22,
2191 -560, -406, -560, -560, -26, 350, -120, -560, 471, 485,
2192 -64, -157, -251, 100, 194, 363, -560, -560, 571, -560,
2193 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2194 499, -560, -560, -560, -560, -560, -560, -559, -115, 162,
2195 -191, -560, -560, 535, -560, -560, -560, -560, -560, 63,
2196 160, -560, -560, -560, -560
Dan Gohmanf4423b12008-04-19 00:24:39 +00002197};
2198
2199/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2200 positive, shift that token. If negative, reduce the rule which
2201 number is the opposite. If zero, do what YYDEFACT says.
2202 If YYTABLE_NINF, syntax error. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002203#define YYTABLE_NINF -212
Dan Gohmanf4423b12008-04-19 00:24:39 +00002204static const yytype_int16 yytable[] =
2205{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002206 11, 82, 351, 283, 282, 403, 105, 271, 167, 282,
2207 317, 91, 168, 13, 368, 370, 502, 11, 111, 94,
2208 111, 484, 485, 313, 273, 321, 322, 323, 324, 325,
2209 13, 314, 466, 329, 111, 111, 506, 24, 284, 244,
2210 111, 29, 30, 31, 32, 33, 34, 35, 36, 272,
2211 37, 468, 109, 502, 631, 144, 144, 165, 111, 111,
2212 -145, 439, 21, 280, 145, 237, 119, 120, 444, 281,
2213 111, 84, 85, 503, 641, 467, 136, 22, 89, 111,
2214 109, 355, 25, 357, 90, 241, 136, 330, 439, 356,
2215 26, 358, 153, 11, 467, 439, 439, 445, 27, 550,
2216 352, 353, 153, 510, 498, -55, -55, -55, -55, 247,
2217 248, 249, 250, 28, 234, 235, 443, 112, 238, 112,
2218 636, 420, 421, 422, 242, 405, 423, 348, 245, 246,
2219 424, 425, 44, 112, 112, 457, 400, -67, 587, 112,
2220 534, 418, 347, 593, 594, 38, 39, 40, 277, 169,
2221 38, 39, 40, 331, 332, 612, 95, 112, 112, -145,
2222 632, -67, 389, -145, 395, 389, 389, 106, 389, 112,
2223 586, 532, 58, 315, 316, 277, 318, 46, 112, 47,
2224 274, 402, -67, 122, 123, 124, 125, 126, 127, 319,
2225 277, 277, 277, 277, 277, 326, 327, 328, 277, 59,
2226 458, 634, 635, 389, 637, 638, 136, 566, 60, 567,
2227 416, 389, 389, 389, 149, 150, 472, 153, 474, 475,
2228 476, 420, 421, 422, 133, 62, 423, 648, 649, 134,
2229 424, 425, 91, 2, 64, 65, 4, 107, 67, 68,
2230 69, 70, 71, 72, 73, 98, 1, 2, 439, 3,
2231 4, 5, 1, 440, 333, 3, 99, 5, 153, 64,
2232 65, 50, 51, 52, 600, 86, 53, 87, 100, 396,
2233 555, 1, 2, 102, 3, 4, 5, 74, 114, 115,
2234 389, 389, 389, 389, 389, 271, 397, 398, 399, 116,
2235 389, 117, 539, 103, 521, 434, 435, 436, 437, 438,
2236 104, 389, 389, 87, 153, 417, 277, 140, 446, 447,
2237 448, 595, 141, 596, 420, 421, 422, 148, 599, 423,
2238 596, 334, 335, 424, 425, 146, 166, 272, 230, 232,
2239 568, 233, 236, 571, 572, 573, 239, 240, 243, 336,
2240 337, 442, 338, 339, -56, 340, 341, 342, -57, -60,
2241 452, 389, -59, 389, -58, 251, 389, 619, 111, 275,
2242 282, 623, 349, 389, 389, 277, 487, 488, 489, 490,
2243 350, 359, 360, 371, 361, 496, 362, 419, 363, 372,
2244 373, 277, 473, 277, 277, 277, 75, 76, 391, 480,
2245 77, 374, 78, 108, 376, 406, 389, 389, 407, 389,
2246 389, 389, 389, 486, 415, 1, 408, 389, 3, 429,
2247 5, 409, 410, 411, 430, 431, 432, 433, 389, 613,
2248 455, 449, 459, 497, 460, 477, 478, 479, 540, 541,
2249 542, 543, 471, 483, 492, 545, 546, 493, 494, 495,
2250 333, 633, 392, 393, 499, 394, 501, 500, 507, 508,
2251 509, 511, 512, 513, 514, 389, 519, 533, 515, 527,
2252 548, 516, 517, 530, 521, 522, 296, 297, 524, 525,
2253 526, 576, 577, 578, 579, 547, 531, 535, 389, 389,
2254 404, 554, 536, 537, 538, 544, 549, 560, 412, 413,
2255 414, 556, 590, 570, 580, 277, 389, 467, 277, 277,
2256 277, 582, 581, 597, 560, 583, 551, 334, 335, 584,
2257 585, 609, 592, 591, 611, 601, 605, 602, 606, 607,
2258 603, 627, 389, 389, 604, 336, 337, 389, 338, 339,
2259 389, 340, 341, 342, 622, 624, 389, 625, 626, 389,
2260 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,
2261 308, 309, 310, 311, 628, -18, -19, 461, 462, 463,
2262 464, 465, 639, 640, 642, 645, 646, 470, 651, 652,
2263 621, 654, 222, 223, 608, 224, 131, 588, 481, 482,
2264 377, 378, 345, 147, 64, 65, 379, 551, 45, 130,
2265 -211, 143, 97, 574, 491, 0, 1, 2, 0, 3,
2266 4, 5, 380, 381, 382, 0, 354, 0, -69, 1,
2267 2, 0, 3, 4, 5, 0, 0, 383, 384, 0,
2268 6, 7, 0, 0, 0, 0, 0, 0, 518, 0,
2269 520, 333, 0, 523, 0, 0, 385, 0, 0, 0,
2270 528, 529, 8, 0, 0, 0, 9, 0, 0, 0,
2271 10, 0, 180, 181, 182, 183, 184, 185, 186, 187,
2272 188, 189, 190, 191, 192, 193, 194, 255, 256, 257,
2273 258, 0, 0, 557, 558, 0, 562, 563, 564, 565,
2274 0, 0, 0, 0, 569, 285, 286, 287, 288, 289,
2275 290, 291, 292, 293, 294, 575, 259, 203, 615, 616,
2276 206, 207, 208, 209, 210, 211, 212, 213, 214, 0,
2277 260, 0, 261, 262, 263, 0, 336, 337, 0, 338,
2278 339, 0, 340, 341, 342, 0, 0, 0, 0, 0,
2279 0, 0, 598, 0, 0, 0, 0, 0, 0, 0,
2280 386, 0, 0, 0, 0, 377, 378, 0, 0, 64,
2281 65, 379, 0, 0, 0, 617, 618, 0, 0, 0,
2282 0, 1, 2, 0, 3, 4, 5, 380, 381, 382,
2283 0, 0, 0, 630, 0, 0, 0, 0, 0, 0,
2284 0, 0, 383, 384, 0, 0, 0, 0, 0, 0,
2285 0, 0, 0, 0, 0, 0, 0, 111, 0, 643,
2286 644, 385, 0, 0, 647, 0, 0, 650, 0, 0,
2287 0, 0, 0, 653, 0, 0, 655, 180, 181, 182,
2288 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2289 193, 194, 255, 256, 257, 258, 0, 64, 65, 0,
2290 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2291 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2292 0, 259, 203, 204, 205, 206, 207, 208, 209, 210,
2293 211, 212, 213, 214, 0, 260, 0, 261, 262, 263,
2294 74, 0, 0, 0, 0, 0, 0, 377, 378, 0,
2295 0, 64, 65, 379, 0, 0, 112, -210, 0, 0,
2296 0, 0, 0, 1, 2, 386, 3, 4, 5, 380,
2297 381, 382, 0, 0, 0, -69, 1, 2, 0, 3,
2298 4, 5, 0, 0, 383, 384, 0, 6, 7, 0,
2299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2300 0, 0, 0, 385, 0, 0, 0, 0, 0, 8,
2301 0, 0, 0, 9, 0, 0, 0, 10, 0, 180,
Nate Begemanac80ade2008-05-12 19:01:56 +00002302 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002303 191, 192, 193, 194, 255, 256, 257, 258, 0, 0,
2304 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2305 76, 0, 0, 77, 0, 78, 142, 0, 0, 0,
2306 0, 0, 0, 259, 203, 204, 205, 206, 207, 208,
2307 209, 210, 211, 212, 213, 214, 0, 260, 0, 261,
2308 262, 263, 64, 65, 0, 0, 0, 0, 0, 0,
2309 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
2310 252, 0, 0, 0, 0, 0, 0, 386, 0, 0,
2311 0, 0, 0, 0, 0, 253, 254, 0, 0, 0,
2312 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2313 111, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2314 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
Chris Lattnercc81d152008-05-04 17:18:47 +00002315 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002316 190, 191, 192, 193, 194, 255, 256, 257, 258, 0,
2317 0, 74, 64, 65, 0, 107, 156, 157, 158, 159,
2318 160, 161, 73, 0, 1, 2, 0, 3, 4, 5,
2319 0, 0, 0, 0, 259, 203, 204, 205, 206, 207,
2320 208, 209, 210, 211, 212, 213, 214, 0, 260, 0,
2321 261, 262, 263, 0, 0, 74, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 0, 0, 112,
2323 0, 64, 65, -67, 0, 264, 0, 0, 265, 0,
2324 266, 0, 267, 1, 2, 0, 3, 4, 5, 252,
Nate Begemanac80ade2008-05-12 19:01:56 +00002325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002326 0, 0, 0, 0, 253, 254, 0, 0, 0, 0,
2327 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2328 75, 76, 0, 0, 77, 0, 78, 369, 0, 0,
2329 0, 0, 0, 0, 0, 0, 0, 0, 0, 180,
2330 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2331 191, 192, 193, 194, 255, 256, 257, 258, 0, 0,
2332 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2333 78, 441, 0, 0, 0, 0, 0, 0, 0, 0,
2334 0, 0, 0, 259, 203, 204, 205, 206, 207, 208,
2335 209, 210, 211, 212, 213, 214, 0, 260, 0, 261,
2336 262, 263, 0, 0, 0, 0, 0, 0, 0, 0,
2337 377, 378, 0, 0, 0, 0, 379, 0, 112, 0,
2338 0, 0, 0, 0, 264, 0, 0, 265, 0, 266,
2339 0, 267, 380, 381, 382, 0, 0, 0, 0, 0,
2340 0, 0, 0, 0, 0, 0, 0, 383, 384, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002342 0, 0, 0, 0, 0, 0, 385, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002344 0, 0, 180, 181, 182, 183, 184, 185, 186, 187,
2345 188, 189, 190, 191, 192, 193, 194, 255, 256, 257,
2346 258, 0, 0, 0, 0, 0, 0, 64, 65, 0,
2347 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2348 2, 0, 3, 4, 5, 0, 259, 203, 204, 205,
2349 206, 207, 208, 209, 210, 211, 212, 213, 214, 135,
2350 260, 0, 261, 262, 263, 0, 0, 0, 64, 65,
2351 74, 151, 67, 68, 69, 70, 71, 72, 73, 0,
2352 1, 2, 0, 3, 4, 5, 0, 0, 64, 65,
2353 386, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2354 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2355 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2356 344, 1, 2, 0, 3, 4, 5, 0, 0, 64,
2357 65, 74, 107, 67, 68, 69, 70, 71, 72, 73,
2358 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2359 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2360 73, 451, 1, 2, 0, 3, 4, 5, 0, 0,
2361 0, 0, 74, 0, 0, 0, 0, 0, 0, 75,
2362 76, 0, 553, 77, 0, 78, 152, 0, 0, 0,
2363 0, 64, 65, 74, 66, 67, 68, 69, 70, 71,
2364 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002366 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2367 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2368 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
Chris Lattnercc81d152008-05-04 17:18:47 +00002369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002370 0, 75, 76, 0, 364, 77, 0, 78, 0, 0,
2371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2372 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2374 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2375 65, 0, 107, 156, 157, 158, 159, 160, 161, 73,
Chris Lattnercc81d152008-05-04 17:18:47 +00002376 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002378 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2379 64, 65, 74, 151, 67, 68, 69, 70, 71, 72,
2380 73, 0, 1, 2, 0, 3, 4, 5, 64, 65,
2381 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2382 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2383 0, 64, 65, 74, 276, 67, 68, 69, 70, 71,
2384 72, 73, 0, 1, 2, 0, 3, 4, 5, 64,
2385 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2386 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2387 0, 0, 64, 65, 74, 107, 67, 68, 69, 70,
2388 71, 72, 559, 0, 1, 2, 0, 3, 4, 5,
2389 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2390 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2391 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
2392 70, 71, 72, 620, 0, 1, 2, 0, 3, 4,
2393 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2394 0, 0, 75, 76, 0, 0, 77, 0, 78, 0,
2395 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
2396 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
Chris Lattnercc81d152008-05-04 17:18:47 +00002397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002398 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2399 0, 0, 0, 0, 0, 0, 0, 0, 171, 0,
2400 0, 75, 76, 0, 0, 77, 0, 367, 0, 0,
2401 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
2402 173, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2403 78, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2404 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2405 193, 194, 195, 196, 197, 198, 0, 0, 0, 0,
2406 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2407 0, 78, 0, 0, 0, 0, 199, 200, 201, 0,
2408 0, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2409 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
2410 221
Dan Gohmanf4423b12008-04-19 00:24:39 +00002411};
2412
2413static const yytype_int16 yycheck[] =
2414{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002415 0, 27, 240, 176, 11, 316, 4, 164, 128, 11,
2416 201, 21, 28, 0, 265, 266, 34, 17, 55, 29,
2417 55, 427, 428, 197, 165, 216, 217, 218, 219, 220,
2418 17, 198, 11, 224, 55, 55, 452, 156, 177, 154,
2419 55, 42, 43, 44, 45, 46, 47, 48, 49, 164,
2420 51, 11, 78, 34, 613, 157, 157, 121, 55, 55,
2421 55, 157, 53, 11, 166, 166, 32, 33, 164, 17,
2422 55, 41, 42, 54, 633, 54, 102, 68, 48, 55,
2423 106, 255, 59, 257, 54, 149, 112, 226, 157, 256,
2424 156, 258, 118, 93, 54, 157, 157, 166, 18, 505,
2425 241, 242, 128, 164, 166, 3, 4, 5, 6, 3,
2426 4, 5, 6, 156, 140, 141, 367, 154, 144, 154,
2427 38, 139, 140, 141, 150, 160, 144, 164, 26, 27,
2428 148, 149, 0, 154, 154, 386, 157, 158, 554, 154,
2429 155, 332, 162, 559, 560, 151, 152, 153, 174, 165,
2430 151, 152, 153, 117, 118, 162, 166, 154, 154, 154,
2431 162, 158, 277, 158, 284, 280, 281, 165, 283, 154,
2432 155, 482, 156, 199, 200, 201, 202, 46, 154, 48,
2433 167, 157, 158, 62, 63, 64, 65, 66, 67, 215,
2434 216, 217, 218, 219, 220, 221, 222, 223, 224, 156,
2435 391, 617, 618, 318, 620, 621, 232, 518, 160, 520,
2436 330, 326, 327, 328, 114, 115, 407, 243, 409, 410,
2437 411, 139, 140, 141, 157, 22, 144, 643, 644, 162,
2438 148, 149, 21, 20, 7, 8, 23, 10, 11, 12,
2439 13, 14, 15, 16, 17, 22, 19, 20, 157, 22,
2440 23, 24, 19, 162, 54, 22, 22, 24, 284, 7,
2441 8, 42, 43, 44, 575, 35, 47, 37, 22, 295,
2442 508, 19, 20, 154, 22, 23, 24, 50, 84, 85,
2443 395, 396, 397, 398, 399, 442, 312, 313, 314, 42,
2444 405, 44, 155, 4, 157, 359, 360, 361, 362, 363,
2445 4, 416, 417, 37, 330, 331, 332, 161, 372, 373,
2446 374, 155, 161, 157, 139, 140, 141, 158, 155, 144,
2447 157, 121, 122, 148, 149, 154, 4, 442, 22, 157,
2448 521, 155, 164, 524, 525, 526, 4, 155, 154, 139,
2449 140, 367, 142, 143, 9, 145, 146, 147, 9, 9,
2450 376, 466, 9, 468, 9, 9, 471, 595, 55, 57,
2451 11, 599, 164, 478, 479, 391, 430, 431, 432, 433,
2452 155, 154, 154, 22, 154, 439, 154, 4, 154, 154,
2453 154, 407, 408, 409, 410, 411, 159, 160, 157, 415,
2454 163, 154, 165, 166, 154, 157, 511, 512, 157, 514,
2455 515, 516, 517, 429, 38, 19, 157, 522, 22, 38,
2456 24, 157, 157, 157, 154, 154, 154, 154, 533, 592,
2457 61, 157, 157, 164, 157, 157, 157, 157, 492, 493,
2458 494, 495, 160, 157, 157, 499, 500, 157, 157, 157,
2459 54, 614, 280, 281, 157, 283, 38, 157, 157, 155,
2460 22, 17, 17, 154, 157, 570, 4, 483, 157, 4,
2461 22, 157, 157, 154, 157, 157, 26, 27, 157, 157,
2462 157, 535, 536, 537, 538, 501, 157, 157, 593, 594,
2463 318, 507, 157, 157, 157, 164, 4, 513, 326, 327,
2464 328, 157, 22, 157, 157, 521, 611, 54, 524, 525,
2465 526, 157, 155, 162, 530, 157, 506, 121, 122, 155,
2466 155, 54, 160, 157, 17, 155, 580, 155, 582, 583,
2467 155, 4, 637, 638, 155, 139, 140, 642, 142, 143,
2468 645, 145, 146, 147, 162, 155, 651, 155, 155, 654,
2469 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2470 110, 111, 112, 113, 150, 154, 154, 395, 396, 397,
2471 398, 399, 22, 157, 17, 17, 157, 405, 17, 73,
2472 596, 17, 131, 131, 587, 131, 93, 555, 416, 417,
2473 3, 4, 232, 112, 7, 8, 9, 587, 17, 90,
2474 0, 106, 57, 530, 434, -1, 19, 20, -1, 22,
2475 23, 24, 25, 26, 27, -1, 243, -1, 18, 19,
2476 20, -1, 22, 23, 24, -1, -1, 40, 41, -1,
2477 30, 31, -1, -1, -1, -1, -1, -1, 466, -1,
2478 468, 54, -1, 471, -1, -1, 59, -1, -1, -1,
2479 478, 479, 52, -1, -1, -1, 56, -1, -1, -1,
2480 60, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2481 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2482 93, -1, -1, 511, 512, -1, 514, 515, 516, 517,
2483 -1, -1, -1, -1, 522, 94, 95, 96, 97, 98,
2484 99, 100, 101, 102, 103, 533, 119, 120, 121, 122,
2485 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2486 133, -1, 135, 136, 137, -1, 139, 140, -1, 142,
2487 143, -1, 145, 146, 147, -1, -1, -1, -1, -1,
2488 -1, -1, 570, -1, -1, -1, -1, -1, -1, -1,
2489 163, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2490 8, 9, -1, -1, -1, 593, 594, -1, -1, -1,
2491 -1, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2492 -1, -1, -1, 611, -1, -1, -1, -1, -1, -1,
2493 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2494 -1, -1, -1, -1, -1, -1, -1, 55, -1, 637,
2495 638, 59, -1, -1, 642, -1, -1, 645, -1, -1,
2496 -1, -1, -1, 651, -1, -1, 654, 75, 76, 77,
2497 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2498 88, 89, 90, 91, 92, 93, -1, 7, 8, -1,
2499 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2500 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2501 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2502 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2503 50, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2504 -1, 7, 8, 9, -1, -1, 154, 0, -1, -1,
2505 -1, -1, -1, 19, 20, 163, 22, 23, 24, 25,
2506 26, 27, -1, -1, -1, 18, 19, 20, -1, 22,
2507 23, 24, -1, -1, 40, 41, -1, 30, 31, -1,
2508 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2509 -1, -1, -1, 59, -1, -1, -1, -1, -1, 52,
2510 -1, -1, -1, 56, -1, -1, -1, 60, -1, 75,
Nate Begemanac80ade2008-05-12 19:01:56 +00002511 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002512 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, 159,
2514 160, -1, -1, 163, -1, 165, 166, -1, -1, -1,
2515 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2516 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2517 136, 137, 7, 8, -1, -1, -1, -1, -1, -1,
2518 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
2519 25, -1, -1, -1, -1, -1, -1, 163, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002520 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002521 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2522 55, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2523 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002524 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002525 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2526 -1, 50, 7, 8, -1, 10, 11, 12, 13, 14,
2527 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2528 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2529 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2530 135, 136, 137, -1, -1, 50, -1, -1, -1, -1,
2531 -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
2532 -1, 7, 8, 158, -1, 160, -1, -1, 163, -1,
2533 165, -1, 167, 19, 20, -1, 22, 23, 24, 25,
Nate Begemanac80ade2008-05-12 19:01:56 +00002534 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002535 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2536 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2537 159, 160, -1, -1, 163, -1, 165, 166, -1, -1,
2538 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2539 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2540 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2541 -1, -1, -1, -1, 159, 160, -1, -1, 163, -1,
2542 165, 166, -1, -1, -1, -1, -1, -1, -1, -1,
2543 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2544 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2545 136, 137, -1, -1, -1, -1, -1, -1, -1, -1,
2546 3, 4, -1, -1, -1, -1, 9, -1, 154, -1,
2547 -1, -1, -1, -1, 160, -1, -1, 163, -1, 165,
2548 -1, 167, 25, 26, 27, -1, -1, -1, -1, -1,
2549 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
Nate Begemanac80ade2008-05-12 19:01:56 +00002550 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002551 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002552 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002553 -1, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2554 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2555 93, -1, -1, -1, -1, -1, -1, 7, 8, -1,
Nate Begemanac80ade2008-05-12 19:01:56 +00002556 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002557 20, -1, 22, 23, 24, -1, 119, 120, 121, 122,
2558 123, 124, 125, 126, 127, 128, 129, 130, 131, 39,
2559 133, -1, 135, 136, 137, -1, -1, -1, 7, 8,
2560 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2561 19, 20, -1, 22, 23, 24, -1, -1, 7, 8,
2562 163, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2563 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2564 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2565 39, 19, 20, -1, 22, 23, 24, -1, -1, 7,
2566 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2567 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2568 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2569 17, 39, 19, 20, -1, 22, 23, 24, -1, -1,
2570 -1, -1, 50, -1, -1, -1, -1, -1, -1, 159,
2571 160, -1, 39, 163, -1, 165, 125, -1, -1, -1,
2572 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
Chris Lattnercc81d152008-05-04 17:18:47 +00002573 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002575 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2576 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2577 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2578 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2579 -1, 159, 160, -1, 162, 163, -1, 165, -1, -1,
2580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2581 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2583 -1, -1, 159, 160, -1, -1, 163, -1, 165, 7,
Chris Lattnercc81d152008-05-04 17:18:47 +00002584 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2585 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2586 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002587 -1, -1, -1, 159, 160, -1, -1, 163, -1, 165,
2588 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
Nate Begemanac80ade2008-05-12 19:01:56 +00002589 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
2590 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002591 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2592 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2593 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2594 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2595 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2596 -1, -1, 7, 8, 50, 10, 11, 12, 13, 14,
2597 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2598 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2599 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2600 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2601 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2602 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2603 -1, -1, 159, 160, -1, -1, 163, -1, 165, -1,
2604 -1, -1, -1, -1, -1, -1, 50, -1, -1, -1,
2605 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002606 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002607 -1, -1, -1, 159, 160, -1, -1, 163, -1, 165,
2608 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2609 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2610 -1, -1, -1, -1, -1, -1, -1, -1, -1, 57,
2611 58, -1, -1, -1, 159, 160, -1, -1, 163, -1,
2612 165, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2613 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2614 88, 89, 90, 91, 92, 93, -1, -1, -1, -1,
2615 -1, -1, -1, -1, -1, 159, 160, -1, -1, 163,
2616 -1, 165, -1, -1, -1, -1, 114, 115, 116, -1,
2617 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2618 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
2619 138
Dan Gohmanf4423b12008-04-19 00:24:39 +00002620};
2621
2622/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2623 symbol of state STATE-NUM. */
2624static const yytype_uint8 yystos[] =
2625{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002626 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2627 60, 176, 179, 180, 181, 182, 214, 215, 216, 218,
2628 217, 53, 68, 223, 156, 59, 156, 18, 156, 42,
2629 43, 44, 45, 46, 47, 48, 49, 51, 151, 152,
2630 153, 183, 184, 185, 0, 216, 46, 48, 186, 233,
2631 42, 43, 44, 47, 187, 230, 232, 240, 156, 156,
2632 160, 224, 22, 222, 7, 8, 10, 11, 12, 13,
2633 14, 15, 16, 17, 50, 159, 160, 163, 165, 176,
2634 180, 201, 202, 236, 185, 185, 35, 37, 212, 185,
2635 185, 21, 241, 242, 29, 166, 231, 241, 22, 22,
2636 22, 225, 154, 4, 4, 4, 165, 10, 166, 202,
2637 207, 55, 154, 178, 212, 212, 42, 44, 188, 32,
2638 33, 211, 62, 63, 64, 65, 66, 67, 189, 228,
2639 228, 179, 245, 157, 162, 39, 202, 203, 205, 206,
2640 161, 161, 166, 207, 157, 166, 154, 206, 158, 211,
2641 211, 10, 125, 202, 204, 213, 11, 12, 13, 14,
2642 15, 16, 174, 175, 202, 208, 4, 204, 28, 165,
2643 229, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnercc81d152008-05-04 17:18:47 +00002644 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002645 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2646 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begemanac80ade2008-05-12 19:01:56 +00002647 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002648 137, 138, 169, 170, 171, 243, 249, 250, 251, 252,
2649 22, 191, 157, 155, 202, 202, 164, 166, 202, 4,
2650 155, 208, 202, 154, 236, 26, 27, 3, 4, 5,
2651 6, 9, 25, 40, 41, 90, 91, 92, 93, 119,
2652 133, 135, 136, 137, 160, 163, 165, 167, 169, 170,
2653 171, 209, 236, 178, 180, 57, 10, 202, 238, 239,
2654 11, 17, 11, 174, 189, 94, 95, 96, 97, 98,
2655 99, 100, 101, 102, 103, 172, 26, 27, 100, 101,
Nate Begemanac80ade2008-05-12 19:01:56 +00002656 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002657 112, 113, 173, 172, 173, 202, 202, 238, 202, 202,
2658 246, 238, 238, 238, 238, 238, 202, 202, 202, 238,
2659 189, 117, 118, 54, 121, 122, 139, 140, 142, 143,
2660 145, 146, 147, 190, 39, 203, 193, 162, 164, 164,
2661 155, 193, 178, 178, 213, 172, 173, 172, 173, 154,
2662 154, 154, 154, 154, 162, 208, 210, 165, 210, 166,
2663 210, 22, 154, 154, 154, 219, 154, 3, 4, 9,
2664 25, 26, 27, 40, 41, 59, 163, 209, 235, 236,
2665 237, 157, 237, 237, 237, 204, 202, 202, 202, 202,
2666 157, 196, 157, 196, 237, 160, 157, 157, 157, 157,
2667 157, 157, 237, 237, 237, 38, 204, 202, 238, 4,
2668 139, 140, 141, 144, 148, 149, 192, 220, 221, 38,
2669 154, 154, 154, 154, 208, 208, 208, 208, 208, 157,
2670 162, 166, 202, 210, 164, 166, 208, 208, 208, 157,
2671 199, 39, 202, 226, 227, 61, 234, 210, 238, 157,
2672 157, 237, 237, 237, 237, 237, 11, 54, 11, 248,
2673 237, 160, 238, 202, 238, 238, 238, 157, 157, 157,
2674 202, 237, 237, 157, 199, 199, 202, 208, 208, 208,
2675 208, 248, 157, 157, 157, 157, 208, 164, 166, 157,
2676 157, 38, 34, 54, 197, 200, 191, 157, 155, 22,
2677 164, 17, 17, 154, 157, 157, 157, 157, 237, 4,
2678 237, 157, 157, 237, 157, 157, 157, 4, 237, 237,
2679 154, 157, 196, 202, 155, 157, 157, 157, 157, 155,
2680 208, 208, 208, 208, 164, 208, 208, 202, 22, 4,
2681 199, 176, 177, 39, 202, 193, 157, 237, 237, 17,
2682 202, 247, 237, 237, 237, 237, 196, 196, 238, 237,
2683 157, 238, 238, 238, 247, 237, 208, 208, 208, 208,
2684 157, 155, 157, 157, 155, 155, 155, 191, 197, 198,
2685 22, 157, 160, 191, 191, 155, 157, 162, 237, 155,
2686 196, 155, 155, 155, 155, 208, 208, 208, 177, 54,
2687 195, 17, 162, 174, 244, 121, 122, 237, 237, 193,
2688 17, 202, 162, 193, 155, 155, 155, 4, 150, 194,
2689 237, 235, 162, 174, 191, 191, 38, 191, 191, 22,
2690 157, 235, 17, 237, 237, 17, 157, 237, 191, 191,
2691 237, 17, 73, 237, 17, 237
Dan Gohmanf4423b12008-04-19 00:24:39 +00002692};
David Greene718fda32007-08-01 03:59:32 +00002693
Reid Spencer68a24bd2005-08-27 18:50:39 +00002694#define yyerrok (yyerrstatus = 0)
2695#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002696#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002697#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002698
Reid Spencer68a24bd2005-08-27 18:50:39 +00002699#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002700#define YYABORT goto yyabortlab
2701#define YYERROR goto yyerrorlab
2702
2703
2704/* Like YYERROR except do call yyerror. This remains here temporarily
2705 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002706 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002707
Reid Spencer68a24bd2005-08-27 18:50:39 +00002708#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002709
Reid Spencer68a24bd2005-08-27 18:50:39 +00002710#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002711
2712#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002713do \
2714 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002715 { \
2716 yychar = (Token); \
2717 yylval = (Value); \
2718 yytoken = YYTRANSLATE (yychar); \
2719 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002720 goto yybackup; \
2721 } \
2722 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002723 { \
2724 yyerror (YY_("syntax error: cannot back up")); \
2725 YYERROR; \
2726 } \
2727while (YYID (0))
2728
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002729
Reid Spencer68a24bd2005-08-27 18:50:39 +00002730#define YYTERROR 1
2731#define YYERRCODE 256
2732
Dan Gohmanf4423b12008-04-19 00:24:39 +00002733
2734/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2735 If N is 0, then set CURRENT to the empty location which ends
2736 the previous symbol: RHS[0] (always defined). */
2737
2738#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2739#ifndef YYLLOC_DEFAULT
2740# define YYLLOC_DEFAULT(Current, Rhs, N) \
2741 do \
2742 if (YYID (N)) \
2743 { \
2744 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2745 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2746 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2747 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2748 } \
2749 else \
2750 { \
2751 (Current).first_line = (Current).last_line = \
2752 YYRHSLOC (Rhs, 0).last_line; \
2753 (Current).first_column = (Current).last_column = \
2754 YYRHSLOC (Rhs, 0).last_column; \
2755 } \
2756 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002757#endif
2758
Dan Gohmanf4423b12008-04-19 00:24:39 +00002759
2760/* YY_LOCATION_PRINT -- Print the location on the stream.
2761 This macro was not mandated originally: define only if we know
2762 we won't break user code: when these are the locations we know. */
2763
2764#ifndef YY_LOCATION_PRINT
2765# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2766# define YY_LOCATION_PRINT(File, Loc) \
2767 fprintf (File, "%d.%d-%d.%d", \
2768 (Loc).first_line, (Loc).first_column, \
2769 (Loc).last_line, (Loc).last_column)
2770# else
2771# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2772# endif
2773#endif
2774
2775
2776/* YYLEX -- calling `yylex' with the right arguments. */
2777
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002778#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002779# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002780#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002781# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002782#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002783
2784/* Enable debugging if requested. */
2785#if YYDEBUG
2786
2787# ifndef YYFPRINTF
2788# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2789# define YYFPRINTF fprintf
2790# endif
2791
2792# define YYDPRINTF(Args) \
2793do { \
2794 if (yydebug) \
2795 YYFPRINTF Args; \
2796} while (YYID (0))
2797
2798# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2799do { \
2800 if (yydebug) \
2801 { \
2802 YYFPRINTF (stderr, "%s ", Title); \
2803 yy_symbol_print (stderr, \
2804 Type, Value); \
2805 YYFPRINTF (stderr, "\n"); \
2806 } \
2807} while (YYID (0))
2808
2809
2810/*--------------------------------.
2811| Print this symbol on YYOUTPUT. |
2812`--------------------------------*/
2813
2814/*ARGSUSED*/
2815#if (defined __STDC__ || defined __C99__FUNC__ \
2816 || defined __cplusplus || defined _MSC_VER)
2817static void
2818yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002819#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002820static void
2821yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2822 FILE *yyoutput;
2823 int yytype;
2824 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002825#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002826{
2827 if (!yyvaluep)
2828 return;
2829# ifdef YYPRINT
2830 if (yytype < YYNTOKENS)
2831 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2832# else
2833 YYUSE (yyoutput);
2834# endif
2835 switch (yytype)
2836 {
2837 default:
2838 break;
2839 }
2840}
2841
2842
2843/*--------------------------------.
2844| Print this symbol on YYOUTPUT. |
2845`--------------------------------*/
2846
2847#if (defined __STDC__ || defined __C99__FUNC__ \
2848 || defined __cplusplus || defined _MSC_VER)
2849static void
2850yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2851#else
2852static void
2853yy_symbol_print (yyoutput, yytype, yyvaluep)
2854 FILE *yyoutput;
2855 int yytype;
2856 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002857#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002858{
2859 if (yytype < YYNTOKENS)
2860 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2861 else
2862 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00002863
Dan Gohmanf4423b12008-04-19 00:24:39 +00002864 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2865 YYFPRINTF (yyoutput, ")");
2866}
Chris Lattner38905612008-02-19 04:36:25 +00002867
Dan Gohmanf4423b12008-04-19 00:24:39 +00002868/*------------------------------------------------------------------.
2869| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2870| TOP (included). |
2871`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00002872
Dan Gohmanf4423b12008-04-19 00:24:39 +00002873#if (defined __STDC__ || defined __C99__FUNC__ \
2874 || defined __cplusplus || defined _MSC_VER)
2875static void
2876yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2877#else
2878static void
2879yy_stack_print (bottom, top)
2880 yytype_int16 *bottom;
2881 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002882#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002883{
2884 YYFPRINTF (stderr, "Stack now");
2885 for (; bottom <= top; ++bottom)
2886 YYFPRINTF (stderr, " %d", *bottom);
2887 YYFPRINTF (stderr, "\n");
2888}
Chris Lattner38905612008-02-19 04:36:25 +00002889
Dan Gohmanf4423b12008-04-19 00:24:39 +00002890# define YY_STACK_PRINT(Bottom, Top) \
2891do { \
2892 if (yydebug) \
2893 yy_stack_print ((Bottom), (Top)); \
2894} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00002895
Dan Gohmanf4423b12008-04-19 00:24:39 +00002896
2897/*------------------------------------------------.
2898| Report that the YYRULE is going to be reduced. |
2899`------------------------------------------------*/
2900
2901#if (defined __STDC__ || defined __C99__FUNC__ \
2902 || defined __cplusplus || defined _MSC_VER)
2903static void
2904yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2905#else
2906static void
2907yy_reduce_print (yyvsp, yyrule)
2908 YYSTYPE *yyvsp;
2909 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00002910#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002911{
2912 int yynrhs = yyr2[yyrule];
2913 int yyi;
2914 unsigned long int yylno = yyrline[yyrule];
2915 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2916 yyrule - 1, yylno);
2917 /* The symbols being reduced. */
2918 for (yyi = 0; yyi < yynrhs; yyi++)
2919 {
2920 fprintf (stderr, " $%d = ", yyi + 1);
2921 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2922 &(yyvsp[(yyi + 1) - (yynrhs)])
2923 );
2924 fprintf (stderr, "\n");
2925 }
2926}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002927
Dan Gohmanf4423b12008-04-19 00:24:39 +00002928# define YY_REDUCE_PRINT(Rule) \
2929do { \
2930 if (yydebug) \
2931 yy_reduce_print (yyvsp, Rule); \
2932} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002933
Dan Gohmanf4423b12008-04-19 00:24:39 +00002934/* Nonzero means print parse trace. It is left uninitialized so that
2935 multiple parsers can coexist. */
2936int yydebug;
2937#else /* !YYDEBUG */
2938# define YYDPRINTF(Args)
2939# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2940# define YY_STACK_PRINT(Bottom, Top)
2941# define YY_REDUCE_PRINT(Rule)
2942#endif /* !YYDEBUG */
2943
2944
2945/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002946#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00002947# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002948#endif
2949
Dan Gohmanf4423b12008-04-19 00:24:39 +00002950/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2951 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002952
Dan Gohmanf4423b12008-04-19 00:24:39 +00002953 Do not make this value too large; the results are undefined if
2954 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2955 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00002956
Reid Spencer68a24bd2005-08-27 18:50:39 +00002957#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00002958# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002959#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002960
Reid Spencer68a24bd2005-08-27 18:50:39 +00002961
2962
Dan Gohmanf4423b12008-04-19 00:24:39 +00002963#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002964
Dan Gohmanf4423b12008-04-19 00:24:39 +00002965# ifndef yystrlen
2966# if defined __GLIBC__ && defined _STRING_H
2967# define yystrlen strlen
2968# else
2969/* Return the length of YYSTR. */
2970#if (defined __STDC__ || defined __C99__FUNC__ \
2971 || defined __cplusplus || defined _MSC_VER)
2972static YYSIZE_T
2973yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00002974#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002975static YYSIZE_T
2976yystrlen (yystr)
2977 const char *yystr;
2978#endif
2979{
2980 YYSIZE_T yylen;
2981 for (yylen = 0; yystr[yylen]; yylen++)
2982 continue;
2983 return yylen;
2984}
2985# endif
2986# endif
2987
2988# ifndef yystpcpy
2989# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2990# define yystpcpy stpcpy
2991# else
2992/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2993 YYDEST. */
2994#if (defined __STDC__ || defined __C99__FUNC__ \
2995 || defined __cplusplus || defined _MSC_VER)
2996static char *
2997yystpcpy (char *yydest, const char *yysrc)
2998#else
2999static char *
3000yystpcpy (yydest, yysrc)
3001 char *yydest;
3002 const char *yysrc;
3003#endif
3004{
3005 char *yyd = yydest;
3006 const char *yys = yysrc;
3007
3008 while ((*yyd++ = *yys++) != '\0')
3009 continue;
3010
3011 return yyd - 1;
3012}
3013# endif
3014# endif
3015
3016# ifndef yytnamerr
3017/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3018 quotes and backslashes, so that it's suitable for yyerror. The
3019 heuristic is that double-quoting is unnecessary unless the string
3020 contains an apostrophe, a comma, or backslash (other than
3021 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3022 null, do not copy; instead, return the length of what the result
3023 would have been. */
3024static YYSIZE_T
3025yytnamerr (char *yyres, const char *yystr)
3026{
3027 if (*yystr == '"')
3028 {
3029 YYSIZE_T yyn = 0;
3030 char const *yyp = yystr;
3031
3032 for (;;)
3033 switch (*++yyp)
3034 {
3035 case '\'':
3036 case ',':
3037 goto do_not_strip_quotes;
3038
3039 case '\\':
3040 if (*++yyp != '\\')
3041 goto do_not_strip_quotes;
3042 /* Fall through. */
3043 default:
3044 if (yyres)
3045 yyres[yyn] = *yyp;
3046 yyn++;
3047 break;
3048
3049 case '"':
3050 if (yyres)
3051 yyres[yyn] = '\0';
3052 return yyn;
3053 }
3054 do_not_strip_quotes: ;
3055 }
3056
3057 if (! yyres)
3058 return yystrlen (yystr);
3059
3060 return yystpcpy (yyres, yystr) - yyres;
3061}
3062# endif
3063
3064/* Copy into YYRESULT an error message about the unexpected token
3065 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3066 including the terminating null byte. If YYRESULT is null, do not
3067 copy anything; just return the number of bytes that would be
3068 copied. As a special case, return 0 if an ordinary "syntax error"
3069 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3070 size calculation. */
3071static YYSIZE_T
3072yysyntax_error (char *yyresult, int yystate, int yychar)
3073{
3074 int yyn = yypact[yystate];
3075
3076 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3077 return 0;
3078 else
3079 {
3080 int yytype = YYTRANSLATE (yychar);
3081 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3082 YYSIZE_T yysize = yysize0;
3083 YYSIZE_T yysize1;
3084 int yysize_overflow = 0;
3085 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3086 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3087 int yyx;
3088
3089# if 0
3090 /* This is so xgettext sees the translatable formats that are
3091 constructed on the fly. */
3092 YY_("syntax error, unexpected %s");
3093 YY_("syntax error, unexpected %s, expecting %s");
3094 YY_("syntax error, unexpected %s, expecting %s or %s");
3095 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3096 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3097# endif
3098 char *yyfmt;
3099 char const *yyf;
3100 static char const yyunexpected[] = "syntax error, unexpected %s";
3101 static char const yyexpecting[] = ", expecting %s";
3102 static char const yyor[] = " or %s";
3103 char yyformat[sizeof yyunexpected
3104 + sizeof yyexpecting - 1
3105 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3106 * (sizeof yyor - 1))];
3107 char const *yyprefix = yyexpecting;
3108
3109 /* Start YYX at -YYN if negative to avoid negative indexes in
3110 YYCHECK. */
3111 int yyxbegin = yyn < 0 ? -yyn : 0;
3112
3113 /* Stay within bounds of both yycheck and yytname. */
3114 int yychecklim = YYLAST - yyn + 1;
3115 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3116 int yycount = 1;
3117
3118 yyarg[0] = yytname[yytype];
3119 yyfmt = yystpcpy (yyformat, yyunexpected);
3120
3121 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3122 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3123 {
3124 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3125 {
3126 yycount = 1;
3127 yysize = yysize0;
3128 yyformat[sizeof yyunexpected - 1] = '\0';
3129 break;
3130 }
3131 yyarg[yycount++] = yytname[yyx];
3132 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3133 yysize_overflow |= (yysize1 < yysize);
3134 yysize = yysize1;
3135 yyfmt = yystpcpy (yyfmt, yyprefix);
3136 yyprefix = yyor;
3137 }
3138
3139 yyf = YY_(yyformat);
3140 yysize1 = yysize + yystrlen (yyf);
3141 yysize_overflow |= (yysize1 < yysize);
3142 yysize = yysize1;
3143
3144 if (yysize_overflow)
3145 return YYSIZE_MAXIMUM;
3146
3147 if (yyresult)
3148 {
3149 /* Avoid sprintf, as that infringes on the user's name space.
3150 Don't have undefined behavior even if the translation
3151 produced a string with the wrong number of "%s"s. */
3152 char *yyp = yyresult;
3153 int yyi = 0;
3154 while ((*yyp = *yyf) != '\0')
3155 {
3156 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3157 {
3158 yyp += yytnamerr (yyp, yyarg[yyi++]);
3159 yyf += 2;
3160 }
3161 else
3162 {
3163 yyp++;
3164 yyf++;
3165 }
3166 }
3167 }
3168 return yysize;
3169 }
3170}
3171#endif /* YYERROR_VERBOSE */
3172
3173
3174/*-----------------------------------------------.
3175| Release the memory associated to this symbol. |
3176`-----------------------------------------------*/
3177
3178/*ARGSUSED*/
3179#if (defined __STDC__ || defined __C99__FUNC__ \
3180 || defined __cplusplus || defined _MSC_VER)
3181static void
3182yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3183#else
3184static void
3185yydestruct (yymsg, yytype, yyvaluep)
3186 const char *yymsg;
3187 int yytype;
3188 YYSTYPE *yyvaluep;
3189#endif
3190{
3191 YYUSE (yyvaluep);
3192
3193 if (!yymsg)
3194 yymsg = "Deleting";
3195 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3196
3197 switch (yytype)
3198 {
3199
3200 default:
3201 break;
3202 }
3203}
3204
3205
3206/* Prevent warnings from -Wmissing-prototypes. */
3207
3208#ifdef YYPARSE_PARAM
3209#if defined __STDC__ || defined __cplusplus
3210int yyparse (void *YYPARSE_PARAM);
3211#else
3212int yyparse ();
3213#endif
3214#else /* ! YYPARSE_PARAM */
3215#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003216int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003217#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003218int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003219#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003220#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003221
Chris Lattner38905612008-02-19 04:36:25 +00003222
Dan Gohmanf4423b12008-04-19 00:24:39 +00003223
3224/* The look-ahead symbol. */
3225int yychar;
3226
3227/* The semantic value of the look-ahead symbol. */
3228YYSTYPE yylval;
3229
3230/* Number of syntax errors so far. */
3231int yynerrs;
3232
3233
3234
3235/*----------.
3236| yyparse. |
3237`----------*/
3238
3239#ifdef YYPARSE_PARAM
3240#if (defined __STDC__ || defined __C99__FUNC__ \
3241 || defined __cplusplus || defined _MSC_VER)
3242int
3243yyparse (void *YYPARSE_PARAM)
3244#else
3245int
3246yyparse (YYPARSE_PARAM)
3247 void *YYPARSE_PARAM;
3248#endif
3249#else /* ! YYPARSE_PARAM */
3250#if (defined __STDC__ || defined __C99__FUNC__ \
3251 || defined __cplusplus || defined _MSC_VER)
3252int
3253yyparse (void)
3254#else
3255int
3256yyparse ()
3257
Gabor Greife64d2482008-04-06 23:07:54 +00003258#endif
3259#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003260{
3261
3262 int yystate;
3263 int yyn;
3264 int yyresult;
3265 /* Number of tokens to shift before error messages enabled. */
3266 int yyerrstatus;
3267 /* Look-ahead token as an internal (translated) token number. */
3268 int yytoken = 0;
3269#if YYERROR_VERBOSE
3270 /* Buffer for error messages, and its allocated size. */
3271 char yymsgbuf[128];
3272 char *yymsg = yymsgbuf;
3273 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003274#endif
Chris Lattner38905612008-02-19 04:36:25 +00003275
Dan Gohmanf4423b12008-04-19 00:24:39 +00003276 /* Three stacks and their tools:
3277 `yyss': related to states,
3278 `yyvs': related to semantic values,
3279 `yyls': related to locations.
3280
3281 Refer to the stacks thru separate pointers, to allow yyoverflow
3282 to reallocate them elsewhere. */
3283
3284 /* The state stack. */
3285 yytype_int16 yyssa[YYINITDEPTH];
3286 yytype_int16 *yyss = yyssa;
3287 yytype_int16 *yyssp;
3288
3289 /* The semantic value stack. */
3290 YYSTYPE yyvsa[YYINITDEPTH];
3291 YYSTYPE *yyvs = yyvsa;
3292 YYSTYPE *yyvsp;
3293
3294
3295
3296#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3297
3298 YYSIZE_T yystacksize = YYINITDEPTH;
3299
3300 /* The variables used to return semantic value and location from the
3301 action routines. */
3302 YYSTYPE yyval;
3303
3304
3305 /* The number of symbols on the RHS of the reduced rule.
3306 Keep to zero when no symbol should be popped. */
3307 int yylen = 0;
3308
3309 YYDPRINTF ((stderr, "Starting parse\n"));
3310
Reid Spencer68a24bd2005-08-27 18:50:39 +00003311 yystate = 0;
3312 yyerrstatus = 0;
3313 yynerrs = 0;
3314 yychar = YYEMPTY; /* Cause a token to be read. */
3315
3316 /* Initialize stack pointers.
3317 Waste one element of value and location stack
3318 so that they stay on the same level as the state stack.
3319 The wasted elements are never initialized. */
3320
Dan Gohmanf4423b12008-04-19 00:24:39 +00003321 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003322 yyvsp = yyvs;
3323
Dan Gohmanf4423b12008-04-19 00:24:39 +00003324 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003325
Dan Gohmanf4423b12008-04-19 00:24:39 +00003326/*------------------------------------------------------------.
3327| yynewstate -- Push a new state, which is found in yystate. |
3328`------------------------------------------------------------*/
3329 yynewstate:
3330 /* In all cases, when you get here, the value and location stacks
3331 have just been pushed. So pushing a state here evens the stacks. */
3332 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003333
Dan Gohmanf4423b12008-04-19 00:24:39 +00003334 yysetstate:
3335 *yyssp = yystate;
3336
3337 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003338 {
3339 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003340 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003341
3342#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003343 {
3344 /* Give user a chance to reallocate the stack. Use copies of
3345 these so that the &'s don't force the real ones into
3346 memory. */
3347 YYSTYPE *yyvs1 = yyvs;
3348 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003349
Dan Gohmanf4423b12008-04-19 00:24:39 +00003350
3351 /* Each stack pointer address is followed by the size of the
3352 data in use in that stack, in bytes. This used to be a
3353 conditional around just the two extra args, but that might
3354 be undefined if yyoverflow is a macro. */
3355 yyoverflow (YY_("memory exhausted"),
3356 &yyss1, yysize * sizeof (*yyssp),
3357 &yyvs1, yysize * sizeof (*yyvsp),
3358
3359 &yystacksize);
3360
3361 yyss = yyss1;
3362 yyvs = yyvs1;
3363 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003364#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003365# ifndef YYSTACK_RELOCATE
3366 goto yyexhaustedlab;
3367# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003368 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003369 if (YYMAXDEPTH <= yystacksize)
3370 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003371 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003372 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003373 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003374
3375 {
3376 yytype_int16 *yyss1 = yyss;
3377 union yyalloc *yyptr =
3378 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3379 if (! yyptr)
3380 goto yyexhaustedlab;
3381 YYSTACK_RELOCATE (yyss);
3382 YYSTACK_RELOCATE (yyvs);
3383
3384# undef YYSTACK_RELOCATE
3385 if (yyss1 != yyssa)
3386 YYSTACK_FREE (yyss1);
3387 }
3388# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003389#endif /* no yyoverflow */
3390
Dan Gohmanf4423b12008-04-19 00:24:39 +00003391 yyssp = yyss + yysize - 1;
3392 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003393
3394
Dan Gohmanf4423b12008-04-19 00:24:39 +00003395 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3396 (unsigned long int) yystacksize));
3397
3398 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003399 YYABORT;
3400 }
3401
Dan Gohmanf4423b12008-04-19 00:24:39 +00003402 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003403
3404 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003405
Dan Gohmanf4423b12008-04-19 00:24:39 +00003406/*-----------.
3407| yybackup. |
3408`-----------*/
3409yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003410
Dan Gohmanf4423b12008-04-19 00:24:39 +00003411 /* Do appropriate processing given the current state. Read a
3412 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003413
Dan Gohmanf4423b12008-04-19 00:24:39 +00003414 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003415 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003416 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003417 goto yydefault;
3418
Dan Gohmanf4423b12008-04-19 00:24:39 +00003419 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003420
Dan Gohmanf4423b12008-04-19 00:24:39 +00003421 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003422 if (yychar == YYEMPTY)
3423 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003424 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003425 yychar = YYLEX;
3426 }
3427
Dan Gohmanf4423b12008-04-19 00:24:39 +00003428 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003429 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003430 yychar = yytoken = YYEOF;
3431 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003432 }
3433 else
3434 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003435 yytoken = YYTRANSLATE (yychar);
3436 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003437 }
3438
Dan Gohmanf4423b12008-04-19 00:24:39 +00003439 /* If the proper action on seeing token YYTOKEN is to reduce or to
3440 detect an error, take that action. */
3441 yyn += yytoken;
3442 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003443 goto yydefault;
3444 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003445 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003446 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003447 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003448 goto yyerrlab;
3449 yyn = -yyn;
3450 goto yyreduce;
3451 }
3452
3453 if (yyn == YYFINAL)
3454 YYACCEPT;
3455
Dan Gohmanf4423b12008-04-19 00:24:39 +00003456 /* Count tokens shifted since error; after three, turn off error
3457 status. */
3458 if (yyerrstatus)
3459 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003460
Dan Gohmanf4423b12008-04-19 00:24:39 +00003461 /* Shift the look-ahead token. */
3462 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003463
Dan Gohmanf4423b12008-04-19 00:24:39 +00003464 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003465 if (yychar != YYEOF)
3466 yychar = YYEMPTY;
3467
Gabor Greife64d2482008-04-06 23:07:54 +00003468 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003469 *++yyvsp = yylval;
3470
Reid Spencer68a24bd2005-08-27 18:50:39 +00003471 goto yynewstate;
3472
Gabor Greife64d2482008-04-06 23:07:54 +00003473
Dan Gohmanf4423b12008-04-19 00:24:39 +00003474/*-----------------------------------------------------------.
3475| yydefault -- do the default action for the current state. |
3476`-----------------------------------------------------------*/
3477yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003478 yyn = yydefact[yystate];
3479 if (yyn == 0)
3480 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003481 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003482
Dan Gohmanf4423b12008-04-19 00:24:39 +00003483
3484/*-----------------------------.
3485| yyreduce -- Do a reduction. |
3486`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003487yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003488 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003489 yylen = yyr2[yyn];
3490
Dan Gohmanf4423b12008-04-19 00:24:39 +00003491 /* If YYLEN is nonzero, implement the default value of the action:
3492 `$$ = $1'.
3493
3494 Otherwise, the following line sets YYVAL to garbage.
3495 This behavior is undocumented and Bison
3496 users should not rely upon it. Assigning to YYVAL
3497 unconditionally makes the parser a bit smaller, and it avoids a
3498 GCC warning that YYVAL may be used uninitialized. */
3499 yyval = yyvsp[1-yylen];
3500
3501
3502 YY_REDUCE_PRINT (yyn);
3503 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003504 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003505 case 29:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003506#line 1117 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003507 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3508 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003509
Dan Gohmanf4423b12008-04-19 00:24:39 +00003510 case 30:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003511#line 1117 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003512 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3513 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003514
Dan Gohmanf4423b12008-04-19 00:24:39 +00003515 case 31:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003516#line 1118 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003517 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3518 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003519
Dan Gohmanf4423b12008-04-19 00:24:39 +00003520 case 32:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003521#line 1118 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003522 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3523 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003524
Dan Gohmanf4423b12008-04-19 00:24:39 +00003525 case 33:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003526#line 1119 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003527 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3528 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003529
Dan Gohmanf4423b12008-04-19 00:24:39 +00003530 case 34:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003531#line 1119 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003532 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3533 break;
3534
3535 case 35:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003536#line 1120 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003537 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3538 break;
3539
3540 case 36:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003541#line 1120 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003542 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3543 break;
3544
3545 case 37:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003546#line 1121 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003547 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3548 break;
3549
3550 case 38:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003551#line 1121 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003552 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3553 break;
3554
3555 case 39:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003556#line 1125 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003557 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3558 break;
3559
3560 case 40:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003561#line 1125 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003562 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3563 break;
3564
3565 case 41:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003566#line 1126 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003567 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3568 break;
3569
3570 case 42:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003571#line 1126 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003572 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3573 break;
3574
3575 case 43:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003576#line 1127 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003577 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3578 break;
3579
3580 case 44:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003581#line 1127 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003582 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3583 break;
3584
3585 case 45:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003586#line 1128 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003587 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3588 break;
3589
3590 case 46:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003591#line 1128 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003592 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3593 break;
3594
3595 case 47:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003596#line 1129 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003597 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3598 break;
3599
3600 case 48:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003601#line 1129 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003602 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3603 break;
3604
3605 case 49:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003606#line 1130 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003607 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3608 break;
3609
3610 case 50:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003611#line 1130 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003612 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3613 break;
3614
3615 case 51:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003616#line 1131 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003617 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3618 break;
3619
3620 case 52:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003621#line 1131 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003622 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3623 break;
3624
3625 case 53:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003626#line 1132 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003627 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3628 break;
3629
3630 case 54:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003631#line 1133 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003632 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3633 break;
3634
3635 case 65:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003636#line 1142 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003637 { (yyval.StrVal) = 0; ;}
3638 break;
3639
3640 case 66:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003641#line 1144 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003642 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3643 break;
3644
3645 case 67:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003646#line 1145 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003647 { (yyval.UIntVal)=0; ;}
3648 break;
3649
3650 case 68:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003651#line 1149 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003652 {
3653 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003654 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003655 ;}
3656 break;
3657
3658 case 69:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003659#line 1153 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003660 {
3661 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003662 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003663 ;}
3664 break;
3665
3666 case 73:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003667#line 1161 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003668 {
3669 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003670 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003671 ;}
3672 break;
3673
3674 case 74:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003675#line 1166 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003676 {
3677 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003678 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003679 ;}
3680 break;
3681
3682 case 75:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003683#line 1172 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003684 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3685 break;
3686
3687 case 76:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003688#line 1173 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003689 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3690 break;
3691
3692 case 77:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003693#line 1174 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003694 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3695 break;
3696
3697 case 78:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003698#line 1175 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003699 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3700 break;
3701
3702 case 79:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003703#line 1176 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003704 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3705 break;
3706
3707 case 80:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003708#line 1177 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003709 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003710 break;
3711
3712 case 81:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003713#line 1181 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003714 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003715 break;
3716
3717 case 82:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003718#line 1182 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003719 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003720 break;
3721
3722 case 83:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003723#line 1183 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003724 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003725 break;
3726
3727 case 84:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003728#line 1187 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003729 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3730 break;
3731
3732 case 85:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003733#line 1188 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003734 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003735 break;
3736
3737 case 86:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003738#line 1189 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003739 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003740 break;
3741
3742 case 87:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003743#line 1190 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003744 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003745 break;
3746
3747 case 88:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003748#line 1194 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003749 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003750 break;
3751
3752 case 89:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003753#line 1195 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003754 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003755 break;
3756
3757 case 90:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003758#line 1196 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003759 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003760 break;
3761
3762 case 91:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003763#line 1200 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003764 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3765 break;
3766
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003767 case 92:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003768#line 1201 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003769 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3770 break;
3771
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003772 case 93:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003773#line 1202 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003774 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3775 break;
3776
3777 case 94:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003778#line 1203 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003779 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3780 break;
3781
3782 case 95:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003783#line 1204 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003784 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3785 break;
3786
3787 case 96:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003788#line 1208 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003789 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3790 break;
3791
3792 case 97:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003793#line 1209 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003794 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3795 break;
3796
Dan Gohmanf4423b12008-04-19 00:24:39 +00003797 case 98:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003798#line 1210 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003799 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003800 break;
3801
3802 case 99:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003803#line 1213 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003804 { (yyval.UIntVal) = CallingConv::C; ;}
3805 break;
3806
3807 case 100:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003808#line 1214 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003809 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003810 break;
3811
3812 case 101:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003813#line 1215 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003814 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003815 break;
3816
3817 case 102:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003818#line 1216 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003819 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003820 break;
3821
3822 case 103:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003823#line 1217 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003824 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003825 break;
3826
3827 case 104:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003828#line 1218 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003829 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3830 break;
3831
3832 case 105:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003833#line 1219 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003834 {
3835 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003836 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003837 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003838 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003839 ;}
3840 break;
3841
Dan Gohmanf4423b12008-04-19 00:24:39 +00003842 case 106:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003843#line 1226 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003844 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3845 break;
3846
3847 case 107:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003848#line 1227 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003849 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003850 break;
3851
3852 case 108:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003853#line 1228 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003854 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3855 break;
3856
3857 case 109:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003858#line 1229 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003859 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003860 break;
3861
3862 case 110:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003863#line 1230 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003864 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003865 break;
3866
3867 case 111:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003868#line 1231 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003869 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003870 break;
3871
3872 case 112:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003873#line 1232 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003874 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003875 break;
3876
3877 case 113:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003878#line 1233 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003879 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003880 break;
3881
3882 case 114:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003883#line 1234 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003884 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3885 break;
3886
3887 case 115:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003888#line 1235 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003889 { (yyval.ParamAttrs) =
3890 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3891 break;
3892
Dan Gohmanf4423b12008-04-19 00:24:39 +00003893 case 116:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003894#line 1239 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003895 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003896 break;
3897
3898 case 117:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003899#line 1240 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003900 {
3901 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3902 ;}
3903 break;
3904
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003905 case 118:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003906#line 1245 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003907 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3908 break;
3909
3910 case 119:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003911#line 1246 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003912 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3913 break;
3914
3915 case 120:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003916#line 1247 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003917 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3918 break;
3919
3920 case 121:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003921#line 1248 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003922 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3923 break;
3924
3925 case 122:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003926#line 1249 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003927 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3928 break;
3929
3930 case 123:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003931#line 1250 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003932 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3933 break;
3934
3935 case 124:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003936#line 1253 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003937 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3938 break;
3939
Dan Gohmanf4423b12008-04-19 00:24:39 +00003940 case 125:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003941#line 1254 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003942 {
3943 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3944 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003945 break;
3946
3947 case 126:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003948#line 1259 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003949 { (yyval.StrVal) = 0; ;}
3950 break;
3951
3952 case 127:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003953#line 1260 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003954 {
3955 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3956 ;}
3957 break;
3958
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003959 case 128:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003960#line 1267 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003961 { (yyval.UIntVal) = 0; ;}
3962 break;
3963
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003964 case 129:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003965#line 1268 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003966 {
3967 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3968 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003969 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003970 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003971;}
3972 break;
3973
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003974 case 130:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003975#line 1274 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003976 { (yyval.UIntVal) = 0; ;}
3977 break;
3978
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003979 case 131:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003980#line 1275 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003981 {
3982 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3983 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00003984 GEN_ERROR("Alignment must be a power of two");
3985 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003986;}
3987 break;
3988
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003989 case 132:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00003990#line 1284 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003991 {
3992 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3993 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003994 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003995 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003996 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003997;}
3998 break;
3999
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004000 case 133:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004001#line 1292 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004002 { (yyval.StrVal) = 0; ;}
4003 break;
4004
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004005 case 134:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004006#line 1293 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004007 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4008 break;
4009
Dan Gohmanf4423b12008-04-19 00:24:39 +00004010 case 135:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004011#line 1298 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004012 {;}
4013 break;
4014
4015 case 136:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004016#line 1299 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004017 {;}
4018 break;
4019
4020 case 137:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004021#line 1300 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004022 {
4023 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4024 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004025 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004026 ;}
4027 break;
4028
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004029 case 138:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004030#line 1305 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004031 {
4032 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004033 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004034 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004035 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004036 ;}
4037 break;
4038
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004039 case 146:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004040#line 1321 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004041 {
4042 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004043 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004044 ;}
4045 break;
4046
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004047 case 147:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004048#line 1325 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004049 {
4050 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004051 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004052 ;}
4053 break;
4054
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004055 case 148:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004056#line 1329 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004057 { // Pointer type?
4058 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004059 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004060 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4061 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004062 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004063 ;}
4064 break;
4065
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004066 case 149:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004067#line 1336 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004068 { // Named types are also simple types...
4069 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004070 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004071 (yyval.TypeVal) = new PATypeHolder(tmp);
4072 ;}
4073 break;
4074
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004075 case 150:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004076#line 1341 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004077 { // Type UpReference
4078 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004079 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004080 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4081 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004082 UR_OUT("New Upreference!\n");
4083 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004084 ;}
4085 break;
4086
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004087 case 151:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004088#line 1349 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004089 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004090 // Allow but ignore attributes on function types; this permits auto-upgrade.
4091 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004092 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4093 if (!FunctionType::isValidReturnType(RetTy))
4094 GEN_ERROR("Invalid result type for LLVM function");
4095
Reid Spencer41dff5e2007-01-26 08:05:27 +00004096 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004097 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004098 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004099 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004100 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004101 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004102
Reid Spencer41dff5e2007-01-26 08:05:27 +00004103 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4104 if (isVarArg) Params.pop_back();
4105
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004106 for (unsigned i = 0; i != Params.size(); ++i)
4107 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4108 GEN_ERROR("Function arguments must be value types!");
4109
4110 CHECK_FOR_ERROR
4111
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004112 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004113 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4114 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4115 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004116 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004117 ;}
4118 break;
4119
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004120 case 152:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004121#line 1378 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004122 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004123 // Allow but ignore attributes on function types; this permits auto-upgrade.
4124 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004125 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004126 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004127 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004128 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004129 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004130 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004131
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004132 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4133 if (isVarArg) Params.pop_back();
4134
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004135 for (unsigned i = 0; i != Params.size(); ++i)
4136 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4137 GEN_ERROR("Function arguments must be value types!");
4138
4139 CHECK_FOR_ERROR
4140
Dan Gohmanf4423b12008-04-19 00:24:39 +00004141 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4142 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4143 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004144 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004145 ;}
4146 break;
4147
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004148 case 153:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004149#line 1403 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004150 { // Sized array type?
4151 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4152 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004153 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004154 ;}
4155 break;
4156
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004157 case 154:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004158#line 1408 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004159 { // Vector type?
4160 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4161 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004162 GEN_ERROR("Unsigned result not equal to signed result");
4163 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4164 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004165 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4166 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004167 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004168 ;}
4169 break;
4170
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004171 case 155:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004172#line 1418 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004173 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004174 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004175 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4176 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004177 Elements.push_back(*I);
4178
Dan Gohmanf4423b12008-04-19 00:24:39 +00004179 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4180 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004181 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004182 ;}
4183 break;
4184
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004185 case 156:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004186#line 1428 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004187 { // Empty structure type?
4188 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004189 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004190 ;}
4191 break;
4192
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004193 case 157:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004194#line 1432 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004195 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004196 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004197 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4198 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004199 Elements.push_back(*I);
4200
Dan Gohmanf4423b12008-04-19 00:24:39 +00004201 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4202 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004203 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004204 ;}
4205 break;
4206
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004207 case 158:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004208#line 1442 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004209 { // Empty structure type?
4210 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004211 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004212 ;}
4213 break;
4214
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004215 case 159:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004216#line 1449 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004217 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004218 // Allow but ignore attributes on function types; this permits auto-upgrade.
4219 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004220 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4221 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4222 ;}
4223 break;
4224
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004225 case 160:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004226#line 1458 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004227 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004228 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004229 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4230 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004231 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004232 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4233 ;}
4234 break;
4235
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004236 case 161:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004237#line 1465 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004238 {
4239 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4240 ;}
4241 break;
4242
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004243 case 162:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004244#line 1470 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004245 {
4246 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4247 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004248 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004249 ;}
4250 break;
4251
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004252 case 163:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004253#line 1475 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004254 {
4255 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004256 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004257 ;}
4258 break;
4259
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004260 case 165:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004261#line 1483 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004262 {
4263 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004264 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004265 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004266 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004267 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004268 ;}
4269 break;
4270
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004271 case 166:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004272#line 1490 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004273 {
4274 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004275 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4276 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004277 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004278 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004279 ;}
4280 break;
4281
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004282 case 167:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004283#line 1497 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004284 {
4285 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004286 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004287 ;}
4288 break;
4289
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004290 case 168:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004291#line 1505 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004292 {
4293 (yyval.TypeList) = new std::list<PATypeHolder>();
4294 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4295 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004296 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004297 ;}
4298 break;
4299
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004300 case 169:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004301#line 1511 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004302 {
4303 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4304 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004305 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004306 ;}
4307 break;
4308
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004309 case 170:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004310#line 1523 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004311 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004312 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4314 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004315 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004316 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004317 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004318 const Type *ETy = ATy->getElementType();
4319 int NumElements = ATy->getNumElements();
4320
4321 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004322 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004323 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004324 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004325 itostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004326
4327 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004328 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4329 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004330 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4331 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004332 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004333 }
4334
Dan Gohmanf4423b12008-04-19 00:24:39 +00004335 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4336 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004337 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004338 ;}
4339 break;
4340
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004341 case 171:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004342#line 1551 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004343 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004344 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004345 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4346 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004347 if (ATy == 0)
4348 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004349 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004350
Andrew Lenharth6353e052006-12-08 18:07:09 +00004351 int NumElements = ATy->getNumElements();
4352 if (NumElements != -1 && NumElements != 0)
4353 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Reid Spencerb5334b02007-02-05 10:18:06 +00004354 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004355 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4356 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004357 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004358 ;}
4359 break;
4360
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004361 case 172:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004362#line 1567 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004364 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004365 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4366 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004367 if (ATy == 0)
4368 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004369 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004370
4371 int NumElements = ATy->getNumElements();
4372 const Type *ETy = ATy->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00004373 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004374 GEN_ERROR("Can't build string constant of size " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004375 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004376 " when array has size " + itostr(NumElements) + "");
4377 std::vector<Constant*> Vals;
4378 if (ETy == Type::Int8Ty) {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004379 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4380 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004381 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004382 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004383 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4384 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004385 delete (yyvsp[(3) - (3)].StrVal);
4386 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4387 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004388 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004389 ;}
4390 break;
4391
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004392 case 173:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004393#line 1594 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004394 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004395 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004396 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4397 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004398 if (PTy == 0)
4399 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004400 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004401 const Type *ETy = PTy->getElementType();
4402 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004403
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004404 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004405 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004406 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004407 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004408 itostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004409
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004410 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004411 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4412 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004413 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4414 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004415 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004416 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004417
Dan Gohmanf4423b12008-04-19 00:24:39 +00004418 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4419 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004420 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004421 ;}
4422 break;
4423
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004424 case 174:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004425#line 1622 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004426 {
4427 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004428 if (STy == 0)
4429 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004430 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004431
Dan Gohmanf4423b12008-04-19 00:24:39 +00004432 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004433 GEN_ERROR("Illegal number of initializers for structure type");
4434
4435 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004436 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4437 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004438 GEN_ERROR("Expected type '" +
4439 STy->getElementType(i)->getDescription() +
4440 "' for element #" + utostr(i) +
4441 " of structure initializer");
4442
4443 // Check to ensure that Type is not packed
4444 if (STy->isPacked())
4445 GEN_ERROR("Unpacked Initializer to vector type '" +
4446 STy->getDescription() + "'");
4447
Dan Gohmanf4423b12008-04-19 00:24:39 +00004448 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4449 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004450 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004451 ;}
4452 break;
4453
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004454 case 175:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004455#line 1648 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004456 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004457 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004458 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4459 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004460 if (STy == 0)
4461 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004462 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004463
4464 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004465 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004466
4467 // Check to ensure that Type is not packed
4468 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004469 GEN_ERROR("Unpacked Initializer to vector type '" +
4470 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004471
Dan Gohmanf4423b12008-04-19 00:24:39 +00004472 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4473 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004474 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004475 ;}
4476 break;
4477
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004478 case 176:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004479#line 1668 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004480 {
4481 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004482 if (STy == 0)
4483 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004484 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004485
Dan Gohmanf4423b12008-04-19 00:24:39 +00004486 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004487 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004488
4489 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004490 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4491 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004492 GEN_ERROR("Expected type '" +
4493 STy->getElementType(i)->getDescription() +
4494 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004495 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004496
4497 // Check to ensure that Type is packed
4498 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004499 GEN_ERROR("Vector initializer to non-vector type '" +
4500 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004501
Dan Gohmanf4423b12008-04-19 00:24:39 +00004502 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4503 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004504 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004505 ;}
4506 break;
4507
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004508 case 177:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004509#line 1694 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004510 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004511 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004512 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4513 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004514 if (STy == 0)
4515 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004516 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004517
4518 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004519 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004520
4521 // Check to ensure that Type is packed
4522 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004523 GEN_ERROR("Vector initializer to non-vector type '" +
4524 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004525
Dan Gohmanf4423b12008-04-19 00:24:39 +00004526 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4527 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004528 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004529 ;}
4530 break;
4531
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004532 case 178:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004533#line 1714 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004534 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004535 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004536 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4537 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004538 if (PTy == 0)
4539 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004540 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004541
Dan Gohmanf4423b12008-04-19 00:24:39 +00004542 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4543 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004544 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004545 ;}
4546 break;
4547
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004548 case 179:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004549#line 1726 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004550 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004551 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004552 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4553 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4554 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004555 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004556 ;}
4557 break;
4558
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004559 case 180:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004560#line 1733 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004561 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004562 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4564 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004565 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004566 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004567
4568 // ConstExprs can exist in the body of a function, thus creating
4569 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004570 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004571 // symbol table instead of the module symbol table for the global symbol,
4572 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004573 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004574 //
4575 Function *SavedCurFn = CurFun.CurrentFunction;
4576 CurFun.CurrentFunction = 0;
4577
Dan Gohmanf4423b12008-04-19 00:24:39 +00004578 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004579 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004580
4581 CurFun.CurrentFunction = SavedCurFn;
4582
4583 // If this is an initializer for a constant pointer, which is referencing a
4584 // (currently) undefined variable, create a stub now that shall be replaced
4585 // in the future with the right type of variable.
4586 //
4587 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004588 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004589 const PointerType *PT = cast<PointerType>(Ty);
4590
4591 // First check to see if the forward references value is already created!
4592 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004593 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004594
4595 if (I != CurModule.GlobalRefs.end()) {
4596 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004597 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004598 } else {
4599 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004600 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4601 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4602 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004603 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004604
4605 // Create the forward referenced global.
4606 GlobalValue *GV;
4607 if (const FunctionType *FTy =
4608 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004609 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4610 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004611 } else {
4612 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004613 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004614 Name, CurModule.CurrentModule);
4615 }
4616
4617 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004618 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004619 V = GV;
4620 }
4621 }
4622
Dan Gohmanf4423b12008-04-19 00:24:39 +00004623 (yyval.ConstVal) = cast<GlobalValue>(V);
4624 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004625 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004626 ;}
4627 break;
4628
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004629 case 181:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004630#line 1799 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004631 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004632 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004633 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4634 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004635 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004636 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4637 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4638 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004639 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004640 ;}
4641 break;
4642
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004643 case 182:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004644#line 1809 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004645 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004646 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004647 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4648 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004649 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4650 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004651 (yyval.ConstVal) = Constant::getNullValue(Ty);
4652 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004653 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004654 ;}
4655 break;
4656
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004657 case 183:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004658#line 1819 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004659 { // integral constants
4660 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004661 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004662 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004663 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004664 ;}
4665 break;
4666
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004667 case 184:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004668#line 1825 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004669 { // arbitrary precision integer constants
4670 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4671 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004672 GEN_ERROR("Constant value does not fit in type");
4673 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004674 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4675 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4676 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004677 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004678 ;}
4679 break;
4680
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004681 case 185:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004682#line 1835 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004683 { // integral constants
4684 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004685 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004686 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004687 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004688 ;}
4689 break;
4690
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004691 case 186:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004692#line 1841 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004693 { // arbitrary precision integer constants
4694 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4695 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004696 GEN_ERROR("Constant value does not fit in type");
4697 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004698 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4699 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4700 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004701 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004702 ;}
4703 break;
4704
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004705 case 187:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004706#line 1851 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004707 { // Boolean constants
4708 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4709 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004710 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004711 ;}
4712 break;
4713
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004714 case 188:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004715#line 1856 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004716 { // Boolean constants
4717 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4718 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004719 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004720 ;}
4721 break;
4722
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004723 case 189:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004724#line 1861 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004725 { // Floating point constants
4726 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004727 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004728 // Lexer has no type info, so builds all float and double FP constants
4729 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004730 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4731 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004732 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004733 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004734 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004735 ;}
4736 break;
4737
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004738 case 190:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004739#line 1874 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004740 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004741 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004742 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4743 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4744 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4745 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004746 GEN_ERROR("invalid cast opcode for cast from '" +
4747 Val->getType()->getDescription() + "' to '" +
4748 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004749 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4750 delete (yyvsp[(5) - (6)].TypeVal);
4751 ;}
4752 break;
4753
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004754 case 191:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004755#line 1886 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004756 {
4757 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004758 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004759
4760 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004761 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004762 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004763 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004764
Chris Lattnerf7469af2007-01-31 04:44:08 +00004765 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004766 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4767 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004768 IdxVec.push_back(C);
4769 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004770 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004771
Dan Gohmanf4423b12008-04-19 00:24:39 +00004772 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004773
Dan Gohmanf4423b12008-04-19 00:24:39 +00004774 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004775 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004776 ;}
4777 break;
4778
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004779 case 192:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004780#line 1907 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004781 {
4782 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004783 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004784 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004785 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004786 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004787 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004788 ;}
4789 break;
4790
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004791 case 193:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004792#line 1915 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004793 {
4794 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004795 GEN_ERROR("Binary operator types must match");
4796 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004797 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4798 ;}
4799 break;
4800
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004801 case 194:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004802#line 1921 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004803 {
4804 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004805 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004806 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4807 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4808 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004809 GEN_ERROR("Logical operator requires integral operands");
4810 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004811 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004812 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004813 ;}
4814 break;
4815
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004816 case 195:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004817#line 1932 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004818 {
4819 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004820 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004821 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4822 ;}
4823 break;
4824
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004825 case 196:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004826#line 1937 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004827 {
4828 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004829 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004830 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4831 ;}
4832 break;
4833
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004834 case 197:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004835#line 1942 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004836 {
4837 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4838 GEN_ERROR("vicmp operand types must match");
4839 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4840 ;}
4841 break;
4842
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004843 case 198:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004844#line 1947 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004845 {
4846 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4847 GEN_ERROR("vfcmp operand types must match");
4848 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4849 ;}
4850 break;
4851
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004852 case 199:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004853#line 1952 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004854 {
4855 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004856 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004857 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004858 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004859 ;}
4860 break;
4861
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004862 case 200:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004863#line 1958 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004864 {
4865 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004866 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004867 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004868 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004869 ;}
4870 break;
4871
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004872 case 201:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004873#line 1964 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004874 {
4875 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004876 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004877 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004878 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004879 ;}
4880 break;
4881
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004882 case 202:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004883#line 1973 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004884 {
4885 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004886 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004887 ;}
4888 break;
4889
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004890 case 203:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004891#line 1977 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004892 {
4893 (yyval.ConstVector) = new std::vector<Constant*>();
4894 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004895 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004896 ;}
4897 break;
4898
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004899 case 204:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004900#line 1985 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004901 { (yyval.BoolVal) = false; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004902 break;
4903
Dan Gohmanf4423b12008-04-19 00:24:39 +00004904 case 205:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004905#line 1985 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004906 { (yyval.BoolVal) = true; ;}
4907 break;
4908
4909 case 206:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004910#line 1988 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004911 { (yyval.BoolVal) = true; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00004912 break;
4913
4914 case 207:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004915#line 1988 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004916 { (yyval.BoolVal) = false; ;}
4917 break;
4918
4919 case 208:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004920#line 1991 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004921 {
4922 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4923 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00004924 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004925 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4926 if (!Aliasee)
4927 GEN_ERROR("Aliases can be created only to global values");
4928
Dan Gohmanf4423b12008-04-19 00:24:39 +00004929 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004930 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004931 delete (yyvsp[(1) - (2)].TypeVal);
4932 ;}
4933 break;
4934
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004935 case 209:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004936#line 2003 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004937 {
4938 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4939 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4940 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004941 GEN_ERROR("invalid cast opcode for cast from '" +
4942 Val->getType()->getDescription() + "' to '" +
4943 DestTy->getDescription() + "'");
4944
Dan Gohmanf4423b12008-04-19 00:24:39 +00004945 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004946 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004947 delete (yyvsp[(5) - (6)].TypeVal);
4948 ;}
4949 break;
4950
Nate Begemanac80ade2008-05-12 19:01:56 +00004951 case 210:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004952#line 2024 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004953 {
4954 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesen172f3112008-02-20 21:15:43 +00004955 CurModule.ModuleDone();
4956 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004957 ;}
4958 break;
4959
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004960 case 211:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004961#line 2029 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004962 {
4963 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4964 CurModule.ModuleDone();
4965 CHECK_FOR_ERROR;
4966 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004967 break;
4968
Nate Begemanac80ade2008-05-12 19:01:56 +00004969 case 214:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004970#line 2042 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004971 { CurFun.isDeclare = false; ;}
4972 break;
4973
4974 case 215:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004975#line 2042 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004976 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004977 CurFun.FunctionDone();
4978 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004979 ;}
4980 break;
4981
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004982 case 216:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004983#line 2046 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004984 { CurFun.isDeclare = true; ;}
4985 break;
4986
Nate Begemanac80ade2008-05-12 19:01:56 +00004987 case 217:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004988#line 2046 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004989 {
4990 CHECK_FOR_ERROR
4991 ;}
4992 break;
4993
4994 case 218:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00004995#line 2049 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004996 {
4997 CHECK_FOR_ERROR
4998 ;}
4999 break;
5000
5001 case 219:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005002#line 2052 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005003 {
Reid Spencer14310612006-12-31 05:40:51 +00005004 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005005 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005006 // Eagerly resolve types. This is not an optimization, this is a
5007 // requirement that is due to the fact that we could have this:
5008 //
5009 // %list = type { %list * }
5010 // %list = type { %list * } ; repeated type decl
5011 //
5012 // If types are not resolved eagerly, then the two types will not be
5013 // determined to be the same type!
5014 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005015 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005016
Dan Gohmanf4423b12008-04-19 00:24:39 +00005017 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005018 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005019 // If this is a named type that is not a redefinition, add it to the slot
5020 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005021 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005022 }
Reid Spencera132e042006-12-03 05:46:11 +00005023
Dan Gohmanf4423b12008-04-19 00:24:39 +00005024 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005025 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005026 ;}
5027 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005028
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005029 case 220:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005030#line 2076 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005031 {
5032 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5033
5034 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005035 CHECK_FOR_ERROR
5036 // If this is a named type that is not a redefinition, add it to the slot
5037 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005038 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005039 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005040 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 ;}
5042 break;
5043
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005044 case 221:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005045#line 2088 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005046 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005047 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005048 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005049 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005050 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5051 (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 +00005052 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005053 ;}
5054 break;
5055
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005056 case 222:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005057#line 2095 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005058 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005059 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005060 ;}
5061 break;
5062
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005063 case 223:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005064#line 2099 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005065 {
5066 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005067 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005068 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 +00005069 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005070 ;}
5071 break;
5072
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005073 case 224:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005074#line 2104 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005075 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005076 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005077 ;}
5078 break;
5079
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005080 case 225:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005081#line 2108 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005082 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005083 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005084 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5085 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 +00005086 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005087 delete (yyvsp[(6) - (7)].TypeVal);
5088 ;}
5089 break;
5090
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005091 case 226:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005092#line 2114 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005093 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005094 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005095 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005096 ;}
5097 break;
5098
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005099 case 227:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005100#line 2118 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005101 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005102 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005103 if ((yyvsp[(1) - (5)].StrVal)) {
5104 Name = *(yyvsp[(1) - (5)].StrVal);
5105 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005106 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005107 if (Name.empty())
5108 GEN_ERROR("Alias name cannot be empty");
5109
Dan Gohmanf4423b12008-04-19 00:24:39 +00005110 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005111 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005112 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005113
Dan Gohmanf4423b12008-04-19 00:24:39 +00005114 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005115 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005116 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005117 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005118
5119
5120 // If there was a forward reference of this alias, resolve it now.
5121
5122 ValID ID;
5123 if (!Name.empty())
5124 ID = ValID::createGlobalName(Name);
5125 else
5126 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5127
5128 if (GlobalValue *FWGV =
5129 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5130 // Replace uses of the fwdref with the actual alias.
5131 FWGV->replaceAllUsesWith(GA);
5132 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5133 GV->eraseFromParent();
5134 else
5135 cast<Function>(FWGV)->eraseFromParent();
5136 }
5137 ID.destroy();
5138
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005139 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005140 ;}
5141 break;
5142
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005143 case 228:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005144#line 2158 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005145 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005146 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005147 ;}
5148 break;
5149
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005150 case 229:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005151#line 2161 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005152 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005153 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005154 ;}
5155 break;
5156
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005157 case 230:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005158#line 2167 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005159 {
Chris Lattner66316012006-01-24 04:14:29 +00005160 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005161 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005162 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005163 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005164 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5165 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005166 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005167;}
5168 break;
5169
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005170 case 231:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005171#line 2177 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005172 {
5173 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5174 delete (yyvsp[(3) - (3)].StrVal);
5175 ;}
5176 break;
5177
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005178 case 232:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005179#line 2181 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005180 {
5181 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5182 delete (yyvsp[(3) - (3)].StrVal);
5183 ;}
5184 break;
5185
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005186 case 234:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005187#line 2188 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005188 {
5189 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5190 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005191 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005192 ;}
5193 break;
5194
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005195 case 235:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005196#line 2193 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005197 {
5198 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5199 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005200 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005201 ;}
5202 break;
5203
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005204 case 236:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005205#line 2198 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005206 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005207 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005208 ;}
5209 break;
5210
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005211 case 237:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005212#line 2207 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005213 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005214 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005215 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5216 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005217 GEN_ERROR("void typed arguments are invalid");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005218 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5219 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5220 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005221 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005222 ;}
5223 break;
5224
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005225 case 238:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005226#line 2217 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005227 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005228 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005229 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5230 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005231 GEN_ERROR("void typed arguments are invalid");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005232 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5233 (yyval.ArgList) = new ArgListType;
5234 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005235 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005236 ;}
5237 break;
5238
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005239 case 239:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005240#line 2228 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005241 {
5242 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005243 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005244 ;}
5245 break;
5246
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005247 case 240:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005248#line 2232 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005249 {
5250 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005251 struct ArgListEntry E;
5252 E.Ty = new PATypeHolder(Type::VoidTy);
5253 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005254 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005255 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005256 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005257 ;}
5258 break;
5259
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005260 case 241:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005261#line 2241 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005262 {
5263 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005264 struct ArgListEntry E;
5265 E.Ty = new PATypeHolder(Type::VoidTy);
5266 E.Name = 0;
5267 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005268 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005269 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005270 ;}
5271 break;
5272
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005273 case 242:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005274#line 2250 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005275 {
5276 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005277 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005278 ;}
5279 break;
5280
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005281 case 243:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005282#line 2256 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005283 {
5284 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5285 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005286
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005287 // Check the function result for abstractness if this is a define. We should
5288 // have no abstract types at this point
Dan Gohmanf4423b12008-04-19 00:24:39 +00005289 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5290 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005291
Chris Lattnera925a142008-04-23 05:37:08 +00005292 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5293 GEN_ERROR("Invalid result type for LLVM function");
5294
Reid Spencer68a24bd2005-08-27 18:50:39 +00005295 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005296 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005297 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5298 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5299 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005300 unsigned index = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005301 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005302 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005303 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5304 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005305 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005306 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5307 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005308 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005309 }
5310
5311 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5312 if (isVarArg) ParamTypeList.pop_back();
5313
Chris Lattner58d74912008-03-12 17:45:29 +00005314 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005315 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005316 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005317
Dan Gohmanf4423b12008-04-19 00:24:39 +00005318 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005319 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005320 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005321
5322 ValID ID;
5323 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005324 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005325 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005326 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005327 }
5328
5329 Function *Fn = 0;
5330 // See if this function was forward referenced. If so, recycle the object.
5331 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5332 // Move the function to the end of the list, from whereever it was
5333 // previously inserted.
5334 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005335 assert(Fn->getParamAttrs().isEmpty() &&
5336 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005337 CurModule.CurrentModule->getFunctionList().remove(Fn);
5338 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5339 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005340 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005341 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005342 // The existing function doesn't have the same type. This is an overload
5343 // error.
5344 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005345 } else if (Fn->getParamAttrs() != PAL) {
5346 // The existing function doesn't have the same parameter attributes.
5347 // This is an overload error.
5348 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005349 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005350 // Neither the existing or the current function is a declaration and they
5351 // have the same name and same type. Clearly this is a redefinition.
5352 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005353 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005354 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005355 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5356 AI != AE; ++AI)
5357 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005358 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005359 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005360 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5361 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005362 InsertValue(Fn, CurModule.Values);
5363 }
5364
5365 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005366
5367 if (CurFun.isDeclare) {
5368 // If we have declaration, always overwrite linkage. This will allow us to
5369 // correctly handle cases, when pointer to function is passed as argument to
5370 // another function.
5371 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005372 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005373 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005374 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005375 Fn->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005376 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5377 if ((yyvsp[(8) - (10)].StrVal)) {
5378 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5379 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005380 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005381 if ((yyvsp[(10) - (10)].StrVal)) {
5382 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5383 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005384 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005385
5386 // Add all of the arguments we parsed to the function...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005387 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005388 if (isVarArg) { // Nuke the last entry
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005390 "Not a varargs marker!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005391 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5392 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005393 }
5394 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005395 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005396 unsigned Idx = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005397 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5398 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005399 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005400 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005401 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005402 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005403 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005404 }
Reid Spencera132e042006-12-03 05:46:11 +00005405
Dan Gohmanf4423b12008-04-19 00:24:39 +00005406 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005407 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005408 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005409;}
5410 break;
5411
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005412 case 246:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005413#line 2386 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005414 {
5415 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005416
5417 // Make sure that we keep track of the linkage type even if there was a
5418 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005419 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5420 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5421;}
5422 break;
5423
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005424 case 249:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005425#line 2397 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005426 {
5427 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005428 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005429;}
5430 break;
5431
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005432 case 250:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005433#line 2402 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005434 {
5435 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5436 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5437 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005438 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005439 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005440 ;}
5441 break;
5442
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005443 case 251:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005444#line 2414 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005445 {
5446 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005447 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005448 ;}
5449 break;
5450
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005451 case 252:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005452#line 2418 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005453 {
5454 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005455 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005456 ;}
5457 break;
5458
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005459 case 253:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005460#line 2423 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005461 { // A reference to a direct constant
5462 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005463 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005464 ;}
5465 break;
5466
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005467 case 254:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005468#line 2427 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005469 {
5470 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005471 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005472 ;}
5473 break;
5474
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005475 case 255:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005476#line 2431 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005477 { // Perhaps it's an FP constant?
5478 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005479 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005480 ;}
5481 break;
5482
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005483 case 256:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005484#line 2435 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005485 {
5486 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005487 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005488 ;}
5489 break;
5490
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005491 case 257:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005492#line 2439 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005493 {
5494 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005495 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005496 ;}
5497 break;
5498
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005499 case 258:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005500#line 2443 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005501 {
5502 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005503 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005504 ;}
5505 break;
5506
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005507 case 259:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005508#line 2447 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005509 {
5510 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005511 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005512 ;}
5513 break;
5514
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005515 case 260:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005516#line 2451 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005517 { // A vector zero constant.
5518 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005519 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005520 ;}
5521 break;
5522
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005523 case 261:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005524#line 2455 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005525 { // Nonempty unsized packed vector
5526 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5527 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005528
Reid Spencer9d6565a2007-02-15 02:26:10 +00005529 VectorType* pt = VectorType::get(ETy, NumElements);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005530 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00005531 HandleUpRefs(
Reid Spencer9d6565a2007-02-15 02:26:10 +00005532 VectorType::get(
Reid Spencera132e042006-12-03 05:46:11 +00005533 ETy,
5534 NumElements)
5535 )
5536 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00005537
5538 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005539 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5540 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005541 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005542 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005543 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005544 }
5545
Dan Gohmanf4423b12008-04-19 00:24:39 +00005546 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5547 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005548 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005549 ;}
5550 break;
5551
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005552 case 262:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005553#line 2480 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005554 {
5555 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005556 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005557 ;}
5558 break;
5559
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005560 case 263:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005561#line 2484 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005562 {
5563 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5564 delete (yyvsp[(3) - (5)].StrVal);
5565 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005566 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005567 ;}
5568 break;
5569
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005570 case 264:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005571#line 2494 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005572 { // Is it an integer reference...?
5573 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005574 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005575 ;}
5576 break;
5577
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005578 case 265:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005579#line 2498 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005580 {
5581 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005582 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005583 ;}
5584 break;
5585
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005586 case 266:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005587#line 2502 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005588 { // Is it a named reference...?
5589 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5590 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005591 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005592 ;}
5593 break;
5594
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005595 case 267:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005596#line 2507 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005597 { // Is it a named reference...?
5598 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5599 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005600 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005601 ;}
5602 break;
5603
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005604 case 270:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005605#line 2520 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005606 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005607 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005608 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5609 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5610 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005611 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005612 ;}
5613 break;
5614
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005615 case 271:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005616#line 2529 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005617 {
5618 (yyval.ValueList) = new std::vector<Value *>();
5619 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005620 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005621 ;}
5622 break;
5623
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005624 case 272:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005625#line 2534 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005626 {
5627 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005628 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005629 ;}
5630 break;
5631
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005632 case 273:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005633#line 2539 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005634 {
5635 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005636 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005637 ;}
5638 break;
5639
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005640 case 274:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005641#line 2543 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005642 { // Do not allow functions with 0 basic blocks
5643 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005644 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005645 ;}
5646 break;
5647
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005648 case 275:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005649#line 2552 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005650 {
5651 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005652 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005653 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5654 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5655 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005656 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005657 ;}
5658 break;
5659
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005660 case 276:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005661#line 2561 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005662 {
5663 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005664 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5665 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00005666 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5667 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5668 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005669 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005670 ;}
5671 break;
Chris Lattner38905612008-02-19 04:36:25 +00005672
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005673 case 277:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005674#line 2570 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005675 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00005676 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00005677 CHECK_FOR_ERROR
5678 ;}
5679 break;
5680
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005681 case 278:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005682#line 2574 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00005683 { // Labelled (named) basic block
5684 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5685 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005686 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00005687
Dan Gohmanf4423b12008-04-19 00:24:39 +00005688 ;}
5689 break;
5690
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005691 case 279:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005692#line 2582 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005693 { // Return with a result...
5694 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5695 assert(!VL.empty() && "Invalid ret operands!");
5696 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5697 delete (yyvsp[(2) - (2)].ValueList);
5698 CHECK_FOR_ERROR
5699 ;}
5700 break;
5701
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005702 case 280:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005703#line 2589 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005704 { // Return with no result...
5705 (yyval.TermInstVal) = ReturnInst::Create();
5706 CHECK_FOR_ERROR
5707 ;}
5708 break;
5709
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005710 case 281:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005711#line 2593 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005712 { // Unconditional Branch...
5713 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5714 CHECK_FOR_ERROR
5715 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5716 ;}
5717 break;
5718
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005719 case 282:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005720#line 2598 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005721 {
5722 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5723 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5724 CHECK_FOR_ERROR
5725 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5726 CHECK_FOR_ERROR
5727 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5728 CHECK_FOR_ERROR
5729 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5730 ;}
5731 break;
5732
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005733 case 283:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005734#line 2608 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005735 {
5736 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5737 CHECK_FOR_ERROR
5738 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5739 CHECK_FOR_ERROR
5740 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5741 (yyval.TermInstVal) = S;
5742
5743 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5744 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005745 for (; I != E; ++I) {
5746 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5747 S->addCase(CI, I->second);
5748 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005749 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005750 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005751 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00005752 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005753 ;}
5754 break;
5755
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005756 case 284:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005757#line 2627 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005758 {
5759 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005760 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005761 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005762 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00005763 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005764 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005765 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005766 ;}
5767 break;
5768
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005769 case 285:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005770#line 2637 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005771 {
Reid Spencer3822ff52006-11-08 06:47:33 +00005772
Reid Spencer14310612006-12-31 05:40:51 +00005773 // Handle the short syntax
5774 const PointerType *PFTy = 0;
5775 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005776 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00005777 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5778 // Pull out the types of all of the arguments...
5779 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005780 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00005781 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005782 const Type *Ty = I->Val->getType();
5783 if (Ty == Type::VoidTy)
5784 GEN_ERROR("Short call syntax cannot be used with varargs");
5785 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005786 }
Chris Lattnera925a142008-04-23 05:37:08 +00005787
5788 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5789 GEN_ERROR("Invalid result type for LLVM function");
5790
Dan Gohmanf4423b12008-04-19 00:24:39 +00005791 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005792 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005793 }
5794
Dan Gohmanf4423b12008-04-19 00:24:39 +00005795 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00005796
Dan Gohmanf4423b12008-04-19 00:24:39 +00005797 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005798 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005799 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005800 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005801 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00005802 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005803
Chris Lattner58d74912008-03-12 17:45:29 +00005804 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005805 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5806 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00005807
Reid Spencer14310612006-12-31 05:40:51 +00005808 // Check the arguments
5809 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005810 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00005811 // Make sure no arguments is a good thing!
5812 if (Ty->getNumParams() != 0)
5813 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00005814 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005815 } else { // Has arguments?
5816 // Loop through FunctionType's arguments and ensure they are specified
5817 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005818 FunctionType::param_iterator I = Ty->param_begin();
5819 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00005820 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00005821 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005822
Duncan Sandsdc024672007-11-27 13:23:08 +00005823 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005824 if (ArgI->Val->getType() != *I)
5825 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00005826 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00005827 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00005828 if (ArgI->Attrs != ParamAttr::None)
5829 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005830 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005831
Reid Spencer14310612006-12-31 05:40:51 +00005832 if (Ty->isVarArg()) {
5833 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00005834 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005835 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00005836 if (ArgI->Attrs != ParamAttr::None)
5837 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00005838 }
Reid Spencer14310612006-12-31 05:40:51 +00005839 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00005840 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005841 }
Reid Spencer14310612006-12-31 05:40:51 +00005842
Chris Lattner58d74912008-03-12 17:45:29 +00005843 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00005844 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005845 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00005846
Reid Spencer14310612006-12-31 05:40:51 +00005847 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00005848 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
5849 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00005850 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005851 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005852 (yyval.TermInstVal) = II;
5853 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005854 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005855 ;}
5856 break;
5857
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005858 case 286:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005859#line 2722 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005860 {
5861 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005862 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005863 ;}
5864 break;
5865
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005866 case 287:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005867#line 2726 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005868 {
5869 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005870 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005871 ;}
5872 break;
5873
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005874 case 288:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005875#line 2733 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005876 {
5877 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5878 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005879 CHECK_FOR_ERROR
5880 if (V == 0)
5881 GEN_ERROR("May only switch on a constant pool value");
5882
Dan Gohmanf4423b12008-04-19 00:24:39 +00005883 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005884 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005885 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5886 ;}
5887 break;
5888
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005889 case 289:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005890#line 2744 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005891 {
5892 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5893 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005894 CHECK_FOR_ERROR
5895
5896 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00005897 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005898
Dan Gohmanf4423b12008-04-19 00:24:39 +00005899 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005900 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005901 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5902 ;}
5903 break;
5904
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005905 case 290:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005906#line 2757 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005907 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005908 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005909 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005910 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005911 InsertValue((yyvsp[(2) - (2)].InstVal));
5912 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005913 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005914 ;}
5915 break;
5916
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005917 case 291:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005918#line 2767 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005919 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005920 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005921 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5922 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5923 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00005924 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005925 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005926 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005927 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5928 delete (yyvsp[(1) - (6)].TypeVal);
5929 ;}
5930 break;
5931
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005932 case 292:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005933#line 2778 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005934 {
5935 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5936 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005937 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005938 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005939 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005940 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5941 ;}
5942 break;
5943
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005944 case 293:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005945#line 2788 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005946 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005947 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005948 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005949 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005950 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00005951 (yyval.ParamList) = new ParamList();
5952 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5953 (yyval.ParamList)->push_back(E);
5954 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00005955 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005956 ;}
5957 break;
5958
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005959 case 294:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005960#line 2799 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005961 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005962 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00005963 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00005964 (yyval.ParamList) = new ParamList();
5965 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5966 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00005967 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005968 ;}
5969 break;
5970
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005971 case 295:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005972#line 2807 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005973 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005974 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005975 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005976 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5977 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5978 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5979 (yyval.ParamList)->push_back(E);
5980 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005981 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005982 ;}
5983 break;
5984
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005985 case 296:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005986#line 2817 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005987 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005988 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00005989 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5990 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5991 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00005992 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005993 ;}
5994 break;
5995
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005996 case 297:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00005997#line 2824 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005998 { (yyval.ParamList) = new ParamList(); ;}
5999 break;
6000
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006001 case 298:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006002#line 2827 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006003 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6004 break;
6005
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006006 case 299:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006007#line 2828 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006008 {
6009 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6010 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006011 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006012 ;}
6013 break;
6014
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006015 case 300:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006016#line 2835 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006017 {
6018 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006019 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006020 ;}
6021 break;
6022
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006023 case 301:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006024#line 2839 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006025 {
6026 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006027 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006028 ;}
6029 break;
6030
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006031 case 302:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006032#line 2844 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006033 {
Reid Spencer14310612006-12-31 05:40:51 +00006034 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006035 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6036 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6037 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006038 GEN_ERROR(
6039 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006040 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006041 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006042 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006043 CHECK_FOR_ERROR
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006044 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006045 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006046 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006047 delete (yyvsp[(2) - (5)].TypeVal);
6048 ;}
6049 break;
6050
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006051 case 303:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006052#line 2860 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006053 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006054 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006055 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6056 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6057 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6058 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006059 GEN_ERROR("Logical operator requires integral operands");
6060 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006061 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006062 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006063 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006064 CHECK_FOR_ERROR
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006065 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006066 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006067 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006068 delete (yyvsp[(2) - (5)].TypeVal);
6069 ;}
6070 break;
6071
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006072 case 304:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006073#line 2877 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006074 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006075 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006076 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6077 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006078 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006079 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006080 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006081 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006082 CHECK_FOR_ERROR
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006083 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006084 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006085 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006086 delete (yyvsp[(3) - (6)].TypeVal);
6087 ;}
6088 break;
6089
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006090 case 305:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006091#line 2891 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006092 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006093 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006094 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6095 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006096 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006097 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006098 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006099 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006100 CHECK_FOR_ERROR
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006101 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006102 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006103 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006104 delete (yyvsp[(3) - (6)].TypeVal);
6105 ;}
6106 break;
6107
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006108 case 306:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006109#line 2905 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006110 {
6111 if (!UpRefs.empty())
6112 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6113 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6114 GEN_ERROR("Scalar types not supported by vicmp instruction");
6115 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6116 CHECK_FOR_ERROR
6117 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6118 CHECK_FOR_ERROR
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006119 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006120 if ((yyval.InstVal) == 0)
6121 GEN_ERROR("icmp operator returned null");
6122 delete (yyvsp[(3) - (6)].TypeVal);
6123 ;}
6124 break;
6125
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006126 case 307:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006127#line 2919 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006128 {
6129 if (!UpRefs.empty())
6130 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6131 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6132 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6133 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6134 CHECK_FOR_ERROR
6135 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6136 CHECK_FOR_ERROR
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006137 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006138 if ((yyval.InstVal) == 0)
6139 GEN_ERROR("fcmp operator returned null");
6140 delete (yyvsp[(3) - (6)].TypeVal);
6141 ;}
6142 break;
6143
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006144 case 308:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006145#line 2933 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006146 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006147 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006148 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6149 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6150 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6151 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006152 GEN_ERROR("invalid cast opcode for cast from '" +
6153 Val->getType()->getDescription() + "' to '" +
6154 DestTy->getDescription() + "'");
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006155 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006156 delete (yyvsp[(4) - (4)].TypeVal);
6157 ;}
6158 break;
6159
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006160 case 309:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006161#line 2945 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006162 {
6163 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006164 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006165 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006166 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006167 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006168 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006169 ;}
6170 break;
6171
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006172 case 310:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006173#line 2953 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006174 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006175 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006176 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6177 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6178 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006179 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006180 ;}
6181 break;
6182
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006183 case 311:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006184#line 2960 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006185 {
6186 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006187 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006188 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006189 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006190 ;}
6191 break;
6192
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006193 case 312:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006194#line 2966 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006195 {
6196 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006197 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006198 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006199 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006200 ;}
6201 break;
6202
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006203 case 313:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006204#line 2972 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006205 {
6206 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006207 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006208 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006209 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006210 ;}
6211 break;
6212
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006213 case 314:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006214#line 2978 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006215 {
6216 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006217 if (!Ty->isFirstClassType())
6218 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006219 (yyval.InstVal) = PHINode::Create(Ty);
6220 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6221 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6222 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006223 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006224 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6225 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006226 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006227 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006228 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006229 ;}
6230 break;
6231
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006232 case 315:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006233#line 2994 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006234 {
Reid Spencer14310612006-12-31 05:40:51 +00006235
6236 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006237 const PointerType *PFTy = 0;
6238 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006239 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006240 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6241 // Pull out the types of all of the arguments...
6242 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006243 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006244 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006245 const Type *Ty = I->Val->getType();
6246 if (Ty == Type::VoidTy)
6247 GEN_ERROR("Short call syntax cannot be used with varargs");
6248 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006249 }
Chris Lattnera925a142008-04-23 05:37:08 +00006250
6251 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6252 GEN_ERROR("Invalid result type for LLVM function");
6253
Dan Gohmanf4423b12008-04-19 00:24:39 +00006254 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006255 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006256 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006257
Dan Gohmanf4423b12008-04-19 00:24:39 +00006258 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006259 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006260
Reid Spencer7780acb2007-04-16 06:56:07 +00006261 // Check for call to invalid intrinsic to avoid crashing later.
6262 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006263 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006264 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6265 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006266 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6267 theF->getName() + "'");
6268 }
6269
Duncan Sandsdc024672007-11-27 13:23:08 +00006270 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006271 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006272 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6273 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006274 // Check the arguments
6275 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006276 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006277 // Make sure no arguments is a good thing!
6278 if (Ty->getNumParams() != 0)
6279 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006280 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006281 } else { // Has arguments?
6282 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006283 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006284 FunctionType::param_iterator I = Ty->param_begin();
6285 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006286 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006287 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006288
Duncan Sandsdc024672007-11-27 13:23:08 +00006289 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006290 if (ArgI->Val->getType() != *I)
6291 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006292 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006293 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006294 if (ArgI->Attrs != ParamAttr::None)
6295 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006296 }
6297 if (Ty->isVarArg()) {
6298 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006299 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006300 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006301 if (ArgI->Attrs != ParamAttr::None)
6302 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006303 }
Reid Spencer14310612006-12-31 05:40:51 +00006304 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006305 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006306 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006307
6308 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006309 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006310 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006311 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006312
Reid Spencer14310612006-12-31 05:40:51 +00006313 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006314 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006315 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6316 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006317 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006318 (yyval.InstVal) = CI;
6319 delete (yyvsp[(6) - (8)].ParamList);
6320 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006321 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006322 ;}
6323 break;
6324
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006325 case 316:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006326#line 3083 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006327 {
6328 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006329 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006330 ;}
6331 break;
6332
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006333 case 317:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006334#line 3088 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006335 {
6336 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006337 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006338 ;}
6339 break;
6340
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006341 case 318:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006342#line 3092 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006343 {
6344 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006345 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006346 ;}
6347 break;
6348
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006349 case 319:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006350#line 3099 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006351 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006352 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006353 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6354 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6355 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006356 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006357 ;}
6358 break;
6359
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006360 case 320:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006361#line 3106 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006362 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006363 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006364 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6365 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006366 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006367 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6368 delete (yyvsp[(2) - (6)].TypeVal);
6369 ;}
6370 break;
6371
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006372 case 321:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006373#line 3114 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006374 {
Reid Spencer14310612006-12-31 05:40:51 +00006375 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006376 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6377 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6378 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006379 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006380 ;}
6381 break;
6382
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006383 case 322:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006384#line 3121 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006386 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6388 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006389 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006390 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6391 delete (yyvsp[(2) - (6)].TypeVal);
6392 ;}
6393 break;
6394
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006395 case 323:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006396#line 3129 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006397 {
6398 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006399 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006400 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6401 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006402 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006403 ;}
6404 break;
6405
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006406 case 324:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006407#line 3137 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006408 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006409 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006410 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6411 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006412 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006413 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6414 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006415 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006416 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6417 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006418 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006419 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6420 delete (yyvsp[(3) - (5)].TypeVal);
6421 ;}
6422 break;
6423
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006424 case 325:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006425#line 3151 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006426 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006427 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006428 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6429 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006430 if (!PT)
6431 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006432 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006433 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006434 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6435 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006436 "' into space of type '" + ElTy->getDescription() + "'");
6437
Dan Gohmanf4423b12008-04-19 00:24:39 +00006438 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006439 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006440 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6441 delete (yyvsp[(5) - (7)].TypeVal);
6442 ;}
6443 break;
6444
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006445 case 326:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006446#line 3168 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 {
6448 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6449 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel5a970972008-02-19 22:27:01 +00006450 GEN_ERROR("Invalid getresult operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006451 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6452 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel5a970972008-02-19 22:27:01 +00006453 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006454 ;}
6455 break;
6456
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006457 case 327:
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006458#line 3176 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006459 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006460 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006461 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6462 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006463 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006464
Dan Gohman041e2eb2008-05-15 19:50:34 +00006465 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006466 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006467 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6468 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006469 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006470 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6471 delete (yyvsp[(2) - (4)].TypeVal);
6472 delete (yyvsp[(4) - (4)].ValueList);
6473 ;}
6474 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006475
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476
6477/* Line 1267 of yacc.c. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00006478#line 6479 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006479 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006480 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006481 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6482
6483 YYPOPSTACK (yylen);
6484 yylen = 0;
6485 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006486
6487 *++yyvsp = yyval;
6488
6489
Dan Gohmanf4423b12008-04-19 00:24:39 +00006490 /* Now `shift' the result of the reduction. Determine what state
6491 that goes to, based on the state we popped back to and the rule
6492 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006493
6494 yyn = yyr1[yyn];
6495
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6497 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006498 yystate = yytable[yystate];
6499 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006500 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006501
6502 goto yynewstate;
6503
6504
Dan Gohmanf4423b12008-04-19 00:24:39 +00006505/*------------------------------------.
6506| yyerrlab -- here on detecting error |
6507`------------------------------------*/
6508yyerrlab:
6509 /* If not already recovering from an error, report this error. */
6510 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006511 {
6512 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006513#if ! YYERROR_VERBOSE
6514 yyerror (YY_("syntax error"));
6515#else
6516 {
6517 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6518 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6519 {
6520 YYSIZE_T yyalloc = 2 * yysize;
6521 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6522 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6523 if (yymsg != yymsgbuf)
6524 YYSTACK_FREE (yymsg);
6525 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6526 if (yymsg)
6527 yymsg_alloc = yyalloc;
6528 else
6529 {
6530 yymsg = yymsgbuf;
6531 yymsg_alloc = sizeof yymsgbuf;
6532 }
6533 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006534
Dan Gohmanf4423b12008-04-19 00:24:39 +00006535 if (0 < yysize && yysize <= yymsg_alloc)
6536 {
6537 (void) yysyntax_error (yymsg, yystate, yychar);
6538 yyerror (yymsg);
6539 }
6540 else
6541 {
6542 yyerror (YY_("syntax error"));
6543 if (yysize != 0)
6544 goto yyexhaustedlab;
6545 }
6546 }
6547#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006548 }
6549
Dan Gohmanf4423b12008-04-19 00:24:39 +00006550
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006551
6552 if (yyerrstatus == 3)
6553 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00006554 /* If just tried and failed to reuse look-ahead token after an
6555 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006556
Dan Gohmanf4423b12008-04-19 00:24:39 +00006557 if (yychar <= YYEOF)
6558 {
6559 /* Return failure if at end of input. */
6560 if (yychar == YYEOF)
6561 YYABORT;
6562 }
6563 else
6564 {
6565 yydestruct ("Error: discarding",
6566 yytoken, &yylval);
6567 yychar = YYEMPTY;
6568 }
6569 }
6570
6571 /* Else will try to reuse look-ahead token after shifting the error
6572 token. */
6573 goto yyerrlab1;
6574
6575
6576/*---------------------------------------------------.
6577| yyerrorlab -- error raised explicitly by YYERROR. |
6578`---------------------------------------------------*/
6579yyerrorlab:
6580
6581 /* Pacify compilers like GCC when the user code never invokes
6582 YYERROR and the label yyerrorlab therefore never appears in user
6583 code. */
6584 if (/*CONSTCOND*/ 0)
6585 goto yyerrorlab;
6586
6587 /* Do not reclaim the symbols of the rule which action triggered
6588 this YYERROR. */
6589 YYPOPSTACK (yylen);
6590 yylen = 0;
6591 YY_STACK_PRINT (yyss, yyssp);
6592 yystate = *yyssp;
6593 goto yyerrlab1;
6594
6595
6596/*-------------------------------------------------------------.
6597| yyerrlab1 -- common code for both syntax error and YYERROR. |
6598`-------------------------------------------------------------*/
6599yyerrlab1:
6600 yyerrstatus = 3; /* Each real token shifted decrements this. */
6601
6602 for (;;)
6603 {
6604 yyn = yypact[yystate];
6605 if (yyn != YYPACT_NINF)
6606 {
6607 yyn += YYTERROR;
6608 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6609 {
6610 yyn = yytable[yyn];
6611 if (0 < yyn)
6612 break;
6613 }
6614 }
6615
6616 /* Pop the current state because it cannot handle the error token. */
6617 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006618 YYABORT;
6619
Dale Johannesencdd509a2007-09-07 21:07:57 +00006620
Dan Gohmanf4423b12008-04-19 00:24:39 +00006621 yydestruct ("Error: popping",
6622 yystos[yystate], yyvsp);
6623 YYPOPSTACK (1);
6624 yystate = *yyssp;
6625 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006626 }
6627
6628 if (yyn == YYFINAL)
6629 YYACCEPT;
6630
Reid Spencer68a24bd2005-08-27 18:50:39 +00006631 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006632
6633
6634 /* Shift the error token. */
6635 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006636
Reid Spencer68a24bd2005-08-27 18:50:39 +00006637 yystate = yyn;
6638 goto yynewstate;
6639
Gabor Greife64d2482008-04-06 23:07:54 +00006640
Dan Gohmanf4423b12008-04-19 00:24:39 +00006641/*-------------------------------------.
6642| yyacceptlab -- YYACCEPT comes here. |
6643`-------------------------------------*/
6644yyacceptlab:
6645 yyresult = 0;
6646 goto yyreturn;
6647
6648/*-----------------------------------.
6649| yyabortlab -- YYABORT comes here. |
6650`-----------------------------------*/
6651yyabortlab:
6652 yyresult = 1;
6653 goto yyreturn;
6654
6655#ifndef yyoverflow
6656/*-------------------------------------------------.
6657| yyexhaustedlab -- memory exhaustion comes here. |
6658`-------------------------------------------------*/
6659yyexhaustedlab:
6660 yyerror (YY_("memory exhausted"));
6661 yyresult = 2;
6662 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00006663#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00006664
6665yyreturn:
6666 if (yychar != YYEOF && yychar != YYEMPTY)
6667 yydestruct ("Cleanup: discarding lookahead",
6668 yytoken, &yylval);
6669 /* Do not reclaim the symbols of the rule which action triggered
6670 this YYABORT or YYACCEPT. */
6671 YYPOPSTACK (yylen);
6672 YY_STACK_PRINT (yyss, yyssp);
6673 while (yyssp != yyss)
6674 {
6675 yydestruct ("Cleanup: popping",
6676 yystos[*yyssp], yyvsp);
6677 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00006678 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006679#ifndef yyoverflow
6680 if (yyss != yyssa)
6681 YYSTACK_FREE (yyss);
6682#endif
6683#if YYERROR_VERBOSE
6684 if (yymsg != yymsgbuf)
6685 YYSTACK_FREE (yymsg);
6686#endif
6687 /* Make sure YYID is used. */
6688 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006689}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006690
6691
Gordon Henriksen83eaae12008-05-19 05:47:10 +00006692#line 3193 "/Users/malichus/Source/LLVM/src/svn/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00006693
6694
Reid Spencer14310612006-12-31 05:40:51 +00006695// common code from the two 'RunVMAsmParser' functions
6696static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00006697 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00006698 // Check to make sure the parser succeeded
6699 if (yyparse()) {
6700 if (ParserResult)
6701 delete ParserResult;
6702 return 0;
6703 }
6704
Reid Spencer0d60b5a2007-03-30 01:37:39 +00006705 // Emit an error if there are any unresolved types left.
6706 if (!CurModule.LateResolveTypes.empty()) {
6707 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6708 if (DID.Type == ValID::LocalName) {
6709 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6710 } else {
6711 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6712 }
6713 if (ParserResult)
6714 delete ParserResult;
6715 return 0;
6716 }
6717
6718 // Emit an error if there are any unresolved values left.
6719 if (!CurModule.LateResolveValues.empty()) {
6720 Value *V = CurModule.LateResolveValues.back();
6721 std::map<Value*, std::pair<ValID, int> >::iterator I =
6722 CurModule.PlaceHolderInfo.find(V);
6723
6724 if (I != CurModule.PlaceHolderInfo.end()) {
6725 ValID &DID = I->second.first;
6726 if (DID.Type == ValID::LocalName) {
6727 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6728 } else {
6729 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6730 }
6731 if (ParserResult)
6732 delete ParserResult;
6733 return 0;
6734 }
6735 }
6736
Reid Spencer14310612006-12-31 05:40:51 +00006737 // Check to make sure that parsing produced a result
6738 if (!ParserResult)
6739 return 0;
6740
6741 // Reset ParserResult variable while saving its value for the result.
6742 Module *Result = ParserResult;
6743 ParserResult = 0;
6744
6745 return Result;
6746}
6747
Reid Spencer61c83e02006-08-18 08:43:06 +00006748void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006749 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00006750 // TODO: column number in exception
6751 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00006752 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00006753 TriggerError = 1;
6754}
Reid Spencer68a24bd2005-08-27 18:50:39 +00006755
6756int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006757 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00006758 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00006759 if (yychar != YYEMPTY && yychar != 0) {
6760 errMsg += " while reading token: '";
6761 errMsg += std::string(LLLgetTokenStart(),
6762 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6763 }
Reid Spencer61c83e02006-08-18 08:43:06 +00006764 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006765 return 0;
6766}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006767