Regenerate for PR645 and PR761

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-01-26 08:05:27 +00:00
parent b2d1786090
commit 41dff5e4f7
5 changed files with 4039 additions and 3833 deletions

File diff suppressed because it is too large Load Diff

View File

@ -148,8 +148,11 @@ using namespace llvm;
/* Comments start with a ; and go till end of line */ /* Comments start with a ; and go till end of line */
Comment ;.* Comment ;.*
/* Variable(Value) identifiers start with a % sign */ /* Local Values and Type identifiers start with a % sign */
VarID %[-a-zA-Z$._][-a-zA-Z$._0-9]* LocalVarName %[-a-zA-Z$._][-a-zA-Z$._0-9]*
/* Global Value identifiers start with an @ sign */
GlobalVarName @[-a-zA-Z$._][-a-zA-Z$._0-9]*
/* Label identifiers end with a colon */ /* Label identifiers end with a colon */
Label [-a-zA-Z$._0-9]+: Label [-a-zA-Z$._0-9]+:
@ -157,18 +160,16 @@ QuoteLabel \"[^\"]+\":
/* Quoted names can contain any character except " and \ */ /* Quoted names can contain any character except " and \ */
StringConstant \"[^\"]*\" StringConstant \"[^\"]*\"
AtStringConstant @\"[^\"]*\"
/* LocalVarID/GlobalVarID: match an unnamed local variable slot ID. */
LocalVarID %[0-9]+
GlobalVarID @[0-9]+
/* Integer types are specified with i and a bitwidth */
/* [PN]Integer: match positive and negative literal integer values that
* are preceeded by a '%' character. These represent unnamed variable slots.
*/
EPInteger %[0-9]+
ENInteger %-[0-9]+
IntegerType i[0-9]+ IntegerType i[0-9]+
/* E[PN]Integer: match positive and negative literal integer values. */
/* E[PN]Integer: match positive and negative literal integer values */
PInteger [0-9]+ PInteger [0-9]+
NInteger -[0-9]+ NInteger -[0-9]+
@ -216,11 +217,7 @@ tail { return TAIL; }
target { return TARGET; } target { return TARGET; }
triple { return TRIPLE; } triple { return TRIPLE; }
deplibs { return DEPLIBS; } deplibs { return DEPLIBS; }
endian { return ENDIAN; }
pointersize { return POINTERSIZE; }
datalayout { return DATALAYOUT; } datalayout { return DATALAYOUT; }
little { return LITTLE; }
big { return BIG; }
volatile { return VOLATILE; } volatile { return VOLATILE; }
align { return ALIGN; } align { return ALIGN; }
section { return SECTION; } section { return SECTION; }
@ -323,10 +320,15 @@ insertelement { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
{VarID} { {LocalVarName} {
UnEscapeLexed(yytext+1); UnEscapeLexed(yytext+1);
llvmAsmlval.StrVal = strdup(yytext+1); // Skip % llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
return VAR_ID; return LOCALVAR;
}
{GlobalVarName} {
UnEscapeLexed(yytext+1);
llvmAsmlval.StrVal = strdup(yytext+1); // Skip @
return GLOBALVAR;
} }
{Label} { {Label} {
yytext[strlen(yytext)-1] = 0; // nuke colon yytext[strlen(yytext)-1] = 0; // nuke colon
@ -350,6 +352,12 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote
return STRINGCONSTANT; return STRINGCONSTANT;
} }
{AtStringConstant} {
yytext[strlen(yytext)-1] = 0; // nuke end quote
llvmAsmlval.StrVal = strdup(yytext+2); // Nuke @, quote
return ATSTRINGCONSTANT;
}
{PInteger} { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } {PInteger} { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
@ -366,20 +374,19 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
} }
{EPInteger} { {LocalVarID} {
uint64_t Val = atoull(yytext+1); uint64_t Val = atoull(yytext+1);
if ((unsigned)Val != Val) if ((unsigned)Val != Val)
GenerateError("Invalid value number (too large)!"); GenerateError("Invalid value number (too large)!");
llvmAsmlval.UIntVal = unsigned(Val); llvmAsmlval.UIntVal = unsigned(Val);
return UINTVAL; return LOCALVAL_ID;
} }
{ENInteger} { {GlobalVarID} {
uint64_t Val = atoull(yytext+2); uint64_t Val = atoull(yytext+1);
// +1: we have bigger negative range if ((unsigned)Val != Val)
if (Val > (uint64_t)INT32_MAX+1) GenerateError("Invalid value number (too large)!");
GenerateError("Constant too large for signed 32 bits!"); llvmAsmlval.UIntVal = unsigned(Val);
llvmAsmlval.SIntVal = (int)-Val; return GLOBALVAL_ID;
return SINTVAL;
} }
{FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } {FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* A Bison parser, made from /usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y, by GNU bison 1.75. */ /* A Bison parser, made by GNU Bison 2.1. */
/* Skeleton parser for Yacc-like parsing with Bison, /* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,17 +15,14 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111-1307, USA. */ Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a /* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction. Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */ in version 1.24 of Bison. */
#ifndef BISON_LLVMASMPARSER_TAB_H
# define BISON_LLVMASMPARSER_TAB_H
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
# define YYTOKENTYPE # define YYTOKENTYPE
@ -34,8 +31,8 @@
enum yytokentype { enum yytokentype {
ESINT64VAL = 258, ESINT64VAL = 258,
EUINT64VAL = 259, EUINT64VAL = 259,
SINTVAL = 260, LOCALVAL_ID = 260,
UINTVAL = 261, GLOBALVAL_ID = 261,
FPVAL = 262, FPVAL = 262,
VOID = 263, VOID = 263,
INTTYPE = 264, INTTYPE = 264,
@ -43,131 +40,130 @@
DOUBLE = 266, DOUBLE = 266,
LABEL = 267, LABEL = 267,
TYPE = 268, TYPE = 268,
VAR_ID = 269, LOCALVAR = 269,
LABELSTR = 270, GLOBALVAR = 270,
STRINGCONSTANT = 271, LABELSTR = 271,
IMPLEMENTATION = 272, STRINGCONSTANT = 272,
ZEROINITIALIZER = 273, ATSTRINGCONSTANT = 273,
TRUETOK = 274, IMPLEMENTATION = 274,
FALSETOK = 275, ZEROINITIALIZER = 275,
BEGINTOK = 276, TRUETOK = 276,
ENDTOK = 277, FALSETOK = 277,
DECLARE = 278, BEGINTOK = 278,
DEFINE = 279, ENDTOK = 279,
GLOBAL = 280, DECLARE = 280,
CONSTANT = 281, DEFINE = 281,
SECTION = 282, GLOBAL = 282,
VOLATILE = 283, CONSTANT = 283,
TO = 284, SECTION = 284,
DOTDOTDOT = 285, VOLATILE = 285,
NULL_TOK = 286, TO = 286,
UNDEF = 287, DOTDOTDOT = 287,
INTERNAL = 288, NULL_TOK = 288,
LINKONCE = 289, UNDEF = 289,
WEAK = 290, INTERNAL = 290,
APPENDING = 291, LINKONCE = 291,
DLLIMPORT = 292, WEAK = 292,
DLLEXPORT = 293, APPENDING = 293,
EXTERN_WEAK = 294, DLLIMPORT = 294,
OPAQUE = 295, DLLEXPORT = 295,
EXTERNAL = 296, EXTERN_WEAK = 296,
TARGET = 297, OPAQUE = 297,
TRIPLE = 298, EXTERNAL = 298,
ENDIAN = 299, TARGET = 299,
POINTERSIZE = 300, TRIPLE = 300,
LITTLE = 301, ALIGN = 301,
BIG = 302, DEPLIBS = 302,
ALIGN = 303, CALL = 303,
DEPLIBS = 304, TAIL = 304,
CALL = 305, ASM_TOK = 305,
TAIL = 306, MODULE = 306,
ASM_TOK = 307, SIDEEFFECT = 307,
MODULE = 308, CC_TOK = 308,
SIDEEFFECT = 309, CCC_TOK = 309,
CC_TOK = 310, CSRETCC_TOK = 310,
CCC_TOK = 311, FASTCC_TOK = 311,
CSRETCC_TOK = 312, COLDCC_TOK = 312,
FASTCC_TOK = 313, X86_STDCALLCC_TOK = 313,
COLDCC_TOK = 314, X86_FASTCALLCC_TOK = 314,
X86_STDCALLCC_TOK = 315, DATALAYOUT = 315,
X86_FASTCALLCC_TOK = 316, RET = 316,
DATALAYOUT = 317, BR = 317,
RET = 318, SWITCH = 318,
BR = 319, INVOKE = 319,
SWITCH = 320, UNWIND = 320,
INVOKE = 321, UNREACHABLE = 321,
UNWIND = 322, ADD = 322,
UNREACHABLE = 323, SUB = 323,
ADD = 324, MUL = 324,
SUB = 325, UDIV = 325,
MUL = 326, SDIV = 326,
UDIV = 327, FDIV = 327,
SDIV = 328, UREM = 328,
FDIV = 329, SREM = 329,
UREM = 330, FREM = 330,
SREM = 331, AND = 331,
FREM = 332, OR = 332,
AND = 333, XOR = 333,
OR = 334, ICMP = 334,
XOR = 335, FCMP = 335,
ICMP = 336, EQ = 336,
FCMP = 337, NE = 337,
EQ = 338, SLT = 338,
NE = 339, SGT = 339,
SLT = 340, SLE = 340,
SGT = 341, SGE = 341,
SLE = 342, ULT = 342,
SGE = 343, UGT = 343,
ULT = 344, ULE = 344,
UGT = 345, UGE = 345,
ULE = 346, OEQ = 346,
UGE = 347, ONE = 347,
OEQ = 348, OLT = 348,
ONE = 349, OGT = 349,
OLT = 350, OLE = 350,
OGT = 351, OGE = 351,
OLE = 352, ORD = 352,
OGE = 353, UNO = 353,
ORD = 354, UEQ = 354,
UNO = 355, UNE = 355,
UEQ = 356, MALLOC = 356,
UNE = 357, ALLOCA = 357,
MALLOC = 358, FREE = 358,
ALLOCA = 359, LOAD = 359,
FREE = 360, STORE = 360,
LOAD = 361, GETELEMENTPTR = 361,
STORE = 362, TRUNC = 362,
GETELEMENTPTR = 363, ZEXT = 363,
TRUNC = 364, SEXT = 364,
ZEXT = 365, FPTRUNC = 365,
SEXT = 366, FPEXT = 366,
FPTRUNC = 367, BITCAST = 367,
FPEXT = 368, UITOFP = 368,
BITCAST = 369, SITOFP = 369,
UITOFP = 370, FPTOUI = 370,
SITOFP = 371, FPTOSI = 371,
FPTOUI = 372, INTTOPTR = 372,
FPTOSI = 373, PTRTOINT = 373,
INTTOPTR = 374, PHI_TOK = 374,
PTRTOINT = 375, SELECT = 375,
PHI_TOK = 376, SHL = 376,
SELECT = 377, LSHR = 377,
SHL = 378, ASHR = 378,
LSHR = 379, VAARG = 379,
ASHR = 380, EXTRACTELEMENT = 380,
VAARG = 381, INSERTELEMENT = 381,
EXTRACTELEMENT = 382, SHUFFLEVECTOR = 382,
INSERTELEMENT = 383, NORETURN = 383,
SHUFFLEVECTOR = 384, DEFAULT = 384,
NORETURN = 385, HIDDEN = 385
DEFAULT = 386,
HIDDEN = 387
}; };
#endif #endif
/* Tokens. */
#define ESINT64VAL 258 #define ESINT64VAL 258
#define EUINT64VAL 259 #define EUINT64VAL 259
#define SINTVAL 260 #define LOCALVAL_ID 260
#define UINTVAL 261 #define GLOBALVAL_ID 261
#define FPVAL 262 #define FPVAL 262
#define VOID 263 #define VOID 263
#define INTTYPE 264 #define INTTYPE 264
@ -175,132 +171,130 @@
#define DOUBLE 266 #define DOUBLE 266
#define LABEL 267 #define LABEL 267
#define TYPE 268 #define TYPE 268
#define VAR_ID 269 #define LOCALVAR 269
#define LABELSTR 270 #define GLOBALVAR 270
#define STRINGCONSTANT 271 #define LABELSTR 271
#define IMPLEMENTATION 272 #define STRINGCONSTANT 272
#define ZEROINITIALIZER 273 #define ATSTRINGCONSTANT 273
#define TRUETOK 274 #define IMPLEMENTATION 274
#define FALSETOK 275 #define ZEROINITIALIZER 275
#define BEGINTOK 276 #define TRUETOK 276
#define ENDTOK 277 #define FALSETOK 277
#define DECLARE 278 #define BEGINTOK 278
#define DEFINE 279 #define ENDTOK 279
#define GLOBAL 280 #define DECLARE 280
#define CONSTANT 281 #define DEFINE 281
#define SECTION 282 #define GLOBAL 282
#define VOLATILE 283 #define CONSTANT 283
#define TO 284 #define SECTION 284
#define DOTDOTDOT 285 #define VOLATILE 285
#define NULL_TOK 286 #define TO 286
#define UNDEF 287 #define DOTDOTDOT 287
#define INTERNAL 288 #define NULL_TOK 288
#define LINKONCE 289 #define UNDEF 289
#define WEAK 290 #define INTERNAL 290
#define APPENDING 291 #define LINKONCE 291
#define DLLIMPORT 292 #define WEAK 292
#define DLLEXPORT 293 #define APPENDING 293
#define EXTERN_WEAK 294 #define DLLIMPORT 294
#define OPAQUE 295 #define DLLEXPORT 295
#define EXTERNAL 296 #define EXTERN_WEAK 296
#define TARGET 297 #define OPAQUE 297
#define TRIPLE 298 #define EXTERNAL 298
#define ENDIAN 299 #define TARGET 299
#define POINTERSIZE 300 #define TRIPLE 300
#define LITTLE 301 #define ALIGN 301
#define BIG 302 #define DEPLIBS 302
#define ALIGN 303 #define CALL 303
#define DEPLIBS 304 #define TAIL 304
#define CALL 305 #define ASM_TOK 305
#define TAIL 306 #define MODULE 306
#define ASM_TOK 307 #define SIDEEFFECT 307
#define MODULE 308 #define CC_TOK 308
#define SIDEEFFECT 309 #define CCC_TOK 309
#define CC_TOK 310 #define CSRETCC_TOK 310
#define CCC_TOK 311 #define FASTCC_TOK 311
#define CSRETCC_TOK 312 #define COLDCC_TOK 312
#define FASTCC_TOK 313 #define X86_STDCALLCC_TOK 313
#define COLDCC_TOK 314 #define X86_FASTCALLCC_TOK 314
#define X86_STDCALLCC_TOK 315 #define DATALAYOUT 315
#define X86_FASTCALLCC_TOK 316 #define RET 316
#define DATALAYOUT 317 #define BR 317
#define RET 318 #define SWITCH 318
#define BR 319 #define INVOKE 319
#define SWITCH 320 #define UNWIND 320
#define INVOKE 321 #define UNREACHABLE 321
#define UNWIND 322 #define ADD 322
#define UNREACHABLE 323 #define SUB 323
#define ADD 324 #define MUL 324
#define SUB 325 #define UDIV 325
#define MUL 326 #define SDIV 326
#define UDIV 327 #define FDIV 327
#define SDIV 328 #define UREM 328
#define FDIV 329 #define SREM 329
#define UREM 330 #define FREM 330
#define SREM 331 #define AND 331
#define FREM 332 #define OR 332
#define AND 333 #define XOR 333
#define OR 334 #define ICMP 334
#define XOR 335 #define FCMP 335
#define ICMP 336 #define EQ 336
#define FCMP 337 #define NE 337
#define EQ 338 #define SLT 338
#define NE 339 #define SGT 339
#define SLT 340 #define SLE 340
#define SGT 341 #define SGE 341
#define SLE 342 #define ULT 342
#define SGE 343 #define UGT 343
#define ULT 344 #define ULE 344
#define UGT 345 #define UGE 345
#define ULE 346 #define OEQ 346
#define UGE 347 #define ONE 347
#define OEQ 348 #define OLT 348
#define ONE 349 #define OGT 349
#define OLT 350 #define OLE 350
#define OGT 351 #define OGE 351
#define OLE 352 #define ORD 352
#define OGE 353 #define UNO 353
#define ORD 354 #define UEQ 354
#define UNO 355 #define UNE 355
#define UEQ 356 #define MALLOC 356
#define UNE 357 #define ALLOCA 357
#define MALLOC 358 #define FREE 358
#define ALLOCA 359 #define LOAD 359
#define FREE 360 #define STORE 360
#define LOAD 361 #define GETELEMENTPTR 361
#define STORE 362 #define TRUNC 362
#define GETELEMENTPTR 363 #define ZEXT 363
#define TRUNC 364 #define SEXT 364
#define ZEXT 365 #define FPTRUNC 365
#define SEXT 366 #define FPEXT 366
#define FPTRUNC 367 #define BITCAST 367
#define FPEXT 368 #define UITOFP 368
#define BITCAST 369 #define SITOFP 369
#define UITOFP 370 #define FPTOUI 370
#define SITOFP 371 #define FPTOSI 371
#define FPTOUI 372 #define INTTOPTR 372
#define FPTOSI 373 #define PTRTOINT 373
#define INTTOPTR 374 #define PHI_TOK 374
#define PTRTOINT 375 #define SELECT 375
#define PHI_TOK 376 #define SHL 376
#define SELECT 377 #define LSHR 377
#define SHL 378 #define ASHR 378
#define LSHR 379 #define VAARG 379
#define ASHR 380 #define EXTRACTELEMENT 380
#define VAARG 381 #define INSERTELEMENT 381
#define EXTRACTELEMENT 382 #define SHUFFLEVECTOR 382
#define INSERTELEMENT 383 #define NORETURN 383
#define SHUFFLEVECTOR 384 #define DEFAULT 384
#define NORETURN 385 #define HIDDEN 385
#define DEFAULT 386
#define HIDDEN 387
#ifndef YYSTYPE #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 883 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" #line 885 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
typedef union { typedef union YYSTYPE {
llvm::Module *ModuleVal; llvm::Module *ModuleVal;
llvm::Function *FunctionVal; llvm::Function *FunctionVal;
llvm::BasicBlock *BasicBlockVal; llvm::BasicBlock *BasicBlockVal;
@ -342,17 +336,17 @@ typedef union {
llvm::Instruction::MemoryOps MemOpVal; llvm::Instruction::MemoryOps MemOpVal;
llvm::Instruction::CastOps CastOpVal; llvm::Instruction::CastOps CastOpVal;
llvm::Instruction::OtherOps OtherOpVal; llvm::Instruction::OtherOps OtherOpVal;
llvm::Module::Endianness Endianness;
llvm::ICmpInst::Predicate IPredicate; llvm::ICmpInst::Predicate IPredicate;
llvm::FCmpInst::Predicate FPredicate; llvm::FCmpInst::Predicate FPredicate;
} yystype; } YYSTYPE;
/* Line 1237 of /usr/local/share/bison/yacc.c. */ /* Line 1447 of yacc.c. */
#line 351 "llvmAsmParser.tab.h" #line 344 "llvmAsmParser.tab.h"
# define YYSTYPE yystype # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif #endif
extern YYSTYPE llvmAsmlval; extern YYSTYPE llvmAsmlval;
#endif /* not BISON_LLVMASMPARSER_TAB_H */

View File

@ -270,12 +270,12 @@ static int InsertValue(Value *V,
static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
switch (D.Type) { switch (D.Type) {
case ValID::NumberVal: // Is it a numbered definition? case ValID::LocalID: // Is it a numbered definition?
// Module constants occupy the lowest numbered slots... // Module constants occupy the lowest numbered slots...
if ((unsigned)D.Num < CurModule.Types.size()) if (D.Num < CurModule.Types.size())
return CurModule.Types[(unsigned)D.Num]; return CurModule.Types[D.Num];
break; break;
case ValID::NameVal: // Is it a named definition? case ValID::LocalName: // Is it a named definition?
if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
D.destroy(); // Free old strdup'd memory... D.destroy(); // Free old strdup'd memory...
return N; return N;
@ -294,11 +294,11 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
if (inFunctionScope()) { if (inFunctionScope()) {
if (D.Type == ValID::NameVal) { if (D.Type == ValID::LocalName) {
GenerateError("Reference to an undefined type: '" + D.getName() + "'"); GenerateError("Reference to an undefined type: '" + D.getName() + "'");
return 0; return 0;
} else { } else {
GenerateError("Reference to an undefined type: #" + itostr(D.Num)); GenerateError("Reference to an undefined type: #" + utostr(D.Num));
return 0; return 0;
} }
} }
@ -312,13 +312,6 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
return Typ; return Typ;
} }
static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
SymbolTable &SymTab =
inFunctionScope() ? CurFun.CurrentFunction->getValueSymbolTable() :
CurModule.CurrentModule->getValueSymbolTable();
return SymTab.lookup(Ty, Name);
}
// getValNonImprovising - Look up the value specified by the provided type and // getValNonImprovising - Look up the value specified by the provided type and
// the provided ValID. If the value exists and has already been defined, return // the provided ValID. If the value exists and has already been defined, return
// it. Otherwise return null. // it. Otherwise return null.
@ -331,29 +324,39 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
} }
switch (D.Type) { switch (D.Type) {
case ValID::NumberVal: { // Is it a numbered definition? case ValID::LocalID: { // Is it a numbered definition?
unsigned Num = (unsigned)D.Num; // Module constants occupy the lowest numbered slots.
std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
// Module constants occupy the lowest numbered slots... // Make sure that our type is within bounds.
std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
if (VI != CurModule.Values.end()) {
if (Num < VI->second.size())
return VI->second[Num];
Num -= VI->second.size();
}
// Make sure that our type is within bounds
VI = CurFun.Values.find(Ty);
if (VI == CurFun.Values.end()) return 0; if (VI == CurFun.Values.end()) return 0;
// Check that the number is within bounds... // Check that the number is within bounds.
if (VI->second.size() <= Num) return 0; if (D.Num >= VI->second.size()) return 0;
return VI->second[D.Num];
}
case ValID::GlobalID: { // Is it a numbered definition?
unsigned Num = D.Num;
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
if (VI == CurModule.Values.end()) return 0;
if (D.Num >= VI->second.size()) return 0;
return VI->second[Num]; return VI->second[Num];
} }
case ValID::NameVal: { // Is it a named definition? case ValID::LocalName: { // Is it a named definition?
Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); if (!inFunctionScope()) return 0;
SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Value *N = SymTab.lookup(Ty, D.Name);
if (N == 0) return 0;
D.destroy(); // Free old strdup'd memory...
return N;
}
case ValID::GlobalName: { // Is it a named definition?
SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Value *N = SymTab.lookup(Ty, D.Name);
if (N == 0) return 0; if (N == 0) return 0;
D.destroy(); // Free old strdup'd memory... D.destroy(); // Free old strdup'd memory...
@ -488,12 +491,12 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
default: default:
GenerateError("Illegal label reference " + ID.getName()); GenerateError("Illegal label reference " + ID.getName());
return 0; return 0;
case ValID::NumberVal: // Is it a numbered definition? case ValID::LocalID: // Is it a numbered definition?
if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) if (ID.Num >= CurFun.NumberedBlocks.size())
CurFun.NumberedBlocks.resize(ID.Num+1); CurFun.NumberedBlocks.resize(ID.Num+1);
BB = CurFun.NumberedBlocks[ID.Num]; BB = CurFun.NumberedBlocks[ID.Num];
break; break;
case ValID::NameVal: // Is it a named definition? case ValID::LocalName: // Is it a named definition?
Name = ID.Name; Name = ID.Name;
if (Value *N = CurFun.CurrentFunction-> if (Value *N = CurFun.CurrentFunction->
getValueSymbolTable().lookup(Type::LabelTy, Name)) getValueSymbolTable().lookup(Type::LabelTy, Name))
@ -518,7 +521,7 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
// Otherwise this block has not been seen before. // Otherwise this block has not been seen before.
BB = new BasicBlock("", CurFun.CurrentFunction); BB = new BasicBlock("", CurFun.CurrentFunction);
if (ID.Type == ValID::NameVal) { if (ID.Type == ValID::LocalName) {
BB->setName(ID.Name); BB->setName(ID.Name);
} else { } else {
CurFun.NumberedBlocks[ID.Num] = BB; CurFun.NumberedBlocks[ID.Num] = BB;
@ -585,7 +588,7 @@ ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
// resolver table // resolver table
InsertValue(V, *FutureLateResolvers); InsertValue(V, *FutureLateResolvers);
} else { } else {
if (DID.Type == ValID::NameVal) { if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
GenerateError("Reference to an invalid definition: '" +DID.getName()+ GenerateError("Reference to an invalid definition: '" +DID.getName()+
"' of type '" + V->getType()->getDescription() + "'", "' of type '" + V->getType()->getDescription() + "'",
PHI->second.second); PHI->second.second);
@ -610,8 +613,8 @@ ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
// //
static void ResolveTypeTo(char *Name, const Type *ToTy) { static void ResolveTypeTo(char *Name, const Type *ToTy) {
ValID D; ValID D;
if (Name) D = ValID::create(Name); if (Name) D = ValID::createLocalName(Name);
else D = ValID::create((int)CurModule.Types.size()); else D = ValID::createLocalID(CurModule.Types.size());
std::map<ValID, PATypeHolder>::iterator I = std::map<ValID, PATypeHolder>::iterator I =
CurModule.LateResolveTypes.find(D); CurModule.LateResolveTypes.find(D);
@ -626,26 +629,25 @@ static void ResolveTypeTo(char *Name, const Type *ToTy) {
// assumed to be a malloc'd string buffer, and is free'd by this function. // assumed to be a malloc'd string buffer, and is free'd by this function.
// //
static void setValueName(Value *V, char *NameStr) { static void setValueName(Value *V, char *NameStr) {
if (NameStr) { if (!NameStr) return;
std::string Name(NameStr); // Copy string std::string Name(NameStr); // Copy string
free(NameStr); // Free old string free(NameStr); // Free old string
if (V->getType() == Type::VoidTy) { if (V->getType() == Type::VoidTy) {
GenerateError("Can't assign name '" + Name+"' to value with void type!"); GenerateError("Can't assign name '" + Name+"' to value with void type!");
return; return;
}
assert(inFunctionScope() && "Must be in function scope!");
SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
if (ST.lookup(V->getType(), Name)) {
GenerateError("Redefinition of value '" + Name + "' of type '" +
V->getType()->getDescription() + "'!");
return;
}
// Set the name.
V->setName(Name);
} }
assert(inFunctionScope() && "Must be in function scope!");
SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
if (ST.lookup(V->getType(), Name)) {
GenerateError("Redefinition of value '" + Name + "' of type '" +
V->getType()->getDescription() + "'!");
return;
}
// Set the name.
V->setName(Name);
} }
/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
@ -673,9 +675,9 @@ ParseGlobalVariable(char *NameStr,
// object. // object.
ValID ID; ValID ID;
if (!Name.empty()) { if (!Name.empty()) {
ID = ValID::create((char*)Name.c_str()); ID = ValID::createGlobalName((char*)Name.c_str());
} else { } else {
ID = ValID::create((int)CurModule.Values[PTy].size()); ID = ValID::createGlobalID(CurModule.Values[PTy].size());
} }
if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
@ -922,7 +924,6 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
llvm::Instruction::MemoryOps MemOpVal; llvm::Instruction::MemoryOps MemOpVal;
llvm::Instruction::CastOps CastOpVal; llvm::Instruction::CastOps CastOpVal;
llvm::Instruction::OtherOps OtherOpVal; llvm::Instruction::OtherOps OtherOpVal;
llvm::Module::Endianness Endianness;
llvm::ICmpInst::Predicate IPredicate; llvm::ICmpInst::Predicate IPredicate;
llvm::FCmpInst::Predicate FPredicate; llvm::FCmpInst::Predicate FPredicate;
} }
@ -949,7 +950,6 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
%type <Linkage> GVInternalLinkage GVExternalLinkage %type <Linkage> GVInternalLinkage GVExternalLinkage
%type <Linkage> FunctionDefineLinkage FunctionDeclareLinkage %type <Linkage> FunctionDefineLinkage FunctionDeclareLinkage
%type <Visibility> GVVisibilityStyle %type <Visibility> GVVisibilityStyle
%type <Endianness> BigOrLittle
// ValueRef - Unresolved reference to a definition or BB // ValueRef - Unresolved reference to a definition or BB
%type <ValIDVal> ValueRef ConstValueRef SymbolicValueRef %type <ValIDVal> ValueRef ConstValueRef SymbolicValueRef
@ -962,9 +962,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
// EUINT64VAL - A positive number within uns. long long range // EUINT64VAL - A positive number within uns. long long range
%token <UInt64Val> EUINT64VAL %token <UInt64Val> EUINT64VAL
%token <SIntVal> SINTVAL // Signed 32 bit ints... %token <UIntVal> LOCALVAL_ID GLOBALVAL_ID // %123 @123
%token <UIntVal> UINTVAL // Unsigned 32 bit ints...
%type <SIntVal> INTVAL
%token <FPVal> FPVAL // Float or Double constant %token <FPVal> FPVAL // Float or Double constant
// Built in types... // Built in types...
@ -974,16 +972,17 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
%token <PrimType> FLOAT DOUBLE LABEL %token <PrimType> FLOAT DOUBLE LABEL
%token TYPE %token TYPE
%token <StrVal> VAR_ID LABELSTR STRINGCONSTANT %token<StrVal> LOCALVAR GLOBALVAR LABELSTR STRINGCONSTANT ATSTRINGCONSTANT
%type <StrVal> Name OptName OptAssign %type <StrVal> LocalName OptLocalName OptLocalAssign
%type <UIntVal> OptAlign OptCAlign %type <StrVal> GlobalName OptGlobalAssign
%type <UIntVal> OptAlign OptCAlign
%type <StrVal> OptSection SectionString %type <StrVal> OptSection SectionString
%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK %token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK
%token DECLARE DEFINE GLOBAL CONSTANT SECTION VOLATILE %token DECLARE DEFINE GLOBAL CONSTANT SECTION VOLATILE
%token TO DOTDOTDOT NULL_TOK UNDEF INTERNAL LINKONCE WEAK APPENDING %token TO DOTDOTDOT NULL_TOK UNDEF INTERNAL LINKONCE WEAK APPENDING
%token DLLIMPORT DLLEXPORT EXTERN_WEAK %token DLLIMPORT DLLEXPORT EXTERN_WEAK
%token OPAQUE EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN
%token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT
%token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK %token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK
%token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK %token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK
@ -1026,15 +1025,6 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
%start Module %start Module
%% %%
// Handle constant integer size restriction and conversion...
//
INTVAL : SINTVAL;
INTVAL : UINTVAL {
if ($1 > (uint32_t)INT32_MAX) // Outside of my range!
GEN_ERROR("Value too large for type!");
$$ = (int32_t)$1;
CHECK_FOR_ERROR
};
// Operations that are notably excluded from this list include: // Operations that are notably excluded from this list include:
// RET, BR, & SWITCH because they end basic blocks and are treated specially. // RET, BR, & SWITCH because they end basic blocks and are treated specially.
@ -1069,8 +1059,23 @@ FPredicates
IntType : INTTYPE; IntType : INTTYPE;
FPType : FLOAT | DOUBLE; FPType : FLOAT | DOUBLE;
// OptAssign - Value producing statements have an optional assignment component LocalName : LOCALVAR | STRINGCONSTANT;
OptAssign : Name '=' { OptLocalName : LocalName | /*empty*/ { $$ = 0; };
/// OptLocalAssign - Value producing statements have an optional assignment
/// component.
OptLocalAssign : LocalName '=' {
$$ = $1;
CHECK_FOR_ERROR
}
| /*empty*/ {
$$ = 0;
CHECK_FOR_ERROR
};
GlobalName : GLOBALVAR | ATSTRINGCONSTANT;
OptGlobalAssign : GlobalName '=' {
$$ = $1; $$ = $1;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -1630,7 +1635,10 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
$2.destroy(); $2.destroy();
} else { } else {
std::string Name; std::string Name;
if ($2.Type == ValID::NameVal) Name = $2.Name; if ($2.Type == ValID::GlobalName)
Name = $2.Name;
else if ($2.Type != ValID::GlobalID)
GEN_ERROR("Invalid reference to global");
// Create the forward referenced global. // Create the forward referenced global.
GlobalValue *GV; GlobalValue *GV;
@ -1857,7 +1865,7 @@ Definition
// Emit an error if there are any unresolved types left. // Emit an error if there are any unresolved types left.
if (!CurModule.LateResolveTypes.empty()) { if (!CurModule.LateResolveTypes.empty()) {
const ValID &DID = CurModule.LateResolveTypes.begin()->first; const ValID &DID = CurModule.LateResolveTypes.begin()->first;
if (DID.Type == ValID::NameVal) { if (DID.Type == ValID::LocalName) {
GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
} else { } else {
GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
@ -1865,7 +1873,7 @@ Definition
} }
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| OptAssign TYPE Types { | OptLocalAssign TYPE Types {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
// Eagerly resolve types. This is not an optimization, this is a // Eagerly resolve types. This is not an optimization, this is a
@ -1889,7 +1897,7 @@ Definition
delete $3; delete $3;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| OptAssign TYPE VOID { | OptLocalAssign TYPE VOID {
ResolveTypeTo($1, $3); ResolveTypeTo($1, $3);
if (!setTypeName($3, $1) && !$1) { if (!setTypeName($3, $1) && !$1) {
@ -1900,7 +1908,8 @@ Definition
} }
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| OptAssign GVVisibilityStyle GlobalType ConstVal { /* "Externally Visible" Linkage */ | OptGlobalAssign GVVisibilityStyle GlobalType ConstVal {
/* "Externally Visible" Linkage */
if ($4 == 0) if ($4 == 0)
GEN_ERROR("Global value initializer is not a constant!"); GEN_ERROR("Global value initializer is not a constant!");
CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage, CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage,
@ -1909,7 +1918,7 @@ Definition
} GlobalVarAttributes { } GlobalVarAttributes {
CurGV = 0; CurGV = 0;
} }
| OptAssign GVInternalLinkage GVVisibilityStyle GlobalType ConstVal { | OptGlobalAssign GVInternalLinkage GVVisibilityStyle GlobalType ConstVal {
if ($5 == 0) if ($5 == 0)
GEN_ERROR("Global value initializer is not a constant!"); GEN_ERROR("Global value initializer is not a constant!");
CurGV = ParseGlobalVariable($1, $2, $3, $4, $5->getType(), $5); CurGV = ParseGlobalVariable($1, $2, $3, $4, $5->getType(), $5);
@ -1917,7 +1926,7 @@ Definition
} GlobalVarAttributes { } GlobalVarAttributes {
CurGV = 0; CurGV = 0;
} }
| OptAssign GVExternalLinkage GVVisibilityStyle GlobalType Types { | OptGlobalAssign GVExternalLinkage GVVisibilityStyle GlobalType Types {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$5)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$5)->getDescription());
CurGV = ParseGlobalVariable($1, $2, $3, $4, *$5, 0); CurGV = ParseGlobalVariable($1, $2, $3, $4, *$5, 0);
@ -1949,23 +1958,7 @@ AsmBlock : STRINGCONSTANT {
CHECK_FOR_ERROR CHECK_FOR_ERROR
}; };
BigOrLittle : BIG { $$ = Module::BigEndian; }; TargetDefinition : TRIPLE '=' STRINGCONSTANT {
BigOrLittle : LITTLE { $$ = Module::LittleEndian; };
TargetDefinition : ENDIAN '=' BigOrLittle {
CurModule.CurrentModule->setEndianness($3);
CHECK_FOR_ERROR
}
| POINTERSIZE '=' EUINT64VAL {
if ($3 == 32)
CurModule.CurrentModule->setPointerSize(Module::Pointer32);
else if ($3 == 64)
CurModule.CurrentModule->setPointerSize(Module::Pointer64);
else
GEN_ERROR("Invalid pointer size: '" + utostr($3) + "'!");
CHECK_FOR_ERROR
}
| TRIPLE '=' STRINGCONSTANT {
CurModule.CurrentModule->setTargetTriple($3); CurModule.CurrentModule->setTargetTriple($3);
free($3); free($3);
} }
@ -1995,10 +1988,7 @@ LibList : LibList ',' STRINGCONSTANT {
// Rules to match Function Headers // Rules to match Function Headers
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
Name : VAR_ID | STRINGCONSTANT; ArgListH : ArgListH ',' Types OptParamAttrs OptLocalName {
OptName : Name | /*empty*/ { $$ = 0; };
ArgListH : ArgListH ',' Types OptParamAttrs OptName {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
if (*$3 == Type::VoidTy) if (*$3 == Type::VoidTy)
@ -2008,7 +1998,7 @@ ArgListH : ArgListH ',' Types OptParamAttrs OptName {
$1->push_back(E); $1->push_back(E);
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| Types OptParamAttrs OptName { | Types OptParamAttrs OptLocalName {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription());
if (*$1 == Type::VoidTy) if (*$1 == Type::VoidTy)
@ -2046,7 +2036,7 @@ ArgList : ArgListH {
CHECK_FOR_ERROR CHECK_FOR_ERROR
}; };
FunctionHeaderH : OptCallingConv ResultTypes Name '(' ArgList ')' FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
OptFuncAttrs OptSection OptAlign { OptFuncAttrs OptSection OptAlign {
UnEscapeLexed($3); UnEscapeLexed($3);
std::string FunctionName($3); std::string FunctionName($3);
@ -2081,9 +2071,9 @@ FunctionHeaderH : OptCallingConv ResultTypes Name '(' ArgList ')'
ValID ID; ValID ID;
if (!FunctionName.empty()) { if (!FunctionName.empty()) {
ID = ValID::create((char*)FunctionName.c_str()); ID = ValID::createGlobalName((char*)FunctionName.c_str());
} else { } else {
ID = ValID::create((int)CurModule.Values[PFT].size()); ID = ValID::createGlobalID(CurModule.Values[PFT].size());
} }
Function *Fn = 0; Function *Fn = 0;
@ -2266,12 +2256,20 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant
// SymbolicValueRef - Reference to one of two ways of symbolically refering to // SymbolicValueRef - Reference to one of two ways of symbolically refering to
// another value. // another value.
// //
SymbolicValueRef : INTVAL { // Is it an integer reference...? SymbolicValueRef : LOCALVAL_ID { // Is it an integer reference...?
$$ = ValID::create($1); $$ = ValID::createLocalID($1);
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| Name { // Is it a named reference...? | GLOBALVAL_ID {
$$ = ValID::create($1); $$ = ValID::createGlobalID($1);
CHECK_FOR_ERROR
}
| LocalName { // Is it a named reference...?
$$ = ValID::createLocalName($1);
CHECK_FOR_ERROR
}
| GlobalName { // Is it a named reference...?
$$ = ValID::createGlobalName($1);
CHECK_FOR_ERROR CHECK_FOR_ERROR
}; };
@ -2304,7 +2302,7 @@ BasicBlockList : BasicBlockList BasicBlock {
// Basic blocks are terminated by branching instructions: // Basic blocks are terminated by branching instructions:
// br, br/cc, switch, ret // br, br/cc, switch, ret
// //
BasicBlock : InstructionList OptAssign BBTerminatorInst { BasicBlock : InstructionList OptLocalAssign BBTerminatorInst {
setValueName($3, $2); setValueName($3, $2);
CHECK_FOR_ERROR CHECK_FOR_ERROR
InsertValue($3); InsertValue($3);
@ -2325,7 +2323,7 @@ InstructionList : InstructionList Inst {
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| /* empty */ { | /* empty */ {
$$ = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); $$ = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
CHECK_FOR_ERROR CHECK_FOR_ERROR
// Make sure to move the basic block to the correct location in the // Make sure to move the basic block to the correct location in the
@ -2337,7 +2335,7 @@ InstructionList : InstructionList Inst {
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| LABELSTR { | LABELSTR {
$$ = getBBVal(ValID::create($1), true); $$ = getBBVal(ValID::createLocalName($1), true);
CHECK_FOR_ERROR CHECK_FOR_ERROR
// Make sure to move the basic block to the correct location in the // Make sure to move the basic block to the correct location in the
@ -2502,7 +2500,7 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef {
$$->push_back(std::make_pair(V, tmpBB)); $$->push_back(std::make_pair(V, tmpBB));
}; };
Inst : OptAssign InstVal { Inst : OptLocalAssign InstVal {
// Is this definition named?? if so, assign the name... // Is this definition named?? if so, assign the name...
setValueName($2, $1); setValueName($2, $1);
CHECK_FOR_ERROR CHECK_FOR_ERROR
@ -2762,6 +2760,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
CI->setCallingConv($2); CI->setCallingConv($2);
$$ = CI; $$ = CI;
delete $6; delete $6;
delete $3;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
| MemoryInst { | MemoryInst {