Regenerate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32128 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2006-12-02 20:21:22 +00:00
parent a8ca090440
commit 787207427a
7 changed files with 3850 additions and 3663 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,7 @@
#define RET_TY(sym,OldTY,NewTY,sign) \
Upgradelval.Type.newTy = new std::string(NewTY); \
Upgradelval.Type.oldTy = OldTY; \
Upgradelval.Type.elemTy = VoidTy; \
return sym
#define YY_NEVER_INTERACTIVE 1
@ -114,6 +115,7 @@ dllimport { RET_TOK( DLLIMPORT); }
dllexport { RET_TOK( DLLEXPORT); }
extern_weak { RET_TOK( EXTERN_WEAK); }
external { RET_TOK( EXTERNAL); }
uninitialized { RET_TOK( UNINITIALIZED); } // alias for external
implementation { RET_TOK( IMPLEMENTATION); }
zeroinitializer { RET_TOK( ZEROINITIALIZER); }
\.\.\. { RET_TOK( DOTDOTDOT); }
@ -163,11 +165,11 @@ type { RET_TOK(TYPE); }
add { RET_TOK( ADD); }
sub { RET_TOK( SUB); }
mul { RET_TOK( MUL); }
div { RET_TOK( UDIV); }
div { RET_TOK( DIV); }
udiv { RET_TOK( UDIV); }
sdiv { RET_TOK( SDIV); }
fdiv { RET_TOK( FDIV); }
rem { RET_TOK( UREM); }
rem { RET_TOK( REM); }
urem { RET_TOK( UREM); }
srem { RET_TOK( SREM); }
frem { RET_TOK( FREM); }
@ -207,7 +209,7 @@ br { RET_TOK( BR); }
switch { RET_TOK( SWITCH); }
invoke { RET_TOK( INVOKE); }
unwind { RET_TOK( UNWIND); }
except { RET_TOK( UNWIND); }
except { RET_TOK( EXCEPT); } // alias for unwind
unreachable { RET_TOK( UNREACHABLE); }
malloc { RET_TOK( MALLOC); }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -84,73 +84,77 @@
LITTLE = 310,
BIG = 311,
ALIGN = 312,
DEPLIBS = 313,
CALL = 314,
TAIL = 315,
ASM_TOK = 316,
MODULE = 317,
SIDEEFFECT = 318,
CC_TOK = 319,
CCC_TOK = 320,
CSRETCC_TOK = 321,
FASTCC_TOK = 322,
COLDCC_TOK = 323,
X86_STDCALLCC_TOK = 324,
X86_FASTCALLCC_TOK = 325,
DATALAYOUT = 326,
RET = 327,
BR = 328,
SWITCH = 329,
INVOKE = 330,
UNWIND = 331,
UNREACHABLE = 332,
ADD = 333,
SUB = 334,
MUL = 335,
UDIV = 336,
SDIV = 337,
FDIV = 338,
UREM = 339,
SREM = 340,
FREM = 341,
AND = 342,
OR = 343,
XOR = 344,
SETLE = 345,
SETGE = 346,
SETLT = 347,
SETGT = 348,
SETEQ = 349,
SETNE = 350,
MALLOC = 351,
ALLOCA = 352,
FREE = 353,
LOAD = 354,
STORE = 355,
GETELEMENTPTR = 356,
PHI_TOK = 357,
SELECT = 358,
SHL = 359,
SHR = 360,
ASHR = 361,
LSHR = 362,
VAARG = 363,
EXTRACTELEMENT = 364,
INSERTELEMENT = 365,
SHUFFLEVECTOR = 366,
CAST = 367,
TRUNC = 368,
ZEXT = 369,
SEXT = 370,
FPTRUNC = 371,
FPEXT = 372,
FPTOUI = 373,
FPTOSI = 374,
UITOFP = 375,
SITOFP = 376,
PTRTOINT = 377,
INTTOPTR = 378,
BITCAST = 379
UNINITIALIZED = 313,
DEPLIBS = 314,
CALL = 315,
TAIL = 316,
ASM_TOK = 317,
MODULE = 318,
SIDEEFFECT = 319,
CC_TOK = 320,
CCC_TOK = 321,
CSRETCC_TOK = 322,
FASTCC_TOK = 323,
COLDCC_TOK = 324,
X86_STDCALLCC_TOK = 325,
X86_FASTCALLCC_TOK = 326,
DATALAYOUT = 327,
RET = 328,
BR = 329,
SWITCH = 330,
INVOKE = 331,
EXCEPT = 332,
UNWIND = 333,
UNREACHABLE = 334,
ADD = 335,
SUB = 336,
MUL = 337,
DIV = 338,
UDIV = 339,
SDIV = 340,
FDIV = 341,
REM = 342,
UREM = 343,
SREM = 344,
FREM = 345,
AND = 346,
OR = 347,
XOR = 348,
SETLE = 349,
SETGE = 350,
SETLT = 351,
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
};
#endif
/* Tokens. */
@ -209,79 +213,83 @@
#define LITTLE 310
#define BIG 311
#define ALIGN 312
#define DEPLIBS 313
#define CALL 314
#define TAIL 315
#define ASM_TOK 316
#define MODULE 317
#define SIDEEFFECT 318
#define CC_TOK 319
#define CCC_TOK 320
#define CSRETCC_TOK 321
#define FASTCC_TOK 322
#define COLDCC_TOK 323
#define X86_STDCALLCC_TOK 324
#define X86_FASTCALLCC_TOK 325
#define DATALAYOUT 326
#define RET 327
#define BR 328
#define SWITCH 329
#define INVOKE 330
#define UNWIND 331
#define UNREACHABLE 332
#define ADD 333
#define SUB 334
#define MUL 335
#define UDIV 336
#define SDIV 337
#define FDIV 338
#define UREM 339
#define SREM 340
#define FREM 341
#define AND 342
#define OR 343
#define XOR 344
#define SETLE 345
#define SETGE 346
#define SETLT 347
#define SETGT 348
#define SETEQ 349
#define SETNE 350
#define MALLOC 351
#define ALLOCA 352
#define FREE 353
#define LOAD 354
#define STORE 355
#define GETELEMENTPTR 356
#define PHI_TOK 357
#define SELECT 358
#define SHL 359
#define SHR 360
#define ASHR 361
#define LSHR 362
#define VAARG 363
#define EXTRACTELEMENT 364
#define INSERTELEMENT 365
#define SHUFFLEVECTOR 366
#define CAST 367
#define TRUNC 368
#define ZEXT 369
#define SEXT 370
#define FPTRUNC 371
#define FPEXT 372
#define FPTOUI 373
#define FPTOSI 374
#define UITOFP 375
#define SITOFP 376
#define PTRTOINT 377
#define INTTOPTR 378
#define BITCAST 379
#define UNINITIALIZED 313
#define DEPLIBS 314
#define CALL 315
#define TAIL 316
#define ASM_TOK 317
#define MODULE 318
#define SIDEEFFECT 319
#define CC_TOK 320
#define CCC_TOK 321
#define CSRETCC_TOK 322
#define FASTCC_TOK 323
#define COLDCC_TOK 324
#define X86_STDCALLCC_TOK 325
#define X86_FASTCALLCC_TOK 326
#define DATALAYOUT 327
#define RET 328
#define BR 329
#define SWITCH 330
#define INVOKE 331
#define EXCEPT 332
#define UNWIND 333
#define UNREACHABLE 334
#define ADD 335
#define SUB 336
#define MUL 337
#define DIV 338
#define UDIV 339
#define SDIV 340
#define FDIV 341
#define REM 342
#define UREM 343
#define SREM 344
#define FREM 345
#define AND 346
#define OR 347
#define XOR 348
#define SETLE 349
#define SETGE 350
#define SETLT 351
#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
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 211 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
#line 239 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
@ -290,7 +298,7 @@ typedef union YYSTYPE {
ValueList* ValList;
} YYSTYPE;
/* Line 1447 of yacc.c. */
#line 294 "UpgradeParser.tab.h"
#line 302 "UpgradeParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -65,9 +65,10 @@ void UpgradeAssembly(const std::string &infile, std::istream& in,
static void ResolveType(TypeInfo& Ty) {
if (Ty.oldTy == UnresolvedTy) {
TypeMap::iterator I = NamedTypes.find(*Ty.newTy);
if (I != NamedTypes.end())
if (I != NamedTypes.end()) {
Ty.oldTy = I->second.oldTy;
else {
Ty.elemTy = I->second.elemTy;
} else {
std::string msg("Can't resolve type: ");
msg += *Ty.newTy;
yyerror(msg.c_str());
@ -76,6 +77,7 @@ static void ResolveType(TypeInfo& Ty) {
unsigned ref = atoi(&((Ty.newTy->c_str())[1])); // Skip the '\\'
if (ref < EnumeratedTypes.size()) {
Ty.oldTy = EnumeratedTypes[ref].oldTy;
Ty.elemTy = EnumeratedTypes[ref].elemTy;
} else {
std::string msg("Can't resolve type: ");
msg += *Ty.newTy;
@ -204,6 +206,32 @@ static std::string getCastUpgrade(
return Result;
}
const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
const char* op = opcode.c_str();
TypeInfo Ty = TI;
ResolveType(Ty);
if (Ty.isPacked())
Ty.oldTy = Ty.getElementType();
if (opcode == "div")
if (Ty.isFloatingPoint())
op = "fdiv";
else if (Ty.isUnsigned())
op = "udiv";
else if (Ty.isSigned())
op = "sdiv";
else
yyerror("Invalid type for div instruction");
else if (opcode == "rem")
if (Ty.isFloatingPoint())
op = "frem";
else if (Ty.isUnsigned())
op = "urem";
else if (Ty.isSigned())
op = "srem";
else
yyerror("Invalid type for rem instruction");
return op;
}
%}
%file-prefix="UpgradeParser"
@ -226,13 +254,13 @@ static std::string getCastUpgrade(
%token <String> TO DOTDOTDOT CONST INTERNAL LINKONCE WEAK
%token <String> DLLIMPORT DLLEXPORT EXTERN_WEAK APPENDING
%token <String> NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG
%token <String> ALIGN
%token <String> ALIGN UNINITIALIZED
%token <String> DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT
%token <String> CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK
%token <String> X86_STDCALLCC_TOK X86_FASTCALLCC_TOK
%token <String> DATALAYOUT
%token <String> RET BR SWITCH INVOKE UNWIND UNREACHABLE
%token <String> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
%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> MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR
%token <String> PHI_TOK SELECT SHL SHR ASHR LSHR VAARG
@ -247,10 +275,10 @@ static std::string getCastUpgrade(
%type <String> ArgVal ArgListH ArgList FunctionHeaderH BEGIN FunctionHeader END
%type <String> Function FunctionProto BasicBlock TypeListI
%type <String> InstructionList BBTerminatorInst JumpTable Inst PHIList
%type <String> OptTailCall InstVal OptVolatile
%type <String> OptTailCall InstVal OptVolatile Unwind
%type <String> MemoryInst SymbolicValueRef OptSideEffect GlobalType
%type <String> FnDeclareLinkage BasicBlockList BigOrLittle AsmBlock
%type <String> Name ConstValueRef ConstVector
%type <String> Name ConstValueRef ConstVector External
%type <String> ShiftOps SetCondOps LogicalOps ArithmeticOps CastOps
%type <ValList> ValueRefList ValueRefListE IndexList
@ -273,7 +301,8 @@ EInt64Val : ESINT64VAL | EUINT64VAL;
// Operations that are notably excluded from this list include:
// RET, BR, & SWITCH because they end basic blocks and are treated specially.
ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM;
ArithmeticOps: ADD | SUB | MUL | DIV | UDIV | SDIV | FDIV
| REM | UREM | SREM | FREM;
LogicalOps : AND | OR | XOR;
SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
ShiftOps : SHL | SHR | ASHR | LSHR;
@ -378,12 +407,10 @@ UpRTypes
$$.newTy = $1;
$$.oldTy = UnresolvedTy;
}
| PrimType
;
// Include derived types in the Types production.
//
UpRTypes : '\\' EUINT64VAL { // Type UpReference
| PrimType {
$$ = $1;
}
| '\\' EUINT64VAL { // Type UpReference
$2->insert(0, "\\");
$$.newTy = $2;
$$.oldTy = NumericTy;
@ -400,6 +427,7 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
delete $4.newTy;
$$.newTy = $2;
$$.oldTy = ArrayTy;
$$.elemTy = $4.oldTy;
}
| '<' EUINT64VAL 'x' UpRTypes '>' { // Packed array type?
$2->insert(0,"< ");
@ -407,6 +435,7 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
delete $4.newTy;
$$.newTy = $2;
$$.oldTy = PackedTy;
$$.elemTy = $4.oldTy;
}
| '{' TypeListI '}' { // Structure type?
$2->insert(0, "{ ");
@ -420,6 +449,7 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
}
| UpRTypes '*' { // Pointer type?
*$1.newTy += '*';
$$.elemTy = $1.oldTy;
$1.oldTy = PointerTy;
$$ = $1;
};
@ -586,9 +616,10 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
$$ = $1;
}
| ArithmeticOps '(' ConstVal ',' ConstVal ')' {
*$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
$3.destroy(); $5.destroy();
$$ = $1;
const char* op = getDivRemOpcode(*$1, $3.type);
$$ = new std::string(op);
*$$ += "(" + *$3.cnst + "," + *$5.cnst + ")";
delete $1; $3.destroy(); $5.destroy();
}
| LogicalOps '(' ConstVal ',' ConstVal ')' {
*$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
@ -671,12 +702,15 @@ DefinitionList : DefinitionList Function {
}
| ConstPool { $$ = 0; }
External : EXTERNAL | UNINITIALIZED { $$ = $1; *$$ = "external"; }
// ConstPool - Constants with optional names assigned to them.
ConstPool : ConstPool OptAssign TYPE TypesV {
EnumeratedTypes.push_back($4);
if (!$2->empty()) {
NamedTypes[*$2].newTy = new std::string(*$4.newTy);
NamedTypes[*$2].oldTy = $4.oldTy;
NamedTypes[*$2].elemTy = $4.elemTy;
*O << *$2 << " = ";
}
*O << "type " << *$4.newTy << "\n";
@ -700,7 +734,7 @@ ConstPool : ConstPool OptAssign TYPE TypesV {
delete $2; delete $3; delete $4; $5.destroy(); delete $6;
$$ = 0;
}
| ConstPool OptAssign EXTERNAL GlobalType Types GlobalVarAttributes {
| ConstPool OptAssign External GlobalType Types GlobalVarAttributes {
if (!$2->empty())
*O << *$2 << " = ";
*O << *$3 << " " << *$4 << " " << *$5.newTy << " " << *$6 << "\n";
@ -837,12 +871,8 @@ FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')'
$$ = $1;
};
BEGIN : BEGINTOK {
$$ = new std::string("begin");
}
| '{' {
$$ = new std::string ("{");
}
BEGIN : BEGINTOK { $$ = new std::string("{"); delete $1; }
| '{' { $$ = new std::string ("{"); }
FunctionHeader : OptLinkage FunctionHeaderH BEGIN {
if (!$1->empty()) {
@ -853,7 +883,7 @@ FunctionHeader : OptLinkage FunctionHeaderH BEGIN {
$$ = 0;
};
END : ENDTOK { $$ = new std::string("end"); }
END : ENDTOK { $$ = new std::string("}"); delete $1; }
| '}' { $$ = new std::string("}"); };
Function : FunctionHeader BasicBlockList END {
@ -960,6 +990,8 @@ InstructionList : InstructionList Inst {
$$ = 0;
};
Unwind : UNWIND | EXCEPT { $$ = $1; *$$ = "unwind"; }
BBTerminatorInst : RET ResolvedVal { // Return with a result...
*O << " " << *$1 << " " << *$2.val << "\n";
delete $1; $2.destroy();
@ -997,7 +1029,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
$$ = 0;
}
| OptAssign INVOKE OptCallingConv TypesV ValueRef '(' ValueRefListE ')'
TO LABEL ValueRef UNWIND LABEL ValueRef {
TO LABEL ValueRef Unwind LABEL ValueRef {
*O << " ";
if (!$1->empty())
*O << *$1 << " = ";
@ -1016,7 +1048,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
$14.destroy();
$$ = 0;
}
| UNWIND {
| Unwind {
*O << " " << *$1 << "\n";
delete $1;
$$ = 0;
@ -1089,9 +1121,10 @@ OptTailCall
;
InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
*$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
$2.destroy(); $3.destroy(); $5.destroy();
$$ = $1;
const char* op = getDivRemOpcode(*$1, $2);
$$ = new std::string(op);
*$$ += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
delete $1; $2.destroy(); $3.destroy(); $5.destroy();
}
| LogicalOps Types ValueRef ',' ValueRef {
*$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;