Remove backwards compatibility goop. Now implemented in llvm-upgrade.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32144 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2006-12-03 05:45:44 +00:00
parent e968dc9847
commit 08de34b229
3 changed files with 424 additions and 602 deletions

View File

@ -41,20 +41,16 @@ void set_scan_string (const char * str) {
// Construct a token value for a non-obsolete token // Construct a token value for a non-obsolete token
#define RET_TOK(type, Enum, sym) \ #define RET_TOK(type, Enum, sym) \
llvmAsmlval.type.opcode = Instruction::Enum; \ llvmAsmlval.type = Instruction::Enum; \
llvmAsmlval.type.obsolete = false; \ return sym
#define RET_ENUM(type, Enum, sym) \
llvmAsmlval.type = Enum; \
return sym return sym
// Construct a token value for an obsolete token // Construct a token value for an obsolete token
#define RET_TOK_OBSOLETE(type, Enum, sym) \ #define RET_TY(CTYPE, SYM) \
llvmAsmlval.type.opcode = Instruction::Enum; \ llvmAsmlval.PrimType = CTYPE;\
llvmAsmlval.type.obsolete = true; \
return sym
// Construct a token value for an obsolete token
#define RET_TY(CTYPE, SIGN, SYM) \
llvmAsmlval.TypeVal.type = new PATypeHolder(CTYPE); \
llvmAsmlval.TypeVal.signedness = SIGN; \
return SYM return SYM
namespace llvm { namespace llvm {
@ -209,7 +205,6 @@ appending { return APPENDING; }
dllimport { return DLLIMPORT; } dllimport { return DLLIMPORT; }
dllexport { return DLLEXPORT; } dllexport { return DLLEXPORT; }
extern_weak { return EXTERN_WEAK; } extern_weak { return EXTERN_WEAK; }
uninitialized { return EXTERNAL; } /* Deprecated, turn into external */
external { return EXTERNAL; } external { return EXTERNAL; }
implementation { return IMPLEMENTATION; } implementation { return IMPLEMENTATION; }
zeroinitializer { return ZEROINITIALIZER; } zeroinitializer { return ZEROINITIALIZER; }
@ -217,8 +212,6 @@ zeroinitializer { return ZEROINITIALIZER; }
undef { return UNDEF; } undef { return UNDEF; }
null { return NULL_TOK; } null { return NULL_TOK; }
to { return TO; } to { return TO; }
except { RET_TOK(TermOpVal, Unwind, UNWIND); }
not { return NOT; } /* Deprecated, turned into XOR */
tail { return TAIL; } tail { return TAIL; }
target { return TARGET; } target { return TARGET; }
triple { return TRIPLE; } triple { return TRIPLE; }
@ -243,30 +236,28 @@ coldcc { return COLDCC_TOK; }
x86_stdcallcc { return X86_STDCALLCC_TOK; } x86_stdcallcc { return X86_STDCALLCC_TOK; }
x86_fastcallcc { return X86_FASTCALLCC_TOK; } x86_fastcallcc { return X86_FASTCALLCC_TOK; }
void { RET_TY(Type::VoidTy, isSignless, VOID); } void { RET_TY(Type::VoidTy, VOID); }
bool { RET_TY(Type::BoolTy, isSignless, BOOL); } bool { RET_TY(Type::BoolTy, BOOL); }
sbyte { RET_TY(Type::SByteTy, isSigned, SBYTE); } sbyte { RET_TY(Type::SByteTy, SBYTE); }
ubyte { RET_TY(Type::UByteTy, isUnsigned, UBYTE); } ubyte { RET_TY(Type::UByteTy, UBYTE); }
short { RET_TY(Type::ShortTy, isSigned, SHORT); } short { RET_TY(Type::ShortTy, SHORT); }
ushort { RET_TY(Type::UShortTy,isUnsigned, USHORT);} ushort { RET_TY(Type::UShortTy,USHORT);}
int { RET_TY(Type::IntTy, isSigned, INT); } int { RET_TY(Type::IntTy, INT); }
uint { RET_TY(Type::UIntTy, isUnsigned, UINT); } uint { RET_TY(Type::UIntTy, UINT); }
long { RET_TY(Type::LongTy, isSigned, LONG); } long { RET_TY(Type::LongTy, LONG); }
ulong { RET_TY(Type::ULongTy, isUnsigned, ULONG); } ulong { RET_TY(Type::ULongTy, ULONG); }
float { RET_TY(Type::FloatTy, isSignless, FLOAT); } float { RET_TY(Type::FloatTy, FLOAT); }
double { RET_TY(Type::DoubleTy,isSignless, DOUBLE);} double { RET_TY(Type::DoubleTy,DOUBLE);}
label { RET_TY(Type::LabelTy, isSignless, LABEL); } label { RET_TY(Type::LabelTy, LABEL); }
type { return TYPE; } type { return TYPE; }
opaque { return OPAQUE; } opaque { return OPAQUE; }
add { RET_TOK(BinaryOpVal, Add, ADD); } add { RET_TOK(BinaryOpVal, Add, ADD); }
sub { RET_TOK(BinaryOpVal, Sub, SUB); } sub { RET_TOK(BinaryOpVal, Sub, SUB); }
mul { RET_TOK(BinaryOpVal, Mul, MUL); } mul { RET_TOK(BinaryOpVal, Mul, MUL); }
div { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); }
udiv { RET_TOK(BinaryOpVal, UDiv, UDIV); } udiv { RET_TOK(BinaryOpVal, UDiv, UDIV); }
sdiv { RET_TOK(BinaryOpVal, SDiv, SDIV); } sdiv { RET_TOK(BinaryOpVal, SDiv, SDIV); }
fdiv { RET_TOK(BinaryOpVal, FDiv, FDIV); } fdiv { RET_TOK(BinaryOpVal, FDiv, FDIV); }
rem { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); }
urem { RET_TOK(BinaryOpVal, URem, UREM); } urem { RET_TOK(BinaryOpVal, URem, UREM); }
srem { RET_TOK(BinaryOpVal, SRem, SREM); } srem { RET_TOK(BinaryOpVal, SRem, SREM); }
frem { RET_TOK(BinaryOpVal, FRem, FREM); } frem { RET_TOK(BinaryOpVal, FRem, FREM); }
@ -279,10 +270,35 @@ setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); }
setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); } setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); }
setle { RET_TOK(BinaryOpVal, SetLE, SETLE); } setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
setge { RET_TOK(BinaryOpVal, SetGE, SETGE); } setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
icmp { RET_TOK(OtherOpVal, ICmp, ICMP); }
fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); }
eq { RET_ENUM(IPredicate, ICmpInst::ICMP_EQ, EQ); }
ne { RET_ENUM(IPredicate, ICmpInst::ICMP_NE, NE); }
slt { RET_ENUM(IPredicate, ICmpInst::ICMP_SLT, SLT); }
sgt { RET_ENUM(IPredicate, ICmpInst::ICMP_SGT, SGT); }
sle { RET_ENUM(IPredicate, ICmpInst::ICMP_SLE, SLE); }
sge { RET_ENUM(IPredicate, ICmpInst::ICMP_SGE, SGE); }
ult { RET_ENUM(IPredicate, ICmpInst::ICMP_ULT, ULT); }
ugt { RET_ENUM(IPredicate, ICmpInst::ICMP_UGT, UGT); }
ule { RET_ENUM(IPredicate, ICmpInst::ICMP_ULE, ULE); }
uge { RET_ENUM(IPredicate, ICmpInst::ICMP_UGE, UGE); }
ordeq { RET_ENUM(FPredicate, FCmpInst::FCMP_OEQ, ORDEQ); }
ordne { RET_ENUM(FPredicate, FCmpInst::FCMP_ONE, ORDNE); }
ordlt { RET_ENUM(FPredicate, FCmpInst::FCMP_OLT, ORDLT); }
ordgt { RET_ENUM(FPredicate, FCmpInst::FCMP_OGT, ORDGT); }
ordle { RET_ENUM(FPredicate, FCmpInst::FCMP_OLE, ORDLE); }
ordge { RET_ENUM(FPredicate, FCmpInst::FCMP_OGE, ORDGE); }
ord { RET_ENUM(FPredicate, FCmpInst::FCMP_ORD, ORD); }
uno { RET_ENUM(FPredicate, FCmpInst::FCMP_UNO, UNO); }
unoeq { RET_ENUM(FPredicate, FCmpInst::FCMP_UEQ, UNOEQ); }
unone { RET_ENUM(FPredicate, FCmpInst::FCMP_UNE, UNONE); }
unolt { RET_ENUM(FPredicate, FCmpInst::FCMP_ULT, UNOLT); }
unogt { RET_ENUM(FPredicate, FCmpInst::FCMP_UGT, UNOGT); }
unole { RET_ENUM(FPredicate, FCmpInst::FCMP_ULE, UNOLE); }
unoge { RET_ENUM(FPredicate, FCmpInst::FCMP_UGE, UNOGE); }
phi { RET_TOK(OtherOpVal, PHI, PHI_TOK); } phi { RET_TOK(OtherOpVal, PHI, PHI_TOK); }
call { RET_TOK(OtherOpVal, Call, CALL); } call { RET_TOK(OtherOpVal, Call, CALL); }
cast { RET_TOK_OBSOLETE(CastOpVal, Trunc, TRUNC); }
trunc { RET_TOK(CastOpVal, Trunc, TRUNC); } trunc { RET_TOK(CastOpVal, Trunc, TRUNC); }
zext { RET_TOK(CastOpVal, ZExt, ZEXT); } zext { RET_TOK(CastOpVal, ZExt, ZEXT); }
sext { RET_TOK(CastOpVal, SExt, SEXT); } sext { RET_TOK(CastOpVal, SExt, SEXT); }
@ -297,11 +313,8 @@ ptrtoint { RET_TOK(CastOpVal, PtrToInt, PTRTOINT); }
bitcast { RET_TOK(CastOpVal, BitCast, BITCAST); } bitcast { RET_TOK(CastOpVal, BitCast, BITCAST); }
select { RET_TOK(OtherOpVal, Select, SELECT); } select { RET_TOK(OtherOpVal, Select, SELECT); }
shl { RET_TOK(OtherOpVal, Shl, SHL); } shl { RET_TOK(OtherOpVal, Shl, SHL); }
shr { RET_TOK_OBSOLETE(OtherOpVal, LShr, LSHR); }
lshr { RET_TOK(OtherOpVal, LShr, LSHR); } lshr { RET_TOK(OtherOpVal, LShr, LSHR); }
ashr { RET_TOK(OtherOpVal, AShr, ASHR); } ashr { RET_TOK(OtherOpVal, AShr, ASHR); }
vanext { return VANEXT_old; }
vaarg { return VAARG_old; }
va_arg { RET_TOK(OtherOpVal, VAArg , VAARG); } va_arg { RET_TOK(OtherOpVal, VAArg , VAARG); }
ret { RET_TOK(TermOpVal, Ret, RET); } ret { RET_TOK(TermOpVal, Ret, RET); }
br { RET_TOK(TermOpVal, Br, BR); } br { RET_TOK(TermOpVal, Br, BR); }

View File

@ -201,56 +201,4 @@ struct ValID {
} // End llvm namespace } // End llvm namespace
// This structure is used to keep track of obsolete opcodes. The lexer will
// retain the ability to parse obsolete opcode mnemonics. In this case it will
// set "obsolete" to true and the opcode will be the replacement opcode. For
// example if "rem" is encountered then opcode will be set to "urem" and the
// "obsolete" flag will be true. If the opcode is not obsolete then "obsolete"
// will be false.
template <class Enum>
struct OpcodeInfo {
Enum opcode;
bool obsolete;
};
typedef OpcodeInfo<llvm::Instruction::BinaryOps> BinaryOpInfo;
typedef OpcodeInfo<llvm::Instruction::TermOps> TermOpInfo;
typedef OpcodeInfo<llvm::Instruction::MemoryOps> MemOpInfo;
typedef OpcodeInfo<llvm::Instruction::CastOps> CastOpInfo;
typedef OpcodeInfo<llvm::Instruction::OtherOps> OtherOpInfo;
/// This enumeration is used to indicate if a type is signed, signless or
/// unsigned. It is used for backwards compatibility with assembly code that
/// pre-dates the signless types conversion.
enum Signedness {
isSigned,
isUnsigned,
isSignless
};
/// This type is used to keep track of the signedness of the obsolete
/// integer types. Instead of creating an llvm::Type directly, the Lexer will
/// create instances of TypeInfo which retains the signedness indication so
/// it can be used by the parser for upgrade decisions.
/// For example if "uint" is encountered then the "first" field will be set
/// to "int32" and the "second" field will be set to "isUnsigned". If the
/// type is not obsolete then "second" will be set to "isSignless".
struct TypeInfo {
llvm::PATypeHolder* type;
Signedness signedness;
};
/// This type is used to keep track of the signedness of values. Instead
/// of creating llvm::Value directly, the parser will create ValueInfo which
/// associates a Value* with a Signedness indication.
struct ValueInfo {
llvm::Value* val;
Signedness signedness;
};
/// This type is used to keep track of the signedness of constants.
struct ConstInfo {
llvm::Constant *cnst;
Signedness signedness;
};
#endif #endif

File diff suppressed because it is too large Load Diff