Shorten the FCmp and ICmp mnemonics to 3 letters. Make the parser
disambiguate them. llvm-svn: 32151
This commit is contained in:
parent
afafde7b11
commit
cfc7f5dc82
|
@ -44,10 +44,6 @@ void set_scan_string (const char * str) {
|
||||||
llvmAsmlval.type = Instruction::Enum; \
|
llvmAsmlval.type = Instruction::Enum; \
|
||||||
return sym
|
return sym
|
||||||
|
|
||||||
#define RET_ENUM(type, Enum, sym) \
|
|
||||||
llvmAsmlval.type = Enum; \
|
|
||||||
return sym
|
|
||||||
|
|
||||||
// Construct a token value for an obsolete token
|
// Construct a token value for an obsolete token
|
||||||
#define RET_TY(CTYPE, SYM) \
|
#define RET_TY(CTYPE, SYM) \
|
||||||
llvmAsmlval.PrimType = CTYPE;\
|
llvmAsmlval.PrimType = CTYPE;\
|
||||||
|
@ -272,30 +268,26 @@ setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
|
||||||
setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
|
setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
|
||||||
icmp { RET_TOK(OtherOpVal, ICmp, ICMP); }
|
icmp { RET_TOK(OtherOpVal, ICmp, ICMP); }
|
||||||
fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); }
|
fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); }
|
||||||
eq { RET_ENUM(IPredicate, ICmpInst::ICMP_EQ, EQ); }
|
eq { return EQ; }
|
||||||
ne { RET_ENUM(IPredicate, ICmpInst::ICMP_NE, NE); }
|
ne { return NE; }
|
||||||
slt { RET_ENUM(IPredicate, ICmpInst::ICMP_SLT, SLT); }
|
slt { return SLT; }
|
||||||
sgt { RET_ENUM(IPredicate, ICmpInst::ICMP_SGT, SGT); }
|
sgt { return SGT; }
|
||||||
sle { RET_ENUM(IPredicate, ICmpInst::ICMP_SLE, SLE); }
|
sle { return SLE; }
|
||||||
sge { RET_ENUM(IPredicate, ICmpInst::ICMP_SGE, SGE); }
|
sge { return SGE; }
|
||||||
ult { RET_ENUM(IPredicate, ICmpInst::ICMP_ULT, ULT); }
|
ult { return ULT; }
|
||||||
ugt { RET_ENUM(IPredicate, ICmpInst::ICMP_UGT, UGT); }
|
ugt { return UGT; }
|
||||||
ule { RET_ENUM(IPredicate, ICmpInst::ICMP_ULE, ULE); }
|
ule { return ULE; }
|
||||||
uge { RET_ENUM(IPredicate, ICmpInst::ICMP_UGE, UGE); }
|
uge { return UGE; }
|
||||||
ordeq { RET_ENUM(FPredicate, FCmpInst::FCMP_OEQ, ORDEQ); }
|
oeq { return OEQ; }
|
||||||
ordne { RET_ENUM(FPredicate, FCmpInst::FCMP_ONE, ORDNE); }
|
one { return ONE; }
|
||||||
ordlt { RET_ENUM(FPredicate, FCmpInst::FCMP_OLT, ORDLT); }
|
olt { return OLT; }
|
||||||
ordgt { RET_ENUM(FPredicate, FCmpInst::FCMP_OGT, ORDGT); }
|
ogt { return OGT; }
|
||||||
ordle { RET_ENUM(FPredicate, FCmpInst::FCMP_OLE, ORDLE); }
|
ole { return OLE; }
|
||||||
ordge { RET_ENUM(FPredicate, FCmpInst::FCMP_OGE, ORDGE); }
|
oge { return OGE; }
|
||||||
ord { RET_ENUM(FPredicate, FCmpInst::FCMP_ORD, ORD); }
|
ord { return ORD; }
|
||||||
uno { RET_ENUM(FPredicate, FCmpInst::FCMP_UNO, UNO); }
|
uno { return UNO; }
|
||||||
unoeq { RET_ENUM(FPredicate, FCmpInst::FCMP_UEQ, UNOEQ); }
|
ueq { return UEQ; }
|
||||||
unone { RET_ENUM(FPredicate, FCmpInst::FCMP_UNE, UNONE); }
|
une { return UNE; }
|
||||||
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); }
|
||||||
|
|
|
@ -1076,11 +1076,10 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
|
||||||
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
|
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
|
||||||
%token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
|
%token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
|
||||||
%token <OtherOpVal> ICMP FCMP
|
%token <OtherOpVal> ICMP FCMP
|
||||||
%token <IPredicate> EQ NE SLT SGT SLE SGE ULT UGT ULE UGE
|
|
||||||
%type <IPredicate> IPredicates
|
%type <IPredicate> IPredicates
|
||||||
%token <FPredicate> ORDEQ ORDNE ORDLT ORDGT ORDLE ORDGE ORD UNO UNOEQ UNONE
|
|
||||||
%token <FPredicate> UNOLT UNOGT UNOLE UNOGE
|
|
||||||
%type <FPredicate> FPredicates
|
%type <FPredicate> FPredicates
|
||||||
|
%token EQ NE SLT SGT SLE SGE ULT UGT ULE UGE
|
||||||
|
%token OEQ ONE OLT OGT OLE OGE ORD UNO UEQ UNE
|
||||||
|
|
||||||
// Memory Instructions
|
// Memory Instructions
|
||||||
%token <MemOpVal> MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR
|
%token <MemOpVal> MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR
|
||||||
|
@ -1128,9 +1127,25 @@ SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
|
||||||
CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST |
|
CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST |
|
||||||
UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT;
|
UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT;
|
||||||
ShiftOps : SHL | LSHR | ASHR;
|
ShiftOps : SHL | LSHR | ASHR;
|
||||||
IPredicates : EQ | NE | SLT | SGT | SLE | SGE | ULT | UGT | ULE | UGE ;
|
IPredicates
|
||||||
FPredicates : ORDEQ | ORDNE | ORDLT | ORDGT | ORDLE | ORDGE | ORD | UNO
|
: EQ { $$ = ICmpInst::ICMP_EQ; } | NE { $$ = ICmpInst::ICMP_NE; }
|
||||||
| UNOEQ | UNONE | UNOLT | UNOGT | UNOLE | UNOGE ;
|
| SLT { $$ = ICmpInst::ICMP_SLT; } | SGT { $$ = ICmpInst::ICMP_SGT; }
|
||||||
|
| SLE { $$ = ICmpInst::ICMP_SLE; } | SGE { $$ = ICmpInst::ICMP_SGE; }
|
||||||
|
| ULT { $$ = ICmpInst::ICMP_ULT; } | UGT { $$ = ICmpInst::ICMP_UGT; }
|
||||||
|
| ULE { $$ = ICmpInst::ICMP_ULE; } | UGE { $$ = ICmpInst::ICMP_UGE; }
|
||||||
|
;
|
||||||
|
|
||||||
|
FPredicates
|
||||||
|
: OEQ { $$ = FCmpInst::FCMP_OEQ; } | ONE { $$ = FCmpInst::FCMP_ONE; }
|
||||||
|
| OLT { $$ = FCmpInst::FCMP_OLT; } | OGT { $$ = FCmpInst::FCMP_OGT; }
|
||||||
|
| OLE { $$ = FCmpInst::FCMP_OLE; } | OGE { $$ = FCmpInst::FCMP_OGE; }
|
||||||
|
| ORD { $$ = FCmpInst::FCMP_ORD; } | UNO { $$ = FCmpInst::FCMP_UNO; }
|
||||||
|
| UEQ { $$ = FCmpInst::FCMP_UEQ; } | UNE { $$ = FCmpInst::FCMP_UNE; }
|
||||||
|
| ULT { $$ = FCmpInst::FCMP_ULT; } | UGT { $$ = FCmpInst::FCMP_UGT; }
|
||||||
|
| ULE { $$ = FCmpInst::FCMP_ULE; } | UGE { $$ = FCmpInst::FCMP_UGE; }
|
||||||
|
| TRUETOK { $$ = FCmpInst::FCMP_TRUE; }
|
||||||
|
| FALSETOK { $$ = FCmpInst::FCMP_FALSE; }
|
||||||
|
;
|
||||||
|
|
||||||
// These are some types that allow classification if we only want a particular
|
// These are some types that allow classification if we only want a particular
|
||||||
// thing... for example, only a signed, unsigned, or integral type.
|
// thing... for example, only a signed, unsigned, or integral type.
|
||||||
|
|
Loading…
Reference in New Issue