Regenerate.

llvm-svn: 32140
This commit is contained in:
Reid Spencer 2006-12-02 22:14:11 +00:00
parent 97cae19c07
commit 0b2fca760d
8 changed files with 3938 additions and 3173 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -182,6 +182,28 @@ setlt { RET_TOK( SETLT); }
setgt { RET_TOK( SETGT); }
setle { RET_TOK( SETLE); }
setge { RET_TOK( SETGE); }
icmp { RET_TOK(ICMP); }
fcmp { RET_TOK(FCMP); }
eq { RET_TOK(EQ); }
ne { RET_TOK(NE); }
slt { RET_TOK(SLT); }
sgt { RET_TOK(SGT); }
sle { RET_TOK(SLE); }
sge { RET_TOK(SGE); }
oeq { RET_TOK(OEQ); }
one { RET_TOK(ONE); }
olt { RET_TOK(OLT); }
ogt { RET_TOK(OGT); }
ole { RET_TOK(OLE); }
oge { RET_TOK(OGE); }
ord { RET_TOK(ORD); }
uno { RET_TOK(UNO); }
ueq { RET_TOK(UEQ); }
une { RET_TOK(UNE); }
ult { RET_TOK(ULT); }
ugt { RET_TOK(UGT); }
ule { RET_TOK(ULE); }
uge { RET_TOK(UGE); }
phi { RET_TOK( PHI_TOK); }
call { RET_TOK( CALL); }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -126,35 +126,57 @@
SETGT = 352,
SETEQ = 353,
SETNE = 354,
MALLOC = 355,
ALLOCA = 356,
FREE = 357,
LOAD = 358,
STORE = 359,
GETELEMENTPTR = 360,
PHI_TOK = 361,
SELECT = 362,
SHL = 363,
SHR = 364,
ASHR = 365,
LSHR = 366,
VAARG = 367,
EXTRACTELEMENT = 368,
INSERTELEMENT = 369,
SHUFFLEVECTOR = 370,
CAST = 371,
TRUNC = 372,
ZEXT = 373,
SEXT = 374,
FPTRUNC = 375,
FPEXT = 376,
FPTOUI = 377,
FPTOSI = 378,
UITOFP = 379,
SITOFP = 380,
PTRTOINT = 381,
INTTOPTR = 382,
BITCAST = 383
ICMP = 355,
FCMP = 356,
EQ = 357,
NE = 358,
SLT = 359,
SGT = 360,
SLE = 361,
SGE = 362,
OEQ = 363,
ONE = 364,
OLT = 365,
OGT = 366,
OLE = 367,
OGE = 368,
ORD = 369,
UNO = 370,
UEQ = 371,
UNE = 372,
ULT = 373,
UGT = 374,
ULE = 375,
UGE = 376,
MALLOC = 377,
ALLOCA = 378,
FREE = 379,
LOAD = 380,
STORE = 381,
GETELEMENTPTR = 382,
PHI_TOK = 383,
SELECT = 384,
SHL = 385,
SHR = 386,
ASHR = 387,
LSHR = 388,
VAARG = 389,
EXTRACTELEMENT = 390,
INSERTELEMENT = 391,
SHUFFLEVECTOR = 392,
CAST = 393,
TRUNC = 394,
ZEXT = 395,
SEXT = 396,
FPTRUNC = 397,
FPEXT = 398,
FPTOUI = 399,
FPTOSI = 400,
UITOFP = 401,
SITOFP = 402,
PTRTOINT = 403,
INTTOPTR = 404,
BITCAST = 405
};
#endif
/* Tokens. */
@ -255,41 +277,63 @@
#define SETGT 352
#define SETEQ 353
#define SETNE 354
#define MALLOC 355
#define ALLOCA 356
#define FREE 357
#define LOAD 358
#define STORE 359
#define GETELEMENTPTR 360
#define PHI_TOK 361
#define SELECT 362
#define SHL 363
#define SHR 364
#define ASHR 365
#define LSHR 366
#define VAARG 367
#define EXTRACTELEMENT 368
#define INSERTELEMENT 369
#define SHUFFLEVECTOR 370
#define CAST 371
#define TRUNC 372
#define ZEXT 373
#define SEXT 374
#define FPTRUNC 375
#define FPEXT 376
#define FPTOUI 377
#define FPTOSI 378
#define UITOFP 379
#define SITOFP 380
#define PTRTOINT 381
#define INTTOPTR 382
#define BITCAST 383
#define ICMP 355
#define FCMP 356
#define EQ 357
#define NE 358
#define SLT 359
#define SGT 360
#define SLE 361
#define SGE 362
#define OEQ 363
#define ONE 364
#define OLT 365
#define OGT 366
#define OLE 367
#define OGE 368
#define ORD 369
#define UNO 370
#define UEQ 371
#define UNE 372
#define ULT 373
#define UGT 374
#define ULE 375
#define UGE 376
#define MALLOC 377
#define ALLOCA 378
#define FREE 379
#define LOAD 380
#define STORE 381
#define GETELEMENTPTR 382
#define PHI_TOK 383
#define SELECT 384
#define SHL 385
#define SHR 386
#define ASHR 387
#define LSHR 388
#define VAARG 389
#define EXTRACTELEMENT 390
#define INSERTELEMENT 391
#define SHUFFLEVECTOR 392
#define CAST 393
#define TRUNC 394
#define ZEXT 395
#define SEXT 396
#define FPTRUNC 397
#define FPEXT 398
#define FPTOUI 399
#define FPTOSI 400
#define UITOFP 401
#define SITOFP 402
#define PTRTOINT 403
#define INTTOPTR 404
#define BITCAST 405
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 239 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
#line 268 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
@ -298,7 +342,7 @@ typedef union YYSTYPE {
ValueList* ValList;
} YYSTYPE;
/* Line 1447 of yacc.c. */
#line 302 "UpgradeParser.tab.h"
#line 346 "UpgradeParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -126,35 +126,57 @@
SETGT = 352,
SETEQ = 353,
SETNE = 354,
MALLOC = 355,
ALLOCA = 356,
FREE = 357,
LOAD = 358,
STORE = 359,
GETELEMENTPTR = 360,
PHI_TOK = 361,
SELECT = 362,
SHL = 363,
SHR = 364,
ASHR = 365,
LSHR = 366,
VAARG = 367,
EXTRACTELEMENT = 368,
INSERTELEMENT = 369,
SHUFFLEVECTOR = 370,
CAST = 371,
TRUNC = 372,
ZEXT = 373,
SEXT = 374,
FPTRUNC = 375,
FPEXT = 376,
FPTOUI = 377,
FPTOSI = 378,
UITOFP = 379,
SITOFP = 380,
PTRTOINT = 381,
INTTOPTR = 382,
BITCAST = 383
ICMP = 355,
FCMP = 356,
EQ = 357,
NE = 358,
SLT = 359,
SGT = 360,
SLE = 361,
SGE = 362,
OEQ = 363,
ONE = 364,
OLT = 365,
OGT = 366,
OLE = 367,
OGE = 368,
ORD = 369,
UNO = 370,
UEQ = 371,
UNE = 372,
ULT = 373,
UGT = 374,
ULE = 375,
UGE = 376,
MALLOC = 377,
ALLOCA = 378,
FREE = 379,
LOAD = 380,
STORE = 381,
GETELEMENTPTR = 382,
PHI_TOK = 383,
SELECT = 384,
SHL = 385,
SHR = 386,
ASHR = 387,
LSHR = 388,
VAARG = 389,
EXTRACTELEMENT = 390,
INSERTELEMENT = 391,
SHUFFLEVECTOR = 392,
CAST = 393,
TRUNC = 394,
ZEXT = 395,
SEXT = 396,
FPTRUNC = 397,
FPEXT = 398,
FPTOUI = 399,
FPTOSI = 400,
UITOFP = 401,
SITOFP = 402,
PTRTOINT = 403,
INTTOPTR = 404,
BITCAST = 405
};
#endif
/* Tokens. */
@ -255,41 +277,63 @@
#define SETGT 352
#define SETEQ 353
#define SETNE 354
#define MALLOC 355
#define ALLOCA 356
#define FREE 357
#define LOAD 358
#define STORE 359
#define GETELEMENTPTR 360
#define PHI_TOK 361
#define SELECT 362
#define SHL 363
#define SHR 364
#define ASHR 365
#define LSHR 366
#define VAARG 367
#define EXTRACTELEMENT 368
#define INSERTELEMENT 369
#define SHUFFLEVECTOR 370
#define CAST 371
#define TRUNC 372
#define ZEXT 373
#define SEXT 374
#define FPTRUNC 375
#define FPEXT 376
#define FPTOUI 377
#define FPTOSI 378
#define UITOFP 379
#define SITOFP 380
#define PTRTOINT 381
#define INTTOPTR 382
#define BITCAST 383
#define ICMP 355
#define FCMP 356
#define EQ 357
#define NE 358
#define SLT 359
#define SGT 360
#define SLE 361
#define SGE 362
#define OEQ 363
#define ONE 364
#define OLT 365
#define OGT 366
#define OLE 367
#define OGE 368
#define ORD 369
#define UNO 370
#define UEQ 371
#define UNE 372
#define ULT 373
#define UGT 374
#define ULE 375
#define UGE 376
#define MALLOC 377
#define ALLOCA 378
#define FREE 379
#define LOAD 380
#define STORE 381
#define GETELEMENTPTR 382
#define PHI_TOK 383
#define SELECT 384
#define SHL 385
#define SHR 386
#define ASHR 387
#define LSHR 388
#define VAARG 389
#define EXTRACTELEMENT 390
#define INSERTELEMENT 391
#define SHUFFLEVECTOR 392
#define CAST 393
#define TRUNC 394
#define ZEXT 395
#define SEXT 396
#define FPTRUNC 397
#define FPEXT 398
#define FPTOUI 399
#define FPTOSI 400
#define UITOFP 401
#define SITOFP 402
#define PTRTOINT 403
#define INTTOPTR 404
#define BITCAST 405
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 239 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
#line 268 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
@ -298,7 +342,7 @@ typedef union YYSTYPE {
ValueList* ValList;
} YYSTYPE;
/* Line 1447 of yacc.c. */
#line 302 "UpgradeParser.tab.h"
#line 346 "UpgradeParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -22,6 +22,7 @@
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
#define YYDEBUG 1
#define UPGRADE_SETCOND_OPS 1
int yylex(); // declaration" of xxx warnings.
int yyparse();
@ -232,6 +233,34 @@ const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
yyerror("Invalid type for rem instruction");
return op;
}
std::string
getCompareOp(const std::string& setcc, const TypeInfo& TI) {
assert(setcc.length() == 5);
char cc1 = setcc[3];
char cc2 = setcc[4];
assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
std::string result("xcmp xxx");
result[6] = cc1;
result[7] = cc2;
if (TI.isFloatingPoint()) {
result[0] = 'f';
result[5] = 'o'; // FIXME: Always map to ordered comparison ?
} else if (TI.isIntegral() || TI.isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
result.erase(5,1);
else if (TI.isSigned())
result[5] = 's';
else if (TI.isUnsigned() || TI.isPointer())
result[5] = 'u';
else
yyerror("Invalid integral type for setcc");
}
return result;
}
%}
%file-prefix="UpgradeParser"
@ -262,6 +291,8 @@ const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
%token <String> RET BR SWITCH INVOKE EXCEPT UNWIND UNREACHABLE
%token <String> ADD SUB MUL DIV UDIV SDIV FDIV REM UREM SREM FREM AND OR XOR
%token <String> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
%token <String> ICMP FCMP EQ NE SLT SGT SLE SGE OEQ ONE OLT OGT OLE OGE
%token <String> ORD UNO UEQ UNE ULT UGT ULE UGE
%token <String> MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR
%token <String> PHI_TOK SELECT SHL SHR ASHR LSHR VAARG
%token <String> EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR
@ -279,7 +310,8 @@ const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
%type <String> MemoryInst SymbolicValueRef OptSideEffect GlobalType
%type <String> FnDeclareLinkage BasicBlockList BigOrLittle AsmBlock
%type <String> Name ConstValueRef ConstVector External
%type <String> ShiftOps SetCondOps LogicalOps ArithmeticOps CastOps
%type <String> ShiftOps SetCondOps LogicalOps ArithmeticOps CastOps CompareOps
%type <String> Predicates
%type <ValList> ValueRefList ValueRefListE IndexList
@ -305,6 +337,9 @@ ArithmeticOps: ADD | SUB | MUL | DIV | UDIV | SDIV | FDIV
| REM | UREM | SREM | FREM;
LogicalOps : AND | OR | XOR;
SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
CompareOps : ICMP | FCMP;
Predicates : EQ | NE | SLT | SGT | SLE | SGE | ULT | UGT | ULE | UGE
| OEQ | ONE | OLT | OGT | OLE | OGE | ORD | UNO | UEQ | UNE ;
ShiftOps : SHL | SHR | ASHR | LSHR;
CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | FPTOUI | FPTOSI |
UITOFP | SITOFP | PTRTOINT | INTTOPTR | BITCAST | CAST
@ -627,10 +662,18 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
$$ = $1;
}
| SetCondOps '(' ConstVal ',' ConstVal ')' {
#if UPGRADE_SETCOND_OPS
*$1 = getCompareOp(*$1, $3.type);
#endif
*$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
$3.destroy(); $5.destroy();
$$ = $1;
}
| CompareOps Predicates '(' ConstVal ',' ConstVal ')' {
*$1 += "(" + *$2 + "," + *$4.cnst + "," + *$6.cnst + ")";
delete $2; $4.destroy(); $6.destroy();
$$ = $1;
}
| ShiftOps '(' ConstVal ',' ConstVal ')' {
const char* shiftop = $1->c_str();
if (*$1 == "shr")
@ -1132,10 +1175,18 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
$$ = $1;
}
| SetCondOps Types ValueRef ',' ValueRef {
#if UPGRADE_SETCOND_OPS
*$1 = getCompareOp(*$1, $2);
#endif
*$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
$2.destroy(); $3.destroy(); $5.destroy();
$$ = $1;
}
| CompareOps Predicates Types ValueRef ',' ValueRef ')' {
*$1 += " " + *$2 + " " + *$4.val + "," + *$6.val + ")";
delete $2; $4.destroy(); $6.destroy();
$$ = $1;
}
| NOT ResolvedVal {
*$1 += " " + *$2.val;
$2.destroy();