#define RET_TY(sym,NewTY,sign) \
Upgradelval.PrimType.T = NewTY; \
- Upgradelval.PrimType.S = sign; \
+ switch (sign) { \
+ case 0: Upgradelval.PrimType.S.makeSignless(); break; \
+ case 1: Upgradelval.PrimType.S.makeUnsigned(); break; \
+ case 2: Upgradelval.PrimType.S.makeSigned(); break; \
+ default: assert(0 && "Invalid sign kind"); break; \
+ }\
return sym
namespace llvm {
Comment ;.*
/* Variable(Value) identifiers start with a % sign */
-VarID %[-a-zA-Z$._][-a-zA-Z$._0-9]*
+VarID [%@][-a-zA-Z$._][-a-zA-Z$._0-9]*
/* Label identifiers end with a colon */
Label [-a-zA-Z$._0-9]+:
QuoteLabel \"[^\"]+\":
/* Quoted names can contain any character except " and \ */
-StringConstant \"[^\"]*\"
+StringConstant @?\"[^\"]*\"
/* [PN]Integer: match positive and negative literal integer values that
x86_stdcallcc { return X86_STDCALLCC_TOK; }
x86_fastcallcc { return X86_FASTCALLCC_TOK; }
-sbyte { RET_TY(SBYTE, Type::Int8Ty, Signed); }
-ubyte { RET_TY(UBYTE, Type::Int8Ty, Unsigned); }
-short { RET_TY(SHORT, Type::Int16Ty, Signed); }
-ushort { RET_TY(USHORT, Type::Int16Ty, Unsigned); }
-int { RET_TY(INT, Type::Int32Ty, Signed); }
-uint { RET_TY(UINT, Type::Int32Ty, Unsigned); }
-long { RET_TY(LONG, Type::Int64Ty, Signed); }
-ulong { RET_TY(ULONG, Type::Int64Ty, Unsigned); }
-void { RET_TY(VOID, Type::VoidTy, Signless ); }
-bool { RET_TY(BOOL, Type::Int1Ty, Unsigned ); }
-float { RET_TY(FLOAT, Type::FloatTy, Signless ); }
-double { RET_TY(DOUBLE, Type::DoubleTy,Signless); }
-label { RET_TY(LABEL, Type::LabelTy, Signless ); }
+sbyte { RET_TY(SBYTE, Type::Int8Ty, 2); }
+ubyte { RET_TY(UBYTE, Type::Int8Ty, 1); }
+i8 { RET_TY(UBYTE, Type::Int8Ty, 1); }
+short { RET_TY(SHORT, Type::Int16Ty, 2); }
+ushort { RET_TY(USHORT, Type::Int16Ty, 1); }
+i16 { RET_TY(USHORT, Type::Int16Ty, 1); }
+int { RET_TY(INT, Type::Int32Ty, 2); }
+uint { RET_TY(UINT, Type::Int32Ty, 1); }
+i32 { RET_TY(UINT, Type::Int32Ty, 1); }
+long { RET_TY(LONG, Type::Int64Ty, 2); }
+ulong { RET_TY(ULONG, Type::Int64Ty, 1); }
+i64 { RET_TY(ULONG, Type::Int64Ty, 1); }
+void { RET_TY(VOID, Type::VoidTy, 0); }
+bool { RET_TY(BOOL, Type::Int1Ty, 1); }
+i1 { RET_TY(BOOL, Type::Int1Ty, 1); }
+float { RET_TY(FLOAT, Type::FloatTy, 0); }
+double { RET_TY(DOUBLE, Type::DoubleTy,0); }
+label { RET_TY(LABEL, Type::LabelTy, 0); }
type { return TYPE; }
opaque { return OPAQUE; }
setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); }
setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
+shl { RET_TOK(BinaryOpVal, ShlOp, SHL); }
+shr { RET_TOK(BinaryOpVal, ShrOp, SHR); }
+lshr { RET_TOK(BinaryOpVal, LShrOp, LSHR); }
+ashr { RET_TOK(BinaryOpVal, AShrOp, ASHR); }
+
icmp { RET_TOK(OtherOpVal, ICmpOp, ICMP); }
fcmp { RET_TOK(OtherOpVal, FCmpOp, FCMP); }
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); }