blob: 111cfabe89268dc4f8f1b2a46bdae68e1c55b8fa [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001
Chris Lattner5eefce32007-09-10 23:24:14 +00002/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y
Dale Johannesen3afee192007-09-07 21:07:57 +00003 by GNU Bison version 1.28 */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Dale Johannesen3afee192007-09-07 21:07:57 +00005#define YYBISON 1 /* Identify Bison output. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
7#define yyparse llvmAsmparse
Dale Johannesen3afee192007-09-07 21:07:57 +00008#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009#define yyerror llvmAsmerror
Dale Johannesen3afee192007-09-07 21:07:57 +000010#define yylval llvmAsmlval
11#define yychar llvmAsmchar
Dan Gohmanf17a25c2007-07-18 16:29:46 +000012#define yydebug llvmAsmdebug
13#define yynerrs llvmAsmnerrs
Dale Johannesen3afee192007-09-07 21:07:57 +000014#define ESINT64VAL 257
15#define EUINT64VAL 258
16#define ESAPINTVAL 259
17#define EUAPINTVAL 260
18#define LOCALVAL_ID 261
19#define GLOBALVAL_ID 262
20#define FPVAL 263
21#define VOID 264
22#define INTTYPE 265
23#define FLOAT 266
24#define DOUBLE 267
25#define X86_FP80 268
26#define FP128 269
27#define PPC_FP128 270
28#define LABEL 271
29#define TYPE 272
30#define LOCALVAR 273
31#define GLOBALVAR 274
32#define LABELSTR 275
33#define STRINGCONSTANT 276
34#define ATSTRINGCONSTANT 277
35#define PCTSTRINGCONSTANT 278
36#define ZEROINITIALIZER 279
37#define TRUETOK 280
38#define FALSETOK 281
39#define BEGINTOK 282
40#define ENDTOK 283
41#define DECLARE 284
42#define DEFINE 285
43#define GLOBAL 286
44#define CONSTANT 287
45#define SECTION 288
46#define ALIAS 289
47#define VOLATILE 290
48#define THREAD_LOCAL 291
49#define TO 292
50#define DOTDOTDOT 293
51#define NULL_TOK 294
52#define UNDEF 295
53#define INTERNAL 296
54#define LINKONCE 297
55#define WEAK 298
56#define APPENDING 299
57#define DLLIMPORT 300
58#define DLLEXPORT 301
59#define EXTERN_WEAK 302
60#define OPAQUE 303
61#define EXTERNAL 304
62#define TARGET 305
63#define TRIPLE 306
64#define ALIGN 307
65#define DEPLIBS 308
66#define CALL 309
67#define TAIL 310
68#define ASM_TOK 311
69#define MODULE 312
70#define SIDEEFFECT 313
71#define CC_TOK 314
72#define CCC_TOK 315
73#define FASTCC_TOK 316
74#define COLDCC_TOK 317
75#define X86_STDCALLCC_TOK 318
76#define X86_FASTCALLCC_TOK 319
77#define DATALAYOUT 320
78#define RET 321
79#define BR 322
80#define SWITCH 323
81#define INVOKE 324
82#define UNWIND 325
83#define UNREACHABLE 326
84#define ADD 327
85#define SUB 328
86#define MUL 329
87#define UDIV 330
88#define SDIV 331
89#define FDIV 332
90#define UREM 333
91#define SREM 334
92#define FREM 335
93#define AND 336
94#define OR 337
95#define XOR 338
96#define SHL 339
97#define LSHR 340
98#define ASHR 341
99#define ICMP 342
100#define FCMP 343
101#define EQ 344
102#define NE 345
103#define SLT 346
104#define SGT 347
105#define SLE 348
106#define SGE 349
107#define ULT 350
108#define UGT 351
109#define ULE 352
110#define UGE 353
111#define OEQ 354
112#define ONE 355
113#define OLT 356
114#define OGT 357
115#define OLE 358
116#define OGE 359
117#define ORD 360
118#define UNO 361
119#define UEQ 362
120#define UNE 363
121#define MALLOC 364
122#define ALLOCA 365
123#define FREE 366
124#define LOAD 367
125#define STORE 368
126#define GETELEMENTPTR 369
127#define TRUNC 370
128#define ZEXT 371
129#define SEXT 372
130#define FPTRUNC 373
131#define FPEXT 374
132#define BITCAST 375
133#define UITOFP 376
134#define SITOFP 377
135#define FPTOUI 378
136#define FPTOSI 379
137#define INTTOPTR 380
138#define PTRTOINT 381
139#define PHI_TOK 382
140#define SELECT 383
141#define VAARG 384
142#define EXTRACTELEMENT 385
143#define INSERTELEMENT 386
144#define SHUFFLEVECTOR 387
145#define SIGNEXT 388
146#define ZEROEXT 389
147#define NORETURN 390
148#define INREG 391
149#define SRET 392
150#define NOUNWIND 393
151#define NOALIAS 394
152#define BYVAL 395
153#define NEST 396
154#define DEFAULT 397
155#define HIDDEN 398
156#define PROTECTED 399
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000157
Chris Lattner5eefce32007-09-10 23:24:14 +0000158#line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000159
160#include "ParserInternals.h"
161#include "llvm/CallingConv.h"
162#include "llvm/InlineAsm.h"
163#include "llvm/Instructions.h"
164#include "llvm/Module.h"
165#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000166#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000167#include "llvm/Support/GetElementPtrTypeIterator.h"
168#include "llvm/Support/CommandLine.h"
169#include "llvm/ADT/SmallVector.h"
170#include "llvm/ADT/STLExtras.h"
171#include "llvm/Support/MathExtras.h"
172#include "llvm/Support/Streams.h"
173#include <algorithm>
174#include <list>
175#include <map>
176#include <utility>
177#ifndef NDEBUG
178#define YYDEBUG 1
179#endif
180
181// The following is a gross hack. In order to rid the libAsmParser library of
182// exceptions, we have to have a way of getting the yyparse function to go into
183// an error situation. So, whenever we want an error to occur, the GenerateError
184// function (see bottom of file) sets TriggerError. Then, at the end of each
185// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
186// (a goto) to put YACC in error state. Furthermore, several calls to
187// GenerateError are made from inside productions and they must simulate the
188// previous exception behavior by exiting the production immediately. We have
189// replaced these with the GEN_ERROR macro which calls GeneratError and then
190// immediately invokes YYERROR. This would be so much cleaner if it was a
191// recursive descent parser.
192static bool TriggerError = false;
193#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
194#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
195
196int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
197int yylex(); // declaration" of xxx warnings.
198int yyparse();
199
200namespace llvm {
201 std::string CurFilename;
202#if YYDEBUG
203static cl::opt<bool>
204Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
205 cl::Hidden, cl::init(false));
206#endif
207}
208using namespace llvm;
209
210static Module *ParserResult;
211
212// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
213// relating to upreferences in the input stream.
214//
215//#define DEBUG_UPREFS 1
216#ifdef DEBUG_UPREFS
217#define UR_OUT(X) cerr << X
218#else
219#define UR_OUT(X)
220#endif
221
222#define YYERROR_VERBOSE 1
223
224static GlobalVariable *CurGV;
225
226
227// This contains info used when building the body of a function. It is
228// destroyed when the function is completed.
229//
230typedef std::vector<Value *> ValueList; // Numbered defs
231
232static void
233ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
234
235static struct PerModuleInfo {
236 Module *CurrentModule;
237 ValueList Values; // Module level numbered definitions
238 ValueList LateResolveValues;
239 std::vector<PATypeHolder> Types;
240 std::map<ValID, PATypeHolder> LateResolveTypes;
241
242 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
243 /// how they were referenced and on which line of the input they came from so
244 /// that we can resolve them later and print error messages as appropriate.
245 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
246
247 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
248 // references to global values. Global values may be referenced before they
249 // are defined, and if so, the temporary object that they represent is held
250 // here. This is used for forward references of GlobalValues.
251 //
252 typedef std::map<std::pair<const PointerType *,
253 ValID>, GlobalValue*> GlobalRefsType;
254 GlobalRefsType GlobalRefs;
255
256 void ModuleDone() {
257 // If we could not resolve some functions at function compilation time
258 // (calls to functions before they are defined), resolve them now... Types
259 // are resolved when the constant pool has been completely parsed.
260 //
261 ResolveDefinitions(LateResolveValues);
262 if (TriggerError)
263 return;
264
265 // Check to make sure that all global value forward references have been
266 // resolved!
267 //
268 if (!GlobalRefs.empty()) {
269 std::string UndefinedReferences = "Unresolved global references exist:\n";
270
271 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
272 I != E; ++I) {
273 UndefinedReferences += " " + I->first.first->getDescription() + " " +
274 I->first.second.getName() + "\n";
275 }
276 GenerateError(UndefinedReferences);
277 return;
278 }
279
Chandler Carruth563d4a42007-08-04 01:56:21 +0000280 // Look for intrinsic functions and CallInst that need to be upgraded
281 for (Module::iterator FI = CurrentModule->begin(),
282 FE = CurrentModule->end(); FI != FE; )
283 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
284
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000285 Values.clear(); // Clear out function local definitions
286 Types.clear();
287 CurrentModule = 0;
288 }
289
290 // GetForwardRefForGlobal - Check to see if there is a forward reference
291 // for this global. If so, remove it from the GlobalRefs map and return it.
292 // If not, just return null.
293 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
294 // Check to see if there is a forward reference to this global variable...
295 // if there is, eliminate it and patch the reference to use the new def'n.
296 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
297 GlobalValue *Ret = 0;
298 if (I != GlobalRefs.end()) {
299 Ret = I->second;
300 GlobalRefs.erase(I);
301 }
302 return Ret;
303 }
304
305 bool TypeIsUnresolved(PATypeHolder* PATy) {
306 // If it isn't abstract, its resolved
307 const Type* Ty = PATy->get();
308 if (!Ty->isAbstract())
309 return false;
310 // Traverse the type looking for abstract types. If it isn't abstract then
311 // we don't need to traverse that leg of the type.
312 std::vector<const Type*> WorkList, SeenList;
313 WorkList.push_back(Ty);
314 while (!WorkList.empty()) {
315 const Type* Ty = WorkList.back();
316 SeenList.push_back(Ty);
317 WorkList.pop_back();
318 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
319 // Check to see if this is an unresolved type
320 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
321 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
322 for ( ; I != E; ++I) {
323 if (I->second.get() == OpTy)
324 return true;
325 }
326 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
327 const Type* TheTy = SeqTy->getElementType();
328 if (TheTy->isAbstract() && TheTy != Ty) {
329 std::vector<const Type*>::iterator I = SeenList.begin(),
330 E = SeenList.end();
331 for ( ; I != E; ++I)
332 if (*I == TheTy)
333 break;
334 if (I == E)
335 WorkList.push_back(TheTy);
336 }
337 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
338 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
339 const Type* TheTy = StrTy->getElementType(i);
340 if (TheTy->isAbstract() && TheTy != Ty) {
341 std::vector<const Type*>::iterator I = SeenList.begin(),
342 E = SeenList.end();
343 for ( ; I != E; ++I)
344 if (*I == TheTy)
345 break;
346 if (I == E)
347 WorkList.push_back(TheTy);
348 }
349 }
350 }
351 }
352 return false;
353 }
354} CurModule;
355
356static struct PerFunctionInfo {
357 Function *CurrentFunction; // Pointer to current function being created
358
359 ValueList Values; // Keep track of #'d definitions
360 unsigned NextValNum;
361 ValueList LateResolveValues;
362 bool isDeclare; // Is this function a forward declararation?
363 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
364 GlobalValue::VisibilityTypes Visibility;
365
366 /// BBForwardRefs - When we see forward references to basic blocks, keep
367 /// track of them here.
368 std::map<ValID, BasicBlock*> BBForwardRefs;
369
370 inline PerFunctionInfo() {
371 CurrentFunction = 0;
372 isDeclare = false;
373 Linkage = GlobalValue::ExternalLinkage;
374 Visibility = GlobalValue::DefaultVisibility;
375 }
376
377 inline void FunctionStart(Function *M) {
378 CurrentFunction = M;
379 NextValNum = 0;
380 }
381
382 void FunctionDone() {
383 // Any forward referenced blocks left?
384 if (!BBForwardRefs.empty()) {
385 GenerateError("Undefined reference to label " +
386 BBForwardRefs.begin()->second->getName());
387 return;
388 }
389
390 // Resolve all forward references now.
391 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
392
393 Values.clear(); // Clear out function local definitions
394 BBForwardRefs.clear();
395 CurrentFunction = 0;
396 isDeclare = false;
397 Linkage = GlobalValue::ExternalLinkage;
398 Visibility = GlobalValue::DefaultVisibility;
399 }
400} CurFun; // Info for the current function...
401
402static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
403
404
405//===----------------------------------------------------------------------===//
406// Code to handle definitions of all the types
407//===----------------------------------------------------------------------===//
408
409static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
410 // Things that have names or are void typed don't get slot numbers
411 if (V->hasName() || (V->getType() == Type::VoidTy))
412 return;
413
414 // In the case of function values, we have to allow for the forward reference
415 // of basic blocks, which are included in the numbering. Consequently, we keep
416 // track of the next insertion location with NextValNum. When a BB gets
417 // inserted, it could change the size of the CurFun.Values vector.
418 if (&ValueTab == &CurFun.Values) {
419 if (ValueTab.size() <= CurFun.NextValNum)
420 ValueTab.resize(CurFun.NextValNum+1);
421 ValueTab[CurFun.NextValNum++] = V;
422 return;
423 }
424 // For all other lists, its okay to just tack it on the back of the vector.
425 ValueTab.push_back(V);
426}
427
428static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
429 switch (D.Type) {
430 case ValID::LocalID: // Is it a numbered definition?
431 // Module constants occupy the lowest numbered slots...
432 if (D.Num < CurModule.Types.size())
433 return CurModule.Types[D.Num];
434 break;
435 case ValID::LocalName: // Is it a named definition?
436 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
437 D.destroy(); // Free old strdup'd memory...
438 return N;
439 }
440 break;
441 default:
442 GenerateError("Internal parser error: Invalid symbol type reference");
443 return 0;
444 }
445
446 // If we reached here, we referenced either a symbol that we don't know about
447 // or an id number that hasn't been read yet. We may be referencing something
448 // forward, so just create an entry to be resolved later and get to it...
449 //
450 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
451
452
453 if (inFunctionScope()) {
454 if (D.Type == ValID::LocalName) {
455 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
456 return 0;
457 } else {
458 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
459 return 0;
460 }
461 }
462
463 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
464 if (I != CurModule.LateResolveTypes.end())
465 return I->second;
466
467 Type *Typ = OpaqueType::get();
468 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
469 return Typ;
470 }
471
472// getExistingVal - Look up the value specified by the provided type and
473// the provided ValID. If the value exists and has already been defined, return
474// it. Otherwise return null.
475//
476static Value *getExistingVal(const Type *Ty, const ValID &D) {
477 if (isa<FunctionType>(Ty)) {
478 GenerateError("Functions are not values and "
479 "must be referenced as pointers");
480 return 0;
481 }
482
483 switch (D.Type) {
484 case ValID::LocalID: { // Is it a numbered definition?
485 // Check that the number is within bounds.
486 if (D.Num >= CurFun.Values.size())
487 return 0;
488 Value *Result = CurFun.Values[D.Num];
489 if (Ty != Result->getType()) {
490 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
491 Result->getType()->getDescription() + "' does not match "
492 "expected type, '" + Ty->getDescription() + "'");
493 return 0;
494 }
495 return Result;
496 }
497 case ValID::GlobalID: { // Is it a numbered definition?
498 if (D.Num >= CurModule.Values.size())
499 return 0;
500 Value *Result = CurModule.Values[D.Num];
501 if (Ty != Result->getType()) {
502 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
503 Result->getType()->getDescription() + "' does not match "
504 "expected type, '" + Ty->getDescription() + "'");
505 return 0;
506 }
507 return Result;
508 }
509
510 case ValID::LocalName: { // Is it a named definition?
511 if (!inFunctionScope())
512 return 0;
513 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
514 Value *N = SymTab.lookup(D.getName());
515 if (N == 0)
516 return 0;
517 if (N->getType() != Ty)
518 return 0;
519
520 D.destroy(); // Free old strdup'd memory...
521 return N;
522 }
523 case ValID::GlobalName: { // Is it a named definition?
524 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
525 Value *N = SymTab.lookup(D.getName());
526 if (N == 0)
527 return 0;
528 if (N->getType() != Ty)
529 return 0;
530
531 D.destroy(); // Free old strdup'd memory...
532 return N;
533 }
534
535 // Check to make sure that "Ty" is an integral type, and that our
536 // value will fit into the specified type...
537 case ValID::ConstSIntVal: // Is it a constant pool reference??
538 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
539 GenerateError("Signed integral constant '" +
540 itostr(D.ConstPool64) + "' is invalid for type '" +
541 Ty->getDescription() + "'");
542 return 0;
543 }
544 return ConstantInt::get(Ty, D.ConstPool64, true);
545
546 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
547 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
548 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
549 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
550 "' is invalid or out of range");
551 return 0;
552 } else { // This is really a signed reference. Transmogrify.
553 return ConstantInt::get(Ty, D.ConstPool64, true);
554 }
555 } else {
556 return ConstantInt::get(Ty, D.UConstPool64);
557 }
558
559 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Dale Johannesen3afee192007-09-07 21:07:57 +0000560 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000561 GenerateError("FP constant invalid for type");
562 return 0;
563 }
Dale Johannesen3afee192007-09-07 21:07:57 +0000564 // Lexer has no type info, so builds all FP constants as double.
565 // Fix this here.
566 if (Ty==Type::FloatTy)
567 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
568 return ConstantFP::get(Ty, *D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000569
570 case ValID::ConstNullVal: // Is it a null value?
571 if (!isa<PointerType>(Ty)) {
572 GenerateError("Cannot create a a non pointer null");
573 return 0;
574 }
575 return ConstantPointerNull::get(cast<PointerType>(Ty));
576
577 case ValID::ConstUndefVal: // Is it an undef value?
578 return UndefValue::get(Ty);
579
580 case ValID::ConstZeroVal: // Is it a zero value?
581 return Constant::getNullValue(Ty);
582
583 case ValID::ConstantVal: // Fully resolved constant?
584 if (D.ConstantValue->getType() != Ty) {
585 GenerateError("Constant expression type different from required type");
586 return 0;
587 }
588 return D.ConstantValue;
589
590 case ValID::InlineAsmVal: { // Inline asm expression
591 const PointerType *PTy = dyn_cast<PointerType>(Ty);
592 const FunctionType *FTy =
593 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
594 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
595 GenerateError("Invalid type for asm constraint string");
596 return 0;
597 }
598 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
599 D.IAD->HasSideEffects);
600 D.destroy(); // Free InlineAsmDescriptor.
601 return IA;
602 }
603 default:
604 assert(0 && "Unhandled case!");
605 return 0;
606 } // End of switch
607
608 assert(0 && "Unhandled case!");
609 return 0;
610}
611
612// getVal - This function is identical to getExistingVal, except that if a
613// value is not already defined, it "improvises" by creating a placeholder var
614// that looks and acts just like the requested variable. When the value is
615// defined later, all uses of the placeholder variable are replaced with the
616// real thing.
617//
618static Value *getVal(const Type *Ty, const ValID &ID) {
619 if (Ty == Type::LabelTy) {
620 GenerateError("Cannot use a basic block here");
621 return 0;
622 }
623
624 // See if the value has already been defined.
625 Value *V = getExistingVal(Ty, ID);
626 if (V) return V;
627 if (TriggerError) return 0;
628
629 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
630 GenerateError("Invalid use of a composite type");
631 return 0;
632 }
633
634 // If we reached here, we referenced either a symbol that we don't know about
635 // or an id number that hasn't been read yet. We may be referencing something
636 // forward, so just create an entry to be resolved later and get to it...
637 //
638 switch (ID.Type) {
639 case ValID::GlobalName:
640 case ValID::GlobalID: {
641 const PointerType *PTy = dyn_cast<PointerType>(Ty);
642 if (!PTy) {
643 GenerateError("Invalid type for reference to global" );
644 return 0;
645 }
646 const Type* ElTy = PTy->getElementType();
647 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
648 V = new Function(FTy, GlobalValue::ExternalLinkage);
649 else
650 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
651 break;
652 }
653 default:
654 V = new Argument(Ty);
655 }
656
657 // Remember where this forward reference came from. FIXME, shouldn't we try
658 // to recycle these things??
659 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
660 llvmAsmlineno)));
661
662 if (inFunctionScope())
663 InsertValue(V, CurFun.LateResolveValues);
664 else
665 InsertValue(V, CurModule.LateResolveValues);
666 return V;
667}
668
669/// defineBBVal - This is a definition of a new basic block with the specified
670/// identifier which must be the same as CurFun.NextValNum, if its numeric.
671static BasicBlock *defineBBVal(const ValID &ID) {
672 assert(inFunctionScope() && "Can't get basic block at global scope!");
673
674 BasicBlock *BB = 0;
675
676 // First, see if this was forward referenced
677
678 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
679 if (BBI != CurFun.BBForwardRefs.end()) {
680 BB = BBI->second;
681 // The forward declaration could have been inserted anywhere in the
682 // function: insert it into the correct place now.
683 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
684 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
685
686 // We're about to erase the entry, save the key so we can clean it up.
687 ValID Tmp = BBI->first;
688
689 // Erase the forward ref from the map as its no longer "forward"
690 CurFun.BBForwardRefs.erase(ID);
691
692 // The key has been removed from the map but so we don't want to leave
693 // strdup'd memory around so destroy it too.
694 Tmp.destroy();
695
696 // If its a numbered definition, bump the number and set the BB value.
697 if (ID.Type == ValID::LocalID) {
698 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
699 InsertValue(BB);
700 }
701
702 ID.destroy();
703 return BB;
704 }
705
706 // We haven't seen this BB before and its first mention is a definition.
707 // Just create it and return it.
708 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
709 BB = new BasicBlock(Name, CurFun.CurrentFunction);
710 if (ID.Type == ValID::LocalID) {
711 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
712 InsertValue(BB);
713 }
714
715 ID.destroy(); // Free strdup'd memory
716 return BB;
717}
718
719/// getBBVal - get an existing BB value or create a forward reference for it.
720///
721static BasicBlock *getBBVal(const ValID &ID) {
722 assert(inFunctionScope() && "Can't get basic block at global scope!");
723
724 BasicBlock *BB = 0;
725
726 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
727 if (BBI != CurFun.BBForwardRefs.end()) {
728 BB = BBI->second;
729 } if (ID.Type == ValID::LocalName) {
730 std::string Name = ID.getName();
731 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
732 if (N)
733 if (N->getType()->getTypeID() == Type::LabelTyID)
734 BB = cast<BasicBlock>(N);
735 else
736 GenerateError("Reference to label '" + Name + "' is actually of type '"+
737 N->getType()->getDescription() + "'");
738 } else if (ID.Type == ValID::LocalID) {
739 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
740 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
741 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
742 else
743 GenerateError("Reference to label '%" + utostr(ID.Num) +
744 "' is actually of type '"+
745 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
746 }
747 } else {
748 GenerateError("Illegal label reference " + ID.getName());
749 return 0;
750 }
751
752 // If its already been defined, return it now.
753 if (BB) {
754 ID.destroy(); // Free strdup'd memory.
755 return BB;
756 }
757
758 // Otherwise, this block has not been seen before, create it.
759 std::string Name;
760 if (ID.Type == ValID::LocalName)
761 Name = ID.getName();
762 BB = new BasicBlock(Name, CurFun.CurrentFunction);
763
764 // Insert it in the forward refs map.
765 CurFun.BBForwardRefs[ID] = BB;
766
767 return BB;
768}
769
770
771//===----------------------------------------------------------------------===//
772// Code to handle forward references in instructions
773//===----------------------------------------------------------------------===//
774//
775// This code handles the late binding needed with statements that reference
776// values not defined yet... for example, a forward branch, or the PHI node for
777// a loop body.
778//
779// This keeps a table (CurFun.LateResolveValues) of all such forward references
780// and back patchs after we are done.
781//
782
783// ResolveDefinitions - If we could not resolve some defs at parsing
784// time (forward branches, phi functions for loops, etc...) resolve the
785// defs now...
786//
787static void
788ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
789 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
790 while (!LateResolvers.empty()) {
791 Value *V = LateResolvers.back();
792 LateResolvers.pop_back();
793
794 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
795 CurModule.PlaceHolderInfo.find(V);
796 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
797
798 ValID &DID = PHI->second.first;
799
800 Value *TheRealValue = getExistingVal(V->getType(), DID);
801 if (TriggerError)
802 return;
803 if (TheRealValue) {
804 V->replaceAllUsesWith(TheRealValue);
805 delete V;
806 CurModule.PlaceHolderInfo.erase(PHI);
807 } else if (FutureLateResolvers) {
808 // Functions have their unresolved items forwarded to the module late
809 // resolver table
810 InsertValue(V, *FutureLateResolvers);
811 } else {
812 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
813 GenerateError("Reference to an invalid definition: '" +DID.getName()+
814 "' of type '" + V->getType()->getDescription() + "'",
815 PHI->second.second);
816 return;
817 } else {
818 GenerateError("Reference to an invalid definition: #" +
819 itostr(DID.Num) + " of type '" +
820 V->getType()->getDescription() + "'",
821 PHI->second.second);
822 return;
823 }
824 }
825 }
826 LateResolvers.clear();
827}
828
829// ResolveTypeTo - A brand new type was just declared. This means that (if
830// name is not null) things referencing Name can be resolved. Otherwise, things
831// refering to the number can be resolved. Do this now.
832//
833static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
834 ValID D;
835 if (Name)
836 D = ValID::createLocalName(*Name);
837 else
838 D = ValID::createLocalID(CurModule.Types.size());
839
840 std::map<ValID, PATypeHolder>::iterator I =
841 CurModule.LateResolveTypes.find(D);
842 if (I != CurModule.LateResolveTypes.end()) {
843 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
844 CurModule.LateResolveTypes.erase(I);
845 }
846}
847
848// setValueName - Set the specified value to the name given. The name may be
849// null potentially, in which case this is a noop. The string passed in is
850// assumed to be a malloc'd string buffer, and is free'd by this function.
851//
852static void setValueName(Value *V, std::string *NameStr) {
853 if (!NameStr) return;
854 std::string Name(*NameStr); // Copy string
855 delete NameStr; // Free old string
856
857 if (V->getType() == Type::VoidTy) {
858 GenerateError("Can't assign name '" + Name+"' to value with void type");
859 return;
860 }
861
862 assert(inFunctionScope() && "Must be in function scope!");
863 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
864 if (ST.lookup(Name)) {
865 GenerateError("Redefinition of value '" + Name + "' of type '" +
866 V->getType()->getDescription() + "'");
867 return;
868 }
869
870 // Set the name.
871 V->setName(Name);
872}
873
874/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
875/// this is a declaration, otherwise it is a definition.
876static GlobalVariable *
877ParseGlobalVariable(std::string *NameStr,
878 GlobalValue::LinkageTypes Linkage,
879 GlobalValue::VisibilityTypes Visibility,
880 bool isConstantGlobal, const Type *Ty,
881 Constant *Initializer, bool IsThreadLocal) {
882 if (isa<FunctionType>(Ty)) {
883 GenerateError("Cannot declare global vars of function type");
884 return 0;
885 }
886
887 const PointerType *PTy = PointerType::get(Ty);
888
889 std::string Name;
890 if (NameStr) {
891 Name = *NameStr; // Copy string
892 delete NameStr; // Free old string
893 }
894
895 // See if this global value was forward referenced. If so, recycle the
896 // object.
897 ValID ID;
898 if (!Name.empty()) {
899 ID = ValID::createGlobalName(Name);
900 } else {
901 ID = ValID::createGlobalID(CurModule.Values.size());
902 }
903
904 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
905 // Move the global to the end of the list, from whereever it was
906 // previously inserted.
907 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
908 CurModule.CurrentModule->getGlobalList().remove(GV);
909 CurModule.CurrentModule->getGlobalList().push_back(GV);
910 GV->setInitializer(Initializer);
911 GV->setLinkage(Linkage);
912 GV->setVisibility(Visibility);
913 GV->setConstant(isConstantGlobal);
914 GV->setThreadLocal(IsThreadLocal);
915 InsertValue(GV, CurModule.Values);
916 return GV;
917 }
918
919 // If this global has a name
920 if (!Name.empty()) {
921 // if the global we're parsing has an initializer (is a definition) and
922 // has external linkage.
923 if (Initializer && Linkage != GlobalValue::InternalLinkage)
924 // If there is already a global with external linkage with this name
925 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
926 // If we allow this GVar to get created, it will be renamed in the
927 // symbol table because it conflicts with an existing GVar. We can't
928 // allow redefinition of GVars whose linking indicates that their name
929 // must stay the same. Issue the error.
930 GenerateError("Redefinition of global variable named '" + Name +
931 "' of type '" + Ty->getDescription() + "'");
932 return 0;
933 }
934 }
935
936 // Otherwise there is no existing GV to use, create one now.
937 GlobalVariable *GV =
938 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
939 CurModule.CurrentModule, IsThreadLocal);
940 GV->setVisibility(Visibility);
941 InsertValue(GV, CurModule.Values);
942 return GV;
943}
944
945// setTypeName - Set the specified type to the name given. The name may be
946// null potentially, in which case this is a noop. The string passed in is
947// assumed to be a malloc'd string buffer, and is freed by this function.
948//
949// This function returns true if the type has already been defined, but is
950// allowed to be redefined in the specified context. If the name is a new name
951// for the type plane, it is inserted and false is returned.
952static bool setTypeName(const Type *T, std::string *NameStr) {
953 assert(!inFunctionScope() && "Can't give types function-local names!");
954 if (NameStr == 0) return false;
955
956 std::string Name(*NameStr); // Copy string
957 delete NameStr; // Free old string
958
959 // We don't allow assigning names to void type
960 if (T == Type::VoidTy) {
961 GenerateError("Can't assign name '" + Name + "' to the void type");
962 return false;
963 }
964
965 // Set the type name, checking for conflicts as we do so.
966 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
967
968 if (AlreadyExists) { // Inserting a name that is already defined???
969 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
970 assert(Existing && "Conflict but no matching type?!");
971
972 // There is only one case where this is allowed: when we are refining an
973 // opaque type. In this case, Existing will be an opaque type.
974 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
975 // We ARE replacing an opaque type!
976 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
977 return true;
978 }
979
980 // Otherwise, this is an attempt to redefine a type. That's okay if
981 // the redefinition is identical to the original. This will be so if
982 // Existing and T point to the same Type object. In this one case we
983 // allow the equivalent redefinition.
984 if (Existing == T) return true; // Yes, it's equal.
985
986 // Any other kind of (non-equivalent) redefinition is an error.
987 GenerateError("Redefinition of type named '" + Name + "' of type '" +
988 T->getDescription() + "'");
989 }
990
991 return false;
992}
993
994//===----------------------------------------------------------------------===//
995// Code for handling upreferences in type names...
996//
997
998// TypeContains - Returns true if Ty directly contains E in it.
999//
1000static bool TypeContains(const Type *Ty, const Type *E) {
1001 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1002 E) != Ty->subtype_end();
1003}
1004
1005namespace {
1006 struct UpRefRecord {
1007 // NestingLevel - The number of nesting levels that need to be popped before
1008 // this type is resolved.
1009 unsigned NestingLevel;
1010
1011 // LastContainedTy - This is the type at the current binding level for the
1012 // type. Every time we reduce the nesting level, this gets updated.
1013 const Type *LastContainedTy;
1014
1015 // UpRefTy - This is the actual opaque type that the upreference is
1016 // represented with.
1017 OpaqueType *UpRefTy;
1018
1019 UpRefRecord(unsigned NL, OpaqueType *URTy)
1020 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1021 };
1022}
1023
1024// UpRefs - A list of the outstanding upreferences that need to be resolved.
1025static std::vector<UpRefRecord> UpRefs;
1026
1027/// HandleUpRefs - Every time we finish a new layer of types, this function is
1028/// called. It loops through the UpRefs vector, which is a list of the
1029/// currently active types. For each type, if the up reference is contained in
1030/// the newly completed type, we decrement the level count. When the level
1031/// count reaches zero, the upreferenced type is the type that is passed in:
1032/// thus we can complete the cycle.
1033///
1034static PATypeHolder HandleUpRefs(const Type *ty) {
1035 // If Ty isn't abstract, or if there are no up-references in it, then there is
1036 // nothing to resolve here.
1037 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1038
1039 PATypeHolder Ty(ty);
1040 UR_OUT("Type '" << Ty->getDescription() <<
1041 "' newly formed. Resolving upreferences.\n" <<
1042 UpRefs.size() << " upreferences active!\n");
1043
1044 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1045 // to zero), we resolve them all together before we resolve them to Ty. At
1046 // the end of the loop, if there is anything to resolve to Ty, it will be in
1047 // this variable.
1048 OpaqueType *TypeToResolve = 0;
1049
1050 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1051 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1052 << UpRefs[i].second->getDescription() << ") = "
1053 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1054 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1055 // Decrement level of upreference
1056 unsigned Level = --UpRefs[i].NestingLevel;
1057 UpRefs[i].LastContainedTy = Ty;
1058 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1059 if (Level == 0) { // Upreference should be resolved!
1060 if (!TypeToResolve) {
1061 TypeToResolve = UpRefs[i].UpRefTy;
1062 } else {
1063 UR_OUT(" * Resolving upreference for "
1064 << UpRefs[i].second->getDescription() << "\n";
1065 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1066 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1067 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1068 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1069 }
1070 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1071 --i; // Do not skip the next element...
1072 }
1073 }
1074 }
1075
1076 if (TypeToResolve) {
1077 UR_OUT(" * Resolving upreference for "
1078 << UpRefs[i].second->getDescription() << "\n";
1079 std::string OldName = TypeToResolve->getDescription());
1080 TypeToResolve->refineAbstractTypeTo(Ty);
1081 }
1082
1083 return Ty;
1084}
1085
1086//===----------------------------------------------------------------------===//
1087// RunVMAsmParser - Define an interface to this parser
1088//===----------------------------------------------------------------------===//
1089//
1090static Module* RunParser(Module * M);
1091
1092Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1093 set_scan_file(F);
1094
1095 CurFilename = Filename;
1096 return RunParser(new Module(CurFilename));
1097}
1098
1099Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1100 set_scan_string(AsmString);
1101
1102 CurFilename = "from_memory";
1103 if (M == NULL) {
1104 return RunParser(new Module (CurFilename));
1105 } else {
1106 return RunParser(M);
1107 }
1108}
1109
1110
Chris Lattner5eefce32007-09-10 23:24:14 +00001111#line 967 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00001112typedef union {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001113 llvm::Module *ModuleVal;
1114 llvm::Function *FunctionVal;
1115 llvm::BasicBlock *BasicBlockVal;
1116 llvm::TerminatorInst *TermInstVal;
1117 llvm::Instruction *InstVal;
1118 llvm::Constant *ConstVal;
1119
1120 const llvm::Type *PrimType;
1121 std::list<llvm::PATypeHolder> *TypeList;
1122 llvm::PATypeHolder *TypeVal;
1123 llvm::Value *ValueVal;
1124 std::vector<llvm::Value*> *ValueList;
1125 llvm::ArgListType *ArgList;
1126 llvm::TypeWithAttrs TypeWithAttrs;
1127 llvm::TypeWithAttrsList *TypeWithAttrsList;
1128 llvm::ValueRefList *ValueRefList;
1129
1130 // Represent the RHS of PHI node
1131 std::list<std::pair<llvm::Value*,
1132 llvm::BasicBlock*> > *PHIList;
1133 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1134 std::vector<llvm::Constant*> *ConstVector;
1135
1136 llvm::GlobalValue::LinkageTypes Linkage;
1137 llvm::GlobalValue::VisibilityTypes Visibility;
1138 uint16_t ParamAttrs;
1139 llvm::APInt *APIntVal;
1140 int64_t SInt64Val;
1141 uint64_t UInt64Val;
1142 int SIntVal;
1143 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001144 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001145 bool BoolVal;
1146
1147 std::string *StrVal; // This memory must be deleted
1148 llvm::ValID ValIDVal;
1149
1150 llvm::Instruction::BinaryOps BinaryOpVal;
1151 llvm::Instruction::TermOps TermOpVal;
1152 llvm::Instruction::MemoryOps MemOpVal;
1153 llvm::Instruction::CastOps CastOpVal;
1154 llvm::Instruction::OtherOps OtherOpVal;
1155 llvm::ICmpInst::Predicate IPredicate;
1156 llvm::FCmpInst::Predicate FPredicate;
Chris Lattnerbb856a32007-08-06 21:00:46 +00001157} YYSTYPE;
Dale Johannesen3afee192007-09-07 21:07:57 +00001158#include <stdio.h>
1159
1160#ifndef __cplusplus
1161#ifndef __STDC__
1162#define const
1163#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001164#endif
1165
1166
1167
Dale Johannesen3afee192007-09-07 21:07:57 +00001168#define YYFINAL 594
1169#define YYFLAG -32768
1170#define YYNTBASE 160
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001171
Dale Johannesen3afee192007-09-07 21:07:57 +00001172#define YYTRANSLATE(x) ((unsigned)(x) <= 399 ? yytranslate[x] : 241)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001173
Dale Johannesen3afee192007-09-07 21:07:57 +00001174static const short yytranslate[] = { 0,
1175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1178 2, 2, 2, 2, 2, 2, 2, 2, 2, 150,
1179 151, 148, 2, 147, 2, 2, 2, 2, 2, 2,
1180 2, 2, 2, 2, 2, 2, 2, 2, 2, 155,
1181 146, 156, 2, 2, 2, 2, 2, 2, 2, 2,
1182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 152, 149, 154, 2, 2, 2, 2, 2, 159, 2,
1185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1186 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1187 2, 2, 157, 2, 158, 2, 2, 2, 2, 2,
1188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1200 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1201 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1202 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1203 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1204 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1205 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1206 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1207 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1208 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1209 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1210 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1211 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1212 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1213 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1214 137, 138, 139, 140, 141, 142, 143, 144, 145
1215};
Reid Spenceraa8ae282007-07-31 03:50:36 +00001216
Dale Johannesen3afee192007-09-07 21:07:57 +00001217#if YYDEBUG != 0
1218static const short yyprhs[] = { 0,
1219 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1220 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1221 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1222 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1223 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1224 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1225 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1226 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1227 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1228 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1229 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1230 215, 216, 219, 221, 223, 225, 227, 228, 231, 232,
1231 235, 236, 240, 243, 244, 246, 247, 251, 253, 256,
1232 258, 260, 262, 264, 266, 268, 270, 272, 274, 277,
1233 279, 282, 288, 294, 300, 306, 310, 313, 319, 324,
1234 327, 329, 331, 333, 337, 339, 343, 345, 346, 348,
1235 352, 357, 361, 365, 370, 375, 379, 386, 392, 395,
1236 398, 401, 404, 407, 410, 413, 416, 419, 422, 425,
1237 428, 435, 441, 450, 457, 464, 472, 480, 487, 496,
1238 505, 509, 511, 513, 515, 517, 518, 521, 528, 530,
1239 531, 533, 536, 537, 541, 542, 546, 550, 554, 558,
1240 559, 567, 568, 577, 578, 587, 593, 596, 600, 602,
1241 606, 610, 614, 618, 620, 621, 627, 631, 633, 637,
1242 639, 640, 650, 652, 654, 659, 661, 663, 666, 670,
1243 671, 673, 675, 677, 679, 681, 683, 685, 687, 689,
1244 693, 695, 701, 703, 705, 707, 709, 711, 713, 716,
1245 719, 722, 726, 729, 730, 732, 735, 738, 742, 752,
1246 762, 771, 786, 788, 790, 797, 803, 806, 813, 821,
1247 825, 831, 832, 833, 837, 840, 842, 848, 854, 861,
1248 868, 873, 880, 885, 890, 897, 904, 907, 916, 918,
1249 920, 921, 925, 932, 936, 943, 946, 952, 960
1250};
Chris Lattnerbb856a32007-08-06 21:00:46 +00001251
Dale Johannesen3afee192007-09-07 21:07:57 +00001252static const short yyrhs[] = { 73,
1253 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1254 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1255 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1256 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1257 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1258 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1259 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1260 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1261 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1262 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1263 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1264 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1265 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1266 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1267 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1268 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1269 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1270 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1271 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1272 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1273 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1274 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1275 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1276 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1277 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1278 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1279 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1280 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1281 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1282 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1283 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1284 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1285 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1286 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1287 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1288 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1289 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1290 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1291 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1292 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1293 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1294 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1295 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1296 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1297 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1298 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1299 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1300 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1301 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1302 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1303 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1304 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1305 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1306 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1307 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1308 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1309 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1310 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1311 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1312 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1313 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1314 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1315 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1316 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1317 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1318 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1319 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1320 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1321 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1322 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1323 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1324 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1325 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1326 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1327 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1328 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1329 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1330 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1331 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1332 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1333 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1334 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
1335 191, 226, 181, 0, 235, 147, 191, 226, 181, 0,
1336 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1337 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1338 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1339 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1340 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1341 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1342 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1343 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1344 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1345 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1346 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1347 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1348 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1349 191, 226, 236, 0
1350};
Chris Lattnerbb856a32007-08-06 21:00:46 +00001351
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001352#endif
1353
Dale Johannesen3afee192007-09-07 21:07:57 +00001354#if YYDEBUG != 0
1355static const short yyrline[] = { 0,
1356 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1127,
1357 1127, 1127, 1127, 1127, 1127, 1128, 1128, 1128, 1128, 1128,
1358 1128, 1128, 1129, 1129, 1129, 1129, 1129, 1132, 1132, 1133,
1359 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1140, 1140, 1141,
1360 1141, 1142, 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146,
1361 1146, 1147, 1148, 1153, 1154, 1154, 1154, 1154, 1154, 1156,
1362 1156, 1156, 1157, 1157, 1161, 1165, 1170, 1170, 1172, 1173,
1363 1178, 1184, 1185, 1186, 1187, 1188, 1192, 1193, 1194, 1198,
1364 1199, 1200, 1201, 1205, 1206, 1207, 1211, 1212, 1213, 1214,
1365 1215, 1219, 1220, 1221, 1224, 1224, 1225, 1226, 1227, 1228,
1366 1229, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245,
1367 1248, 1249, 1254, 1255, 1256, 1257, 1260, 1261, 1268, 1268,
1368 1275, 1275, 1284, 1292, 1292, 1298, 1298, 1300, 1305, 1318,
1369 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336,
1370 1341, 1349, 1379, 1410, 1415, 1427, 1437, 1441, 1451, 1458,
1371 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518,
1372 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733,
1373 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1863, 1868,
1374 1881, 1893, 1915, 1923, 1929, 1940, 1945, 1950, 1956, 1962,
1375 1971, 1975, 1983, 1983, 1986, 1986, 1989, 2001, 2022, 2027,
1376 2035, 2036, 2040, 2040, 2044, 2044, 2047, 2050, 2074, 2085,
Chris Lattner5eefce32007-09-10 23:24:14 +00001377 2092, 2095, 2101, 2104, 2111, 2115, 2155, 2158, 2164, 2174,
1378 2178, 2183, 2185, 2190, 2195, 2204, 2214, 2225, 2229, 2238,
1379 2247, 2252, 2373, 2373, 2375, 2384, 2384, 2386, 2391, 2403,
1380 2407, 2412, 2416, 2420, 2424, 2428, 2432, 2436, 2440, 2444,
1381 2469, 2473, 2483, 2487, 2491, 2496, 2503, 2503, 2509, 2518,
1382 2522, 2531, 2540, 2549, 2553, 2560, 2564, 2568, 2573, 2583,
1383 2602, 2611, 2691, 2695, 2702, 2713, 2726, 2736, 2747, 2757,
1384 2766, 2775, 2778, 2779, 2786, 2790, 2795, 2816, 2833, 2847,
1385 2861, 2873, 2881, 2888, 2894, 2900, 2906, 2921, 3006, 3011,
1386 3015, 3022, 3029, 3037, 3044, 3052, 3060, 3074, 3091
Dale Johannesen3afee192007-09-07 21:07:57 +00001387};
1388#endif
1389
1390
1391#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1392
1393static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1394"EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1395"VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1396"LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1397"ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1398"GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1399"NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1400"EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1401"TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1402"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1403"UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1404"FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1405"SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1406"UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1407"ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1408"INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1409"SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1410"BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1411"')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1412"CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1413"OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1414"GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1415"AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1416"OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1417"PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1418"ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1419"Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1420"LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1421"FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1422"SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1423"BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall",
1424"InstVal","OptVolatile","MemoryInst", NULL
1425};
1426#endif
1427
1428static const short yyr1[] = { 0,
1429 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1430 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1431 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1432 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1433 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1434 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1435 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1436 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1437 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1438 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1439 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1440 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1441 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1442 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1443 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1444 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1445 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1446 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1447 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1448 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1449 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1450 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1451 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1452 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1453 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1454 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1455 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1456 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
1457 235, 235, 236, 236, 237, 237, 238, 238, 238, 238,
1458 238, 238, 238, 238, 238, 238, 238, 238, 238, 239,
1459 239, 240, 240, 240, 240, 240, 240, 240, 240
1460};
1461
1462static const short yyr2[] = { 0,
1463 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1464 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1469 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1470 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1471 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1472 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1473 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1474 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1475 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1476 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1477 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1478 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1479 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1481 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1482 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1483 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1484 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1485 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1486 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1487 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1488 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1489 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1490 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1491 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1492 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1493 0, 3, 6, 3, 6, 2, 5, 7, 4
1494};
1495
1496static const short yydefact[] = { 70,
1497 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1498 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1499 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1500 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1501 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1502 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1503 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1504 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1505 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1506 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1507 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1508 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
1509 98, 99, 100, 0, 239, 0, 301, 263, 0, 222,
1510 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1511 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1512 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
1513 0, 233, 234, 235, 300, 286, 0, 0, 0, 0,
1514 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1515 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1516 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1517 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
1518 0, 0, 0, 0, 0, 262, 95, 277, 0, 299,
1519 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1520 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1521 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1522 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
1523 126, 0, 285, 267, 0, 266, 0, 0, 54, 0,
1524 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1525 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1526 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
1527 121, 306, 0, 0, 297, 0, 0, 0, 0, 0,
1528 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1529 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1530 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1531 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1532 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1533 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
1534 259, 0, 268, 0, 0, 0, 0, 0, 302, 0,
1535 304, 283, 0, 0, 0, 0, 0, 0, 0, 0,
1536 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
1537 213, 215, 0, 0, 0, 283, 0, 0, 0, 0,
1538 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1539 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
1540 0, 0, 0, 0, 0, 0, 0, 0, 0, 309,
1541 0, 0, 0, 293, 294, 0, 0, 0, 0, 291,
1542 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1543 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
1544 64, 0, 117, 0, 250, 0, 0, 282, 0, 0,
1545 121, 122, 121, 0, 0, 0, 0, 0, 0, 287,
1546 288, 282, 0, 307, 0, 198, 0, 0, 182, 0,
1547 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
1548 111, 124, 0, 0, 0, 0, 0, 289, 290, 303,
1549 305, 284, 0, 0, 292, 295, 296, 0, 121, 0,
1550 0, 0, 188, 0, 0, 184, 185, 181, 64, 125,
1551 119, 252, 0, 0, 111, 0, 117, 278, 0, 117,
1552 308, 186, 187, 0, 0, 0, 226, 0, 232, 0,
1553 271, 0, 0, 280, 0, 0, 279, 298, 183, 189,
1554 190, 120, 269, 0, 270, 0, 111, 0, 0, 0,
1555 281, 0, 0, 0, 0, 276, 0, 0, 275, 0,
1556 272, 0, 0, 0
1557};
1558
1559static const short yydefgoto[] = { 256,
1560 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1561 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
1562 222, 400, 329, 559, 379, 423, 541, 356, 424, 78,
1563 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
1564 85, 149, 592, 16, 17, 19, 18, 261, 334, 335,
1565 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1566 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
1567 216, 563, 128, 305, 517, 440, 217, 218, 219, 220
1568};
1569
1570static const short yypact[] = { 42,
1571-32768,-32768,-32768,-32768,-32768,-32768,-32768, -21, -131, 60,
1572 -93, 105, -22, 182,-32768, 525,-32768, 46, 168, -12,
1573 19,-32768, 1, 152,-32768, 1277,-32768,-32768,-32768,-32768,
1574-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 90, 90,
1575 100,-32768,-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768,
1576 90, 186,-32768, 12, 187, 201, 209,-32768,-32768,-32768,
1577-32768,-32768, 93,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1578-32768, 252, 254, 2, 907,-32768,-32768,-32768, 13,-32768,
1579 225, 225, 150,-32768, 76, 116, 116,-32768,-32768, 108,
1580-32768,-32768,-32768,-32768,-32768,-32768,-32768, -79, 1027,-32768,
1581 111, 114, 947, 93,-32768, 13, -104,-32768, 1027, 76,
1582 76,-32768,-32768, 1067,-32768,-32768, 1299, 266,-32768,-32768,
1583-32768,-32768,-32768, 1330,-32768, -16, 1572,-32768, 256,-32768,
1584-32768, 13,-32768, 139, 144, 1370, 1370, 132, -95, 1370,
1585-32768, 145, 1299, 1370, 93, 147, 13, 311,-32768, 43,
1586 290, 293, 298, 299, 302, 247, 303, 724,-32768,-32768,
1587 35,-32768,-32768,-32768,-32768,-32768, 258, 1450, 70, 305,
1588 116,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1589-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 405,
1590 1370, 1370, 1370, 1370,-32768,-32768,-32768,-32768,-32768,-32768,
1591-32768,-32768,-32768,-32768,-32768,-32768, 1370, 1370, 1370, 1370,
1592 1370, 1370, 1370, 1370, 1370,-32768, 116,-32768, 34,-32768,
1593-32768, 131, 1107,-32768, 6, -46,-32768, 164, 13,-32768,
1594-32768, 13, 1067,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1595-32768,-32768,-32768,-32768, 317, 405, 173, 178, 179, 189,
1596 192, 1179, 1481, 987, 314, 193, 197, 198,-32768,-32768,
1597 202, 203,-32768, 93, 565,-32768, 699, 699,-32768, 699,
1598 1330,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1599-32768, 1370,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1600-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1370, 113,
1601 137,-32768, 565, -10, 205, 207, 208, 210, 218, 219,
1602 565, 565, 330, 1330, 1370, 1370,-32768,-32768,-32768,-32768,
1603-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 106,-32768,
1604-32768,-32768, 106, 202, 202, 331, 220, 221, 1299, 1299,
1605 1299, 1299, 1299,-32768,-32768, -41, 1005, -61,-32768, -91,
1606-32768, 1299, 1299, 1299, -13,-32768, 1219,-32768,-32768,-32768,
1607-32768,-32768,-32768,-32768,-32768, 313, 1299,-32768,-32768,-32768,
1608-32768, 226,-32768, 227, 699, 565, 565, 23,-32768, 24,
1609-32768,-32768, 699, 223, 1370, 1370, 1370, 1370, 1370, 232,
1610 233, 1370, 699, 565, 234,-32768,-32768,-32768,-32768,-32768,
1611-32768,-32768, 1370, 1299, 1299,-32768, 235, 236, 237, 239,
1612 1299,-32768, 231, 724, -76,-32768,-32768, 241, 242, 352,
1613 369, 388,-32768, 202,-32768, 13, 246, 243,-32768, 374,
1614 -59, 380, 385, 253, 257, 270, 699, 414, 699, 272,
1615 273, 699, 278, 13,-32768, 280, 282, 699, 699, 13,
1616 283, 287, 1370, -112, 288, 289, -33, 1299, 1299, 1299,
1617 1299,-32768,-32768, 294, 1299, 1299, 1370,-32768,-32768,-32768,
1618 79, 1259,-32768, 292,-32768, 699, 699, 1370, 699, 699,
1619 287,-32768, 287, 1370, 699, 307, 1370, 1370, 1370,-32768,
1620-32768, 1370, 392,-32768, 565,-32768, 1299, 1299,-32768, 308,
1621 295, 309, 310,-32768, 301, 315, 7,-32768,-32768,-32768,
1622 13, 10, 427, 318, 306, 565, 52,-32768,-32768,-32768,
1623-32768,-32768, 316, 699,-32768,-32768,-32768, 71, 287, 322,
1624 325, 1299,-32768, 1299, 1299,-32768,-32768,-32768, 79,-32768,
1625 407,-32768, 444, -4,-32768, 1370,-32768,-32768, 323,-32768,
1626-32768,-32768,-32768, 327, 328, 329,-32768, 464,-32768, 699,
1627-32768, 859, -3, 131, 565, -14,-32768, 106,-32768,-32768,
1628-32768,-32768,-32768, 334,-32768, 859,-32768, 452, 465, 336,
1629 131, 699, 699, 468, 416,-32768, 699, 471,-32768, 699,
1630-32768, 490, 491,-32768
1631};
1632
1633static const short yypgoto[] = { 365,
1634 366, 367, 255, 251, -168,-32768, 0, -40, 408, 14,
1635-32768,-32768,-32768,-32768, 40,-32768,-32768,-32768, -158,-32768,
1636 -406,-32768, -226,-32768, -290, 3,-32768, -317,-32768,-32768,
1637 -25, 296, -119,-32768, 409, 413, -60, -155, -231, 166,
1638 119, 284,-32768,-32768, 504,-32768,-32768,-32768,-32768,-32768,
1639-32768,-32768,-32768,-32768,-32768,-32768, 435,-32768,-32768,-32768,
1640-32768,-32768,-32768, -525, -139, 47, -183,-32768, 474,-32768,
1641-32768,-32768,-32768,-32768, 37, 124,-32768,-32768,-32768,-32768
1642};
1643
1644
1645#define YYLAST 1705
1646
1647
1648static const short yytable[] = { 11,
1649 79, 270, 259, 333, 161, 102, 269, 269, 234, 302,
1650 381, 162, 271, 13, 23, 11, 401, 402, 260, 471,
1651 421, 348, 350, 578, 306, 307, 308, 309, 310, 13,
1652 20, 313, 88, 437, 439, 108, 574, 109, 496, 422,
1653 91, -200, 140, 421, 21, -54, -54, -54, -54, 106,
1654 580, 140, 25, 141, 2, 411, 159, 4, 314, -66,
1655 1, 2, 228, 3, 4, 5, 417, 129, 235, 236,
1656 411, 6, 7, 132, 130, 438, 438, 106, 81, 82,
1657 267, 464, 231, 132, 86, 411, 268, 411, 147, 11,
1658 87, 43, 8, 44, 416, 9, 475, 1, 147, 10,
1659 3, 108, 5, 109, 539, 411, 470, 115, 116, 331,
1660 225, 226, 412, 484, 229, 415, 24, 499, 232, 396,
1661 397, 398, 26, 27, 399, 370, 1, 370, 370, 3,
1662 370, 5, 395, 55, 83, 431, 84, 108, 564, 109,
1663 163, 383, 265, 396, 397, 398, 315, 316, 399, 561,
1664 575, 375, 57, 108, 108, 109, 109, 538, 103, 330,
1665 108, 494, 109, 370, 56, 300, 301, 265, 303, 92,
1666 581, 370, 370, 59, 262, 118, 119, 120, 121, 122,
1667 123, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1668 520, 112, 521, 113, 393, 317, 318, 132, 546, 110,
1669 111, 443, 547, 445, 446, 447, 88, 147, 95, 47,
1670 48, 49, 319, 320, 50, 321, 322, 546, 323, 324,
1671 325, 550, 96, 28, 29, 30, 31, 32, 33, 34,
1672 97, 35, 36, 37, 38, 370, 370, 370, 551, 396,
1673 397, 398, 99, 370, 399, 147, 512, 317, 318, 237,
1674 238, 239, 240, 370, 370, 100, 376, 101, 259, 378,
1675 108, 84, 109, 136, 319, 320, 137, 321, 322, 160,
1676 323, 324, 325, 377, 260, 143, 144, 221, 406, 407,
1677 408, 409, 410, 380, 108, 223, 109, 227, 147, 394,
1678 265, 418, 419, 420, 224, 230, 233, 370, -55, 370,
1679 522, -56, 370, 525, 526, 527, -59, -58, 370, 370,
1680 -57, 241, 263, 372, 373, 269, 374, 61, 62, 332,
1681 566, 414, 339, 568, 36, 37, 38, 340, 341, 1,
1682 2, 426, 3, 4, 5, 351, 370, 370, 342, 370,
1683 370, 343, 352, 455, 456, 370, 353, 354, 355, 382,
1684 462, 384, 357, 385, 386, 370, 387, 390, 391, 265,
1685 444, 265, 265, 265, 388, 389, 450, 392, 403, 404,
1686 405, 429, 432, 433, 442, 562, 370, 454, 448, 449,
1687 453, 458, 459, 460, 370, 461, 463, 465, 466, 467,
1688 468, 469, 472, 473, 576, 474, 476, 500, 501, 502,
1689 503, 477, 478, 479, 505, 506, 272, 273, 274, 275,
1690 276, 277, 278, 279, 280, 281, 480, 482, 484, 485,
1691 370, 434, 435, 436, 487, 370, 488, 495, 489, 441,
1692 283, 284, 492, 493, 497, 498, 530, 531, 513, 451,
1693 452, 507, 370, 370, 438, 533, 511, 370, 542, 504,
1694 370, 536, 516, 524, 532, 534, 535, 544, 265, 558,
1695 560, 265, 265, 265, 543, 537, 516, 572, 582, 548,
1696 508, 554, 552, 555, 556, 553, 567, 569, 570, 571,
1697 579, 583, 584, 481, 587, 483, 588, 590, 486, 593,
1698 594, 213, 214, 215, 490, 491, 338, 127, 557, 337,
1699 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1700 295, 296, 297, 298, 540, 139, 336, 142, 328, 42,
1701 565, 126, 514, 515, -199, 518, 519, 94, 528, 457,
1702 0, 523, 0, 0, 0, 0, 0, 0, 508, 0,
1703 0, 529, -66, 1, 2, 0, 3, 4, 5, 0,
1704 0, 0, 0, 0, 6, 7, 0, 0, 0, 0,
1705 0, 0, 545, 0, 0, 0, 0, 358, 359, 0,
1706 549, 61, 62, 360, 0, 8, 0, 0, 9, 0,
1707 0, 0, 10, 1, 2, 0, 3, 4, 5, 361,
1708 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
1709 0, 0, 0, 0, 364, 365, 573, 0, 0, 0,
1710 0, 577, 0, 0, 0, 0, 0, 0, 0, 0,
1711 0, 366, 0, 0, 0, 0, 0, 0, 585, 586,
1712 0, 0, 0, 589, 0, 0, 591, 174, 175, 176,
1713 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1714 187, 188, 245, 246, 0, 0, 0, 0, 0, 0,
1715 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1716 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
1717 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1718 205, 206, 0, 248, 0, 249, 250, 251, 0, 0,
1719 0, 358, 359, 0, 0, 61, 62, 360, 0, 0,
1720 0, 0, 108, 0, 109, 0, 0, 1, 2, 367,
1721 3, 4, 5, 361, 362, 363, 0, 0, 0, 0,
1722 61, 62, 0, 0, 0, 0, 0, 0, 364, 365,
1723 0, 0, 1, 2, 0, 3, 4, 5, 242, 0,
1724 0, 0, 0, 0, 0, 366, 0, 0, 0, 0,
1725 0, 0, 0, 243, 244, 0, 0, 0, 0, 0,
1726 0, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1727 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1728 0, 0, 0, 0, 0, 0, 174, 175, 176, 177,
1729 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1730 188, 245, 246, 247, 195, 196, 197, 198, 199, 200,
1731 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1732 250, 251, 0, 0, 0, 0, 0, 0, 247, 195,
1733 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1734 206, 0, 248, 367, 249, 250, 251, 0, 0, 0,
1735 0, 358, 359, 0, 0, 0, 0, 360, 0, 0,
1736 0, 108, 0, 109, 0, 252, 0, 0, 253, 0,
1737 254, 0, 255, 361, 362, 363, 0, 0, 0, 0,
1738 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
1739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1740 0, 0, 0, 61, 62, 366, 104, 64, 65, 66,
1741 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1742 5, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1743 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1744 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1745 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1746 5, 0, 0, 247, 195, 196, 197, 198, 199, 200,
1747 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1748 250, 251, 0, 61, 62, 71, 104, 150, 151, 152,
1749 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
1750 5, 61, 62, 367, 104, 150, 151, 152, 153, 154,
1751 155, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1752 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1753 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1754 5, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1755 0, 74, 0, 75, 105, 131, 0, 0, 0, 0,
1756 0, 0, 0, 61, 62, 71, 145, 64, 65, 66,
1757 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1758 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1759 0, 74, 0, 75, 138, 0, 0, 0, 0, 0,
1760 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1761 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1762 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1763 0, 74, 0, 75, 349, 327, 0, 0, 0, 0,
1764 0, 0, 0, 72, 0, 71, 73, 0, 0, 74,
1765 0, 75, 413, 0, 0, 0, 0, 0, 0, 0,
1766 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1767 0, 74, 0, 75, 0, 61, 62, 146, 104, 150,
1768 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1769 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1770 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1771 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1772 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1773 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1774 0, 0, 0, 0, 0, 72, 0, 425, 73, 0,
1775 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1776 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1777 3, 4, 5, 61, 62, 0, 63, 64, 65, 66,
1778 67, 68, 69, 70, 0, 1, 2, 510, 3, 4,
1779 5, 0, 0, 0, 0, 61, 62, 71, 104, 150,
1780 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1781 3, 4, 5, 0, 0, 71, 0, 72, 0, 0,
1782 73, 0, 344, 74, 0, 75, 61, 62, 0, 145,
1783 64, 65, 66, 67, 68, 69, 70, 71, 1, 2,
1784 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1785 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1786 73, 0, 0, 74, 0, 75, 61, 62, 71, 104,
1787 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1788 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1789 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1790 73, 0, 0, 74, 0, 75, 0, 0, 71, 0,
1791 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1792 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1793 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1794 73, 0, 0, 74, 0, 75, 61, 62, 0, 264,
1795 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1796 0, 3, 4, 5, 0, 0, 0, 0, 72, 0,
1797 0, 73, 0, 0, 74, 0, 75, 61, 62, 0,
1798 104, 150, 151, 152, 153, 154, 155, 70, 71, 1,
1799 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1800 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1801 0, 73, 0, 0, 74, 0, 75, 0, 0, 71,
1802 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1803 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1804 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1808 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1809 0, 73, 0, 0, 74, 0, 75, 165, 0, 0,
1810 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1811 0, 0, 0, 0, 0, 0, 166, 167, 0, 72,
1812 0, 0, 73, 0, 0, 74, 0, 347, 168, 169,
1813 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1814 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1815 190, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1816 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1817 0, 191, 192, 193, 0, 0, 194, 195, 196, 197,
1818 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1819 208, 209, 210, 211, 212
1820};
1821
1822static const short yycheck[] = { 0,
1823 26, 170, 158, 230, 124, 4, 11, 11, 148, 193,
1824 301, 28, 171, 0, 146, 16, 334, 335, 158, 426,
1825 34, 253, 254, 38, 208, 209, 210, 211, 212, 16,
1826 52, 215, 21, 11, 11, 148, 562, 150, 151, 53,
1827 29, 0, 147, 34, 66, 3, 4, 5, 6, 75,
1828 576, 147, 146, 158, 20, 147, 117, 23, 217, 18,
1829 19, 20, 158, 22, 23, 24, 158, 147, 26, 27,
1830 147, 30, 31, 99, 154, 53, 53, 103, 39, 40,
1831 11, 158, 143, 109, 45, 147, 17, 147, 114, 90,
1832 51, 46, 51, 48, 156, 54, 156, 19, 124, 58,
1833 22, 148, 24, 150, 511, 147, 424, 32, 33, 156,
1834 136, 137, 154, 147, 140, 347, 57, 151, 144, 134,
1835 135, 136, 18, 146, 139, 265, 19, 267, 268, 22,
1836 270, 24, 316, 146, 35, 367, 37, 148, 545, 150,
1837 157, 152, 168, 134, 135, 136, 113, 114, 139, 154,
1838 154, 271, 152, 148, 148, 150, 150, 151, 157, 154,
1839 148, 452, 150, 303, 146, 191, 192, 193, 194, 158,
1840 577, 311, 312, 22, 161, 60, 61, 62, 63, 64,
1841 65, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1842 481, 42, 483, 44, 314, 117, 118, 223, 147, 81,
1843 82, 385, 151, 387, 388, 389, 21, 233, 22, 42,
1844 43, 44, 134, 135, 47, 137, 138, 147, 140, 141,
1845 142, 151, 22, 42, 43, 44, 45, 46, 47, 48,
1846 22, 50, 143, 144, 145, 375, 376, 377, 529, 134,
1847 135, 136, 150, 383, 139, 271, 473, 117, 118, 3,
1848 4, 5, 6, 393, 394, 4, 282, 4, 414, 147,
1849 148, 37, 150, 153, 134, 135, 153, 137, 138, 4,
1850 140, 141, 142, 299, 414, 110, 111, 22, 339, 340,
1851 341, 342, 343, 147, 148, 147, 150, 156, 314, 315,
1852 316, 352, 353, 354, 151, 151, 150, 437, 9, 439,
1853 484, 9, 442, 487, 488, 489, 9, 9, 448, 449,
1854 9, 9, 55, 267, 268, 11, 270, 7, 8, 156,
1855 547, 347, 150, 550, 143, 144, 145, 150, 150, 19,
1856 20, 357, 22, 23, 24, 22, 476, 477, 150, 479,
1857 480, 150, 150, 404, 405, 485, 150, 150, 147, 303,
1858 411, 147, 150, 147, 147, 495, 147, 311, 312, 385,
1859 386, 387, 388, 389, 147, 147, 392, 38, 38, 150,
1860 150, 59, 147, 147, 152, 544, 516, 403, 147, 147,
1861 147, 147, 147, 147, 524, 147, 156, 147, 147, 38,
1862 22, 4, 147, 151, 563, 22, 17, 458, 459, 460,
1863 461, 17, 150, 147, 465, 466, 90, 91, 92, 93,
1864 94, 95, 96, 97, 98, 99, 147, 4, 147, 147,
1865 560, 375, 376, 377, 147, 565, 147, 453, 147, 383,
1866 26, 27, 150, 147, 147, 147, 497, 498, 147, 393,
1867 394, 467, 582, 583, 53, 151, 472, 587, 22, 156,
1868 590, 151, 478, 147, 147, 147, 147, 152, 484, 53,
1869 17, 487, 488, 489, 147, 151, 492, 4, 17, 154,
1870 471, 532, 151, 534, 535, 151, 154, 151, 151, 151,
1871 147, 17, 147, 437, 17, 439, 71, 17, 442, 0,
1872 0, 127, 127, 127, 448, 449, 246, 90, 539, 245,
1873 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1874 106, 107, 108, 109, 512, 103, 233, 109, 223, 16,
1875 546, 87, 476, 477, 0, 479, 480, 54, 492, 406,
1876 -1, 485, -1, -1, -1, -1, -1, -1, 539, -1,
1877 -1, 495, 18, 19, 20, -1, 22, 23, 24, -1,
1878 -1, -1, -1, -1, 30, 31, -1, -1, -1, -1,
1879 -1, -1, 516, -1, -1, -1, -1, 3, 4, -1,
1880 524, 7, 8, 9, -1, 51, -1, -1, 54, -1,
1881 -1, -1, 58, 19, 20, -1, 22, 23, 24, 25,
1882 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
1883 -1, -1, -1, -1, 40, 41, 560, -1, -1, -1,
1884 -1, 565, -1, -1, -1, -1, -1, -1, -1, -1,
1885 -1, 57, -1, -1, -1, -1, -1, -1, 582, 583,
1886 -1, -1, -1, 587, -1, -1, 590, 73, 74, 75,
1887 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1888 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
1889 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1890 -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
1891 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1892 126, 127, -1, 129, -1, 131, 132, 133, -1, -1,
1893 -1, 3, 4, -1, -1, 7, 8, 9, -1, -1,
1894 -1, -1, 148, -1, 150, -1, -1, 19, 20, 155,
1895 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
1896 7, 8, -1, -1, -1, -1, -1, -1, 40, 41,
1897 -1, -1, 19, 20, -1, 22, 23, 24, 25, -1,
1898 -1, -1, -1, -1, -1, 57, -1, -1, -1, -1,
1899 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
1900 -1, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1901 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1902 -1, -1, -1, -1, -1, -1, 73, 74, 75, 76,
1903 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1904 87, 88, 89, 115, 116, 117, 118, 119, 120, 121,
1905 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1906 132, 133, -1, -1, -1, -1, -1, -1, 115, 116,
1907 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1908 127, -1, 129, 155, 131, 132, 133, -1, -1, -1,
1909 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
1910 -1, 148, -1, 150, -1, 152, -1, -1, 155, -1,
1911 157, -1, 159, 25, 26, 27, -1, -1, -1, -1,
1912 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
1913 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1914 -1, -1, -1, 7, 8, 57, 10, 11, 12, 13,
1915 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1916 24, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1917 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1918 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1919 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1920 24, -1, -1, 115, 116, 117, 118, 119, 120, 121,
1921 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1922 132, 133, -1, 7, 8, 49, 10, 11, 12, 13,
1923 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1924 24, 7, 8, 155, 10, 11, 12, 13, 14, 15,
1925 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1926 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1927 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1928 24, -1, -1, 49, -1, 149, -1, -1, 152, -1,
1929 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1930 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1931 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1932 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1933 -1, 155, -1, 157, 158, -1, -1, -1, -1, -1,
1934 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1935 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1936 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1937 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1938 -1, -1, -1, 149, -1, 49, 152, -1, -1, 155,
1939 -1, 157, 158, -1, -1, -1, -1, -1, -1, -1,
1940 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1941 -1, 155, -1, 157, -1, 7, 8, 121, 10, 11,
1942 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1943 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1944 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1945 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1946 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1947 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1948 -1, -1, -1, -1, -1, 149, -1, 39, 152, -1,
1949 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1950 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1951 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
1952 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
1953 24, -1, -1, -1, -1, 7, 8, 49, 10, 11,
1954 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1955 22, 23, 24, -1, -1, 49, -1, 149, -1, -1,
1956 152, -1, 154, 155, -1, 157, 7, 8, -1, 10,
1957 11, 12, 13, 14, 15, 16, 17, 49, 19, 20,
1958 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1959 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1960 152, -1, -1, 155, -1, 157, 7, 8, 49, 10,
1961 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1962 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1963 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1964 152, -1, -1, 155, -1, 157, -1, -1, 49, -1,
1965 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1966 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
1967 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1968 152, -1, -1, 155, -1, 157, 7, 8, -1, 10,
1969 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1970 -1, 22, 23, 24, -1, -1, -1, -1, 149, -1,
1971 -1, 152, -1, -1, 155, -1, 157, 7, 8, -1,
1972 10, 11, 12, 13, 14, 15, 16, 17, 49, 19,
1973 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
1974 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1975 -1, 152, -1, -1, 155, -1, 157, -1, -1, 49,
1976 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1977 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1978 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1979 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1980 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1981 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1982 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1983 -1, 152, -1, -1, 155, -1, 157, 36, -1, -1,
1984 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1985 -1, -1, -1, -1, -1, -1, 55, 56, -1, 149,
1986 -1, -1, 152, -1, -1, 155, -1, 157, 67, 68,
1987 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
1988 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1989 89, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1990 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1991 -1, 110, 111, 112, -1, -1, 115, 116, 117, 118,
1992 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1993 129, 130, 131, 132, 133
1994};
1995/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1996#line 3 "/usr/share/bison.simple"
1997/* This file comes from bison-1.28. */
1998
1999/* Skeleton output parser for bison,
2000 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2001
2002 This program is free software; you can redistribute it and/or modify
2003 it under the terms of the GNU General Public License as published by
2004 the Free Software Foundation; either version 2, or (at your option)
2005 any later version.
2006
2007 This program is distributed in the hope that it will be useful,
2008 but WITHOUT ANY WARRANTY; without even the implied warranty of
2009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2010 GNU General Public License for more details.
2011
2012 You should have received a copy of the GNU General Public License
2013 along with this program; if not, write to the Free Software
2014 Foundation, Inc., 59 Temple Place - Suite 330,
2015 Boston, MA 02111-1307, USA. */
2016
2017/* As a special exception, when this file is copied by Bison into a
2018 Bison output file, you may use that output file without restriction.
2019 This special exception was added by the Free Software Foundation
2020 in version 1.24 of Bison. */
2021
2022/* This is the parser code that is written into each bison parser
2023 when the %semantic_parser declaration is not specified in the grammar.
2024 It was written by Richard Stallman by simplifying the hairy parser
2025 used when %semantic_parser is specified. */
2026
2027#ifndef YYSTACK_USE_ALLOCA
2028#ifdef alloca
2029#define YYSTACK_USE_ALLOCA
2030#else /* alloca not defined */
2031#ifdef __GNUC__
2032#define YYSTACK_USE_ALLOCA
2033#define alloca __builtin_alloca
2034#else /* not GNU C. */
2035#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2036#define YYSTACK_USE_ALLOCA
2037#include <alloca.h>
2038#else /* not sparc */
2039/* We think this test detects Watcom and Microsoft C. */
2040/* This used to test MSDOS, but that is a bad idea
2041 since that symbol is in the user namespace. */
2042#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2043#if 0 /* No need for malloc.h, which pollutes the namespace;
2044 instead, just don't use alloca. */
2045#include <malloc.h>
2046#endif
2047#else /* not MSDOS, or __TURBOC__ */
2048#if defined(_AIX)
2049/* I don't know what this was needed for, but it pollutes the namespace.
2050 So I turned it off. rms, 2 May 1997. */
2051/* #include <malloc.h> */
2052 #pragma alloca
2053#define YYSTACK_USE_ALLOCA
2054#else /* not MSDOS, or __TURBOC__, or _AIX */
2055#if 0
2056#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2057 and on HPUX 10. Eventually we can turn this on. */
2058#define YYSTACK_USE_ALLOCA
2059#define alloca __builtin_alloca
2060#endif /* __hpux */
2061#endif
2062#endif /* not _AIX */
2063#endif /* not MSDOS, or __TURBOC__ */
2064#endif /* not sparc */
2065#endif /* not GNU C */
2066#endif /* alloca not defined */
2067#endif /* YYSTACK_USE_ALLOCA not defined */
2068
2069#ifdef YYSTACK_USE_ALLOCA
2070#define YYSTACK_ALLOC alloca
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002071#else
Dale Johannesen3afee192007-09-07 21:07:57 +00002072#define YYSTACK_ALLOC malloc
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002073#endif
2074
Dale Johannesen3afee192007-09-07 21:07:57 +00002075/* Note: there must be only one dollar sign in this file.
2076 It is replaced by the list of actions, each action
2077 as one case of the switch. */
David Greene9145dd22007-08-01 03:59:32 +00002078
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002079#define yyerrok (yyerrstatus = 0)
2080#define yyclearin (yychar = YYEMPTY)
Dale Johannesen3afee192007-09-07 21:07:57 +00002081#define YYEMPTY -2
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002082#define YYEOF 0
2083#define YYACCEPT goto yyacceptlab
Dale Johannesen3afee192007-09-07 21:07:57 +00002084#define YYABORT goto yyabortlab
2085#define YYERROR goto yyerrlab1
2086/* Like YYERROR except do call yyerror.
2087 This remains here temporarily to ease the
2088 transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002089 Once GCC version 2 has supplanted version 1, this can go. */
2090#define YYFAIL goto yyerrlab
2091#define YYRECOVERING() (!!yyerrstatus)
Dale Johannesen3afee192007-09-07 21:07:57 +00002092#define YYBACKUP(token, value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002093do \
2094 if (yychar == YYEMPTY && yylen == 1) \
Dale Johannesen3afee192007-09-07 21:07:57 +00002095 { yychar = (token), yylval = (value); \
2096 yychar1 = YYTRANSLATE (yychar); \
Chris Lattnerbb856a32007-08-06 21:00:46 +00002097 YYPOPSTACK; \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002098 goto yybackup; \
2099 } \
2100 else \
Dale Johannesen3afee192007-09-07 21:07:57 +00002101 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Chris Lattnerbb856a32007-08-06 21:00:46 +00002102while (0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002103
2104#define YYTERROR 1
2105#define YYERRCODE 256
2106
Dale Johannesen3afee192007-09-07 21:07:57 +00002107#ifndef YYPURE
2108#define YYLEX yylex()
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002109#endif
2110
Dale Johannesen3afee192007-09-07 21:07:57 +00002111#ifdef YYPURE
2112#ifdef YYLSP_NEEDED
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002113#ifdef YYLEX_PARAM
Dale Johannesen3afee192007-09-07 21:07:57 +00002114#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002115#else
Dale Johannesen3afee192007-09-07 21:07:57 +00002116#define YYLEX yylex(&yylval, &yylloc)
2117#endif
2118#else /* not YYLSP_NEEDED */
2119#ifdef YYLEX_PARAM
2120#define YYLEX yylex(&yylval, YYLEX_PARAM)
2121#else
2122#define YYLEX yylex(&yylval)
2123#endif
2124#endif /* not YYLSP_NEEDED */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002125#endif
David Greene48556392007-09-04 18:46:50 +00002126
Dale Johannesen3afee192007-09-07 21:07:57 +00002127/* If nonreentrant, generate the variables here */
David Greene48556392007-09-04 18:46:50 +00002128
Dale Johannesen3afee192007-09-07 21:07:57 +00002129#ifndef YYPURE
David Greene48556392007-09-04 18:46:50 +00002130
Dale Johannesen3afee192007-09-07 21:07:57 +00002131int yychar; /* the lookahead symbol */
2132YYSTYPE yylval; /* the semantic value of the */
2133 /* lookahead symbol */
David Greene48556392007-09-04 18:46:50 +00002134
Dale Johannesen3afee192007-09-07 21:07:57 +00002135#ifdef YYLSP_NEEDED
2136YYLTYPE yylloc; /* location data for the lookahead */
2137 /* symbol */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002138#endif
David Greene48556392007-09-04 18:46:50 +00002139
Dale Johannesen3afee192007-09-07 21:07:57 +00002140int yynerrs; /* number of parse errors so far */
2141#endif /* not YYPURE */
David Greene48556392007-09-04 18:46:50 +00002142
Dale Johannesen3afee192007-09-07 21:07:57 +00002143#if YYDEBUG != 0
2144int yydebug; /* nonzero means print parse trace */
2145/* Since this is uninitialized, it does not stop multiple parsers
2146 from coexisting. */
Dale Johannesenf325d9f2007-08-03 01:03:46 +00002147#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002148
Dale Johannesen3afee192007-09-07 21:07:57 +00002149/* YYINITDEPTH indicates the initial size of the parser's stacks */
Chandler Carruth563d4a42007-08-04 01:56:21 +00002150
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002151#ifndef YYINITDEPTH
Dale Johannesen3afee192007-09-07 21:07:57 +00002152#define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002153#endif
2154
Dale Johannesen3afee192007-09-07 21:07:57 +00002155/* YYMAXDEPTH is the maximum size the stacks can grow to
2156 (effective only if the built-in stack extension method is used). */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002157
Dale Johannesen3afee192007-09-07 21:07:57 +00002158#if YYMAXDEPTH == 0
2159#undef YYMAXDEPTH
Chris Lattnerbb856a32007-08-06 21:00:46 +00002160#endif
David Greene9145dd22007-08-01 03:59:32 +00002161
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002162#ifndef YYMAXDEPTH
Dale Johannesen3afee192007-09-07 21:07:57 +00002163#define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002164#endif
2165
Dale Johannesen3afee192007-09-07 21:07:57 +00002166/* Define __yy_memcpy. Note that the size argument
2167 should be passed with type unsigned int, because that is what the non-GCC
2168 definitions require. With GCC, __builtin_memcpy takes an arg
2169 of type size_t, but it can handle unsigned int. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002170
Dale Johannesen3afee192007-09-07 21:07:57 +00002171#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2172#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2173#else /* not GNU C or C++ */
2174#ifndef __cplusplus
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002175
Dale Johannesen3afee192007-09-07 21:07:57 +00002176/* This is the most reliable way to avoid incompatibilities
2177 in available built-in functions on various systems. */
David Greene48556392007-09-04 18:46:50 +00002178static void
Dale Johannesen3afee192007-09-07 21:07:57 +00002179__yy_memcpy (to, from, count)
2180 char *to;
2181 char *from;
2182 unsigned int count;
2183{
2184 register char *f = from;
2185 register char *t = to;
2186 register int i = count;
2187
2188 while (i-- > 0)
2189 *t++ = *f++;
2190}
2191
2192#else /* __cplusplus */
2193
2194/* This is the most reliable way to avoid incompatibilities
2195 in available built-in functions on various systems. */
David Greene48556392007-09-04 18:46:50 +00002196static void
Dale Johannesen3afee192007-09-07 21:07:57 +00002197__yy_memcpy (char *to, char *from, unsigned int count)
2198{
2199 register char *t = to;
2200 register char *f = from;
2201 register int i = count;
2202
2203 while (i-- > 0)
2204 *t++ = *f++;
2205}
2206
Dale Johannesenf325d9f2007-08-03 01:03:46 +00002207#endif
David Greene48556392007-09-04 18:46:50 +00002208#endif
David Greene48556392007-09-04 18:46:50 +00002209
Dale Johannesen3afee192007-09-07 21:07:57 +00002210#line 217 "/usr/share/bison.simple"
David Greene48556392007-09-04 18:46:50 +00002211
Dale Johannesen3afee192007-09-07 21:07:57 +00002212/* The user can define YYPARSE_PARAM as the name of an argument to be passed
2213 into yyparse. The argument should have type void *.
2214 It should actually point to an object.
2215 Grammar actions can access the variable by casting it
2216 to the proper pointer type. */
David Greene48556392007-09-04 18:46:50 +00002217
2218#ifdef YYPARSE_PARAM
Dale Johannesen3afee192007-09-07 21:07:57 +00002219#ifdef __cplusplus
2220#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2221#define YYPARSE_PARAM_DECL
2222#else /* not __cplusplus */
2223#define YYPARSE_PARAM_ARG YYPARSE_PARAM
2224#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2225#endif /* not __cplusplus */
2226#else /* not YYPARSE_PARAM */
2227#define YYPARSE_PARAM_ARG
2228#define YYPARSE_PARAM_DECL
2229#endif /* not YYPARSE_PARAM */
2230
2231/* Prevent warning if -Wstrict-prototypes. */
2232#ifdef __GNUC__
2233#ifdef YYPARSE_PARAM
2234int yyparse (void *);
2235#else
David Greene48556392007-09-04 18:46:50 +00002236int yyparse (void);
David Greene48556392007-09-04 18:46:50 +00002237#endif
Dale Johannesen3afee192007-09-07 21:07:57 +00002238#endif
David Greene48556392007-09-04 18:46:50 +00002239
David Greene48556392007-09-04 18:46:50 +00002240int
Dale Johannesen3afee192007-09-07 21:07:57 +00002241yyparse(YYPARSE_PARAM_ARG)
2242 YYPARSE_PARAM_DECL
David Greene48556392007-09-04 18:46:50 +00002243{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002244 register int yystate;
2245 register int yyn;
2246 register short *yyssp;
2247 register YYSTYPE *yyvsp;
Dale Johannesen3afee192007-09-07 21:07:57 +00002248 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2249 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002250
Dale Johannesen3afee192007-09-07 21:07:57 +00002251 short yyssa[YYINITDEPTH]; /* the state stack */
2252 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002253
Dale Johannesen3afee192007-09-07 21:07:57 +00002254 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2255 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002256
Dale Johannesen3afee192007-09-07 21:07:57 +00002257#ifdef YYLSP_NEEDED
2258 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2259 YYLTYPE *yyls = yylsa;
2260 YYLTYPE *yylsp;
2261
2262#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2263#else
Chris Lattnerbb856a32007-08-06 21:00:46 +00002264#define YYPOPSTACK (yyvsp--, yyssp--)
Dale Johannesen3afee192007-09-07 21:07:57 +00002265#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002266
Dale Johannesen3afee192007-09-07 21:07:57 +00002267 int yystacksize = YYINITDEPTH;
2268 int yyfree_stacks = 0;
Chandler Carruth563d4a42007-08-04 01:56:21 +00002269
Dale Johannesen3afee192007-09-07 21:07:57 +00002270#ifdef YYPURE
2271 int yychar;
2272 YYSTYPE yylval;
2273 int yynerrs;
2274#ifdef YYLSP_NEEDED
2275 YYLTYPE yylloc;
2276#endif
2277#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002278
Dale Johannesen3afee192007-09-07 21:07:57 +00002279 YYSTYPE yyval; /* the variable used to return */
2280 /* semantic values from the action */
2281 /* routines */
Chandler Carruth563d4a42007-08-04 01:56:21 +00002282
Chris Lattnerbb856a32007-08-06 21:00:46 +00002283 int yylen;
Chandler Carruth563d4a42007-08-04 01:56:21 +00002284
Dale Johannesen3afee192007-09-07 21:07:57 +00002285#if YYDEBUG != 0
2286 if (yydebug)
2287 fprintf(stderr, "Starting parse\n");
2288#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002289
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002290 yystate = 0;
2291 yyerrstatus = 0;
2292 yynerrs = 0;
2293 yychar = YYEMPTY; /* Cause a token to be read. */
2294
2295 /* Initialize stack pointers.
2296 Waste one element of value and location stack
2297 so that they stay on the same level as the state stack.
2298 The wasted elements are never initialized. */
2299
Dale Johannesen3afee192007-09-07 21:07:57 +00002300 yyssp = yyss - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002301 yyvsp = yyvs;
Dale Johannesen3afee192007-09-07 21:07:57 +00002302#ifdef YYLSP_NEEDED
2303 yylsp = yyls;
2304#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002305
Dale Johannesen3afee192007-09-07 21:07:57 +00002306/* Push a new state, which is found in yystate . */
2307/* In all cases, when you get here, the value and location stacks
2308 have just been pushed. so pushing a state here evens the stacks. */
2309yynewstate:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002310
Dale Johannesen3afee192007-09-07 21:07:57 +00002311 *++yyssp = yystate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002312
Dale Johannesen3afee192007-09-07 21:07:57 +00002313 if (yyssp >= yyss + yystacksize - 1)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002314 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002315 /* Give user a chance to reallocate the stack */
2316 /* Use copies of these so that the &'s don't force the real ones into memory. */
2317 YYSTYPE *yyvs1 = yyvs;
2318 short *yyss1 = yyss;
2319#ifdef YYLSP_NEEDED
2320 YYLTYPE *yyls1 = yyls;
2321#endif
2322
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002323 /* Get the current used size of the three stacks, in elements. */
Dale Johannesen3afee192007-09-07 21:07:57 +00002324 int size = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002325
2326#ifdef yyoverflow
Dale Johannesen3afee192007-09-07 21:07:57 +00002327 /* Each stack pointer address is followed by the size of
2328 the data in use in that stack, in bytes. */
2329#ifdef YYLSP_NEEDED
2330 /* This used to be a conditional around just the two extra args,
2331 but that might be undefined if yyoverflow is a macro. */
2332 yyoverflow("parser stack overflow",
2333 &yyss1, size * sizeof (*yyssp),
2334 &yyvs1, size * sizeof (*yyvsp),
2335 &yyls1, size * sizeof (*yylsp),
2336 &yystacksize);
2337#else
2338 yyoverflow("parser stack overflow",
2339 &yyss1, size * sizeof (*yyssp),
2340 &yyvs1, size * sizeof (*yyvsp),
2341 &yystacksize);
2342#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002343
Dale Johannesen3afee192007-09-07 21:07:57 +00002344 yyss = yyss1; yyvs = yyvs1;
2345#ifdef YYLSP_NEEDED
2346 yyls = yyls1;
2347#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002348#else /* no yyoverflow */
2349 /* Extend the stack our own way. */
Dale Johannesen3afee192007-09-07 21:07:57 +00002350 if (yystacksize >= YYMAXDEPTH)
2351 {
2352 yyerror("parser stack overflow");
2353 if (yyfree_stacks)
2354 {
2355 free (yyss);
2356 free (yyvs);
2357#ifdef YYLSP_NEEDED
2358 free (yyls);
2359#endif
2360 }
2361 return 2;
2362 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002363 yystacksize *= 2;
Dale Johannesen3afee192007-09-07 21:07:57 +00002364 if (yystacksize > YYMAXDEPTH)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002365 yystacksize = YYMAXDEPTH;
Dale Johannesen3afee192007-09-07 21:07:57 +00002366#ifndef YYSTACK_USE_ALLOCA
2367 yyfree_stacks = 1;
2368#endif
2369 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2370 __yy_memcpy ((char *)yyss, (char *)yyss1,
2371 size * (unsigned int) sizeof (*yyssp));
2372 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2373 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2374 size * (unsigned int) sizeof (*yyvsp));
2375#ifdef YYLSP_NEEDED
2376 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2377 __yy_memcpy ((char *)yyls, (char *)yyls1,
2378 size * (unsigned int) sizeof (*yylsp));
2379#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002380#endif /* no yyoverflow */
2381
Dale Johannesen3afee192007-09-07 21:07:57 +00002382 yyssp = yyss + size - 1;
2383 yyvsp = yyvs + size - 1;
2384#ifdef YYLSP_NEEDED
2385 yylsp = yyls + size - 1;
2386#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002387
Dale Johannesen3afee192007-09-07 21:07:57 +00002388#if YYDEBUG != 0
2389 if (yydebug)
2390 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2391#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002392
Dale Johannesen3afee192007-09-07 21:07:57 +00002393 if (yyssp >= yyss + yystacksize - 1)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002394 YYABORT;
2395 }
2396
Dale Johannesen3afee192007-09-07 21:07:57 +00002397#if YYDEBUG != 0
2398 if (yydebug)
2399 fprintf(stderr, "Entering state %d\n", yystate);
2400#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002401
2402 goto yybackup;
Dale Johannesen3afee192007-09-07 21:07:57 +00002403 yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002404
Chris Lattnerbb856a32007-08-06 21:00:46 +00002405/* Do appropriate processing given the current state. */
2406/* Read a lookahead token if we need one and don't already have one. */
2407/* yyresume: */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002408
Chris Lattnerbb856a32007-08-06 21:00:46 +00002409 /* First try to decide what to do without reference to lookahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002410
2411 yyn = yypact[yystate];
Dale Johannesen3afee192007-09-07 21:07:57 +00002412 if (yyn == YYFLAG)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002413 goto yydefault;
2414
Chris Lattnerbb856a32007-08-06 21:00:46 +00002415 /* Not known => get a lookahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002416
Dale Johannesen3afee192007-09-07 21:07:57 +00002417 /* yychar is either YYEMPTY or YYEOF
2418 or a valid token in external form. */
2419
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002420 if (yychar == YYEMPTY)
2421 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002422#if YYDEBUG != 0
2423 if (yydebug)
2424 fprintf(stderr, "Reading a token: ");
2425#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002426 yychar = YYLEX;
2427 }
2428
Dale Johannesen3afee192007-09-07 21:07:57 +00002429 /* Convert token to internal form (in yychar1) for indexing tables with */
2430
2431 if (yychar <= 0) /* This means end of input. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002432 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002433 yychar1 = 0;
2434 yychar = YYEOF; /* Don't call YYLEX any more */
2435
2436#if YYDEBUG != 0
2437 if (yydebug)
2438 fprintf(stderr, "Now at end of input.\n");
2439#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002440 }
2441 else
2442 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002443 yychar1 = YYTRANSLATE(yychar);
2444
2445#if YYDEBUG != 0
2446 if (yydebug)
2447 {
2448 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2449 /* Give the individual parser a way to print the precise meaning
2450 of a token, for further debugging info. */
2451#ifdef YYPRINT
2452 YYPRINT (stderr, yychar, yylval);
2453#endif
2454 fprintf (stderr, ")\n");
2455 }
2456#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002457 }
2458
Dale Johannesen3afee192007-09-07 21:07:57 +00002459 yyn += yychar1;
2460 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002461 goto yydefault;
Dale Johannesen3afee192007-09-07 21:07:57 +00002462
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002463 yyn = yytable[yyn];
Dale Johannesen3afee192007-09-07 21:07:57 +00002464
2465 /* yyn is what to do for this token type in this state.
2466 Negative => reduce, -yyn is rule number.
2467 Positive => shift, yyn is new state.
2468 New state is final state => don't bother to shift,
2469 just return success.
2470 0, or most negative number => error. */
2471
2472 if (yyn < 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002473 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002474 if (yyn == YYFLAG)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002475 goto yyerrlab;
2476 yyn = -yyn;
2477 goto yyreduce;
2478 }
Dale Johannesen3afee192007-09-07 21:07:57 +00002479 else if (yyn == 0)
2480 goto yyerrlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002481
2482 if (yyn == YYFINAL)
2483 YYACCEPT;
2484
Chris Lattnerbb856a32007-08-06 21:00:46 +00002485 /* Shift the lookahead token. */
Dale Johannesen3afee192007-09-07 21:07:57 +00002486
2487#if YYDEBUG != 0
2488 if (yydebug)
2489 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2490#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002491
Chris Lattnerbb856a32007-08-06 21:00:46 +00002492 /* Discard the token being shifted unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002493 if (yychar != YYEOF)
2494 yychar = YYEMPTY;
2495
Chandler Carruth563d4a42007-08-04 01:56:21 +00002496 *++yyvsp = yylval;
Dale Johannesen3afee192007-09-07 21:07:57 +00002497#ifdef YYLSP_NEEDED
2498 *++yylsp = yylloc;
2499#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002500
Dale Johannesen3afee192007-09-07 21:07:57 +00002501 /* count tokens shifted since error; after three, turn off error status. */
2502 if (yyerrstatus) yyerrstatus--;
Chris Lattnerbb856a32007-08-06 21:00:46 +00002503
2504 yystate = yyn;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002505 goto yynewstate;
2506
Dale Johannesen3afee192007-09-07 21:07:57 +00002507/* Do the default action for the current state. */
David Greene48556392007-09-04 18:46:50 +00002508yydefault:
Dale Johannesen3afee192007-09-07 21:07:57 +00002509
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002510 yyn = yydefact[yystate];
2511 if (yyn == 0)
2512 goto yyerrlab;
2513
Dale Johannesen3afee192007-09-07 21:07:57 +00002514/* Do a reduction. yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002515yyreduce:
2516 yylen = yyr2[yyn];
Dale Johannesen3afee192007-09-07 21:07:57 +00002517 if (yylen > 0)
2518 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002519
Dale Johannesen3afee192007-09-07 21:07:57 +00002520#if YYDEBUG != 0
2521 if (yydebug)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002522 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002523 int i;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002524
Dale Johannesen3afee192007-09-07 21:07:57 +00002525 fprintf (stderr, "Reducing via rule %d (line %d), ",
2526 yyn, yyrline[yyn]);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002527
Dale Johannesen3afee192007-09-07 21:07:57 +00002528 /* Print the symbols being reduced, and their result. */
2529 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2530 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2531 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2532 }
2533#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002534
2535
Dale Johannesen3afee192007-09-07 21:07:57 +00002536 switch (yyn) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002537
Dale Johannesen3afee192007-09-07 21:07:57 +00002538case 28:
Chris Lattner5eefce32007-09-10 23:24:14 +00002539#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002540{ yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2541 break;}
2542case 29:
Chris Lattner5eefce32007-09-10 23:24:14 +00002543#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002544{ yyval.IPredicate = ICmpInst::ICMP_NE; ;
2545 break;}
2546case 30:
Chris Lattner5eefce32007-09-10 23:24:14 +00002547#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002548{ yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2549 break;}
2550case 31:
Chris Lattner5eefce32007-09-10 23:24:14 +00002551#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002552{ yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2553 break;}
2554case 32:
Chris Lattner5eefce32007-09-10 23:24:14 +00002555#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002556{ yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2557 break;}
2558case 33:
Chris Lattner5eefce32007-09-10 23:24:14 +00002559#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002560{ yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2561 break;}
2562case 34:
Chris Lattner5eefce32007-09-10 23:24:14 +00002563#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002564{ yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2565 break;}
2566case 35:
Chris Lattner5eefce32007-09-10 23:24:14 +00002567#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002568{ yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2569 break;}
2570case 36:
Chris Lattner5eefce32007-09-10 23:24:14 +00002571#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002572{ yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2573 break;}
2574case 37:
Chris Lattner5eefce32007-09-10 23:24:14 +00002575#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002576{ yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2577 break;}
2578case 38:
Chris Lattner5eefce32007-09-10 23:24:14 +00002579#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002580{ yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2581 break;}
2582case 39:
Chris Lattner5eefce32007-09-10 23:24:14 +00002583#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002584{ yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2585 break;}
2586case 40:
Chris Lattner5eefce32007-09-10 23:24:14 +00002587#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002588{ yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2589 break;}
2590case 41:
Chris Lattner5eefce32007-09-10 23:24:14 +00002591#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002592{ yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2593 break;}
2594case 42:
Chris Lattner5eefce32007-09-10 23:24:14 +00002595#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002596{ yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2597 break;}
2598case 43:
Chris Lattner5eefce32007-09-10 23:24:14 +00002599#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002600{ yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2601 break;}
2602case 44:
Chris Lattner5eefce32007-09-10 23:24:14 +00002603#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002604{ yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2605 break;}
2606case 45:
Chris Lattner5eefce32007-09-10 23:24:14 +00002607#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002608{ yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2609 break;}
2610case 46:
Chris Lattner5eefce32007-09-10 23:24:14 +00002611#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002612{ yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2613 break;}
2614case 47:
Chris Lattner5eefce32007-09-10 23:24:14 +00002615#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002616{ yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2617 break;}
2618case 48:
Chris Lattner5eefce32007-09-10 23:24:14 +00002619#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002620{ yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2621 break;}
2622case 49:
Chris Lattner5eefce32007-09-10 23:24:14 +00002623#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002624{ yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2625 break;}
2626case 50:
Chris Lattner5eefce32007-09-10 23:24:14 +00002627#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002628{ yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2629 break;}
2630case 51:
Chris Lattner5eefce32007-09-10 23:24:14 +00002631#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002632{ yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2633 break;}
2634case 52:
Chris Lattner5eefce32007-09-10 23:24:14 +00002635#line 1147 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002636{ yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2637 break;}
2638case 53:
Chris Lattner5eefce32007-09-10 23:24:14 +00002639#line 1148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002640{ yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2641 break;}
2642case 64:
Chris Lattner5eefce32007-09-10 23:24:14 +00002643#line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002644{ yyval.StrVal = 0; ;
2645 break;}
2646case 65:
Chris Lattner5eefce32007-09-10 23:24:14 +00002647#line 1161 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002648{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002649 yyval.StrVal = yyvsp[-1].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002650 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002651 ;
2652 break;}
2653case 66:
Chris Lattner5eefce32007-09-10 23:24:14 +00002654#line 1165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002655{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002656 yyval.StrVal = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002657 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002658 ;
2659 break;}
2660case 70:
Chris Lattner5eefce32007-09-10 23:24:14 +00002661#line 1173 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002662{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002663 yyval.StrVal = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002664 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002665 ;
2666 break;}
2667case 71:
Chris Lattner5eefce32007-09-10 23:24:14 +00002668#line 1178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002669{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002670 yyval.StrVal = yyvsp[-1].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002671 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002672 ;
2673 break;}
2674case 72:
Chris Lattner5eefce32007-09-10 23:24:14 +00002675#line 1184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002676{ yyval.Linkage = GlobalValue::InternalLinkage; ;
2677 break;}
2678case 73:
Chris Lattner5eefce32007-09-10 23:24:14 +00002679#line 1185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002680{ yyval.Linkage = GlobalValue::WeakLinkage; ;
2681 break;}
2682case 74:
Chris Lattner5eefce32007-09-10 23:24:14 +00002683#line 1186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002684{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2685 break;}
2686case 75:
Chris Lattner5eefce32007-09-10 23:24:14 +00002687#line 1187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002688{ yyval.Linkage = GlobalValue::AppendingLinkage; ;
2689 break;}
2690case 76:
Chris Lattner5eefce32007-09-10 23:24:14 +00002691#line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002692{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2693 break;}
2694case 77:
Chris Lattner5eefce32007-09-10 23:24:14 +00002695#line 1192 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002696{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2697 break;}
2698case 78:
Chris Lattner5eefce32007-09-10 23:24:14 +00002699#line 1193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002700{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2701 break;}
2702case 79:
Chris Lattner5eefce32007-09-10 23:24:14 +00002703#line 1194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002704{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2705 break;}
2706case 80:
Chris Lattner5eefce32007-09-10 23:24:14 +00002707#line 1198 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002708{ yyval.Visibility = GlobalValue::DefaultVisibility; ;
2709 break;}
2710case 81:
Chris Lattner5eefce32007-09-10 23:24:14 +00002711#line 1199 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002712{ yyval.Visibility = GlobalValue::DefaultVisibility; ;
2713 break;}
2714case 82:
Chris Lattner5eefce32007-09-10 23:24:14 +00002715#line 1200 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002716{ yyval.Visibility = GlobalValue::HiddenVisibility; ;
2717 break;}
2718case 83:
Chris Lattner5eefce32007-09-10 23:24:14 +00002719#line 1201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002720{ yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2721 break;}
2722case 84:
Chris Lattner5eefce32007-09-10 23:24:14 +00002723#line 1205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002724{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2725 break;}
2726case 85:
Chris Lattner5eefce32007-09-10 23:24:14 +00002727#line 1206 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002728{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2729 break;}
2730case 86:
Chris Lattner5eefce32007-09-10 23:24:14 +00002731#line 1207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002732{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2733 break;}
2734case 87:
Chris Lattner5eefce32007-09-10 23:24:14 +00002735#line 1211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002736{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2737 break;}
2738case 88:
Chris Lattner5eefce32007-09-10 23:24:14 +00002739#line 1212 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002740{ yyval.Linkage = GlobalValue::InternalLinkage; ;
2741 break;}
2742case 89:
Chris Lattner5eefce32007-09-10 23:24:14 +00002743#line 1213 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002744{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2745 break;}
2746case 90:
Chris Lattner5eefce32007-09-10 23:24:14 +00002747#line 1214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002748{ yyval.Linkage = GlobalValue::WeakLinkage; ;
2749 break;}
2750case 91:
Chris Lattner5eefce32007-09-10 23:24:14 +00002751#line 1215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002752{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2753 break;}
2754case 92:
Chris Lattner5eefce32007-09-10 23:24:14 +00002755#line 1219 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002756{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2757 break;}
2758case 93:
Chris Lattner5eefce32007-09-10 23:24:14 +00002759#line 1220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002760{ yyval.Linkage = GlobalValue::WeakLinkage; ;
2761 break;}
2762case 94:
Chris Lattner5eefce32007-09-10 23:24:14 +00002763#line 1221 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002764{ yyval.Linkage = GlobalValue::InternalLinkage; ;
2765 break;}
2766case 95:
Chris Lattner5eefce32007-09-10 23:24:14 +00002767#line 1224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002768{ yyval.UIntVal = CallingConv::C; ;
2769 break;}
2770case 96:
Chris Lattner5eefce32007-09-10 23:24:14 +00002771#line 1225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002772{ yyval.UIntVal = CallingConv::C; ;
2773 break;}
2774case 97:
Chris Lattner5eefce32007-09-10 23:24:14 +00002775#line 1226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002776{ yyval.UIntVal = CallingConv::Fast; ;
2777 break;}
2778case 98:
Chris Lattner5eefce32007-09-10 23:24:14 +00002779#line 1227 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002780{ yyval.UIntVal = CallingConv::Cold; ;
2781 break;}
2782case 99:
Chris Lattner5eefce32007-09-10 23:24:14 +00002783#line 1228 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002784{ yyval.UIntVal = CallingConv::X86_StdCall; ;
2785 break;}
2786case 100:
Chris Lattner5eefce32007-09-10 23:24:14 +00002787#line 1229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002788{ yyval.UIntVal = CallingConv::X86_FastCall; ;
2789 break;}
2790case 101:
Chris Lattner5eefce32007-09-10 23:24:14 +00002791#line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002792{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002793 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002794 GEN_ERROR("Calling conv too large");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002795 yyval.UIntVal = yyvsp[0].UInt64Val;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002796 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002797 ;
2798 break;}
2799case 102:
Chris Lattner5eefce32007-09-10 23:24:14 +00002800#line 1237 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002801{ yyval.ParamAttrs = ParamAttr::ZExt; ;
2802 break;}
2803case 103:
Chris Lattner5eefce32007-09-10 23:24:14 +00002804#line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002805{ yyval.ParamAttrs = ParamAttr::ZExt; ;
2806 break;}
2807case 104:
Chris Lattner5eefce32007-09-10 23:24:14 +00002808#line 1239 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002809{ yyval.ParamAttrs = ParamAttr::SExt; ;
2810 break;}
2811case 105:
Chris Lattner5eefce32007-09-10 23:24:14 +00002812#line 1240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002813{ yyval.ParamAttrs = ParamAttr::SExt; ;
2814 break;}
2815case 106:
Chris Lattner5eefce32007-09-10 23:24:14 +00002816#line 1241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002817{ yyval.ParamAttrs = ParamAttr::InReg; ;
2818 break;}
2819case 107:
Chris Lattner5eefce32007-09-10 23:24:14 +00002820#line 1242 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002821{ yyval.ParamAttrs = ParamAttr::StructRet; ;
2822 break;}
2823case 108:
Chris Lattner5eefce32007-09-10 23:24:14 +00002824#line 1243 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002825{ yyval.ParamAttrs = ParamAttr::NoAlias; ;
2826 break;}
2827case 109:
Chris Lattner5eefce32007-09-10 23:24:14 +00002828#line 1244 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002829{ yyval.ParamAttrs = ParamAttr::ByVal; ;
2830 break;}
2831case 110:
Chris Lattner5eefce32007-09-10 23:24:14 +00002832#line 1245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002833{ yyval.ParamAttrs = ParamAttr::Nest; ;
2834 break;}
2835case 111:
Chris Lattner5eefce32007-09-10 23:24:14 +00002836#line 1248 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002837{ yyval.ParamAttrs = ParamAttr::None; ;
2838 break;}
2839case 112:
Chris Lattner5eefce32007-09-10 23:24:14 +00002840#line 1249 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002841{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002842 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00002843 ;
2844 break;}
2845case 113:
Chris Lattner5eefce32007-09-10 23:24:14 +00002846#line 1254 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002847{ yyval.ParamAttrs = ParamAttr::NoReturn; ;
2848 break;}
2849case 114:
Chris Lattner5eefce32007-09-10 23:24:14 +00002850#line 1255 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002851{ yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2852 break;}
2853case 115:
Chris Lattner5eefce32007-09-10 23:24:14 +00002854#line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002855{ yyval.ParamAttrs = ParamAttr::ZExt; ;
2856 break;}
2857case 116:
Chris Lattner5eefce32007-09-10 23:24:14 +00002858#line 1257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002859{ yyval.ParamAttrs = ParamAttr::SExt; ;
2860 break;}
2861case 117:
Chris Lattner5eefce32007-09-10 23:24:14 +00002862#line 1260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002863{ yyval.ParamAttrs = ParamAttr::None; ;
2864 break;}
2865case 118:
Chris Lattner5eefce32007-09-10 23:24:14 +00002866#line 1261 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002867{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002868 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00002869 ;
2870 break;}
2871case 119:
Chris Lattner5eefce32007-09-10 23:24:14 +00002872#line 1268 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002873{ yyval.UIntVal = 0; ;
2874 break;}
2875case 120:
Chris Lattner5eefce32007-09-10 23:24:14 +00002876#line 1269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002877{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002878 yyval.UIntVal = yyvsp[0].UInt64Val;
2879 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002880 GEN_ERROR("Alignment must be a power of two");
2881 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002882;
2883 break;}
2884case 121:
Chris Lattner5eefce32007-09-10 23:24:14 +00002885#line 1275 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002886{ yyval.UIntVal = 0; ;
2887 break;}
2888case 122:
Chris Lattner5eefce32007-09-10 23:24:14 +00002889#line 1276 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002890{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002891 yyval.UIntVal = yyvsp[0].UInt64Val;
2892 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002893 GEN_ERROR("Alignment must be a power of two");
2894 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002895;
2896 break;}
2897case 123:
Chris Lattner5eefce32007-09-10 23:24:14 +00002898#line 1284 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002899{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002900 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2901 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002902 GEN_ERROR("Invalid character in section name");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002903 yyval.StrVal = yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002904 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002905;
2906 break;}
2907case 124:
Chris Lattner5eefce32007-09-10 23:24:14 +00002908#line 1292 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002909{ yyval.StrVal = 0; ;
2910 break;}
2911case 125:
Chris Lattner5eefce32007-09-10 23:24:14 +00002912#line 1293 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002913{ yyval.StrVal = yyvsp[0].StrVal; ;
2914 break;}
2915case 126:
Chris Lattner5eefce32007-09-10 23:24:14 +00002916#line 1298 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002917{;
2918 break;}
2919case 127:
Chris Lattner5eefce32007-09-10 23:24:14 +00002920#line 1299 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002921{;
2922 break;}
2923case 128:
Chris Lattner5eefce32007-09-10 23:24:14 +00002924#line 1300 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002925{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002926 CurGV->setSection(*yyvsp[0].StrVal);
2927 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002928 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002929 ;
2930 break;}
2931case 129:
Chris Lattner5eefce32007-09-10 23:24:14 +00002932#line 1305 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002933{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002934 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002935 GEN_ERROR("Alignment must be a power of two");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002936 CurGV->setAlignment(yyvsp[0].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002937 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002938 ;
2939 break;}
2940case 137:
Chris Lattner5eefce32007-09-10 23:24:14 +00002941#line 1321 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002942{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002943 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002944 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002945 ;
2946 break;}
2947case 138:
Chris Lattner5eefce32007-09-10 23:24:14 +00002948#line 1325 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002949{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002950 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002951 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002952 ;
2953 break;}
2954case 139:
Chris Lattner5eefce32007-09-10 23:24:14 +00002955#line 1329 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002956{ // Pointer type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00002957 if (*yyvsp[-1].TypeVal == Type::LabelTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002958 GEN_ERROR("Cannot form a pointer to a basic block");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002959 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2960 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002961 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002962 ;
2963 break;}
2964case 140:
Chris Lattner5eefce32007-09-10 23:24:14 +00002965#line 1336 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002966{ // Named types are also simple types...
Chris Lattnerbb856a32007-08-06 21:00:46 +00002967 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002968 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00002969 yyval.TypeVal = new PATypeHolder(tmp);
Dale Johannesen3afee192007-09-07 21:07:57 +00002970 ;
2971 break;}
2972case 141:
Chris Lattner5eefce32007-09-10 23:24:14 +00002973#line 1341 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002974{ // Type UpReference
Chris Lattnerbb856a32007-08-06 21:00:46 +00002975 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002976 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Chris Lattnerbb856a32007-08-06 21:00:46 +00002977 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2978 yyval.TypeVal = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002979 UR_OUT("New Upreference!\n");
2980 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002981 ;
2982 break;}
2983case 142:
Chris Lattner5eefce32007-09-10 23:24:14 +00002984#line 1349 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002985{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002986 std::vector<const Type*> Params;
2987 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00002988 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2989 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002990 Attrs.push_back(X);
2991 }
2992 unsigned index = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00002993 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002994 for (; I != E; ++I, ++index) {
2995 const Type *Ty = I->Ty->get();
2996 Params.push_back(Ty);
2997 if (Ty != Type::VoidTy)
2998 if (I->Attrs != ParamAttr::None) {
2999 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3000 Attrs.push_back(X);
3001 }
3002 }
3003 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3004 if (isVarArg) Params.pop_back();
3005
3006 ParamAttrsList *ActualAttrs = 0;
3007 if (!Attrs.empty())
3008 ActualAttrs = ParamAttrsList::get(Attrs);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003009 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3010 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3011 delete yyvsp[-4].TypeVal; // Delete the return type handle
3012 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003013 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003014 ;
3015 break;}
3016case 143:
Chris Lattner5eefce32007-09-10 23:24:14 +00003017#line 1379 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003018{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003019 std::vector<const Type*> Params;
3020 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003021 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3022 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003023 Attrs.push_back(X);
3024 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003025 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003026 unsigned index = 1;
3027 for ( ; I != E; ++I, ++index) {
3028 const Type* Ty = I->Ty->get();
3029 Params.push_back(Ty);
3030 if (Ty != Type::VoidTy)
3031 if (I->Attrs != ParamAttr::None) {
3032 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3033 Attrs.push_back(X);
3034 }
3035 }
3036 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3037 if (isVarArg) Params.pop_back();
3038
3039 ParamAttrsList *ActualAttrs = 0;
3040 if (!Attrs.empty())
3041 ActualAttrs = ParamAttrsList::get(Attrs);
3042
Chris Lattnerbb856a32007-08-06 21:00:46 +00003043 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3044 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3045 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003046 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003047 ;
3048 break;}
3049case 144:
Chris Lattner5eefce32007-09-10 23:24:14 +00003050#line 1410 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003051{ // Sized array type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003052 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3053 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003054 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003055 ;
3056 break;}
3057case 145:
Chris Lattner5eefce32007-09-10 23:24:14 +00003058#line 1415 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003059{ // Vector type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003060 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3061 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003062 GEN_ERROR("Unsigned result not equal to signed result");
3063 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3064 GEN_ERROR("Element type of a VectorType must be primitive");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003065 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003066 GEN_ERROR("Vector length should be a power of 2");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003067 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3068 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003069 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003070 ;
3071 break;}
3072case 146:
Chris Lattner5eefce32007-09-10 23:24:14 +00003073#line 1427 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003074{ // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003075 std::vector<const Type*> Elements;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003076 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3077 E = yyvsp[-1].TypeList->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003078 Elements.push_back(*I);
3079
Chris Lattnerbb856a32007-08-06 21:00:46 +00003080 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3081 delete yyvsp[-1].TypeList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003082 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003083 ;
3084 break;}
3085case 147:
Chris Lattner5eefce32007-09-10 23:24:14 +00003086#line 1437 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003087{ // Empty structure type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003088 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003089 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003090 ;
3091 break;}
3092case 148:
Chris Lattner5eefce32007-09-10 23:24:14 +00003093#line 1441 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003094{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003095 std::vector<const Type*> Elements;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003096 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3097 E = yyvsp[-2].TypeList->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003098 Elements.push_back(*I);
3099
Chris Lattnerbb856a32007-08-06 21:00:46 +00003100 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3101 delete yyvsp[-2].TypeList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003102 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003103 ;
3104 break;}
3105case 149:
Chris Lattner5eefce32007-09-10 23:24:14 +00003106#line 1451 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003107{ // Empty structure type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003108 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003109 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003110 ;
3111 break;}
3112case 150:
Chris Lattner5eefce32007-09-10 23:24:14 +00003113#line 1458 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003114{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003115 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3116 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00003117 ;
3118 break;}
3119case 151:
Chris Lattner5eefce32007-09-10 23:24:14 +00003120#line 1465 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003121{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003122 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003123 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3124 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003125 GEN_ERROR("LLVM functions cannot return aggregate types");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003126 yyval.TypeVal = yyvsp[0].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003127 ;
3128 break;}
3129case 152:
Chris Lattner5eefce32007-09-10 23:24:14 +00003130#line 1472 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003131{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003132 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
Dale Johannesen3afee192007-09-07 21:07:57 +00003133 ;
3134 break;}
3135case 153:
Chris Lattner5eefce32007-09-10 23:24:14 +00003136#line 1477 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003137{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003138 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3139 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003140 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003141 ;
3142 break;}
3143case 154:
Chris Lattner5eefce32007-09-10 23:24:14 +00003144#line 1482 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003145{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003146 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003147 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003148 ;
3149 break;}
3150case 156:
Chris Lattner5eefce32007-09-10 23:24:14 +00003151#line 1490 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003152{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003153 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003154 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3155 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003156 yyval.TypeWithAttrsList->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003157 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003158 ;
3159 break;}
3160case 157:
Chris Lattner5eefce32007-09-10 23:24:14 +00003161#line 1497 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003162{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003163 yyval.TypeWithAttrsList = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003164 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3165 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003166 yyval.TypeWithAttrsList->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003167 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003168 ;
3169 break;}
3170case 158:
Chris Lattner5eefce32007-09-10 23:24:14 +00003171#line 1504 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003172{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003173 yyval.TypeWithAttrsList = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003174 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003175 ;
3176 break;}
3177case 159:
Chris Lattner5eefce32007-09-10 23:24:14 +00003178#line 1512 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003179{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003180 yyval.TypeList = new std::list<PATypeHolder>();
3181 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3182 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003183 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003184 ;
3185 break;}
3186case 160:
Chris Lattner5eefce32007-09-10 23:24:14 +00003187#line 1518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003188{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003189 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3190 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003191 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003192 ;
3193 break;}
3194case 161:
Chris Lattner5eefce32007-09-10 23:24:14 +00003195#line 1530 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003196{ // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003197 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003198 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3199 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003200 if (ATy == 0)
3201 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003202 (*yyvsp[-3].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003203 const Type *ETy = ATy->getElementType();
3204 int NumElements = ATy->getNumElements();
3205
3206 // Verify that we have the correct size...
Chris Lattnerbb856a32007-08-06 21:00:46 +00003207 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003208 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003209 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003210 itostr(NumElements) + "");
3211
3212 // Verify all elements are correct type!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003213 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3214 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003215 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3216 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattnerbb856a32007-08-06 21:00:46 +00003217 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003218 }
3219
Chris Lattnerbb856a32007-08-06 21:00:46 +00003220 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3221 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003222 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003223 ;
3224 break;}
3225case 162:
Chris Lattner5eefce32007-09-10 23:24:14 +00003226#line 1558 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003227{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003228 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003229 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3230 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003231 if (ATy == 0)
3232 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003233 (*yyvsp[-2].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003234
3235 int NumElements = ATy->getNumElements();
3236 if (NumElements != -1 && NumElements != 0)
3237 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3238 " arguments, but has size of " + itostr(NumElements) +"");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003239 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3240 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003241 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003242 ;
3243 break;}
3244case 163:
Chris Lattner5eefce32007-09-10 23:24:14 +00003245#line 1574 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003246{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003247 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003248 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3249 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003250 if (ATy == 0)
3251 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003252 (*yyvsp[-2].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003253
3254 int NumElements = ATy->getNumElements();
3255 const Type *ETy = ATy->getElementType();
Chris Lattnerbb856a32007-08-06 21:00:46 +00003256 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003257 GEN_ERROR("Can't build string constant of size " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003258 itostr((int)(yyvsp[0].StrVal->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003259 " when array has size " + itostr(NumElements) + "");
3260 std::vector<Constant*> Vals;
3261 if (ETy == Type::Int8Ty) {
Chris Lattnerbb856a32007-08-06 21:00:46 +00003262 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3263 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003264 } else {
Chris Lattnerbb856a32007-08-06 21:00:46 +00003265 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003266 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3267 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003268 delete yyvsp[0].StrVal;
3269 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3270 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003271 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003272 ;
3273 break;}
3274case 164:
Chris Lattner5eefce32007-09-10 23:24:14 +00003275#line 1601 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003276{ // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003277 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003278 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3279 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003280 if (PTy == 0)
3281 GEN_ERROR("Cannot make packed constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003282 (*yyvsp[-3].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003283 const Type *ETy = PTy->getElementType();
3284 int NumElements = PTy->getNumElements();
3285
3286 // Verify that we have the correct size...
Chris Lattnerbb856a32007-08-06 21:00:46 +00003287 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003288 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003289 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003290 itostr(NumElements) + "");
3291
3292 // Verify all elements are correct type!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003293 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3294 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003295 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3296 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattnerbb856a32007-08-06 21:00:46 +00003297 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003298 }
3299
Chris Lattnerbb856a32007-08-06 21:00:46 +00003300 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3301 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003302 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003303 ;
3304 break;}
3305case 165:
Chris Lattner5eefce32007-09-10 23:24:14 +00003306#line 1629 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003307{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003308 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003309 if (STy == 0)
3310 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003311 (*yyvsp[-3].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003312
Chris Lattnerbb856a32007-08-06 21:00:46 +00003313 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003314 GEN_ERROR("Illegal number of initializers for structure type");
3315
3316 // Check to ensure that constants are compatible with the type initializer!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003317 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3318 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003319 GEN_ERROR("Expected type '" +
3320 STy->getElementType(i)->getDescription() +
3321 "' for element #" + utostr(i) +
3322 " of structure initializer");
3323
3324 // Check to ensure that Type is not packed
3325 if (STy->isPacked())
3326 GEN_ERROR("Unpacked Initializer to vector type '" +
3327 STy->getDescription() + "'");
3328
Chris Lattnerbb856a32007-08-06 21:00:46 +00003329 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3330 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003331 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003332 ;
3333 break;}
3334case 166:
Chris Lattner5eefce32007-09-10 23:24:14 +00003335#line 1655 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003336{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003337 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003338 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3339 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003340 if (STy == 0)
3341 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003342 (*yyvsp[-2].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003343
3344 if (STy->getNumContainedTypes() != 0)
3345 GEN_ERROR("Illegal number of initializers for structure type");
3346
3347 // Check to ensure that Type is not packed
3348 if (STy->isPacked())
3349 GEN_ERROR("Unpacked Initializer to vector type '" +
3350 STy->getDescription() + "'");
3351
Chris Lattnerbb856a32007-08-06 21:00:46 +00003352 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3353 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003354 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003355 ;
3356 break;}
3357case 167:
Chris Lattner5eefce32007-09-10 23:24:14 +00003358#line 1675 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003359{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003360 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003361 if (STy == 0)
3362 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003363 (*yyvsp[-5].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003364
Chris Lattnerbb856a32007-08-06 21:00:46 +00003365 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003366 GEN_ERROR("Illegal number of initializers for structure type");
3367
3368 // Check to ensure that constants are compatible with the type initializer!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003369 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3370 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003371 GEN_ERROR("Expected type '" +
3372 STy->getElementType(i)->getDescription() +
3373 "' for element #" + utostr(i) +
3374 " of structure initializer");
3375
3376 // Check to ensure that Type is packed
3377 if (!STy->isPacked())
3378 GEN_ERROR("Vector initializer to non-vector type '" +
3379 STy->getDescription() + "'");
3380
Chris Lattnerbb856a32007-08-06 21:00:46 +00003381 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3382 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003383 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003384 ;
3385 break;}
3386case 168:
Chris Lattner5eefce32007-09-10 23:24:14 +00003387#line 1701 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003388{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003389 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003390 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3391 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003392 if (STy == 0)
3393 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003394 (*yyvsp[-4].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003395
3396 if (STy->getNumContainedTypes() != 0)
3397 GEN_ERROR("Illegal number of initializers for structure type");
3398
3399 // Check to ensure that Type is packed
3400 if (!STy->isPacked())
3401 GEN_ERROR("Vector initializer to non-vector type '" +
3402 STy->getDescription() + "'");
3403
Chris Lattnerbb856a32007-08-06 21:00:46 +00003404 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3405 delete yyvsp[-4].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003406 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003407 ;
3408 break;}
3409case 169:
Chris Lattner5eefce32007-09-10 23:24:14 +00003410#line 1721 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003411{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003412 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003413 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3414 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003415 if (PTy == 0)
3416 GEN_ERROR("Cannot make null pointer constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003417 (*yyvsp[-1].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003418
Chris Lattnerbb856a32007-08-06 21:00:46 +00003419 yyval.ConstVal = ConstantPointerNull::get(PTy);
3420 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003421 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003422 ;
3423 break;}
3424case 170:
Chris Lattner5eefce32007-09-10 23:24:14 +00003425#line 1733 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003426{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003427 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003428 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3429 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3430 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003431 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003432 ;
3433 break;}
3434case 171:
Chris Lattner5eefce32007-09-10 23:24:14 +00003435#line 1740 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003436{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003437 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003438 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3439 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003440 if (Ty == 0)
3441 GEN_ERROR("Global const reference must be a pointer type");
3442
3443 // ConstExprs can exist in the body of a function, thus creating
3444 // GlobalValues whenever they refer to a variable. Because we are in
3445 // the context of a function, getExistingVal will search the functions
3446 // symbol table instead of the module symbol table for the global symbol,
3447 // which throws things all off. To get around this, we just tell
3448 // getExistingVal that we are at global scope here.
3449 //
3450 Function *SavedCurFn = CurFun.CurrentFunction;
3451 CurFun.CurrentFunction = 0;
3452
Chris Lattnerbb856a32007-08-06 21:00:46 +00003453 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003454 CHECK_FOR_ERROR
3455
3456 CurFun.CurrentFunction = SavedCurFn;
3457
3458 // If this is an initializer for a constant pointer, which is referencing a
3459 // (currently) undefined variable, create a stub now that shall be replaced
3460 // in the future with the right type of variable.
3461 //
3462 if (V == 0) {
3463 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3464 const PointerType *PT = cast<PointerType>(Ty);
3465
3466 // First check to see if the forward references value is already created!
3467 PerModuleInfo::GlobalRefsType::iterator I =
Chris Lattnerbb856a32007-08-06 21:00:46 +00003468 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003469
3470 if (I != CurModule.GlobalRefs.end()) {
3471 V = I->second; // Placeholder already exists, use it...
Chris Lattnerbb856a32007-08-06 21:00:46 +00003472 yyvsp[0].ValIDVal.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003473 } else {
3474 std::string Name;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003475 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3476 Name = yyvsp[0].ValIDVal.getName();
3477 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003478 GEN_ERROR("Invalid reference to global");
3479
3480 // Create the forward referenced global.
3481 GlobalValue *GV;
3482 if (const FunctionType *FTy =
3483 dyn_cast<FunctionType>(PT->getElementType())) {
3484 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3485 CurModule.CurrentModule);
3486 } else {
3487 GV = new GlobalVariable(PT->getElementType(), false,
3488 GlobalValue::ExternalWeakLinkage, 0,
3489 Name, CurModule.CurrentModule);
3490 }
3491
3492 // Keep track of the fact that we have a forward ref to recycle it
Chris Lattnerbb856a32007-08-06 21:00:46 +00003493 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003494 V = GV;
3495 }
3496 }
3497
Chris Lattnerbb856a32007-08-06 21:00:46 +00003498 yyval.ConstVal = cast<GlobalValue>(V);
3499 delete yyvsp[-1].TypeVal; // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003500 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003501 ;
3502 break;}
3503case 172:
Chris Lattner5eefce32007-09-10 23:24:14 +00003504#line 1806 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003505{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003506 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003507 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3508 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003509 GEN_ERROR("Mismatched types for constant expression: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003510 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3511 yyval.ConstVal = yyvsp[0].ConstVal;
3512 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003513 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003514 ;
3515 break;}
3516case 173:
Chris Lattner5eefce32007-09-10 23:24:14 +00003517#line 1816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003518{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003519 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003520 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3521 const Type *Ty = yyvsp[-1].TypeVal->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003522 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3523 GEN_ERROR("Cannot create a null initialized value of this type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003524 yyval.ConstVal = Constant::getNullValue(Ty);
3525 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003526 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003527 ;
3528 break;}
3529case 174:
Chris Lattner5eefce32007-09-10 23:24:14 +00003530#line 1826 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003531{ // integral constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003532 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003533 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003534 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003535 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003536 ;
3537 break;}
3538case 175:
Chris Lattner5eefce32007-09-10 23:24:14 +00003539#line 1832 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003540{ // arbitrary precision integer constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003541 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3542 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003543 GEN_ERROR("Constant value does not fit in type");
3544 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003545 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3546 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3547 delete yyvsp[0].APIntVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003548 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003549 ;
3550 break;}
3551case 176:
Chris Lattner5eefce32007-09-10 23:24:14 +00003552#line 1842 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003553{ // integral constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003554 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003555 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003556 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003557 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003558 ;
3559 break;}
3560case 177:
Chris Lattner5eefce32007-09-10 23:24:14 +00003561#line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003562{ // arbitrary precision integer constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003563 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3564 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003565 GEN_ERROR("Constant value does not fit in type");
3566 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003567 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3568 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3569 delete yyvsp[0].APIntVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003570 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003571 ;
3572 break;}
3573case 178:
Chris Lattner5eefce32007-09-10 23:24:14 +00003574#line 1858 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003575{ // Boolean constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003576 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3577 yyval.ConstVal = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003578 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003579 ;
3580 break;}
3581case 179:
Chris Lattner5eefce32007-09-10 23:24:14 +00003582#line 1863 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003583{ // Boolean constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003584 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3585 yyval.ConstVal = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003586 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003587 ;
3588 break;}
3589case 180:
Chris Lattner5eefce32007-09-10 23:24:14 +00003590#line 1868 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003591{ // Float & Double constants
3592 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003593 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen3afee192007-09-07 21:07:57 +00003594 // Lexer has no type info, so builds all FP constants as double.
3595 // Fix this here.
3596 if (yyvsp[-1].PrimType==Type::FloatTy)
3597 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3598 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3599 delete yyvsp[0].FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003600 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003601 ;
3602 break;}
3603case 181:
Chris Lattner5eefce32007-09-10 23:24:14 +00003604#line 1881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003605{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003606 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003607 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3608 Constant *Val = yyvsp[-3].ConstVal;
3609 const Type *DestTy = yyvsp[-1].TypeVal->get();
3610 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003611 GEN_ERROR("invalid cast opcode for cast from '" +
3612 Val->getType()->getDescription() + "' to '" +
3613 DestTy->getDescription() + "'");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003614 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3615 delete yyvsp[-1].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003616 ;
3617 break;}
3618case 182:
Chris Lattner5eefce32007-09-10 23:24:14 +00003619#line 1893 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003620{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003621 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003622 GEN_ERROR("GetElementPtr requires a pointer operand");
3623
3624 const Type *IdxTy =
David Greene48556392007-09-04 18:46:50 +00003625 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003626 true);
3627 if (!IdxTy)
3628 GEN_ERROR("Index list invalid for constant getelementptr");
3629
3630 SmallVector<Constant*, 8> IdxVec;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003631 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3632 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003633 IdxVec.push_back(C);
3634 else
3635 GEN_ERROR("Indices to constant getelementptr must be constants");
3636
Chris Lattnerbb856a32007-08-06 21:00:46 +00003637 delete yyvsp[-1].ValueList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003638
Chris Lattnerbb856a32007-08-06 21:00:46 +00003639 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003640 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003641 ;
3642 break;}
3643case 183:
Chris Lattner5eefce32007-09-10 23:24:14 +00003644#line 1915 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003645{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003646 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003647 GEN_ERROR("Select condition must be of boolean type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003648 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003649 GEN_ERROR("Select operand types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003650 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003651 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003652 ;
3653 break;}
3654case 184:
Chris Lattner5eefce32007-09-10 23:24:14 +00003655#line 1923 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003656{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003657 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003658 GEN_ERROR("Binary operator types must match");
3659 CHECK_FOR_ERROR;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003660 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00003661 ;
3662 break;}
3663case 185:
Chris Lattner5eefce32007-09-10 23:24:14 +00003664#line 1929 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003665{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003666 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003667 GEN_ERROR("Logical operator types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003668 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3669 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3670 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003671 GEN_ERROR("Logical operator requires integral operands");
3672 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003673 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003674 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003675 ;
3676 break;}
3677case 186:
Chris Lattner5eefce32007-09-10 23:24:14 +00003678#line 1940 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003679{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003680 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003681 GEN_ERROR("icmp operand types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003682 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00003683 ;
3684 break;}
3685case 187:
Chris Lattner5eefce32007-09-10 23:24:14 +00003686#line 1945 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003687{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003688 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003689 GEN_ERROR("fcmp operand types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003690 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00003691 ;
3692 break;}
3693case 188:
Chris Lattner5eefce32007-09-10 23:24:14 +00003694#line 1950 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003695{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003696 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003697 GEN_ERROR("Invalid extractelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003698 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003699 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003700 ;
3701 break;}
3702case 189:
Chris Lattner5eefce32007-09-10 23:24:14 +00003703#line 1956 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003704{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003705 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003706 GEN_ERROR("Invalid insertelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003707 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003708 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003709 ;
3710 break;}
3711case 190:
Chris Lattner5eefce32007-09-10 23:24:14 +00003712#line 1962 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003713{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003714 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003715 GEN_ERROR("Invalid shufflevector operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003716 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003717 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003718 ;
3719 break;}
3720case 191:
Chris Lattner5eefce32007-09-10 23:24:14 +00003721#line 1971 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003722{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003723 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003724 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003725 ;
3726 break;}
3727case 192:
Chris Lattner5eefce32007-09-10 23:24:14 +00003728#line 1975 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003729{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003730 yyval.ConstVector = new std::vector<Constant*>();
3731 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003732 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003733 ;
3734 break;}
3735case 193:
Chris Lattner5eefce32007-09-10 23:24:14 +00003736#line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003737{ yyval.BoolVal = false; ;
3738 break;}
3739case 194:
Chris Lattner5eefce32007-09-10 23:24:14 +00003740#line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003741{ yyval.BoolVal = true; ;
3742 break;}
3743case 195:
Chris Lattner5eefce32007-09-10 23:24:14 +00003744#line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003745{ yyval.BoolVal = true; ;
3746 break;}
3747case 196:
Chris Lattner5eefce32007-09-10 23:24:14 +00003748#line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003749{ yyval.BoolVal = false; ;
3750 break;}
3751case 197:
Chris Lattner5eefce32007-09-10 23:24:14 +00003752#line 1989 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003753{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003754 const Type* VTy = yyvsp[-1].TypeVal->get();
3755 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3756 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003757 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3758 if (!Aliasee)
3759 GEN_ERROR("Aliases can be created only to global values");
3760
Chris Lattnerbb856a32007-08-06 21:00:46 +00003761 yyval.ConstVal = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003762 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00003763 delete yyvsp[-1].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003764 ;
3765 break;}
3766case 198:
Chris Lattner5eefce32007-09-10 23:24:14 +00003767#line 2001 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003768{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003769 Constant *Val = yyvsp[-3].ConstVal;
3770 const Type *DestTy = yyvsp[-1].TypeVal->get();
3771 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003772 GEN_ERROR("invalid cast opcode for cast from '" +
3773 Val->getType()->getDescription() + "' to '" +
3774 DestTy->getDescription() + "'");
3775
Chris Lattnerbb856a32007-08-06 21:00:46 +00003776 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003777 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00003778 delete yyvsp[-1].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003779 ;
3780 break;}
3781case 199:
Chris Lattner5eefce32007-09-10 23:24:14 +00003782#line 2022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003783{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003784 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
Reid Spencer47470022007-07-31 14:41:17 +00003785 CurModule.ModuleDone();
3786 CHECK_FOR_ERROR;
Dale Johannesen3afee192007-09-07 21:07:57 +00003787 ;
3788 break;}
3789case 200:
Chris Lattner5eefce32007-09-10 23:24:14 +00003790#line 2027 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003791{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003792 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003793 CurModule.ModuleDone();
3794 CHECK_FOR_ERROR;
Dale Johannesen3afee192007-09-07 21:07:57 +00003795 ;
3796 break;}
3797case 203:
Chris Lattner5eefce32007-09-10 23:24:14 +00003798#line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003799{ CurFun.isDeclare = false; ;
3800 break;}
3801case 204:
Chris Lattner5eefce32007-09-10 23:24:14 +00003802#line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003803{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003804 CurFun.FunctionDone();
3805 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003806 ;
3807 break;}
3808case 205:
Chris Lattner5eefce32007-09-10 23:24:14 +00003809#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003810{ CurFun.isDeclare = true; ;
3811 break;}
3812case 206:
Chris Lattner5eefce32007-09-10 23:24:14 +00003813#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003814{
Reid Spencer47470022007-07-31 14:41:17 +00003815 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003816 ;
3817 break;}
3818case 207:
Chris Lattner5eefce32007-09-10 23:24:14 +00003819#line 2047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003820{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003821 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003822 ;
3823 break;}
3824case 208:
Chris Lattner5eefce32007-09-10 23:24:14 +00003825#line 2050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003826{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003827 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003828 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003829 // Eagerly resolve types. This is not an optimization, this is a
3830 // requirement that is due to the fact that we could have this:
3831 //
3832 // %list = type { %list * }
3833 // %list = type { %list * } ; repeated type decl
3834 //
3835 // If types are not resolved eagerly, then the two types will not be
3836 // determined to be the same type!
3837 //
Chris Lattnerbb856a32007-08-06 21:00:46 +00003838 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003839
Chris Lattnerbb856a32007-08-06 21:00:46 +00003840 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003841 CHECK_FOR_ERROR
3842 // If this is a named type that is not a redefinition, add it to the slot
3843 // table.
Chris Lattnerbb856a32007-08-06 21:00:46 +00003844 CurModule.Types.push_back(*yyvsp[0].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003845 }
3846
Chris Lattnerbb856a32007-08-06 21:00:46 +00003847 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003848 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003849 ;
3850 break;}
3851case 209:
Chris Lattner5eefce32007-09-10 23:24:14 +00003852#line 2074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003853{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003854 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
Reid Spenceraa8ae282007-07-31 03:50:36 +00003855
Chris Lattnerbb856a32007-08-06 21:00:46 +00003856 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003857 CHECK_FOR_ERROR
3858 // If this is a named type that is not a redefinition, add it to the slot
3859 // table.
Chris Lattnerbb856a32007-08-06 21:00:46 +00003860 CurModule.Types.push_back(yyvsp[0].PrimType);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003861 }
3862 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003863 ;
3864 break;}
3865case 210:
Chris Lattner5eefce32007-09-10 23:24:14 +00003866#line 2085 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003867{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003868 /* "Externally Visible" Linkage */
Chris Lattnerbb856a32007-08-06 21:00:46 +00003869 if (yyvsp[0].ConstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003870 GEN_ERROR("Global value initializer is not a constant");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003871 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3872 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003873 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003874 ;
3875 break;}
3876case 211:
Chris Lattner5eefce32007-09-10 23:24:14 +00003877#line 2092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003878{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003879 CurGV = 0;
Dale Johannesen3afee192007-09-07 21:07:57 +00003880 ;
3881 break;}
3882case 212:
Chris Lattner5eefce32007-09-10 23:24:14 +00003883#line 2096 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003884{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003885 if (yyvsp[0].ConstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003886 GEN_ERROR("Global value initializer is not a constant");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003887 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003888 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003889 ;
3890 break;}
3891case 213:
Chris Lattner5eefce32007-09-10 23:24:14 +00003892#line 2101 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003893{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003894 CurGV = 0;
Dale Johannesen3afee192007-09-07 21:07:57 +00003895 ;
3896 break;}
3897case 214:
Chris Lattner5eefce32007-09-10 23:24:14 +00003898#line 2105 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003899{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003900 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003901 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3902 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003903 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00003904 delete yyvsp[0].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003905 ;
3906 break;}
3907case 215:
Chris Lattner5eefce32007-09-10 23:24:14 +00003908#line 2111 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003909{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003910 CurGV = 0;
3911 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003912 ;
3913 break;}
3914case 216:
Chris Lattner5eefce32007-09-10 23:24:14 +00003915#line 2115 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003916{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003917 std::string Name;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003918 if (yyvsp[-4].StrVal) {
3919 Name = *yyvsp[-4].StrVal;
3920 delete yyvsp[-4].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003921 }
3922 if (Name.empty())
3923 GEN_ERROR("Alias name cannot be empty");
3924
Chris Lattnerbb856a32007-08-06 21:00:46 +00003925 Constant* Aliasee = yyvsp[0].ConstVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003926 if (Aliasee == 0)
3927 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3928
Chris Lattnerbb856a32007-08-06 21:00:46 +00003929 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003930 CurModule.CurrentModule);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003931 GA->setVisibility(yyvsp[-3].Visibility);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003932 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00003933
3934
3935 // If there was a forward reference of this alias, resolve it now.
3936
3937 ValID ID;
3938 if (!Name.empty())
3939 ID = ValID::createGlobalName(Name);
3940 else
3941 ID = ValID::createGlobalID(CurModule.Values.size()-1);
3942
3943 if (GlobalValue *FWGV =
3944 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
3945 // Replace uses of the fwdref with the actual alias.
3946 FWGV->replaceAllUsesWith(GA);
3947 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
3948 GV->eraseFromParent();
3949 else
3950 cast<Function>(FWGV)->eraseFromParent();
3951 }
3952 ID.destroy();
3953
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003954 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003955 ;
3956 break;}
3957case 217:
Chris Lattner5eefce32007-09-10 23:24:14 +00003958#line 2155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003959{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003960 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003961 ;
3962 break;}
3963case 218:
Chris Lattner5eefce32007-09-10 23:24:14 +00003964#line 2158 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003965{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003966 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003967 ;
3968 break;}
3969case 219:
Chris Lattner5eefce32007-09-10 23:24:14 +00003970#line 2164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003971{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003972 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3973 if (AsmSoFar.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003974 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003975 else
Chris Lattnerbb856a32007-08-06 21:00:46 +00003976 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
3977 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003978 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003979;
3980 break;}
3981case 220:
Chris Lattner5eefce32007-09-10 23:24:14 +00003982#line 2174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003983{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003984 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
3985 delete yyvsp[0].StrVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003986 ;
3987 break;}
3988case 221:
Chris Lattner5eefce32007-09-10 23:24:14 +00003989#line 2178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003990{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003991 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
3992 delete yyvsp[0].StrVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003993 ;
3994 break;}
3995case 223:
Chris Lattner5eefce32007-09-10 23:24:14 +00003996#line 2185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003997{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003998 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3999 delete yyvsp[0].StrVal;
Reid Spencer47470022007-07-31 14:41:17 +00004000 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004001 ;
4002 break;}
4003case 224:
Chris Lattner5eefce32007-09-10 23:24:14 +00004004#line 2190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004005{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004006 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4007 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004008 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004009 ;
4010 break;}
4011case 225:
Chris Lattner5eefce32007-09-10 23:24:14 +00004012#line 2195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004013{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004014 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004015 ;
4016 break;}
4017case 226:
Chris Lattner5eefce32007-09-10 23:24:14 +00004018#line 2204 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004019{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004020 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004021 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4022 if (*yyvsp[-2].TypeVal == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004023 GEN_ERROR("void typed arguments are invalid");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004024 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4025 yyval.ArgList = yyvsp[-4].ArgList;
4026 yyvsp[-4].ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004027 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004028 ;
4029 break;}
4030case 227:
Chris Lattner5eefce32007-09-10 23:24:14 +00004031#line 2214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004032{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004033 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004034 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4035 if (*yyvsp[-2].TypeVal == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004036 GEN_ERROR("void typed arguments are invalid");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004037 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4038 yyval.ArgList = new ArgListType;
4039 yyval.ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004040 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004041 ;
4042 break;}
4043case 228:
Chris Lattner5eefce32007-09-10 23:24:14 +00004044#line 2225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004045{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004046 yyval.ArgList = yyvsp[0].ArgList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004047 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004048 ;
4049 break;}
4050case 229:
Chris Lattner5eefce32007-09-10 23:24:14 +00004051#line 2229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004052{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004053 yyval.ArgList = yyvsp[-2].ArgList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004054 struct ArgListEntry E;
4055 E.Ty = new PATypeHolder(Type::VoidTy);
4056 E.Name = 0;
4057 E.Attrs = ParamAttr::None;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004058 yyval.ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004059 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004060 ;
4061 break;}
4062case 230:
Chris Lattner5eefce32007-09-10 23:24:14 +00004063#line 2238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004064{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004065 yyval.ArgList = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004066 struct ArgListEntry E;
4067 E.Ty = new PATypeHolder(Type::VoidTy);
4068 E.Name = 0;
4069 E.Attrs = ParamAttr::None;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004070 yyval.ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004071 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004072 ;
4073 break;}
4074case 231:
Chris Lattner5eefce32007-09-10 23:24:14 +00004075#line 2247 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004076{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004077 yyval.ArgList = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004078 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004079 ;
4080 break;}
4081case 232:
Chris Lattner5eefce32007-09-10 23:24:14 +00004082#line 2253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004083{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004084 std::string FunctionName(*yyvsp[-6].StrVal);
4085 delete yyvsp[-6].StrVal; // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004086
4087 // Check the function result for abstractness if this is a define. We should
4088 // have no abstract types at this point
Chris Lattnerbb856a32007-08-06 21:00:46 +00004089 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4090 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004091
4092 std::vector<const Type*> ParamTypeList;
4093 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004094 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4095 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004096 Attrs.push_back(PAWI);
4097 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004098 if (yyvsp[-4].ArgList) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004099 unsigned index = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004100 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004101 const Type* Ty = I->Ty->get();
4102 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4103 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4104 ParamTypeList.push_back(Ty);
4105 if (Ty != Type::VoidTy)
4106 if (I->Attrs != ParamAttr::None) {
4107 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4108 Attrs.push_back(PAWI);
4109 }
4110 }
4111 }
4112
4113 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4114 if (isVarArg) ParamTypeList.pop_back();
4115
4116 ParamAttrsList *PAL = 0;
4117 if (!Attrs.empty())
4118 PAL = ParamAttrsList::get(Attrs);
4119
Chris Lattnerbb856a32007-08-06 21:00:46 +00004120 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004121 const PointerType *PFT = PointerType::get(FT);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004122 delete yyvsp[-7].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004123
4124 ValID ID;
4125 if (!FunctionName.empty()) {
4126 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4127 } else {
4128 ID = ValID::createGlobalID(CurModule.Values.size());
4129 }
4130
4131 Function *Fn = 0;
4132 // See if this function was forward referenced. If so, recycle the object.
4133 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4134 // Move the function to the end of the list, from whereever it was
4135 // previously inserted.
4136 Fn = cast<Function>(FWRef);
4137 CurModule.CurrentModule->getFunctionList().remove(Fn);
4138 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4139 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4140 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4141 if (Fn->getFunctionType() != FT) {
4142 // The existing function doesn't have the same type. This is an overload
4143 // error.
4144 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4145 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4146 // Neither the existing or the current function is a declaration and they
4147 // have the same name and same type. Clearly this is a redefinition.
4148 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4149 } if (Fn->isDeclaration()) {
4150 // Make sure to strip off any argument names so we can't get conflicts.
4151 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4152 AI != AE; ++AI)
4153 AI->setName("");
4154 }
4155 } else { // Not already defined?
4156 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4157 CurModule.CurrentModule);
4158
4159 InsertValue(Fn, CurModule.Values);
4160 }
4161
4162 CurFun.FunctionStart(Fn);
4163
4164 if (CurFun.isDeclare) {
4165 // If we have declaration, always overwrite linkage. This will allow us to
4166 // correctly handle cases, when pointer to function is passed as argument to
4167 // another function.
4168 Fn->setLinkage(CurFun.Linkage);
4169 Fn->setVisibility(CurFun.Visibility);
4170 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004171 Fn->setCallingConv(yyvsp[-8].UIntVal);
4172 Fn->setAlignment(yyvsp[0].UIntVal);
4173 if (yyvsp[-1].StrVal) {
4174 Fn->setSection(*yyvsp[-1].StrVal);
4175 delete yyvsp[-1].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004176 }
4177
4178 // Add all of the arguments we parsed to the function...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004179 if (yyvsp[-4].ArgList) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004180 if (isVarArg) { // Nuke the last entry
Chris Lattnerbb856a32007-08-06 21:00:46 +00004181 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004182 "Not a varargs marker!");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004183 delete yyvsp[-4].ArgList->back().Ty;
4184 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004185 }
4186 Function::arg_iterator ArgIt = Fn->arg_begin();
4187 Function::arg_iterator ArgEnd = Fn->arg_end();
4188 unsigned Idx = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004189 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4190 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004191 delete I->Ty; // Delete the typeholder...
4192 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4193 CHECK_FOR_ERROR
4194 InsertValue(ArgIt);
4195 Idx++;
4196 }
4197
Chris Lattnerbb856a32007-08-06 21:00:46 +00004198 delete yyvsp[-4].ArgList; // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004199 }
4200 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004201;
4202 break;}
4203case 235:
Chris Lattner5eefce32007-09-10 23:24:14 +00004204#line 2375 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004205{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004206 yyval.FunctionVal = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004207
4208 // Make sure that we keep track of the linkage type even if there was a
4209 // previous "declare".
Chris Lattnerbb856a32007-08-06 21:00:46 +00004210 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4211 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
Dale Johannesen3afee192007-09-07 21:07:57 +00004212;
4213 break;}
4214case 238:
Chris Lattner5eefce32007-09-10 23:24:14 +00004215#line 2386 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004216{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004217 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004218 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004219;
4220 break;}
4221case 239:
Chris Lattner5eefce32007-09-10 23:24:14 +00004222#line 2391 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004223{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004224 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4225 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4226 yyval.FunctionVal = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004227 CurFun.FunctionDone();
4228 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004229 ;
4230 break;}
4231case 240:
Chris Lattner5eefce32007-09-10 23:24:14 +00004232#line 2403 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004233{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004234 yyval.BoolVal = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004235 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004236 ;
4237 break;}
4238case 241:
Chris Lattner5eefce32007-09-10 23:24:14 +00004239#line 2407 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004240{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004241 yyval.BoolVal = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004242 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004243 ;
4244 break;}
4245case 242:
Chris Lattner5eefce32007-09-10 23:24:14 +00004246#line 2412 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004247{ // A reference to a direct constant
Chris Lattnerbb856a32007-08-06 21:00:46 +00004248 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004249 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004250 ;
4251 break;}
4252case 243:
Chris Lattner5eefce32007-09-10 23:24:14 +00004253#line 2416 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004254{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004255 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004256 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004257 ;
4258 break;}
4259case 244:
Chris Lattner5eefce32007-09-10 23:24:14 +00004260#line 2420 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004261{ // Perhaps it's an FP constant?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004262 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004263 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004264 ;
4265 break;}
4266case 245:
Chris Lattner5eefce32007-09-10 23:24:14 +00004267#line 2424 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004268{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004269 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004270 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004271 ;
4272 break;}
4273case 246:
Chris Lattner5eefce32007-09-10 23:24:14 +00004274#line 2428 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004275{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004276 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004277 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004278 ;
4279 break;}
4280case 247:
Chris Lattner5eefce32007-09-10 23:24:14 +00004281#line 2432 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004282{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004283 yyval.ValIDVal = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004284 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004285 ;
4286 break;}
4287case 248:
Chris Lattner5eefce32007-09-10 23:24:14 +00004288#line 2436 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004289{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004290 yyval.ValIDVal = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004291 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004292 ;
4293 break;}
4294case 249:
Chris Lattner5eefce32007-09-10 23:24:14 +00004295#line 2440 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004296{ // A vector zero constant.
Chris Lattnerbb856a32007-08-06 21:00:46 +00004297 yyval.ValIDVal = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004298 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004299 ;
4300 break;}
4301case 250:
Chris Lattner5eefce32007-09-10 23:24:14 +00004302#line 2444 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004303{ // Nonempty unsized packed vector
Chris Lattnerbb856a32007-08-06 21:00:46 +00004304 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4305 int NumElements = yyvsp[-1].ConstVector->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004306
4307 VectorType* pt = VectorType::get(ETy, NumElements);
4308 PATypeHolder* PTy = new PATypeHolder(
4309 HandleUpRefs(
4310 VectorType::get(
4311 ETy,
4312 NumElements)
4313 )
4314 );
4315
4316 // Verify all elements are correct type!
Chris Lattnerbb856a32007-08-06 21:00:46 +00004317 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4318 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004319 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4320 ETy->getDescription() +"' as required!\nIt is of type '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00004321 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322 }
4323
Chris Lattnerbb856a32007-08-06 21:00:46 +00004324 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4325 delete PTy; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004326 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004327 ;
4328 break;}
4329case 251:
Chris Lattner5eefce32007-09-10 23:24:14 +00004330#line 2469 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004331{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004332 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004333 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004334 ;
4335 break;}
4336case 252:
Chris Lattner5eefce32007-09-10 23:24:14 +00004337#line 2473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004338{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004339 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4340 delete yyvsp[-2].StrVal;
4341 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004342 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004343 ;
4344 break;}
4345case 253:
Chris Lattner5eefce32007-09-10 23:24:14 +00004346#line 2483 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004347{ // Is it an integer reference...?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004348 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004349 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004350 ;
4351 break;}
4352case 254:
Chris Lattner5eefce32007-09-10 23:24:14 +00004353#line 2487 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004354{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004355 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004356 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004357 ;
4358 break;}
4359case 255:
Chris Lattner5eefce32007-09-10 23:24:14 +00004360#line 2491 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004361{ // Is it a named reference...?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004362 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4363 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004364 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004365 ;
4366 break;}
4367case 256:
Chris Lattner5eefce32007-09-10 23:24:14 +00004368#line 2496 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004369{ // Is it a named reference...?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004370 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4371 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004372 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004373 ;
4374 break;}
4375case 259:
Chris Lattner5eefce32007-09-10 23:24:14 +00004376#line 2509 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004377{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004378 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004379 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4380 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4381 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004382 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004383 ;
4384 break;}
4385case 260:
Chris Lattner5eefce32007-09-10 23:24:14 +00004386#line 2518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004387{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004388 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004389 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004390 ;
4391 break;}
4392case 261:
Chris Lattner5eefce32007-09-10 23:24:14 +00004393#line 2522 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004394{ // Do not allow functions with 0 basic blocks
Chris Lattnerbb856a32007-08-06 21:00:46 +00004395 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004396 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004397 ;
4398 break;}
4399case 262:
Chris Lattner5eefce32007-09-10 23:24:14 +00004400#line 2531 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004401{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004402 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004403 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004404 InsertValue(yyvsp[0].TermInstVal);
4405 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4406 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004407 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004408 ;
4409 break;}
4410case 263:
Chris Lattner5eefce32007-09-10 23:24:14 +00004411#line 2540 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004412{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004413 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004414 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4415 if (CI2->getParent() == 0)
Chris Lattnerbb856a32007-08-06 21:00:46 +00004416 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4417 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4418 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004419 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004420 ;
4421 break;}
4422case 264:
Chris Lattner5eefce32007-09-10 23:24:14 +00004423#line 2549 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004424{ // Empty space between instruction lists
Chris Lattnerbb856a32007-08-06 21:00:46 +00004425 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004426 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004427 ;
4428 break;}
4429case 265:
Chris Lattner5eefce32007-09-10 23:24:14 +00004430#line 2553 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004431{ // Labelled (named) basic block
Chris Lattnerbb856a32007-08-06 21:00:46 +00004432 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4433 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004434 CHECK_FOR_ERROR
4435
Dale Johannesen3afee192007-09-07 21:07:57 +00004436 ;
4437 break;}
4438case 266:
Chris Lattner5eefce32007-09-10 23:24:14 +00004439#line 2560 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004440{ // Return with a result...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004441 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4442 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004443 ;
4444 break;}
4445case 267:
Chris Lattner5eefce32007-09-10 23:24:14 +00004446#line 2564 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004447{ // Return with no result...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004448 yyval.TermInstVal = new ReturnInst();
4449 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004450 ;
4451 break;}
4452case 268:
Chris Lattner5eefce32007-09-10 23:24:14 +00004453#line 2568 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004454{ // Unconditional Branch...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004455 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4456 CHECK_FOR_ERROR
4457 yyval.TermInstVal = new BranchInst(tmpBB);
Dale Johannesen3afee192007-09-07 21:07:57 +00004458 ;
4459 break;}
4460case 269:
Chris Lattner5eefce32007-09-10 23:24:14 +00004461#line 2573 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004462{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004463 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4464 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4465 CHECK_FOR_ERROR
4466 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4467 CHECK_FOR_ERROR
4468 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4469 CHECK_FOR_ERROR
4470 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00004471 ;
4472 break;}
4473case 270:
Chris Lattner5eefce32007-09-10 23:24:14 +00004474#line 2583 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004475{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004476 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4477 CHECK_FOR_ERROR
4478 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4479 CHECK_FOR_ERROR
4480 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4481 yyval.TermInstVal = S;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004482
Chris Lattnerbb856a32007-08-06 21:00:46 +00004483 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4484 E = yyvsp[-1].JumpTable->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004485 for (; I != E; ++I) {
4486 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4487 S->addCase(CI, I->second);
4488 else
4489 GEN_ERROR("Switch case is constant, but not a simple integer");
4490 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004491 delete yyvsp[-1].JumpTable;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004492 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004493 ;
4494 break;}
4495case 271:
Chris Lattner5eefce32007-09-10 23:24:14 +00004496#line 2602 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004497{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004498 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004499 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004500 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004501 CHECK_FOR_ERROR
4502 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004503 yyval.TermInstVal = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004504 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004505 ;
4506 break;}
4507case 272:
Chris Lattner5eefce32007-09-10 23:24:14 +00004508#line 2612 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004509{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004510
4511 // Handle the short syntax
4512 const PointerType *PFTy = 0;
4513 const FunctionType *Ty = 0;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004514 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004515 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4516 // Pull out the types of all of the arguments...
4517 std::vector<const Type*> ParamTypes;
4518 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004519 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4520 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004521 Attrs.push_back(PAWI);
4522 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004523 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004524 unsigned index = 1;
4525 for (; I != E; ++I, ++index) {
4526 const Type *Ty = I->Val->getType();
4527 if (Ty == Type::VoidTy)
4528 GEN_ERROR("Short call syntax cannot be used with varargs");
4529 ParamTypes.push_back(Ty);
4530 if (I->Attrs != ParamAttr::None) {
4531 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4532 Attrs.push_back(PAWI);
4533 }
4534 }
4535
4536 ParamAttrsList *PAL = 0;
4537 if (!Attrs.empty())
4538 PAL = ParamAttrsList::get(Attrs);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004539 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004540 PFTy = PointerType::get(Ty);
4541 }
4542
Chris Lattnerbb856a32007-08-06 21:00:46 +00004543 delete yyvsp[-11].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004544
Chris Lattnerbb856a32007-08-06 21:00:46 +00004545 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004546 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004547 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004548 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004549 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004550 CHECK_FOR_ERROR
4551
4552 // Check the arguments
4553 ValueList Args;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004554 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004555 // Make sure no arguments is a good thing!
4556 if (Ty->getNumParams() != 0)
4557 GEN_ERROR("No arguments passed to a function that "
4558 "expects arguments");
4559 } else { // Has arguments?
4560 // Loop through FunctionType's arguments and ensure they are specified
4561 // correctly!
4562 FunctionType::param_iterator I = Ty->param_begin();
4563 FunctionType::param_iterator E = Ty->param_end();
Chris Lattnerbb856a32007-08-06 21:00:46 +00004564 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004565
4566 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4567 if (ArgI->Val->getType() != *I)
4568 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4569 (*I)->getDescription() + "'");
4570 Args.push_back(ArgI->Val);
4571 }
4572
4573 if (Ty->isVarArg()) {
4574 if (I == E)
4575 for (; ArgI != ArgE; ++ArgI)
4576 Args.push_back(ArgI->Val); // push the remaining varargs
4577 } else if (I != E || ArgI != ArgE)
4578 GEN_ERROR("Invalid number of parameters detected");
4579 }
4580
4581 // Create the InvokeInst
Chris Lattnerd140ada2007-08-29 16:15:23 +00004582 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Chris Lattnerbb856a32007-08-06 21:00:46 +00004583 II->setCallingConv(yyvsp[-12].UIntVal);
4584 yyval.TermInstVal = II;
4585 delete yyvsp[-8].ValueRefList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004586 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004587 ;
4588 break;}
4589case 273:
Chris Lattner5eefce32007-09-10 23:24:14 +00004590#line 2691 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004591{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004592 yyval.TermInstVal = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004593 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004594 ;
4595 break;}
4596case 274:
Chris Lattner5eefce32007-09-10 23:24:14 +00004597#line 2695 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004598{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004599 yyval.TermInstVal = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004600 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004601 ;
4602 break;}
4603case 275:
Chris Lattner5eefce32007-09-10 23:24:14 +00004604#line 2702 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004605{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004606 yyval.JumpTable = yyvsp[-5].JumpTable;
4607 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004608 CHECK_FOR_ERROR
4609 if (V == 0)
4610 GEN_ERROR("May only switch on a constant pool value");
4611
Chris Lattnerbb856a32007-08-06 21:00:46 +00004612 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004613 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004614 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
Dale Johannesen3afee192007-09-07 21:07:57 +00004615 ;
4616 break;}
4617case 276:
Chris Lattner5eefce32007-09-10 23:24:14 +00004618#line 2713 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004619{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004620 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4621 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004622 CHECK_FOR_ERROR
4623
4624 if (V == 0)
4625 GEN_ERROR("May only switch on a constant pool value");
4626
Chris Lattnerbb856a32007-08-06 21:00:46 +00004627 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004628 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004629 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
Dale Johannesen3afee192007-09-07 21:07:57 +00004630 ;
4631 break;}
4632case 277:
Chris Lattner5eefce32007-09-10 23:24:14 +00004633#line 2726 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004634{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004635 // Is this definition named?? if so, assign the name...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004636 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004637 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004638 InsertValue(yyvsp[0].InstVal);
4639 yyval.InstVal = yyvsp[0].InstVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004640 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004641 ;
4642 break;}
4643case 278:
Chris Lattner5eefce32007-09-10 23:24:14 +00004644#line 2736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004645{ // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004646 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004647 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4648 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4649 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004651 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004652 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004653 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4654 delete yyvsp[-5].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004655 ;
4656 break;}
4657case 279:
Chris Lattner5eefce32007-09-10 23:24:14 +00004658#line 2747 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004659{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004660 yyval.PHIList = yyvsp[-6].PHIList;
4661 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004662 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004663 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004664 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004665 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
Dale Johannesen3afee192007-09-07 21:07:57 +00004666 ;
4667 break;}
4668case 280:
Chris Lattner5eefce32007-09-10 23:24:14 +00004669#line 2757 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004670{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004671 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004672 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004673 // Used for call and invoke instructions
Chris Lattnerbb856a32007-08-06 21:00:46 +00004674 yyval.ValueRefList = new ValueRefList();
4675 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4676 yyval.ValueRefList->push_back(E);
4677 delete yyvsp[-2].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004678 ;
4679 break;}
4680case 281:
Chris Lattner5eefce32007-09-10 23:24:14 +00004681#line 2766 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004682{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004683 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004684 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4685 yyval.ValueRefList = yyvsp[-4].ValueRefList;
4686 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4687 yyval.ValueRefList->push_back(E);
4688 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004689 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004690 ;
4691 break;}
4692case 282:
Chris Lattner5eefce32007-09-10 23:24:14 +00004693#line 2775 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004694{ yyval.ValueRefList = new ValueRefList(); ;
4695 break;}
4696case 283:
Chris Lattner5eefce32007-09-10 23:24:14 +00004697#line 2778 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004698{ yyval.ValueList = new std::vector<Value*>(); ;
4699 break;}
4700case 284:
Chris Lattner5eefce32007-09-10 23:24:14 +00004701#line 2779 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004702{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004703 yyval.ValueList = yyvsp[-2].ValueList;
4704 yyval.ValueList->push_back(yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004705 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004706 ;
4707 break;}
4708case 285:
Chris Lattner5eefce32007-09-10 23:24:14 +00004709#line 2786 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004710{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004711 yyval.BoolVal = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004712 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004713 ;
4714 break;}
4715case 286:
Chris Lattner5eefce32007-09-10 23:24:14 +00004716#line 2790 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004717{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004718 yyval.BoolVal = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004719 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004720 ;
4721 break;}
4722case 287:
Chris Lattner5eefce32007-09-10 23:24:14 +00004723#line 2795 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004724{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004725 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004726 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4727 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4728 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004729 GEN_ERROR(
4730 "Arithmetic operator requires integer, FP, or packed operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004731 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4732 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4733 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4734 yyvsp[-4].BinaryOpVal == Instruction::FRem))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004735 GEN_ERROR("Remainder not supported on vector types");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004736 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004737 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004738 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004739 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004740 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4741 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004742 GEN_ERROR("binary operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004743 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004744 ;
4745 break;}
4746case 288:
Chris Lattner5eefce32007-09-10 23:24:14 +00004747#line 2816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004748{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004749 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004750 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4751 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4752 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4753 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004754 GEN_ERROR("Logical operator requires integral operands");
4755 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004756 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004757 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004758 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004759 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004760 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4761 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004762 GEN_ERROR("binary operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004763 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004764 ;
4765 break;}
4766case 289:
Chris Lattner5eefce32007-09-10 23:24:14 +00004767#line 2833 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004768{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004769 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004770 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4771 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004772 GEN_ERROR("Vector types not supported by icmp instruction");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004773 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004774 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004775 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004776 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004777 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4778 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004779 GEN_ERROR("icmp operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004780 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004781 ;
4782 break;}
4783case 290:
Chris Lattner5eefce32007-09-10 23:24:14 +00004784#line 2847 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004785{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004786 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004787 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4788 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004789 GEN_ERROR("Vector types not supported by fcmp instruction");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004790 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004791 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004792 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004793 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004794 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4795 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004796 GEN_ERROR("fcmp operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004797 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004798 ;
4799 break;}
4800case 291:
Chris Lattner5eefce32007-09-10 23:24:14 +00004801#line 2861 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004802{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004803 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004804 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4805 Value* Val = yyvsp[-2].ValueVal;
4806 const Type* DestTy = yyvsp[0].TypeVal->get();
4807 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004808 GEN_ERROR("invalid cast opcode for cast from '" +
4809 Val->getType()->getDescription() + "' to '" +
4810 DestTy->getDescription() + "'");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004811 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4812 delete yyvsp[0].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004813 ;
4814 break;}
4815case 292:
Chris Lattner5eefce32007-09-10 23:24:14 +00004816#line 2873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004817{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004818 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004819 GEN_ERROR("select condition must be boolean");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004820 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004821 GEN_ERROR("select value types should match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004822 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004823 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004824 ;
4825 break;}
4826case 293:
Chris Lattner5eefce32007-09-10 23:24:14 +00004827#line 2881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004828{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004829 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004830 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4831 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4832 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004833 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004834 ;
4835 break;}
4836case 294:
Chris Lattner5eefce32007-09-10 23:24:14 +00004837#line 2888 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004838{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004839 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004840 GEN_ERROR("Invalid extractelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004841 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004842 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004843 ;
4844 break;}
4845case 295:
Chris Lattner5eefce32007-09-10 23:24:14 +00004846#line 2894 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004847{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004848 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004849 GEN_ERROR("Invalid insertelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004850 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004851 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004852 ;
4853 break;}
4854case 296:
Chris Lattner5eefce32007-09-10 23:24:14 +00004855#line 2900 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004856{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004857 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004858 GEN_ERROR("Invalid shufflevector operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004859 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004860 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004861 ;
4862 break;}
4863case 297:
Chris Lattner5eefce32007-09-10 23:24:14 +00004864#line 2906 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004865{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004866 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004867 if (!Ty->isFirstClassType())
4868 GEN_ERROR("PHI node operands must be of first class type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004869 yyval.InstVal = new PHINode(Ty);
4870 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4871 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4872 if (yyvsp[0].PHIList->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004873 GEN_ERROR("All elements of a PHI node must be of the same type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004874 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4875 yyvsp[0].PHIList->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004876 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004877 delete yyvsp[0].PHIList; // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004878 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004879 ;
4880 break;}
4881case 298:
Chris Lattner5eefce32007-09-10 23:24:14 +00004882#line 2922 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004883{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004884
4885 // Handle the short syntax
4886 const PointerType *PFTy = 0;
4887 const FunctionType *Ty = 0;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004888 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004889 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4890 // Pull out the types of all of the arguments...
4891 std::vector<const Type*> ParamTypes;
4892 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004893 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4894 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004895 Attrs.push_back(PAWI);
4896 }
4897 unsigned index = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004898 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004899 for (; I != E; ++I, ++index) {
4900 const Type *Ty = I->Val->getType();
4901 if (Ty == Type::VoidTy)
4902 GEN_ERROR("Short call syntax cannot be used with varargs");
4903 ParamTypes.push_back(Ty);
4904 if (I->Attrs != ParamAttr::None) {
4905 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4906 Attrs.push_back(PAWI);
4907 }
4908 }
4909
4910 ParamAttrsList *PAL = 0;
4911 if (!Attrs.empty())
4912 PAL = ParamAttrsList::get(Attrs);
4913
Chris Lattnerbb856a32007-08-06 21:00:46 +00004914 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004915 PFTy = PointerType::get(Ty);
4916 }
4917
Chris Lattnerbb856a32007-08-06 21:00:46 +00004918 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004919 CHECK_FOR_ERROR
4920
4921 // Check for call to invalid intrinsic to avoid crashing later.
4922 if (Function *theF = dyn_cast<Function>(V)) {
4923 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4924 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4925 !theF->getIntrinsicID(true))
4926 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4927 theF->getName() + "'");
4928 }
4929
4930 // Check the arguments
4931 ValueList Args;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004932 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004933 // Make sure no arguments is a good thing!
4934 if (Ty->getNumParams() != 0)
4935 GEN_ERROR("No arguments passed to a function that "
4936 "expects arguments");
4937 } else { // Has arguments?
4938 // Loop through FunctionType's arguments and ensure they are specified
4939 // correctly!
4940 //
4941 FunctionType::param_iterator I = Ty->param_begin();
4942 FunctionType::param_iterator E = Ty->param_end();
Chris Lattnerbb856a32007-08-06 21:00:46 +00004943 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004944
4945 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4946 if (ArgI->Val->getType() != *I)
4947 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4948 (*I)->getDescription() + "'");
4949 Args.push_back(ArgI->Val);
4950 }
4951 if (Ty->isVarArg()) {
4952 if (I == E)
4953 for (; ArgI != ArgE; ++ArgI)
4954 Args.push_back(ArgI->Val); // push the remaining varargs
4955 } else if (I != E || ArgI != ArgE)
4956 GEN_ERROR("Invalid number of parameters detected");
4957 }
4958 // Create the call node
David Greene9145dd22007-08-01 03:59:32 +00004959 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Chris Lattnerbb856a32007-08-06 21:00:46 +00004960 CI->setTailCall(yyvsp[-7].BoolVal);
4961 CI->setCallingConv(yyvsp[-6].UIntVal);
4962 yyval.InstVal = CI;
4963 delete yyvsp[-2].ValueRefList;
4964 delete yyvsp[-5].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004965 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004966 ;
4967 break;}
4968case 299:
Chris Lattner5eefce32007-09-10 23:24:14 +00004969#line 3006 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004970{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004971 yyval.InstVal = yyvsp[0].InstVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004972 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004973 ;
4974 break;}
4975case 300:
Chris Lattner5eefce32007-09-10 23:24:14 +00004976#line 3011 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004977{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004978 yyval.BoolVal = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004979 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004980 ;
4981 break;}
4982case 301:
Chris Lattner5eefce32007-09-10 23:24:14 +00004983#line 3015 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004984{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004985 yyval.BoolVal = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004986 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004987 ;
4988 break;}
4989case 302:
Chris Lattner5eefce32007-09-10 23:24:14 +00004990#line 3022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004991{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004992 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004993 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4994 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4995 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004996 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004997 ;
4998 break;}
4999case 303:
Chris Lattner5eefce32007-09-10 23:24:14 +00005000#line 3029 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005001{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005002 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005003 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5004 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005005 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005006 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5007 delete yyvsp[-4].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005008 ;
5009 break;}
5010case 304:
Chris Lattner5eefce32007-09-10 23:24:14 +00005011#line 3037 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005012{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005013 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005014 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5015 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5016 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005017 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005018 ;
5019 break;}
5020case 305:
Chris Lattner5eefce32007-09-10 23:24:14 +00005021#line 3044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005022{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005023 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005024 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5025 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005026 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005027 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5028 delete yyvsp[-4].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005029 ;
5030 break;}
5031case 306:
Chris Lattner5eefce32007-09-10 23:24:14 +00005032#line 3052 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005033{
Chris Lattnerbb856a32007-08-06 21:00:46 +00005034 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005035 GEN_ERROR("Trying to free nonpointer type " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005036 yyvsp[0].ValueVal->getType()->getDescription() + "");
5037 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005038 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005039 ;
5040 break;}
5041case 307:
Chris Lattner5eefce32007-09-10 23:24:14 +00005042#line 3060 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005043{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005044 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5046 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005047 GEN_ERROR("Can't load from nonpointer type: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005048 (*yyvsp[-2].TypeVal)->getDescription());
5049 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005050 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005051 (*yyvsp[-2].TypeVal)->getDescription());
5052 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005053 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005054 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5055 delete yyvsp[-2].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005056 ;
5057 break;}
5058case 308:
Chris Lattner5eefce32007-09-10 23:24:14 +00005059#line 3074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005060{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005061 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005062 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5063 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005064 if (!PT)
5065 GEN_ERROR("Can't store to a nonpointer type: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005066 (*yyvsp[-2].TypeVal)->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005067 const Type *ElTy = PT->getElementType();
Chris Lattnerbb856a32007-08-06 21:00:46 +00005068 if (ElTy != yyvsp[-4].ValueVal->getType())
5069 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005070 "' into space of type '" + ElTy->getDescription() + "'");
5071
Chris Lattnerbb856a32007-08-06 21:00:46 +00005072 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005073 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005074 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5075 delete yyvsp[-2].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005076 ;
5077 break;}
5078case 309:
Chris Lattner5eefce32007-09-10 23:24:14 +00005079#line 3091 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005080{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005081 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005082 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5083 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005084 GEN_ERROR("getelementptr insn requires pointer operand");
5085
David Greene48556392007-09-04 18:46:50 +00005086 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005087 GEN_ERROR("Invalid getelementptr indices for type '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005088 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5089 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005090 CHECK_FOR_ERROR
David Greene48556392007-09-04 18:46:50 +00005091 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
Chris Lattnerbb856a32007-08-06 21:00:46 +00005092 delete yyvsp[-2].TypeVal;
5093 delete yyvsp[0].ValueList;
Dale Johannesen3afee192007-09-07 21:07:57 +00005094 ;
5095 break;}
5096}
5097 /* the action file gets copied in in place of this dollarsign */
5098#line 543 "/usr/share/bison.simple"
Chris Lattnerbb856a32007-08-06 21:00:46 +00005099
5100 yyvsp -= yylen;
5101 yyssp -= yylen;
Dale Johannesen3afee192007-09-07 21:07:57 +00005102#ifdef YYLSP_NEEDED
5103 yylsp -= yylen;
5104#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005105
Dale Johannesen3afee192007-09-07 21:07:57 +00005106#if YYDEBUG != 0
5107 if (yydebug)
5108 {
5109 short *ssp1 = yyss - 1;
5110 fprintf (stderr, "state stack now");
5111 while (ssp1 != yyssp)
5112 fprintf (stderr, " %d", *++ssp1);
5113 fprintf (stderr, "\n");
5114 }
5115#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005116
5117 *++yyvsp = yyval;
5118
Dale Johannesen3afee192007-09-07 21:07:57 +00005119#ifdef YYLSP_NEEDED
5120 yylsp++;
5121 if (yylen == 0)
5122 {
5123 yylsp->first_line = yylloc.first_line;
5124 yylsp->first_column = yylloc.first_column;
5125 yylsp->last_line = (yylsp-1)->last_line;
5126 yylsp->last_column = (yylsp-1)->last_column;
5127 yylsp->text = 0;
5128 }
5129 else
5130 {
5131 yylsp->last_line = (yylsp+yylen-1)->last_line;
5132 yylsp->last_column = (yylsp+yylen-1)->last_column;
5133 }
5134#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005135
Dale Johannesen3afee192007-09-07 21:07:57 +00005136 /* Now "shift" the result of the reduction.
5137 Determine what state that goes to,
5138 based on the state we popped back to
5139 and the rule number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005140
5141 yyn = yyr1[yyn];
5142
Dale Johannesen3afee192007-09-07 21:07:57 +00005143 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5144 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005145 yystate = yytable[yystate];
5146 else
Dale Johannesen3afee192007-09-07 21:07:57 +00005147 yystate = yydefgoto[yyn - YYNTBASE];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005148
5149 goto yynewstate;
5150
Dale Johannesen3afee192007-09-07 21:07:57 +00005151yyerrlab: /* here on detecting error */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005152
Dale Johannesen3afee192007-09-07 21:07:57 +00005153 if (! yyerrstatus)
5154 /* If not already recovering from an error, report this error. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005155 {
5156 ++yynerrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00005157
5158#ifdef YYERROR_VERBOSE
Chris Lattnerbb856a32007-08-06 21:00:46 +00005159 yyn = yypact[yystate];
5160
Dale Johannesen3afee192007-09-07 21:07:57 +00005161 if (yyn > YYFLAG && yyn < YYLAST)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005162 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005163 int size = 0;
5164 char *msg;
5165 int x, count;
Chris Lattnerbb856a32007-08-06 21:00:46 +00005166
Dale Johannesen3afee192007-09-07 21:07:57 +00005167 count = 0;
5168 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5169 for (x = (yyn < 0 ? -yyn : 0);
5170 x < (sizeof(yytname) / sizeof(char *)); x++)
5171 if (yycheck[x + yyn] == x)
5172 size += strlen(yytname[x]) + 15, count++;
5173 msg = (char *) malloc(size + 15);
5174 if (msg != 0)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005175 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005176 strcpy(msg, "parse error");
Chris Lattnerbb856a32007-08-06 21:00:46 +00005177
Dale Johannesen3afee192007-09-07 21:07:57 +00005178 if (count < 5)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005179 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005180 count = 0;
5181 for (x = (yyn < 0 ? -yyn : 0);
5182 x < (sizeof(yytname) / sizeof(char *)); x++)
5183 if (yycheck[x + yyn] == x)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005184 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005185 strcat(msg, count == 0 ? ", expecting `" : " or `");
5186 strcat(msg, yytname[x]);
5187 strcat(msg, "'");
5188 count++;
Chris Lattnerbb856a32007-08-06 21:00:46 +00005189 }
5190 }
Dale Johannesen3afee192007-09-07 21:07:57 +00005191 yyerror(msg);
5192 free(msg);
Chris Lattnerbb856a32007-08-06 21:00:46 +00005193 }
5194 else
Dale Johannesen3afee192007-09-07 21:07:57 +00005195 yyerror ("parse error; also virtual memory exceeded");
Chris Lattnerbb856a32007-08-06 21:00:46 +00005196 }
5197 else
5198#endif /* YYERROR_VERBOSE */
Dale Johannesen3afee192007-09-07 21:07:57 +00005199 yyerror("parse error");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005200 }
5201
Dale Johannesen3afee192007-09-07 21:07:57 +00005202 goto yyerrlab1;
5203yyerrlab1: /* here on error raised explicitly by an action */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005204
5205 if (yyerrstatus == 3)
5206 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005207 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005208
Dale Johannesen3afee192007-09-07 21:07:57 +00005209 /* return failure if at end of input */
5210 if (yychar == YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005211 YYABORT;
5212
Dale Johannesen3afee192007-09-07 21:07:57 +00005213#if YYDEBUG != 0
5214 if (yydebug)
5215 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5216#endif
5217
5218 yychar = YYEMPTY;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005219 }
5220
Dale Johannesen3afee192007-09-07 21:07:57 +00005221 /* Else will try to reuse lookahead token
5222 after shifting the error token. */
5223
5224 yyerrstatus = 3; /* Each real token shifted decrements this */
5225
5226 goto yyerrhandle;
5227
5228yyerrdefault: /* current state does not do anything special for the error token. */
5229
5230#if 0
5231 /* This is wrong; only states that explicitly want error tokens
5232 should shift them. */
5233 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5234 if (yyn) goto yydefault;
5235#endif
5236
5237yyerrpop: /* pop the current state because it cannot handle the error token */
5238
5239 if (yyssp == yyss) YYABORT;
5240 yyvsp--;
5241 yystate = *--yyssp;
5242#ifdef YYLSP_NEEDED
5243 yylsp--;
5244#endif
5245
5246#if YYDEBUG != 0
5247 if (yydebug)
5248 {
5249 short *ssp1 = yyss - 1;
5250 fprintf (stderr, "Error: state stack now");
5251 while (ssp1 != yyssp)
5252 fprintf (stderr, " %d", *++ssp1);
5253 fprintf (stderr, "\n");
5254 }
5255#endif
5256
5257yyerrhandle:
5258
5259 yyn = yypact[yystate];
5260 if (yyn == YYFLAG)
5261 goto yyerrdefault;
5262
5263 yyn += YYTERROR;
5264 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5265 goto yyerrdefault;
5266
5267 yyn = yytable[yyn];
5268 if (yyn < 0)
5269 {
5270 if (yyn == YYFLAG)
5271 goto yyerrpop;
5272 yyn = -yyn;
5273 goto yyreduce;
5274 }
5275 else if (yyn == 0)
5276 goto yyerrpop;
5277
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005278 if (yyn == YYFINAL)
5279 YYACCEPT;
5280
Dale Johannesen3afee192007-09-07 21:07:57 +00005281#if YYDEBUG != 0
5282 if (yydebug)
5283 fprintf(stderr, "Shifting error token, ");
5284#endif
Chris Lattnerbb856a32007-08-06 21:00:46 +00005285
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005286 *++yyvsp = yylval;
Dale Johannesen3afee192007-09-07 21:07:57 +00005287#ifdef YYLSP_NEEDED
5288 *++yylsp = yylloc;
5289#endif
Reid Spenceraa8ae282007-07-31 03:50:36 +00005290
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005291 yystate = yyn;
5292 goto yynewstate;
5293
Dale Johannesen3afee192007-09-07 21:07:57 +00005294 yyacceptlab:
5295 /* YYACCEPT comes here. */
5296 if (yyfree_stacks)
5297 {
5298 free (yyss);
5299 free (yyvs);
5300#ifdef YYLSP_NEEDED
5301 free (yyls);
Chandler Carruth563d4a42007-08-04 01:56:21 +00005302#endif
Dale Johannesen3afee192007-09-07 21:07:57 +00005303 }
5304 return 0;
David Greene48556392007-09-04 18:46:50 +00005305
Dale Johannesen3afee192007-09-07 21:07:57 +00005306 yyabortlab:
5307 /* YYABORT comes here. */
5308 if (yyfree_stacks)
5309 {
5310 free (yyss);
5311 free (yyvs);
5312#ifdef YYLSP_NEEDED
5313 free (yyls);
David Greene48556392007-09-04 18:46:50 +00005314#endif
Dale Johannesen3afee192007-09-07 21:07:57 +00005315 }
5316 return 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005317}
Chris Lattner5eefce32007-09-10 23:24:14 +00005318#line 3108 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005319
5320
5321// common code from the two 'RunVMAsmParser' functions
5322static Module* RunParser(Module * M) {
5323
5324 llvmAsmlineno = 1; // Reset the current line number...
5325 CurModule.CurrentModule = M;
5326#if YYDEBUG
5327 yydebug = Debug;
5328#endif
5329
5330 // Check to make sure the parser succeeded
5331 if (yyparse()) {
5332 if (ParserResult)
5333 delete ParserResult;
5334 return 0;
5335 }
5336
5337 // Emit an error if there are any unresolved types left.
5338 if (!CurModule.LateResolveTypes.empty()) {
5339 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5340 if (DID.Type == ValID::LocalName) {
5341 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5342 } else {
5343 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5344 }
5345 if (ParserResult)
5346 delete ParserResult;
5347 return 0;
5348 }
5349
5350 // Emit an error if there are any unresolved values left.
5351 if (!CurModule.LateResolveValues.empty()) {
5352 Value *V = CurModule.LateResolveValues.back();
5353 std::map<Value*, std::pair<ValID, int> >::iterator I =
5354 CurModule.PlaceHolderInfo.find(V);
5355
5356 if (I != CurModule.PlaceHolderInfo.end()) {
5357 ValID &DID = I->second.first;
5358 if (DID.Type == ValID::LocalName) {
5359 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5360 } else {
5361 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5362 }
5363 if (ParserResult)
5364 delete ParserResult;
5365 return 0;
5366 }
5367 }
5368
5369 // Check to make sure that parsing produced a result
5370 if (!ParserResult)
5371 return 0;
5372
5373 // Reset ParserResult variable while saving its value for the result.
5374 Module *Result = ParserResult;
5375 ParserResult = 0;
5376
5377 return Result;
5378}
5379
5380void llvm::GenerateError(const std::string &message, int LineNo) {
5381 if (LineNo == -1) LineNo = llvmAsmlineno;
5382 // TODO: column number in exception
5383 if (TheParseError)
5384 TheParseError->setError(CurFilename, message, LineNo);
5385 TriggerError = 1;
5386}
5387
5388int yyerror(const char *ErrorMsg) {
5389 std::string where
5390 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5391 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5392 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5393 if (yychar != YYEMPTY && yychar != 0)
5394 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5395 "'";
5396 GenerateError(errMsg);
5397 return 0;
5398}