mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
LEVEL = ../..
|
LEVEL = ../..
|
||||||
TOOLNAME = llvm-upgrade
|
TOOLNAME = llvm-upgrade
|
||||||
LINK_COMPONENTS := support system
|
LINK_COMPONENTS := BCWriter Core support system
|
||||||
REQUIRES_EH := 1
|
REQUIRES_EH := 1
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -25,8 +25,9 @@
|
|||||||
%option noyymore
|
%option noyymore
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
|
||||||
#include "UpgradeInternals.h"
|
#include "UpgradeInternals.h"
|
||||||
|
#include "llvm/Module.h"
|
||||||
|
#include <list>
|
||||||
#include "UpgradeParser.h"
|
#include "UpgradeParser.h"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@@ -41,17 +42,108 @@
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define YY_NEVER_INTERACTIVE 1
|
||||||
|
|
||||||
// Construct a token value for a non-obsolete token
|
// Construct a token value for a non-obsolete token
|
||||||
#define RET_TOK(sym) \
|
#define RET_TOK(type, Enum, sym) \
|
||||||
Upgradelval.String = new std::string(yytext); \
|
Upgradelval.type = Enum; \
|
||||||
return sym
|
return sym
|
||||||
|
|
||||||
#define RET_TY(sym,OldTY,NewTY,sign) \
|
#define RET_TY(sym,NewTY,sign) \
|
||||||
Upgradelval.Ty = getType(NewTY, OldTY); \
|
Upgradelval.PrimType.T = NewTY; \
|
||||||
|
Upgradelval.PrimType.S = sign; \
|
||||||
return sym
|
return sym
|
||||||
|
|
||||||
#define YY_NEVER_INTERACTIVE 1
|
namespace llvm {
|
||||||
|
|
||||||
|
// TODO: All of the static identifiers are figured out by the lexer,
|
||||||
|
// these should be hashed to reduce the lexer size
|
||||||
|
|
||||||
|
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
|
||||||
|
// appropriate character. If AllowNull is set to false, a \00 value will cause
|
||||||
|
// an exception to be thrown.
|
||||||
|
//
|
||||||
|
// If AllowNull is set to true, the return value of the function points to the
|
||||||
|
// last character of the string in memory.
|
||||||
|
//
|
||||||
|
char *UnEscapeLexed(char *Buffer, bool AllowNull) {
|
||||||
|
char *BOut = Buffer;
|
||||||
|
for (char *BIn = Buffer; *BIn; ) {
|
||||||
|
if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) {
|
||||||
|
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
|
||||||
|
*BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
|
||||||
|
if (!AllowNull && !*BOut)
|
||||||
|
error("String literal cannot accept \\00 escape!");
|
||||||
|
|
||||||
|
BIn[3] = Tmp; // Restore character
|
||||||
|
BIn += 3; // Skip over handled chars
|
||||||
|
++BOut;
|
||||||
|
} else {
|
||||||
|
*BOut++ = *BIn++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return BOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
// atoull - Convert an ascii string of decimal digits into the unsigned long
|
||||||
|
// long representation... this does not have to do input error checking,
|
||||||
|
// because we know that the input will be matched by a suitable regex...
|
||||||
|
//
|
||||||
|
static uint64_t atoull(const char *Buffer) {
|
||||||
|
uint64_t Result = 0;
|
||||||
|
for (; *Buffer; Buffer++) {
|
||||||
|
uint64_t OldRes = Result;
|
||||||
|
Result *= 10;
|
||||||
|
Result += *Buffer-'0';
|
||||||
|
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||||
|
error("constant bigger than 64 bits detected!");
|
||||||
|
}
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint64_t HexIntToVal(const char *Buffer) {
|
||||||
|
uint64_t Result = 0;
|
||||||
|
for (; *Buffer; ++Buffer) {
|
||||||
|
uint64_t OldRes = Result;
|
||||||
|
Result *= 16;
|
||||||
|
char C = *Buffer;
|
||||||
|
if (C >= '0' && C <= '9')
|
||||||
|
Result += C-'0';
|
||||||
|
else if (C >= 'A' && C <= 'F')
|
||||||
|
Result += C-'A'+10;
|
||||||
|
else if (C >= 'a' && C <= 'f')
|
||||||
|
Result += C-'a'+10;
|
||||||
|
|
||||||
|
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||||
|
error("constant bigger than 64 bits detected!");
|
||||||
|
}
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// HexToFP - Convert the ascii string in hexidecimal format to the floating
|
||||||
|
// point representation of it.
|
||||||
|
//
|
||||||
|
static double HexToFP(const char *Buffer) {
|
||||||
|
// Behave nicely in the face of C TBAA rules... see:
|
||||||
|
// http://www.nullstone.com/htmls/category/aliastyp.htm
|
||||||
|
union {
|
||||||
|
uint64_t UI;
|
||||||
|
double FP;
|
||||||
|
} UIntToFP;
|
||||||
|
UIntToFP.UI = HexIntToVal(Buffer);
|
||||||
|
|
||||||
|
assert(sizeof(double) == sizeof(uint64_t) &&
|
||||||
|
"Data sizes incompatible on this target!");
|
||||||
|
return UIntToFP.FP; // Cast Hex constant to double
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End llvm namespace
|
||||||
|
|
||||||
|
using namespace llvm;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
@@ -98,168 +190,219 @@ HexIntConstant [us]0x[0-9A-Fa-f]+
|
|||||||
|
|
||||||
{Comment} { /* Ignore comments for now */ }
|
{Comment} { /* Ignore comments for now */ }
|
||||||
|
|
||||||
begin { RET_TOK( BEGINTOK); }
|
begin { return BEGINTOK; }
|
||||||
end { RET_TOK( ENDTOK); }
|
end { return ENDTOK; }
|
||||||
true { RET_TOK( TRUETOK); }
|
true { return TRUETOK; }
|
||||||
false { RET_TOK( FALSETOK); }
|
false { return FALSETOK; }
|
||||||
declare { RET_TOK( DECLARE); }
|
declare { return DECLARE; }
|
||||||
global { RET_TOK( GLOBAL); }
|
global { return GLOBAL; }
|
||||||
constant { RET_TOK( CONSTANT); }
|
constant { return CONSTANT; }
|
||||||
internal { RET_TOK( INTERNAL); }
|
internal { return INTERNAL; }
|
||||||
linkonce { RET_TOK( LINKONCE); }
|
linkonce { return LINKONCE; }
|
||||||
weak { RET_TOK( WEAK); }
|
weak { return WEAK; }
|
||||||
appending { RET_TOK( APPENDING); }
|
appending { return APPENDING; }
|
||||||
dllimport { RET_TOK( DLLIMPORT); }
|
dllimport { return DLLIMPORT; }
|
||||||
dllexport { RET_TOK( DLLEXPORT); }
|
dllexport { return DLLEXPORT; }
|
||||||
extern_weak { RET_TOK( EXTERN_WEAK); }
|
extern_weak { return EXTERN_WEAK; }
|
||||||
external { RET_TOK( EXTERNAL); }
|
uninitialized { return EXTERNAL; } /* Deprecated, turn into external */
|
||||||
uninitialized { RET_TOK( UNINITIALIZED); } // alias for external
|
external { return EXTERNAL; }
|
||||||
implementation { RET_TOK( IMPLEMENTATION); }
|
implementation { return IMPLEMENTATION; }
|
||||||
zeroinitializer { RET_TOK( ZEROINITIALIZER); }
|
zeroinitializer { return ZEROINITIALIZER; }
|
||||||
\.\.\. { RET_TOK( DOTDOTDOT); }
|
\.\.\. { return DOTDOTDOT; }
|
||||||
undef { RET_TOK( UNDEF); }
|
undef { return UNDEF; }
|
||||||
null { RET_TOK( NULL_TOK); }
|
null { return NULL_TOK; }
|
||||||
to { RET_TOK( TO); }
|
to { return TO; }
|
||||||
tail { RET_TOK( TAIL); }
|
except { return EXCEPT; }
|
||||||
target { RET_TOK( TARGET); }
|
not { return NOT; } /* Deprecated, turned into XOR */
|
||||||
triple { RET_TOK( TRIPLE); }
|
tail { return TAIL; }
|
||||||
deplibs { RET_TOK( DEPLIBS); }
|
target { return TARGET; }
|
||||||
endian { RET_TOK( ENDIAN); }
|
triple { return TRIPLE; }
|
||||||
pointersize { RET_TOK( POINTERSIZE); }
|
deplibs { return DEPLIBS; }
|
||||||
datalayout { RET_TOK( DATALAYOUT); }
|
endian { return ENDIAN; }
|
||||||
little { RET_TOK( LITTLE); }
|
pointersize { return POINTERSIZE; }
|
||||||
big { RET_TOK( BIG); }
|
datalayout { return DATALAYOUT; }
|
||||||
volatile { RET_TOK( VOLATILE); }
|
little { return LITTLE; }
|
||||||
align { RET_TOK( ALIGN); }
|
big { return BIG; }
|
||||||
section { RET_TOK( SECTION); }
|
volatile { return VOLATILE; }
|
||||||
module { RET_TOK( MODULE); }
|
align { return ALIGN; }
|
||||||
asm { RET_TOK( ASM_TOK); }
|
section { return SECTION; }
|
||||||
sideeffect { RET_TOK( SIDEEFFECT); }
|
module { return MODULE; }
|
||||||
|
asm { return ASM_TOK; }
|
||||||
|
sideeffect { return SIDEEFFECT; }
|
||||||
|
|
||||||
cc { RET_TOK( CC_TOK); }
|
cc { return CC_TOK; }
|
||||||
ccc { RET_TOK( CCC_TOK); }
|
ccc { return CCC_TOK; }
|
||||||
csretcc { RET_TOK( CSRETCC_TOK); }
|
csretcc { return CSRETCC_TOK; }
|
||||||
fastcc { RET_TOK( FASTCC_TOK); }
|
fastcc { return FASTCC_TOK; }
|
||||||
coldcc { RET_TOK( COLDCC_TOK); }
|
coldcc { return COLDCC_TOK; }
|
||||||
x86_stdcallcc { RET_TOK( X86_STDCALLCC_TOK); }
|
x86_stdcallcc { return X86_STDCALLCC_TOK; }
|
||||||
x86_fastcallcc { RET_TOK( X86_FASTCALLCC_TOK); }
|
x86_fastcallcc { return X86_FASTCALLCC_TOK; }
|
||||||
|
|
||||||
void { RET_TY(VOID,VoidTy,"void",false); }
|
sbyte { RET_TY(SBYTE, Type::Int8Ty, Signed); }
|
||||||
bool { RET_TY(BOOL,BoolTy,"i1",false); }
|
ubyte { RET_TY(UBYTE, Type::Int8Ty, Unsigned); }
|
||||||
sbyte { RET_TY(SBYTE,SByteTy,"i8",true); }
|
short { RET_TY(SHORT, Type::Int16Ty, Signed); }
|
||||||
ubyte { RET_TY(UBYTE,UByteTy,"i8",false); }
|
ushort { RET_TY(USHORT, Type::Int16Ty, Unsigned); }
|
||||||
short { RET_TY(SHORT,ShortTy,"i16",true); }
|
int { RET_TY(INT, Type::Int32Ty, Signed); }
|
||||||
ushort { RET_TY(USHORT,UShortTy,"i16",false); }
|
uint { RET_TY(UINT, Type::Int32Ty, Unsigned); }
|
||||||
int { RET_TY(INT,IntTy,"i32",true); }
|
long { RET_TY(LONG, Type::Int64Ty, Signed); }
|
||||||
uint { RET_TY(UINT,UIntTy,"i32",false); }
|
ulong { RET_TY(ULONG, Type::Int64Ty, Unsigned); }
|
||||||
long { RET_TY(LONG,LongTy,"i64",true); }
|
void { RET_TY(VOID, Type::VoidTy, Signless ); }
|
||||||
ulong { RET_TY(ULONG,ULongTy,"i64",false); }
|
bool { RET_TY(BOOL, Type::Int1Ty, Unsigned ); }
|
||||||
i8 { RET_TY(UBYTE,UByteTy,"i8",false); }
|
float { RET_TY(FLOAT, Type::FloatTy, Signless ); }
|
||||||
i16 { RET_TY(USHORT,UShortTy,"i16",false); }
|
double { RET_TY(DOUBLE, Type::DoubleTy,Signless); }
|
||||||
i32 { RET_TY(UINT,UIntTy,"i32",false); }
|
label { RET_TY(LABEL, Type::LabelTy, Signless ); }
|
||||||
i64 { RET_TY(ULONG,ULongTy,"i64",false); }
|
type { return TYPE; }
|
||||||
float { RET_TY(FLOAT,FloatTy,"float",false); }
|
opaque { return OPAQUE; }
|
||||||
double { RET_TY(DOUBLE,DoubleTy,"double",false); }
|
|
||||||
label { RET_TY(LABEL,LabelTy,"label",false); }
|
|
||||||
opaque { RET_TOK(OPAQUE); }
|
|
||||||
type { RET_TOK(TYPE); }
|
|
||||||
|
|
||||||
add { RET_TOK( ADD); }
|
add { RET_TOK(BinaryOpVal, AddOp, ADD); }
|
||||||
sub { RET_TOK( SUB); }
|
sub { RET_TOK(BinaryOpVal, SubOp, SUB); }
|
||||||
mul { RET_TOK( MUL); }
|
mul { RET_TOK(BinaryOpVal, MulOp, MUL); }
|
||||||
div { RET_TOK( DIV); }
|
div { RET_TOK(BinaryOpVal, DivOp, DIV); }
|
||||||
udiv { RET_TOK( UDIV); }
|
udiv { RET_TOK(BinaryOpVal, UDivOp, UDIV); }
|
||||||
sdiv { RET_TOK( SDIV); }
|
sdiv { RET_TOK(BinaryOpVal, SDivOp, SDIV); }
|
||||||
fdiv { RET_TOK( FDIV); }
|
fdiv { RET_TOK(BinaryOpVal, FDivOp, FDIV); }
|
||||||
rem { RET_TOK( REM); }
|
rem { RET_TOK(BinaryOpVal, RemOp, REM); }
|
||||||
urem { RET_TOK( UREM); }
|
urem { RET_TOK(BinaryOpVal, URemOp, UREM); }
|
||||||
srem { RET_TOK( SREM); }
|
srem { RET_TOK(BinaryOpVal, SRemOp, SREM); }
|
||||||
frem { RET_TOK( FREM); }
|
frem { RET_TOK(BinaryOpVal, FRemOp, FREM); }
|
||||||
and { RET_TOK( AND); }
|
and { RET_TOK(BinaryOpVal, AndOp, AND); }
|
||||||
or { RET_TOK( OR); }
|
or { RET_TOK(BinaryOpVal, OrOp , OR ); }
|
||||||
xor { RET_TOK( XOR); }
|
xor { RET_TOK(BinaryOpVal, XorOp, XOR); }
|
||||||
setne { RET_TOK( SETNE); }
|
setne { RET_TOK(BinaryOpVal, SetNE, SETNE); }
|
||||||
seteq { RET_TOK( SETEQ); }
|
seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
|
||||||
setlt { RET_TOK( SETLT); }
|
setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); }
|
||||||
setgt { RET_TOK( SETGT); }
|
setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); }
|
||||||
setle { RET_TOK( SETLE); }
|
setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
|
||||||
setge { RET_TOK( SETGE); }
|
setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
|
||||||
icmp { RET_TOK(ICMP); }
|
icmp { RET_TOK(OtherOpVal, ICmpOp, ICMP); }
|
||||||
fcmp { RET_TOK(FCMP); }
|
fcmp { RET_TOK(OtherOpVal, FCmpOp, 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); }
|
eq { return EQ; }
|
||||||
call { RET_TOK( CALL); }
|
ne { return NE; }
|
||||||
cast { RET_TOK( CAST); }
|
slt { return SLT; }
|
||||||
trunc { RET_TOK( TRUNC); }
|
sgt { return SGT; }
|
||||||
zext { RET_TOK( ZEXT); }
|
sle { return SLE; }
|
||||||
sext { RET_TOK( SEXT); }
|
sge { return SGE; }
|
||||||
fptrunc { RET_TOK( FPTRUNC); }
|
ult { return ULT; }
|
||||||
fpext { RET_TOK( FPEXT); }
|
ugt { return UGT; }
|
||||||
fptoui { RET_TOK( FPTOUI); }
|
ule { return ULE; }
|
||||||
fptosi { RET_TOK( FPTOSI); }
|
uge { return UGE; }
|
||||||
uitofp { RET_TOK( UITOFP); }
|
oeq { return OEQ; }
|
||||||
sitofp { RET_TOK( SITOFP); }
|
one { return ONE; }
|
||||||
ptrtoint { RET_TOK( PTRTOINT); }
|
olt { return OLT; }
|
||||||
inttoptr { RET_TOK( INTTOPTR); }
|
ogt { return OGT; }
|
||||||
bitcast { RET_TOK( BITCAST); }
|
ole { return OLE; }
|
||||||
select { RET_TOK( SELECT); }
|
oge { return OGE; }
|
||||||
shl { RET_TOK( SHL); }
|
ord { return ORD; }
|
||||||
shr { RET_TOK( SHR); }
|
uno { return UNO; }
|
||||||
ashr { RET_TOK( ASHR); }
|
ueq { return UEQ; }
|
||||||
lshr { RET_TOK( LSHR); }
|
une { return UNE; }
|
||||||
va_arg { RET_TOK( VAARG); }
|
|
||||||
ret { RET_TOK( RET); }
|
|
||||||
br { RET_TOK( BR); }
|
|
||||||
switch { RET_TOK( SWITCH); }
|
|
||||||
invoke { RET_TOK( INVOKE); }
|
|
||||||
unwind { RET_TOK( UNWIND); }
|
|
||||||
except { RET_TOK( EXCEPT); } // alias for unwind
|
|
||||||
unreachable { RET_TOK( UNREACHABLE); }
|
|
||||||
|
|
||||||
malloc { RET_TOK( MALLOC); }
|
phi { RET_TOK(OtherOpVal, PHIOp, PHI_TOK); }
|
||||||
alloca { RET_TOK( ALLOCA); }
|
call { RET_TOK(OtherOpVal, CallOp, CALL); }
|
||||||
free { RET_TOK( FREE); }
|
cast { RET_TOK(CastOpVal, CastOp, CAST); }
|
||||||
load { RET_TOK( LOAD); }
|
trunc { RET_TOK(CastOpVal, TruncOp, TRUNC); }
|
||||||
store { RET_TOK( STORE); }
|
zext { RET_TOK(CastOpVal, ZExtOp , ZEXT); }
|
||||||
getelementptr { RET_TOK( GETELEMENTPTR); }
|
sext { RET_TOK(CastOpVal, SExtOp, SEXT); }
|
||||||
|
fptrunc { RET_TOK(CastOpVal, FPTruncOp, FPTRUNC); }
|
||||||
|
fpext { RET_TOK(CastOpVal, FPExtOp, FPEXT); }
|
||||||
|
fptoui { RET_TOK(CastOpVal, FPToUIOp, FPTOUI); }
|
||||||
|
fptosi { RET_TOK(CastOpVal, FPToSIOp, FPTOSI); }
|
||||||
|
uitofp { RET_TOK(CastOpVal, UIToFPOp, UITOFP); }
|
||||||
|
sitofp { RET_TOK(CastOpVal, SIToFPOp, SITOFP); }
|
||||||
|
ptrtoint { RET_TOK(CastOpVal, PtrToIntOp, PTRTOINT); }
|
||||||
|
inttoptr { RET_TOK(CastOpVal, IntToPtrOp, INTTOPTR); }
|
||||||
|
bitcast { RET_TOK(CastOpVal, BitCastOp, BITCAST); }
|
||||||
|
select { RET_TOK(OtherOpVal, SelectOp, SELECT); }
|
||||||
|
shl { RET_TOK(OtherOpVal, ShlOp, SHL); }
|
||||||
|
shr { RET_TOK(OtherOpVal, ShrOp, SHR); }
|
||||||
|
lshr { RET_TOK(OtherOpVal, LShrOp, LSHR); }
|
||||||
|
ashr { RET_TOK(OtherOpVal, AShrOp, ASHR); }
|
||||||
|
vanext { return VANEXT_old; }
|
||||||
|
vaarg { return VAARG_old; }
|
||||||
|
va_arg { RET_TOK(OtherOpVal, VAArg , VAARG); }
|
||||||
|
ret { RET_TOK(TermOpVal, RetOp, RET); }
|
||||||
|
br { RET_TOK(TermOpVal, BrOp, BR); }
|
||||||
|
switch { RET_TOK(TermOpVal, SwitchOp, SWITCH); }
|
||||||
|
invoke { RET_TOK(TermOpVal, InvokeOp, INVOKE); }
|
||||||
|
unwind { return UNWIND; }
|
||||||
|
unreachable { RET_TOK(TermOpVal, UnreachableOp, UNREACHABLE); }
|
||||||
|
|
||||||
extractelement { RET_TOK( EXTRACTELEMENT); }
|
malloc { RET_TOK(MemOpVal, MallocOp, MALLOC); }
|
||||||
insertelement { RET_TOK( INSERTELEMENT); }
|
alloca { RET_TOK(MemOpVal, AllocaOp, ALLOCA); }
|
||||||
shufflevector { RET_TOK( SHUFFLEVECTOR); }
|
free { RET_TOK(MemOpVal, FreeOp, FREE); }
|
||||||
|
load { RET_TOK(MemOpVal, LoadOp, LOAD); }
|
||||||
|
store { RET_TOK(MemOpVal, StoreOp, STORE); }
|
||||||
|
getelementptr { RET_TOK(MemOpVal, GetElementPtrOp, GETELEMENTPTR); }
|
||||||
|
|
||||||
|
extractelement { RET_TOK(OtherOpVal, ExtractElementOp, EXTRACTELEMENT); }
|
||||||
|
insertelement { RET_TOK(OtherOpVal, InsertElementOp, INSERTELEMENT); }
|
||||||
|
shufflevector { RET_TOK(OtherOpVal, ShuffleVectorOp, SHUFFLEVECTOR); }
|
||||||
|
|
||||||
|
|
||||||
{VarID} { RET_TOK( VAR_ID); }
|
{VarID} {
|
||||||
{Label} { RET_TOK( LABELSTR); }
|
UnEscapeLexed(yytext+1);
|
||||||
{QuoteLabel} { RET_TOK( LABELSTR); }
|
Upgradelval.StrVal = strdup(yytext+1); // Skip %
|
||||||
{StringConstant} { RET_TOK( STRINGCONSTANT ); }
|
return VAR_ID;
|
||||||
{PInteger} { RET_TOK( EUINT64VAL ); }
|
}
|
||||||
{NInteger} { RET_TOK( ESINT64VAL ); }
|
{Label} {
|
||||||
{HexIntConstant} { RET_TOK( yytext[0] == 's' ? ESINT64VAL : EUINT64VAL ); }
|
yytext[strlen(yytext)-1] = 0; // nuke colon
|
||||||
{EPInteger} { RET_TOK( UINTVAL); }
|
UnEscapeLexed(yytext);
|
||||||
{ENInteger} { RET_TOK( SINTVAL); }
|
Upgradelval.StrVal = strdup(yytext);
|
||||||
{FPConstant} { RET_TOK( FPVAL); }
|
return LABELSTR;
|
||||||
{HexFPConstant} { RET_TOK( FPVAL); }
|
}
|
||||||
<<EOF>> {
|
{QuoteLabel} {
|
||||||
|
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
|
||||||
|
UnEscapeLexed(yytext+1);
|
||||||
|
Upgradelval.StrVal = strdup(yytext+1);
|
||||||
|
return LABELSTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
{StringConstant} { // Note that we cannot unescape a string constant here! The
|
||||||
|
// string constant might contain a \00 which would not be
|
||||||
|
// understood by the string stuff. It is valid to make a
|
||||||
|
// [sbyte] c"Hello World\00" constant, for example.
|
||||||
|
//
|
||||||
|
yytext[strlen(yytext)-1] = 0; // nuke end quote
|
||||||
|
Upgradelval.StrVal = strdup(yytext+1); // Nuke start quote
|
||||||
|
return STRINGCONSTANT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{PInteger} { Upgradelval.UInt64Val = atoull(yytext); return EUINT64VAL; }
|
||||||
|
{NInteger} {
|
||||||
|
uint64_t Val = atoull(yytext+1);
|
||||||
|
// +1: we have bigger negative range
|
||||||
|
if (Val > (uint64_t)INT64_MAX+1)
|
||||||
|
error("Constant too large for signed 64 bits!");
|
||||||
|
Upgradelval.SInt64Val = -Val;
|
||||||
|
return ESINT64VAL;
|
||||||
|
}
|
||||||
|
{HexIntConstant} {
|
||||||
|
Upgradelval.UInt64Val = HexIntToVal(yytext+3);
|
||||||
|
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{EPInteger} {
|
||||||
|
uint64_t Val = atoull(yytext+1);
|
||||||
|
if ((unsigned)Val != Val)
|
||||||
|
error("Invalid value number (too large)!");
|
||||||
|
Upgradelval.UIntVal = unsigned(Val);
|
||||||
|
return UINTVAL;
|
||||||
|
}
|
||||||
|
{ENInteger} {
|
||||||
|
uint64_t Val = atoull(yytext+2);
|
||||||
|
// +1: we have bigger negative range
|
||||||
|
if (Val > (uint64_t)INT32_MAX+1)
|
||||||
|
error("Constant too large for signed 32 bits!");
|
||||||
|
Upgradelval.SIntVal = (int)-Val;
|
||||||
|
return SINTVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{FPConstant} { Upgradelval.FPVal = atof(yytext); return FPVAL; }
|
||||||
|
{HexFPConstant} { Upgradelval.FPVal = HexToFP(yytext); return FPVAL; }
|
||||||
|
|
||||||
|
<<EOF>> {
|
||||||
/* Make sure to free the internal buffers for flex when we are
|
/* Make sure to free the internal buffers for flex when we are
|
||||||
* done reading our input!
|
* done reading our input!
|
||||||
*/
|
*/
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/* A Bison parser, made from /usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.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,78 +15,75 @@
|
|||||||
|
|
||||||
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_UPGRADEPARSER_TAB_H
|
|
||||||
# define BISON_UPGRADEPARSER_TAB_H
|
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum yytokentype {
|
enum yytokentype {
|
||||||
VOID = 258,
|
ESINT64VAL = 258,
|
||||||
BOOL = 259,
|
EUINT64VAL = 259,
|
||||||
SBYTE = 260,
|
SINTVAL = 260,
|
||||||
UBYTE = 261,
|
UINTVAL = 261,
|
||||||
SHORT = 262,
|
FPVAL = 262,
|
||||||
USHORT = 263,
|
VOID = 263,
|
||||||
INT = 264,
|
BOOL = 264,
|
||||||
UINT = 265,
|
SBYTE = 265,
|
||||||
LONG = 266,
|
UBYTE = 266,
|
||||||
ULONG = 267,
|
SHORT = 267,
|
||||||
FLOAT = 268,
|
USHORT = 268,
|
||||||
DOUBLE = 269,
|
INT = 269,
|
||||||
LABEL = 270,
|
UINT = 270,
|
||||||
OPAQUE = 271,
|
LONG = 271,
|
||||||
ESINT64VAL = 272,
|
ULONG = 272,
|
||||||
EUINT64VAL = 273,
|
FLOAT = 273,
|
||||||
SINTVAL = 274,
|
DOUBLE = 274,
|
||||||
UINTVAL = 275,
|
TYPE = 275,
|
||||||
FPVAL = 276,
|
LABEL = 276,
|
||||||
NULL_TOK = 277,
|
VAR_ID = 277,
|
||||||
UNDEF = 278,
|
LABELSTR = 278,
|
||||||
ZEROINITIALIZER = 279,
|
STRINGCONSTANT = 279,
|
||||||
TRUETOK = 280,
|
IMPLEMENTATION = 280,
|
||||||
FALSETOK = 281,
|
ZEROINITIALIZER = 281,
|
||||||
TYPE = 282,
|
TRUETOK = 282,
|
||||||
VAR_ID = 283,
|
FALSETOK = 283,
|
||||||
LABELSTR = 284,
|
BEGINTOK = 284,
|
||||||
STRINGCONSTANT = 285,
|
ENDTOK = 285,
|
||||||
IMPLEMENTATION = 286,
|
DECLARE = 286,
|
||||||
BEGINTOK = 287,
|
GLOBAL = 287,
|
||||||
ENDTOK = 288,
|
CONSTANT = 288,
|
||||||
DECLARE = 289,
|
SECTION = 289,
|
||||||
GLOBAL = 290,
|
VOLATILE = 290,
|
||||||
CONSTANT = 291,
|
TO = 291,
|
||||||
SECTION = 292,
|
DOTDOTDOT = 292,
|
||||||
VOLATILE = 293,
|
NULL_TOK = 293,
|
||||||
TO = 294,
|
UNDEF = 294,
|
||||||
DOTDOTDOT = 295,
|
CONST = 295,
|
||||||
CONST = 296,
|
INTERNAL = 296,
|
||||||
INTERNAL = 297,
|
LINKONCE = 297,
|
||||||
LINKONCE = 298,
|
WEAK = 298,
|
||||||
WEAK = 299,
|
APPENDING = 299,
|
||||||
DLLIMPORT = 300,
|
DLLIMPORT = 300,
|
||||||
DLLEXPORT = 301,
|
DLLEXPORT = 301,
|
||||||
EXTERN_WEAK = 302,
|
EXTERN_WEAK = 302,
|
||||||
APPENDING = 303,
|
OPAQUE = 303,
|
||||||
EXTERNAL = 304,
|
NOT = 304,
|
||||||
TARGET = 305,
|
EXTERNAL = 305,
|
||||||
TRIPLE = 306,
|
TARGET = 306,
|
||||||
ENDIAN = 307,
|
TRIPLE = 307,
|
||||||
POINTERSIZE = 308,
|
ENDIAN = 308,
|
||||||
LITTLE = 309,
|
POINTERSIZE = 309,
|
||||||
BIG = 310,
|
LITTLE = 310,
|
||||||
ALIGN = 311,
|
BIG = 311,
|
||||||
UNINITIALIZED = 312,
|
ALIGN = 312,
|
||||||
DEPLIBS = 313,
|
DEPLIBS = 313,
|
||||||
CALL = 314,
|
CALL = 314,
|
||||||
TAIL = 315,
|
TAIL = 315,
|
||||||
@@ -105,9 +102,9 @@
|
|||||||
BR = 328,
|
BR = 328,
|
||||||
SWITCH = 329,
|
SWITCH = 329,
|
||||||
INVOKE = 330,
|
INVOKE = 330,
|
||||||
EXCEPT = 331,
|
UNREACHABLE = 331,
|
||||||
UNWIND = 332,
|
UNWIND = 332,
|
||||||
UNREACHABLE = 333,
|
EXCEPT = 333,
|
||||||
ADD = 334,
|
ADD = 334,
|
||||||
SUB = 335,
|
SUB = 335,
|
||||||
MUL = 336,
|
MUL = 336,
|
||||||
@@ -130,112 +127,115 @@
|
|||||||
SETNE = 353,
|
SETNE = 353,
|
||||||
ICMP = 354,
|
ICMP = 354,
|
||||||
FCMP = 355,
|
FCMP = 355,
|
||||||
EQ = 356,
|
MALLOC = 356,
|
||||||
NE = 357,
|
ALLOCA = 357,
|
||||||
SLT = 358,
|
FREE = 358,
|
||||||
SGT = 359,
|
LOAD = 359,
|
||||||
SLE = 360,
|
STORE = 360,
|
||||||
SGE = 361,
|
GETELEMENTPTR = 361,
|
||||||
OEQ = 362,
|
PHI_TOK = 362,
|
||||||
ONE = 363,
|
SELECT = 363,
|
||||||
OLT = 364,
|
SHL = 364,
|
||||||
OGT = 365,
|
SHR = 365,
|
||||||
OLE = 366,
|
ASHR = 366,
|
||||||
OGE = 367,
|
LSHR = 367,
|
||||||
ORD = 368,
|
VAARG = 368,
|
||||||
UNO = 369,
|
EXTRACTELEMENT = 369,
|
||||||
UEQ = 370,
|
INSERTELEMENT = 370,
|
||||||
UNE = 371,
|
SHUFFLEVECTOR = 371,
|
||||||
ULT = 372,
|
VAARG_old = 372,
|
||||||
UGT = 373,
|
VANEXT_old = 373,
|
||||||
ULE = 374,
|
EQ = 374,
|
||||||
UGE = 375,
|
NE = 375,
|
||||||
MALLOC = 376,
|
SLT = 376,
|
||||||
ALLOCA = 377,
|
SGT = 377,
|
||||||
FREE = 378,
|
SLE = 378,
|
||||||
LOAD = 379,
|
SGE = 379,
|
||||||
STORE = 380,
|
ULT = 380,
|
||||||
GETELEMENTPTR = 381,
|
UGT = 381,
|
||||||
PHI_TOK = 382,
|
ULE = 382,
|
||||||
SELECT = 383,
|
UGE = 383,
|
||||||
SHL = 384,
|
OEQ = 384,
|
||||||
SHR = 385,
|
ONE = 385,
|
||||||
ASHR = 386,
|
OLT = 386,
|
||||||
LSHR = 387,
|
OGT = 387,
|
||||||
VAARG = 388,
|
OLE = 388,
|
||||||
EXTRACTELEMENT = 389,
|
OGE = 389,
|
||||||
INSERTELEMENT = 390,
|
ORD = 390,
|
||||||
SHUFFLEVECTOR = 391,
|
UNO = 391,
|
||||||
CAST = 392,
|
UEQ = 392,
|
||||||
TRUNC = 393,
|
UNE = 393,
|
||||||
ZEXT = 394,
|
CAST = 394,
|
||||||
SEXT = 395,
|
TRUNC = 395,
|
||||||
FPTRUNC = 396,
|
ZEXT = 396,
|
||||||
FPEXT = 397,
|
SEXT = 397,
|
||||||
FPTOUI = 398,
|
FPTRUNC = 398,
|
||||||
FPTOSI = 399,
|
FPEXT = 399,
|
||||||
UITOFP = 400,
|
FPTOUI = 400,
|
||||||
SITOFP = 401,
|
FPTOSI = 401,
|
||||||
PTRTOINT = 402,
|
UITOFP = 402,
|
||||||
INTTOPTR = 403,
|
SITOFP = 403,
|
||||||
BITCAST = 404
|
PTRTOINT = 404,
|
||||||
|
INTTOPTR = 405,
|
||||||
|
BITCAST = 406
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#define VOID 258
|
/* Tokens. */
|
||||||
#define BOOL 259
|
#define ESINT64VAL 258
|
||||||
#define SBYTE 260
|
#define EUINT64VAL 259
|
||||||
#define UBYTE 261
|
#define SINTVAL 260
|
||||||
#define SHORT 262
|
#define UINTVAL 261
|
||||||
#define USHORT 263
|
#define FPVAL 262
|
||||||
#define INT 264
|
#define VOID 263
|
||||||
#define UINT 265
|
#define BOOL 264
|
||||||
#define LONG 266
|
#define SBYTE 265
|
||||||
#define ULONG 267
|
#define UBYTE 266
|
||||||
#define FLOAT 268
|
#define SHORT 267
|
||||||
#define DOUBLE 269
|
#define USHORT 268
|
||||||
#define LABEL 270
|
#define INT 269
|
||||||
#define OPAQUE 271
|
#define UINT 270
|
||||||
#define ESINT64VAL 272
|
#define LONG 271
|
||||||
#define EUINT64VAL 273
|
#define ULONG 272
|
||||||
#define SINTVAL 274
|
#define FLOAT 273
|
||||||
#define UINTVAL 275
|
#define DOUBLE 274
|
||||||
#define FPVAL 276
|
#define TYPE 275
|
||||||
#define NULL_TOK 277
|
#define LABEL 276
|
||||||
#define UNDEF 278
|
#define VAR_ID 277
|
||||||
#define ZEROINITIALIZER 279
|
#define LABELSTR 278
|
||||||
#define TRUETOK 280
|
#define STRINGCONSTANT 279
|
||||||
#define FALSETOK 281
|
#define IMPLEMENTATION 280
|
||||||
#define TYPE 282
|
#define ZEROINITIALIZER 281
|
||||||
#define VAR_ID 283
|
#define TRUETOK 282
|
||||||
#define LABELSTR 284
|
#define FALSETOK 283
|
||||||
#define STRINGCONSTANT 285
|
#define BEGINTOK 284
|
||||||
#define IMPLEMENTATION 286
|
#define ENDTOK 285
|
||||||
#define BEGINTOK 287
|
#define DECLARE 286
|
||||||
#define ENDTOK 288
|
#define GLOBAL 287
|
||||||
#define DECLARE 289
|
#define CONSTANT 288
|
||||||
#define GLOBAL 290
|
#define SECTION 289
|
||||||
#define CONSTANT 291
|
#define VOLATILE 290
|
||||||
#define SECTION 292
|
#define TO 291
|
||||||
#define VOLATILE 293
|
#define DOTDOTDOT 292
|
||||||
#define TO 294
|
#define NULL_TOK 293
|
||||||
#define DOTDOTDOT 295
|
#define UNDEF 294
|
||||||
#define CONST 296
|
#define CONST 295
|
||||||
#define INTERNAL 297
|
#define INTERNAL 296
|
||||||
#define LINKONCE 298
|
#define LINKONCE 297
|
||||||
#define WEAK 299
|
#define WEAK 298
|
||||||
|
#define APPENDING 299
|
||||||
#define DLLIMPORT 300
|
#define DLLIMPORT 300
|
||||||
#define DLLEXPORT 301
|
#define DLLEXPORT 301
|
||||||
#define EXTERN_WEAK 302
|
#define EXTERN_WEAK 302
|
||||||
#define APPENDING 303
|
#define OPAQUE 303
|
||||||
#define EXTERNAL 304
|
#define NOT 304
|
||||||
#define TARGET 305
|
#define EXTERNAL 305
|
||||||
#define TRIPLE 306
|
#define TARGET 306
|
||||||
#define ENDIAN 307
|
#define TRIPLE 307
|
||||||
#define POINTERSIZE 308
|
#define ENDIAN 308
|
||||||
#define LITTLE 309
|
#define POINTERSIZE 309
|
||||||
#define BIG 310
|
#define LITTLE 310
|
||||||
#define ALIGN 311
|
#define BIG 311
|
||||||
#define UNINITIALIZED 312
|
#define ALIGN 312
|
||||||
#define DEPLIBS 313
|
#define DEPLIBS 313
|
||||||
#define CALL 314
|
#define CALL 314
|
||||||
#define TAIL 315
|
#define TAIL 315
|
||||||
@@ -254,9 +254,9 @@
|
|||||||
#define BR 328
|
#define BR 328
|
||||||
#define SWITCH 329
|
#define SWITCH 329
|
||||||
#define INVOKE 330
|
#define INVOKE 330
|
||||||
#define EXCEPT 331
|
#define UNREACHABLE 331
|
||||||
#define UNWIND 332
|
#define UNWIND 332
|
||||||
#define UNREACHABLE 333
|
#define EXCEPT 333
|
||||||
#define ADD 334
|
#define ADD 334
|
||||||
#define SUB 335
|
#define SUB 335
|
||||||
#define MUL 336
|
#define MUL 336
|
||||||
@@ -279,76 +279,112 @@
|
|||||||
#define SETNE 353
|
#define SETNE 353
|
||||||
#define ICMP 354
|
#define ICMP 354
|
||||||
#define FCMP 355
|
#define FCMP 355
|
||||||
#define EQ 356
|
#define MALLOC 356
|
||||||
#define NE 357
|
#define ALLOCA 357
|
||||||
#define SLT 358
|
#define FREE 358
|
||||||
#define SGT 359
|
#define LOAD 359
|
||||||
#define SLE 360
|
#define STORE 360
|
||||||
#define SGE 361
|
#define GETELEMENTPTR 361
|
||||||
#define OEQ 362
|
#define PHI_TOK 362
|
||||||
#define ONE 363
|
#define SELECT 363
|
||||||
#define OLT 364
|
#define SHL 364
|
||||||
#define OGT 365
|
#define SHR 365
|
||||||
#define OLE 366
|
#define ASHR 366
|
||||||
#define OGE 367
|
#define LSHR 367
|
||||||
#define ORD 368
|
#define VAARG 368
|
||||||
#define UNO 369
|
#define EXTRACTELEMENT 369
|
||||||
#define UEQ 370
|
#define INSERTELEMENT 370
|
||||||
#define UNE 371
|
#define SHUFFLEVECTOR 371
|
||||||
#define ULT 372
|
#define VAARG_old 372
|
||||||
#define UGT 373
|
#define VANEXT_old 373
|
||||||
#define ULE 374
|
#define EQ 374
|
||||||
#define UGE 375
|
#define NE 375
|
||||||
#define MALLOC 376
|
#define SLT 376
|
||||||
#define ALLOCA 377
|
#define SGT 377
|
||||||
#define FREE 378
|
#define SLE 378
|
||||||
#define LOAD 379
|
#define SGE 379
|
||||||
#define STORE 380
|
#define ULT 380
|
||||||
#define GETELEMENTPTR 381
|
#define UGT 381
|
||||||
#define PHI_TOK 382
|
#define ULE 382
|
||||||
#define SELECT 383
|
#define UGE 383
|
||||||
#define SHL 384
|
#define OEQ 384
|
||||||
#define SHR 385
|
#define ONE 385
|
||||||
#define ASHR 386
|
#define OLT 386
|
||||||
#define LSHR 387
|
#define OGT 387
|
||||||
#define VAARG 388
|
#define OLE 388
|
||||||
#define EXTRACTELEMENT 389
|
#define OGE 389
|
||||||
#define INSERTELEMENT 390
|
#define ORD 390
|
||||||
#define SHUFFLEVECTOR 391
|
#define UNO 391
|
||||||
#define CAST 392
|
#define UEQ 392
|
||||||
#define TRUNC 393
|
#define UNE 393
|
||||||
#define ZEXT 394
|
#define CAST 394
|
||||||
#define SEXT 395
|
#define TRUNC 395
|
||||||
#define FPTRUNC 396
|
#define ZEXT 396
|
||||||
#define FPEXT 397
|
#define SEXT 397
|
||||||
#define FPTOUI 398
|
#define FPTRUNC 398
|
||||||
#define FPTOSI 399
|
#define FPEXT 399
|
||||||
#define UITOFP 400
|
#define FPTOUI 400
|
||||||
#define SITOFP 401
|
#define FPTOSI 401
|
||||||
#define PTRTOINT 402
|
#define UITOFP 402
|
||||||
#define INTTOPTR 403
|
#define SITOFP 403
|
||||||
#define BITCAST 404
|
#define PTRTOINT 404
|
||||||
|
#define INTTOPTR 405
|
||||||
|
#define BITCAST 406
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef YYSTYPE
|
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||||
#line 971 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
|
#line 1469 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
|
||||||
typedef union {
|
typedef union YYSTYPE {
|
||||||
std::string* String;
|
llvm::Module *ModuleVal;
|
||||||
const Type* Ty;
|
llvm::Function *FunctionVal;
|
||||||
Value* Val;
|
std::pair<llvm::PATypeInfo, char*> *ArgVal;
|
||||||
Constant* Const;
|
llvm::BasicBlock *BasicBlockVal;
|
||||||
ValueList* ValList;
|
llvm::TerminatorInst *TermInstVal;
|
||||||
TypeList* TypeVec;
|
llvm::InstrInfo InstVal;
|
||||||
} yystype;
|
llvm::ConstInfo ConstVal;
|
||||||
/* Line 1237 of /usr/local/share/bison/yacc.c. */
|
llvm::ValueInfo ValueVal;
|
||||||
#line 347 "UpgradeParser.tab.h"
|
llvm::PATypeInfo TypeVal;
|
||||||
# define YYSTYPE yystype
|
llvm::TypeInfo PrimType;
|
||||||
|
llvm::PHIListInfo PHIList;
|
||||||
|
std::list<llvm::PATypeInfo> *TypeList;
|
||||||
|
std::vector<llvm::ValueInfo> *ValueList;
|
||||||
|
std::vector<llvm::ConstInfo> *ConstVector;
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<std::pair<llvm::PATypeInfo,char*> > *ArgList;
|
||||||
|
// Represent the RHS of PHI node
|
||||||
|
std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
|
||||||
|
|
||||||
|
llvm::GlobalValue::LinkageTypes Linkage;
|
||||||
|
int64_t SInt64Val;
|
||||||
|
uint64_t UInt64Val;
|
||||||
|
int SIntVal;
|
||||||
|
unsigned UIntVal;
|
||||||
|
double FPVal;
|
||||||
|
bool BoolVal;
|
||||||
|
|
||||||
|
char *StrVal; // This memory is strdup'd!
|
||||||
|
llvm::ValID ValIDVal; // strdup'd memory maybe!
|
||||||
|
|
||||||
|
llvm::BinaryOps BinaryOpVal;
|
||||||
|
llvm::TermOps TermOpVal;
|
||||||
|
llvm::MemoryOps MemOpVal;
|
||||||
|
llvm::OtherOps OtherOpVal;
|
||||||
|
llvm::CastOps CastOpVal;
|
||||||
|
llvm::ICmpInst::Predicate IPred;
|
||||||
|
llvm::FCmpInst::Predicate FPred;
|
||||||
|
llvm::Module::Endianness Endianness;
|
||||||
|
} YYSTYPE;
|
||||||
|
/* Line 1447 of yacc.c. */
|
||||||
|
#line 382 "UpgradeParser.tab.h"
|
||||||
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern YYSTYPE Upgradelval;
|
extern YYSTYPE Upgradelval;
|
||||||
|
|
||||||
|
|
||||||
#endif /* not BISON_UPGRADEPARSER_TAB_H */
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,8 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "UpgradeInternals.h"
|
#include "UpgradeInternals.h"
|
||||||
|
#include "llvm/Module.h"
|
||||||
|
#include "llvm/Bytecode/Writer.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
@@ -45,7 +47,11 @@ AddAttrs("add-attrs", cl::desc("Add function result and argument attributes"),
|
|||||||
cl::init(false));
|
cl::init(false));
|
||||||
|
|
||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
Debug("debug", cl::desc("Print debug output from yacc parser"),cl::Hidden,
|
Debug("debug-upgrade-yacc", cl::desc("Print debug output from yacc parser"),
|
||||||
|
cl::Hidden, cl::init(false));
|
||||||
|
|
||||||
|
static cl::opt<bool>
|
||||||
|
EmitByteCode("emit-bytecode", cl::desc("Emit bytecode instead of assembly"),
|
||||||
cl::init(false));
|
cl::init(false));
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@@ -119,7 +125,20 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeAssembly(InputFilename, *In, *Out, Debug, AddAttrs);
|
Module *M = UpgradeAssembly(InputFilename, *In, Debug, AddAttrs);
|
||||||
|
if (!M) {
|
||||||
|
cerr << argv[0] << ": No module returned from assembly parsing\n";
|
||||||
|
if (!EmitByteCode)
|
||||||
|
*Out << argv[0] << ": parse failed.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally, print the module on the output stream.
|
||||||
|
if (EmitByteCode) {
|
||||||
|
OStream OS(*Out);
|
||||||
|
WriteBytecodeToFile(M, OS);
|
||||||
|
} else
|
||||||
|
M->print(Out);
|
||||||
|
|
||||||
} catch (const std::string& caught_message) {
|
} catch (const std::string& caught_message) {
|
||||||
cerr << argv[0] << ": " << caught_message << "\n";
|
cerr << argv[0] << ": " << caught_message << "\n";
|
||||||
|
Reference in New Issue
Block a user