mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
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:
parent
b2d1786090
commit
41dff5e4f7
File diff suppressed because it is too large
Load Diff
@ -148,8 +148,11 @@ using namespace llvm;
|
||||
/* Comments start with a ; and go till end of line */
|
||||
Comment ;.*
|
||||
|
||||
/* Variable(Value) identifiers start with a % sign */
|
||||
VarID %[-a-zA-Z$._][-a-zA-Z$._0-9]*
|
||||
/* Local Values and Type identifiers start with a % sign */
|
||||
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 [-a-zA-Z$._0-9]+:
|
||||
@ -157,18 +160,16 @@ QuoteLabel \"[^\"]+\":
|
||||
|
||||
/* Quoted names can contain any character except " and \ */
|
||||
StringConstant \"[^\"]*\"
|
||||
AtStringConstant @\"[^\"]*\"
|
||||
|
||||
/* LocalVarID/GlobalVarID: match an unnamed local variable slot ID. */
|
||||
LocalVarID %[0-9]+
|
||||
GlobalVarID @[0-9]+
|
||||
|
||||
|
||||
/* [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]+
|
||||
|
||||
/* Integer types are specified with i and a bitwidth */
|
||||
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]+
|
||||
NInteger -[0-9]+
|
||||
|
||||
@ -216,11 +217,7 @@ tail { return TAIL; }
|
||||
target { return TARGET; }
|
||||
triple { return TRIPLE; }
|
||||
deplibs { return DEPLIBS; }
|
||||
endian { return ENDIAN; }
|
||||
pointersize { return POINTERSIZE; }
|
||||
datalayout { return DATALAYOUT; }
|
||||
little { return LITTLE; }
|
||||
big { return BIG; }
|
||||
volatile { return VOLATILE; }
|
||||
align { return ALIGN; }
|
||||
section { return SECTION; }
|
||||
@ -323,10 +320,15 @@ insertelement { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
|
||||
shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
|
||||
|
||||
{VarID} {
|
||||
{LocalVarName} {
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
|
||||
return VAR_ID;
|
||||
return LOCALVAR;
|
||||
}
|
||||
{GlobalVarName} {
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Skip @
|
||||
return GLOBALVAR;
|
||||
}
|
||||
{Label} {
|
||||
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
|
||||
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; }
|
||||
@ -366,20 +374,19 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
|
||||
}
|
||||
|
||||
{EPInteger} {
|
||||
{LocalVarID} {
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
GenerateError("Invalid value number (too large)!");
|
||||
llvmAsmlval.UIntVal = unsigned(Val);
|
||||
return UINTVAL;
|
||||
return LOCALVAL_ID;
|
||||
}
|
||||
{ENInteger} {
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT32_MAX+1)
|
||||
GenerateError("Constant too large for signed 32 bits!");
|
||||
llvmAsmlval.SIntVal = (int)-Val;
|
||||
return SINTVAL;
|
||||
{GlobalVarID} {
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
GenerateError("Invalid value number (too large)!");
|
||||
llvmAsmlval.UIntVal = unsigned(Val);
|
||||
return GLOBALVAL_ID;
|
||||
}
|
||||
|
||||
{FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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,
|
||||
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
|
||||
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
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
#ifndef BISON_LLVMASMPARSER_TAB_H
|
||||
# define BISON_LLVMASMPARSER_TAB_H
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
@ -34,8 +31,8 @@
|
||||
enum yytokentype {
|
||||
ESINT64VAL = 258,
|
||||
EUINT64VAL = 259,
|
||||
SINTVAL = 260,
|
||||
UINTVAL = 261,
|
||||
LOCALVAL_ID = 260,
|
||||
GLOBALVAL_ID = 261,
|
||||
FPVAL = 262,
|
||||
VOID = 263,
|
||||
INTTYPE = 264,
|
||||
@ -43,131 +40,130 @@
|
||||
DOUBLE = 266,
|
||||
LABEL = 267,
|
||||
TYPE = 268,
|
||||
VAR_ID = 269,
|
||||
LABELSTR = 270,
|
||||
STRINGCONSTANT = 271,
|
||||
IMPLEMENTATION = 272,
|
||||
ZEROINITIALIZER = 273,
|
||||
TRUETOK = 274,
|
||||
FALSETOK = 275,
|
||||
BEGINTOK = 276,
|
||||
ENDTOK = 277,
|
||||
DECLARE = 278,
|
||||
DEFINE = 279,
|
||||
GLOBAL = 280,
|
||||
CONSTANT = 281,
|
||||
SECTION = 282,
|
||||
VOLATILE = 283,
|
||||
TO = 284,
|
||||
DOTDOTDOT = 285,
|
||||
NULL_TOK = 286,
|
||||
UNDEF = 287,
|
||||
INTERNAL = 288,
|
||||
LINKONCE = 289,
|
||||
WEAK = 290,
|
||||
APPENDING = 291,
|
||||
DLLIMPORT = 292,
|
||||
DLLEXPORT = 293,
|
||||
EXTERN_WEAK = 294,
|
||||
OPAQUE = 295,
|
||||
EXTERNAL = 296,
|
||||
TARGET = 297,
|
||||
TRIPLE = 298,
|
||||
ENDIAN = 299,
|
||||
POINTERSIZE = 300,
|
||||
LITTLE = 301,
|
||||
BIG = 302,
|
||||
ALIGN = 303,
|
||||
DEPLIBS = 304,
|
||||
CALL = 305,
|
||||
TAIL = 306,
|
||||
ASM_TOK = 307,
|
||||
MODULE = 308,
|
||||
SIDEEFFECT = 309,
|
||||
CC_TOK = 310,
|
||||
CCC_TOK = 311,
|
||||
CSRETCC_TOK = 312,
|
||||
FASTCC_TOK = 313,
|
||||
COLDCC_TOK = 314,
|
||||
X86_STDCALLCC_TOK = 315,
|
||||
X86_FASTCALLCC_TOK = 316,
|
||||
DATALAYOUT = 317,
|
||||
RET = 318,
|
||||
BR = 319,
|
||||
SWITCH = 320,
|
||||
INVOKE = 321,
|
||||
UNWIND = 322,
|
||||
UNREACHABLE = 323,
|
||||
ADD = 324,
|
||||
SUB = 325,
|
||||
MUL = 326,
|
||||
UDIV = 327,
|
||||
SDIV = 328,
|
||||
FDIV = 329,
|
||||
UREM = 330,
|
||||
SREM = 331,
|
||||
FREM = 332,
|
||||
AND = 333,
|
||||
OR = 334,
|
||||
XOR = 335,
|
||||
ICMP = 336,
|
||||
FCMP = 337,
|
||||
EQ = 338,
|
||||
NE = 339,
|
||||
SLT = 340,
|
||||
SGT = 341,
|
||||
SLE = 342,
|
||||
SGE = 343,
|
||||
ULT = 344,
|
||||
UGT = 345,
|
||||
ULE = 346,
|
||||
UGE = 347,
|
||||
OEQ = 348,
|
||||
ONE = 349,
|
||||
OLT = 350,
|
||||
OGT = 351,
|
||||
OLE = 352,
|
||||
OGE = 353,
|
||||
ORD = 354,
|
||||
UNO = 355,
|
||||
UEQ = 356,
|
||||
UNE = 357,
|
||||
MALLOC = 358,
|
||||
ALLOCA = 359,
|
||||
FREE = 360,
|
||||
LOAD = 361,
|
||||
STORE = 362,
|
||||
GETELEMENTPTR = 363,
|
||||
TRUNC = 364,
|
||||
ZEXT = 365,
|
||||
SEXT = 366,
|
||||
FPTRUNC = 367,
|
||||
FPEXT = 368,
|
||||
BITCAST = 369,
|
||||
UITOFP = 370,
|
||||
SITOFP = 371,
|
||||
FPTOUI = 372,
|
||||
FPTOSI = 373,
|
||||
INTTOPTR = 374,
|
||||
PTRTOINT = 375,
|
||||
PHI_TOK = 376,
|
||||
SELECT = 377,
|
||||
SHL = 378,
|
||||
LSHR = 379,
|
||||
ASHR = 380,
|
||||
VAARG = 381,
|
||||
EXTRACTELEMENT = 382,
|
||||
INSERTELEMENT = 383,
|
||||
SHUFFLEVECTOR = 384,
|
||||
NORETURN = 385,
|
||||
DEFAULT = 386,
|
||||
HIDDEN = 387
|
||||
LOCALVAR = 269,
|
||||
GLOBALVAR = 270,
|
||||
LABELSTR = 271,
|
||||
STRINGCONSTANT = 272,
|
||||
ATSTRINGCONSTANT = 273,
|
||||
IMPLEMENTATION = 274,
|
||||
ZEROINITIALIZER = 275,
|
||||
TRUETOK = 276,
|
||||
FALSETOK = 277,
|
||||
BEGINTOK = 278,
|
||||
ENDTOK = 279,
|
||||
DECLARE = 280,
|
||||
DEFINE = 281,
|
||||
GLOBAL = 282,
|
||||
CONSTANT = 283,
|
||||
SECTION = 284,
|
||||
VOLATILE = 285,
|
||||
TO = 286,
|
||||
DOTDOTDOT = 287,
|
||||
NULL_TOK = 288,
|
||||
UNDEF = 289,
|
||||
INTERNAL = 290,
|
||||
LINKONCE = 291,
|
||||
WEAK = 292,
|
||||
APPENDING = 293,
|
||||
DLLIMPORT = 294,
|
||||
DLLEXPORT = 295,
|
||||
EXTERN_WEAK = 296,
|
||||
OPAQUE = 297,
|
||||
EXTERNAL = 298,
|
||||
TARGET = 299,
|
||||
TRIPLE = 300,
|
||||
ALIGN = 301,
|
||||
DEPLIBS = 302,
|
||||
CALL = 303,
|
||||
TAIL = 304,
|
||||
ASM_TOK = 305,
|
||||
MODULE = 306,
|
||||
SIDEEFFECT = 307,
|
||||
CC_TOK = 308,
|
||||
CCC_TOK = 309,
|
||||
CSRETCC_TOK = 310,
|
||||
FASTCC_TOK = 311,
|
||||
COLDCC_TOK = 312,
|
||||
X86_STDCALLCC_TOK = 313,
|
||||
X86_FASTCALLCC_TOK = 314,
|
||||
DATALAYOUT = 315,
|
||||
RET = 316,
|
||||
BR = 317,
|
||||
SWITCH = 318,
|
||||
INVOKE = 319,
|
||||
UNWIND = 320,
|
||||
UNREACHABLE = 321,
|
||||
ADD = 322,
|
||||
SUB = 323,
|
||||
MUL = 324,
|
||||
UDIV = 325,
|
||||
SDIV = 326,
|
||||
FDIV = 327,
|
||||
UREM = 328,
|
||||
SREM = 329,
|
||||
FREM = 330,
|
||||
AND = 331,
|
||||
OR = 332,
|
||||
XOR = 333,
|
||||
ICMP = 334,
|
||||
FCMP = 335,
|
||||
EQ = 336,
|
||||
NE = 337,
|
||||
SLT = 338,
|
||||
SGT = 339,
|
||||
SLE = 340,
|
||||
SGE = 341,
|
||||
ULT = 342,
|
||||
UGT = 343,
|
||||
ULE = 344,
|
||||
UGE = 345,
|
||||
OEQ = 346,
|
||||
ONE = 347,
|
||||
OLT = 348,
|
||||
OGT = 349,
|
||||
OLE = 350,
|
||||
OGE = 351,
|
||||
ORD = 352,
|
||||
UNO = 353,
|
||||
UEQ = 354,
|
||||
UNE = 355,
|
||||
MALLOC = 356,
|
||||
ALLOCA = 357,
|
||||
FREE = 358,
|
||||
LOAD = 359,
|
||||
STORE = 360,
|
||||
GETELEMENTPTR = 361,
|
||||
TRUNC = 362,
|
||||
ZEXT = 363,
|
||||
SEXT = 364,
|
||||
FPTRUNC = 365,
|
||||
FPEXT = 366,
|
||||
BITCAST = 367,
|
||||
UITOFP = 368,
|
||||
SITOFP = 369,
|
||||
FPTOUI = 370,
|
||||
FPTOSI = 371,
|
||||
INTTOPTR = 372,
|
||||
PTRTOINT = 373,
|
||||
PHI_TOK = 374,
|
||||
SELECT = 375,
|
||||
SHL = 376,
|
||||
LSHR = 377,
|
||||
ASHR = 378,
|
||||
VAARG = 379,
|
||||
EXTRACTELEMENT = 380,
|
||||
INSERTELEMENT = 381,
|
||||
SHUFFLEVECTOR = 382,
|
||||
NORETURN = 383,
|
||||
DEFAULT = 384,
|
||||
HIDDEN = 385
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ESINT64VAL 258
|
||||
#define EUINT64VAL 259
|
||||
#define SINTVAL 260
|
||||
#define UINTVAL 261
|
||||
#define LOCALVAL_ID 260
|
||||
#define GLOBALVAL_ID 261
|
||||
#define FPVAL 262
|
||||
#define VOID 263
|
||||
#define INTTYPE 264
|
||||
@ -175,132 +171,130 @@
|
||||
#define DOUBLE 266
|
||||
#define LABEL 267
|
||||
#define TYPE 268
|
||||
#define VAR_ID 269
|
||||
#define LABELSTR 270
|
||||
#define STRINGCONSTANT 271
|
||||
#define IMPLEMENTATION 272
|
||||
#define ZEROINITIALIZER 273
|
||||
#define TRUETOK 274
|
||||
#define FALSETOK 275
|
||||
#define BEGINTOK 276
|
||||
#define ENDTOK 277
|
||||
#define DECLARE 278
|
||||
#define DEFINE 279
|
||||
#define GLOBAL 280
|
||||
#define CONSTANT 281
|
||||
#define SECTION 282
|
||||
#define VOLATILE 283
|
||||
#define TO 284
|
||||
#define DOTDOTDOT 285
|
||||
#define NULL_TOK 286
|
||||
#define UNDEF 287
|
||||
#define INTERNAL 288
|
||||
#define LINKONCE 289
|
||||
#define WEAK 290
|
||||
#define APPENDING 291
|
||||
#define DLLIMPORT 292
|
||||
#define DLLEXPORT 293
|
||||
#define EXTERN_WEAK 294
|
||||
#define OPAQUE 295
|
||||
#define EXTERNAL 296
|
||||
#define TARGET 297
|
||||
#define TRIPLE 298
|
||||
#define ENDIAN 299
|
||||
#define POINTERSIZE 300
|
||||
#define LITTLE 301
|
||||
#define BIG 302
|
||||
#define ALIGN 303
|
||||
#define DEPLIBS 304
|
||||
#define CALL 305
|
||||
#define TAIL 306
|
||||
#define ASM_TOK 307
|
||||
#define MODULE 308
|
||||
#define SIDEEFFECT 309
|
||||
#define CC_TOK 310
|
||||
#define CCC_TOK 311
|
||||
#define CSRETCC_TOK 312
|
||||
#define FASTCC_TOK 313
|
||||
#define COLDCC_TOK 314
|
||||
#define X86_STDCALLCC_TOK 315
|
||||
#define X86_FASTCALLCC_TOK 316
|
||||
#define DATALAYOUT 317
|
||||
#define RET 318
|
||||
#define BR 319
|
||||
#define SWITCH 320
|
||||
#define INVOKE 321
|
||||
#define UNWIND 322
|
||||
#define UNREACHABLE 323
|
||||
#define ADD 324
|
||||
#define SUB 325
|
||||
#define MUL 326
|
||||
#define UDIV 327
|
||||
#define SDIV 328
|
||||
#define FDIV 329
|
||||
#define UREM 330
|
||||
#define SREM 331
|
||||
#define FREM 332
|
||||
#define AND 333
|
||||
#define OR 334
|
||||
#define XOR 335
|
||||
#define ICMP 336
|
||||
#define FCMP 337
|
||||
#define EQ 338
|
||||
#define NE 339
|
||||
#define SLT 340
|
||||
#define SGT 341
|
||||
#define SLE 342
|
||||
#define SGE 343
|
||||
#define ULT 344
|
||||
#define UGT 345
|
||||
#define ULE 346
|
||||
#define UGE 347
|
||||
#define OEQ 348
|
||||
#define ONE 349
|
||||
#define OLT 350
|
||||
#define OGT 351
|
||||
#define OLE 352
|
||||
#define OGE 353
|
||||
#define ORD 354
|
||||
#define UNO 355
|
||||
#define UEQ 356
|
||||
#define UNE 357
|
||||
#define MALLOC 358
|
||||
#define ALLOCA 359
|
||||
#define FREE 360
|
||||
#define LOAD 361
|
||||
#define STORE 362
|
||||
#define GETELEMENTPTR 363
|
||||
#define TRUNC 364
|
||||
#define ZEXT 365
|
||||
#define SEXT 366
|
||||
#define FPTRUNC 367
|
||||
#define FPEXT 368
|
||||
#define BITCAST 369
|
||||
#define UITOFP 370
|
||||
#define SITOFP 371
|
||||
#define FPTOUI 372
|
||||
#define FPTOSI 373
|
||||
#define INTTOPTR 374
|
||||
#define PTRTOINT 375
|
||||
#define PHI_TOK 376
|
||||
#define SELECT 377
|
||||
#define SHL 378
|
||||
#define LSHR 379
|
||||
#define ASHR 380
|
||||
#define VAARG 381
|
||||
#define EXTRACTELEMENT 382
|
||||
#define INSERTELEMENT 383
|
||||
#define SHUFFLEVECTOR 384
|
||||
#define NORETURN 385
|
||||
#define DEFAULT 386
|
||||
#define HIDDEN 387
|
||||
#define LOCALVAR 269
|
||||
#define GLOBALVAR 270
|
||||
#define LABELSTR 271
|
||||
#define STRINGCONSTANT 272
|
||||
#define ATSTRINGCONSTANT 273
|
||||
#define IMPLEMENTATION 274
|
||||
#define ZEROINITIALIZER 275
|
||||
#define TRUETOK 276
|
||||
#define FALSETOK 277
|
||||
#define BEGINTOK 278
|
||||
#define ENDTOK 279
|
||||
#define DECLARE 280
|
||||
#define DEFINE 281
|
||||
#define GLOBAL 282
|
||||
#define CONSTANT 283
|
||||
#define SECTION 284
|
||||
#define VOLATILE 285
|
||||
#define TO 286
|
||||
#define DOTDOTDOT 287
|
||||
#define NULL_TOK 288
|
||||
#define UNDEF 289
|
||||
#define INTERNAL 290
|
||||
#define LINKONCE 291
|
||||
#define WEAK 292
|
||||
#define APPENDING 293
|
||||
#define DLLIMPORT 294
|
||||
#define DLLEXPORT 295
|
||||
#define EXTERN_WEAK 296
|
||||
#define OPAQUE 297
|
||||
#define EXTERNAL 298
|
||||
#define TARGET 299
|
||||
#define TRIPLE 300
|
||||
#define ALIGN 301
|
||||
#define DEPLIBS 302
|
||||
#define CALL 303
|
||||
#define TAIL 304
|
||||
#define ASM_TOK 305
|
||||
#define MODULE 306
|
||||
#define SIDEEFFECT 307
|
||||
#define CC_TOK 308
|
||||
#define CCC_TOK 309
|
||||
#define CSRETCC_TOK 310
|
||||
#define FASTCC_TOK 311
|
||||
#define COLDCC_TOK 312
|
||||
#define X86_STDCALLCC_TOK 313
|
||||
#define X86_FASTCALLCC_TOK 314
|
||||
#define DATALAYOUT 315
|
||||
#define RET 316
|
||||
#define BR 317
|
||||
#define SWITCH 318
|
||||
#define INVOKE 319
|
||||
#define UNWIND 320
|
||||
#define UNREACHABLE 321
|
||||
#define ADD 322
|
||||
#define SUB 323
|
||||
#define MUL 324
|
||||
#define UDIV 325
|
||||
#define SDIV 326
|
||||
#define FDIV 327
|
||||
#define UREM 328
|
||||
#define SREM 329
|
||||
#define FREM 330
|
||||
#define AND 331
|
||||
#define OR 332
|
||||
#define XOR 333
|
||||
#define ICMP 334
|
||||
#define FCMP 335
|
||||
#define EQ 336
|
||||
#define NE 337
|
||||
#define SLT 338
|
||||
#define SGT 339
|
||||
#define SLE 340
|
||||
#define SGE 341
|
||||
#define ULT 342
|
||||
#define UGT 343
|
||||
#define ULE 344
|
||||
#define UGE 345
|
||||
#define OEQ 346
|
||||
#define ONE 347
|
||||
#define OLT 348
|
||||
#define OGT 349
|
||||
#define OLE 350
|
||||
#define OGE 351
|
||||
#define ORD 352
|
||||
#define UNO 353
|
||||
#define UEQ 354
|
||||
#define UNE 355
|
||||
#define MALLOC 356
|
||||
#define ALLOCA 357
|
||||
#define FREE 358
|
||||
#define LOAD 359
|
||||
#define STORE 360
|
||||
#define GETELEMENTPTR 361
|
||||
#define TRUNC 362
|
||||
#define ZEXT 363
|
||||
#define SEXT 364
|
||||
#define FPTRUNC 365
|
||||
#define FPEXT 366
|
||||
#define BITCAST 367
|
||||
#define UITOFP 368
|
||||
#define SITOFP 369
|
||||
#define FPTOUI 370
|
||||
#define FPTOSI 371
|
||||
#define INTTOPTR 372
|
||||
#define PTRTOINT 373
|
||||
#define PHI_TOK 374
|
||||
#define SELECT 375
|
||||
#define SHL 376
|
||||
#define LSHR 377
|
||||
#define ASHR 378
|
||||
#define VAARG 379
|
||||
#define EXTRACTELEMENT 380
|
||||
#define INSERTELEMENT 381
|
||||
#define SHUFFLEVECTOR 382
|
||||
#define NORETURN 383
|
||||
#define DEFAULT 384
|
||||
#define HIDDEN 385
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef YYSTYPE
|
||||
#line 883 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
|
||||
typedef union {
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 885 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
typedef union YYSTYPE {
|
||||
llvm::Module *ModuleVal;
|
||||
llvm::Function *FunctionVal;
|
||||
llvm::BasicBlock *BasicBlockVal;
|
||||
@ -342,17 +336,17 @@ typedef union {
|
||||
llvm::Instruction::MemoryOps MemOpVal;
|
||||
llvm::Instruction::CastOps CastOpVal;
|
||||
llvm::Instruction::OtherOps OtherOpVal;
|
||||
llvm::Module::Endianness Endianness;
|
||||
llvm::ICmpInst::Predicate IPredicate;
|
||||
llvm::FCmpInst::Predicate FPredicate;
|
||||
} yystype;
|
||||
/* Line 1237 of /usr/local/share/bison/yacc.c. */
|
||||
#line 351 "llvmAsmParser.tab.h"
|
||||
# define YYSTYPE yystype
|
||||
} YYSTYPE;
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 344 "llvmAsmParser.tab.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE llvmAsmlval;
|
||||
|
||||
|
||||
#endif /* not BISON_LLVMASMPARSER_TAB_H */
|
||||
|
||||
|
@ -270,12 +270,12 @@ static int InsertValue(Value *V,
|
||||
|
||||
static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
|
||||
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...
|
||||
if ((unsigned)D.Num < CurModule.Types.size())
|
||||
return CurModule.Types[(unsigned)D.Num];
|
||||
if (D.Num < CurModule.Types.size())
|
||||
return CurModule.Types[D.Num];
|
||||
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)) {
|
||||
D.destroy(); // Free old strdup'd memory...
|
||||
return N;
|
||||
@ -294,11 +294,11 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
|
||||
|
||||
|
||||
if (inFunctionScope()) {
|
||||
if (D.Type == ValID::NameVal) {
|
||||
if (D.Type == ValID::LocalName) {
|
||||
GenerateError("Reference to an undefined type: '" + D.getName() + "'");
|
||||
return 0;
|
||||
} else {
|
||||
GenerateError("Reference to an undefined type: #" + itostr(D.Num));
|
||||
GenerateError("Reference to an undefined type: #" + utostr(D.Num));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -312,13 +312,6 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
|
||||
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
|
||||
// the provided ValID. If the value exists and has already been defined, return
|
||||
// it. Otherwise return null.
|
||||
@ -331,29 +324,39 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
|
||||
}
|
||||
|
||||
switch (D.Type) {
|
||||
case ValID::NumberVal: { // Is it a numbered definition?
|
||||
unsigned Num = (unsigned)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()) {
|
||||
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);
|
||||
case ValID::LocalID: { // Is it a numbered definition?
|
||||
// Module constants occupy the lowest numbered slots.
|
||||
std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
|
||||
// Make sure that our type is within bounds.
|
||||
if (VI == CurFun.Values.end()) return 0;
|
||||
|
||||
// Check that the number is within bounds...
|
||||
if (VI->second.size() <= Num) return 0;
|
||||
// Check that the number is within bounds.
|
||||
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];
|
||||
}
|
||||
|
||||
case ValID::NameVal: { // Is it a named definition?
|
||||
Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
|
||||
|
||||
case ValID::LocalName: { // Is it a named definition?
|
||||
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;
|
||||
|
||||
D.destroy(); // Free old strdup'd memory...
|
||||
@ -488,12 +491,12 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
|
||||
default:
|
||||
GenerateError("Illegal label reference " + ID.getName());
|
||||
return 0;
|
||||
case ValID::NumberVal: // Is it a numbered definition?
|
||||
if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
|
||||
case ValID::LocalID: // Is it a numbered definition?
|
||||
if (ID.Num >= CurFun.NumberedBlocks.size())
|
||||
CurFun.NumberedBlocks.resize(ID.Num+1);
|
||||
BB = CurFun.NumberedBlocks[ID.Num];
|
||||
break;
|
||||
case ValID::NameVal: // Is it a named definition?
|
||||
case ValID::LocalName: // Is it a named definition?
|
||||
Name = ID.Name;
|
||||
if (Value *N = CurFun.CurrentFunction->
|
||||
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.
|
||||
BB = new BasicBlock("", CurFun.CurrentFunction);
|
||||
if (ID.Type == ValID::NameVal) {
|
||||
if (ID.Type == ValID::LocalName) {
|
||||
BB->setName(ID.Name);
|
||||
} else {
|
||||
CurFun.NumberedBlocks[ID.Num] = BB;
|
||||
@ -585,7 +588,7 @@ ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
|
||||
// resolver table
|
||||
InsertValue(V, *FutureLateResolvers);
|
||||
} else {
|
||||
if (DID.Type == ValID::NameVal) {
|
||||
if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
|
||||
GenerateError("Reference to an invalid definition: '" +DID.getName()+
|
||||
"' of type '" + V->getType()->getDescription() + "'",
|
||||
PHI->second.second);
|
||||
@ -610,8 +613,8 @@ ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
|
||||
//
|
||||
static void ResolveTypeTo(char *Name, const Type *ToTy) {
|
||||
ValID D;
|
||||
if (Name) D = ValID::create(Name);
|
||||
else D = ValID::create((int)CurModule.Types.size());
|
||||
if (Name) D = ValID::createLocalName(Name);
|
||||
else D = ValID::createLocalID(CurModule.Types.size());
|
||||
|
||||
std::map<ValID, PATypeHolder>::iterator I =
|
||||
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.
|
||||
//
|
||||
static void setValueName(Value *V, char *NameStr) {
|
||||
if (NameStr) {
|
||||
std::string Name(NameStr); // Copy string
|
||||
free(NameStr); // Free old string
|
||||
if (!NameStr) return;
|
||||
std::string Name(NameStr); // Copy string
|
||||
free(NameStr); // Free old string
|
||||
|
||||
if (V->getType() == Type::VoidTy) {
|
||||
GenerateError("Can't assign name '" + Name+"' to value with void type!");
|
||||
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);
|
||||
if (V->getType() == Type::VoidTy) {
|
||||
GenerateError("Can't assign name '" + Name+"' to value with void type!");
|
||||
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);
|
||||
}
|
||||
|
||||
/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
|
||||
@ -673,9 +675,9 @@ ParseGlobalVariable(char *NameStr,
|
||||
// object.
|
||||
ValID ID;
|
||||
if (!Name.empty()) {
|
||||
ID = ValID::create((char*)Name.c_str());
|
||||
ID = ValID::createGlobalName((char*)Name.c_str());
|
||||
} else {
|
||||
ID = ValID::create((int)CurModule.Values[PTy].size());
|
||||
ID = ValID::createGlobalID(CurModule.Values[PTy].size());
|
||||
}
|
||||
|
||||
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::CastOps CastOpVal;
|
||||
llvm::Instruction::OtherOps OtherOpVal;
|
||||
llvm::Module::Endianness Endianness;
|
||||
llvm::ICmpInst::Predicate IPredicate;
|
||||
llvm::FCmpInst::Predicate FPredicate;
|
||||
}
|
||||
@ -949,7 +950,6 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
|
||||
%type <Linkage> GVInternalLinkage GVExternalLinkage
|
||||
%type <Linkage> FunctionDefineLinkage FunctionDeclareLinkage
|
||||
%type <Visibility> GVVisibilityStyle
|
||||
%type <Endianness> BigOrLittle
|
||||
|
||||
// ValueRef - Unresolved reference to a definition or BB
|
||||
%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
|
||||
%token <UInt64Val> EUINT64VAL
|
||||
|
||||
%token <SIntVal> SINTVAL // Signed 32 bit ints...
|
||||
%token <UIntVal> UINTVAL // Unsigned 32 bit ints...
|
||||
%type <SIntVal> INTVAL
|
||||
%token <UIntVal> LOCALVAL_ID GLOBALVAL_ID // %123 @123
|
||||
%token <FPVal> FPVAL // Float or Double constant
|
||||
|
||||
// Built in types...
|
||||
@ -974,16 +972,17 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
|
||||
%token <PrimType> FLOAT DOUBLE LABEL
|
||||
%token TYPE
|
||||
|
||||
%token <StrVal> VAR_ID LABELSTR STRINGCONSTANT
|
||||
%type <StrVal> Name OptName OptAssign
|
||||
%type <UIntVal> OptAlign OptCAlign
|
||||
%token<StrVal> LOCALVAR GLOBALVAR LABELSTR STRINGCONSTANT ATSTRINGCONSTANT
|
||||
%type <StrVal> LocalName OptLocalName OptLocalAssign
|
||||
%type <StrVal> GlobalName OptGlobalAssign
|
||||
%type <UIntVal> OptAlign OptCAlign
|
||||
%type <StrVal> OptSection SectionString
|
||||
|
||||
%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK
|
||||
%token DECLARE DEFINE GLOBAL CONSTANT SECTION VOLATILE
|
||||
%token TO DOTDOTDOT NULL_TOK UNDEF INTERNAL LINKONCE WEAK APPENDING
|
||||
%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 CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK
|
||||
%token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK
|
||||
@ -1026,15 +1025,6 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
|
||||
%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:
|
||||
// RET, BR, & SWITCH because they end basic blocks and are treated specially.
|
||||
@ -1069,8 +1059,23 @@ FPredicates
|
||||
IntType : INTTYPE;
|
||||
FPType : FLOAT | DOUBLE;
|
||||
|
||||
// OptAssign - Value producing statements have an optional assignment component
|
||||
OptAssign : Name '=' {
|
||||
LocalName : LOCALVAR | STRINGCONSTANT;
|
||||
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;
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
@ -1630,7 +1635,10 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
|
||||
$2.destroy();
|
||||
} else {
|
||||
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.
|
||||
GlobalValue *GV;
|
||||
@ -1857,7 +1865,7 @@ Definition
|
||||
// Emit an error if there are any unresolved types left.
|
||||
if (!CurModule.LateResolveTypes.empty()) {
|
||||
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() + "'");
|
||||
} else {
|
||||
GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
|
||||
@ -1865,7 +1873,7 @@ Definition
|
||||
}
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| OptAssign TYPE Types {
|
||||
| OptLocalAssign TYPE Types {
|
||||
if (!UpRefs.empty())
|
||||
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
|
||||
// Eagerly resolve types. This is not an optimization, this is a
|
||||
@ -1889,7 +1897,7 @@ Definition
|
||||
delete $3;
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| OptAssign TYPE VOID {
|
||||
| OptLocalAssign TYPE VOID {
|
||||
ResolveTypeTo($1, $3);
|
||||
|
||||
if (!setTypeName($3, $1) && !$1) {
|
||||
@ -1900,7 +1908,8 @@ Definition
|
||||
}
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| OptAssign GVVisibilityStyle GlobalType ConstVal { /* "Externally Visible" Linkage */
|
||||
| OptGlobalAssign GVVisibilityStyle GlobalType ConstVal {
|
||||
/* "Externally Visible" Linkage */
|
||||
if ($4 == 0)
|
||||
GEN_ERROR("Global value initializer is not a constant!");
|
||||
CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage,
|
||||
@ -1909,7 +1918,7 @@ Definition
|
||||
} GlobalVarAttributes {
|
||||
CurGV = 0;
|
||||
}
|
||||
| OptAssign GVInternalLinkage GVVisibilityStyle GlobalType ConstVal {
|
||||
| OptGlobalAssign GVInternalLinkage GVVisibilityStyle GlobalType ConstVal {
|
||||
if ($5 == 0)
|
||||
GEN_ERROR("Global value initializer is not a constant!");
|
||||
CurGV = ParseGlobalVariable($1, $2, $3, $4, $5->getType(), $5);
|
||||
@ -1917,7 +1926,7 @@ Definition
|
||||
} GlobalVarAttributes {
|
||||
CurGV = 0;
|
||||
}
|
||||
| OptAssign GVExternalLinkage GVVisibilityStyle GlobalType Types {
|
||||
| OptGlobalAssign GVExternalLinkage GVVisibilityStyle GlobalType Types {
|
||||
if (!UpRefs.empty())
|
||||
GEN_ERROR("Invalid upreference in type: " + (*$5)->getDescription());
|
||||
CurGV = ParseGlobalVariable($1, $2, $3, $4, *$5, 0);
|
||||
@ -1949,23 +1958,7 @@ AsmBlock : STRINGCONSTANT {
|
||||
CHECK_FOR_ERROR
|
||||
};
|
||||
|
||||
BigOrLittle : BIG { $$ = Module::BigEndian; };
|
||||
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 {
|
||||
TargetDefinition : TRIPLE '=' STRINGCONSTANT {
|
||||
CurModule.CurrentModule->setTargetTriple($3);
|
||||
free($3);
|
||||
}
|
||||
@ -1995,10 +1988,7 @@ LibList : LibList ',' STRINGCONSTANT {
|
||||
// Rules to match Function Headers
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Name : VAR_ID | STRINGCONSTANT;
|
||||
OptName : Name | /*empty*/ { $$ = 0; };
|
||||
|
||||
ArgListH : ArgListH ',' Types OptParamAttrs OptName {
|
||||
ArgListH : ArgListH ',' Types OptParamAttrs OptLocalName {
|
||||
if (!UpRefs.empty())
|
||||
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
|
||||
if (*$3 == Type::VoidTy)
|
||||
@ -2008,7 +1998,7 @@ ArgListH : ArgListH ',' Types OptParamAttrs OptName {
|
||||
$1->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| Types OptParamAttrs OptName {
|
||||
| Types OptParamAttrs OptLocalName {
|
||||
if (!UpRefs.empty())
|
||||
GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription());
|
||||
if (*$1 == Type::VoidTy)
|
||||
@ -2046,7 +2036,7 @@ ArgList : ArgListH {
|
||||
CHECK_FOR_ERROR
|
||||
};
|
||||
|
||||
FunctionHeaderH : OptCallingConv ResultTypes Name '(' ArgList ')'
|
||||
FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
|
||||
OptFuncAttrs OptSection OptAlign {
|
||||
UnEscapeLexed($3);
|
||||
std::string FunctionName($3);
|
||||
@ -2081,9 +2071,9 @@ FunctionHeaderH : OptCallingConv ResultTypes Name '(' ArgList ')'
|
||||
|
||||
ValID ID;
|
||||
if (!FunctionName.empty()) {
|
||||
ID = ValID::create((char*)FunctionName.c_str());
|
||||
ID = ValID::createGlobalName((char*)FunctionName.c_str());
|
||||
} else {
|
||||
ID = ValID::create((int)CurModule.Values[PFT].size());
|
||||
ID = ValID::createGlobalID(CurModule.Values[PFT].size());
|
||||
}
|
||||
|
||||
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
|
||||
// another value.
|
||||
//
|
||||
SymbolicValueRef : INTVAL { // Is it an integer reference...?
|
||||
$$ = ValID::create($1);
|
||||
SymbolicValueRef : LOCALVAL_ID { // Is it an integer reference...?
|
||||
$$ = ValID::createLocalID($1);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| Name { // Is it a named reference...?
|
||||
$$ = ValID::create($1);
|
||||
| GLOBALVAL_ID {
|
||||
$$ = 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
|
||||
};
|
||||
|
||||
@ -2304,7 +2302,7 @@ BasicBlockList : BasicBlockList BasicBlock {
|
||||
// Basic blocks are terminated by branching instructions:
|
||||
// br, br/cc, switch, ret
|
||||
//
|
||||
BasicBlock : InstructionList OptAssign BBTerminatorInst {
|
||||
BasicBlock : InstructionList OptLocalAssign BBTerminatorInst {
|
||||
setValueName($3, $2);
|
||||
CHECK_FOR_ERROR
|
||||
InsertValue($3);
|
||||
@ -2325,7 +2323,7 @@ InstructionList : InstructionList Inst {
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| /* empty */ {
|
||||
$$ = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
|
||||
$$ = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
|
||||
CHECK_FOR_ERROR
|
||||
|
||||
// Make sure to move the basic block to the correct location in the
|
||||
@ -2337,7 +2335,7 @@ InstructionList : InstructionList Inst {
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| LABELSTR {
|
||||
$$ = getBBVal(ValID::create($1), true);
|
||||
$$ = getBBVal(ValID::createLocalName($1), true);
|
||||
CHECK_FOR_ERROR
|
||||
|
||||
// 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));
|
||||
};
|
||||
|
||||
Inst : OptAssign InstVal {
|
||||
Inst : OptLocalAssign InstVal {
|
||||
// Is this definition named?? if so, assign the name...
|
||||
setValueName($2, $1);
|
||||
CHECK_FOR_ERROR
|
||||
@ -2762,6 +2760,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CI->setCallingConv($2);
|
||||
$$ = CI;
|
||||
delete $6;
|
||||
delete $3;
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| MemoryInst {
|
||||
|
Loading…
Reference in New Issue
Block a user