mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Remove IsUnary() and IsBinary()
- This information is already stored in the node's NodeType field, so there's no reason to go do a table lookup for it elsewhere. Must have been a brain fart when I wrote them in the first place.
This commit is contained in:
parent
16fc9be411
commit
b66de4116d
4 changed files with 47 additions and 60 deletions
|
@ -226,11 +226,11 @@ PSymbolConst *ZCCCompiler::CompileConstant(ZCC_ConstantDef *def)
|
|||
|
||||
ZCC_Expression *ZCCCompiler::Simplify(ZCC_Expression *root)
|
||||
{
|
||||
if (IsUnaryOp(root->Operation))
|
||||
if (root->NodeType == AST_ExprUnary)
|
||||
{
|
||||
return SimplifyUnary(static_cast<ZCC_ExprUnary *>(root));
|
||||
}
|
||||
else if (IsBinaryOp(root->Operation))
|
||||
else if (root->NodeType == AST_ExprBinary)
|
||||
{
|
||||
return SimplifyBinary(static_cast<ZCC_ExprBinary *>(root));
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
ZCC_OpInfoType ZCC_OpInfo[PEX_COUNT_OF] =
|
||||
{
|
||||
#define xx(a,n) { n, #a, NULL },
|
||||
#define xx(a,z) { #a, NULL },
|
||||
#include "zcc_exprlist.h"
|
||||
};
|
||||
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
// Name n-ary
|
||||
xx(Nil, 0)
|
||||
xx(Nil, )
|
||||
|
||||
xx(ID, 0)
|
||||
xx(Super, 0)
|
||||
xx(Self, 0)
|
||||
xx(ConstValue, 0)
|
||||
xx(FuncCall, 0)
|
||||
xx(ArrayAccess, 0)
|
||||
xx(MemberAccess, 0)
|
||||
xx(TypeRef, 0)
|
||||
xx(ID, )
|
||||
xx(Super, )
|
||||
xx(Self, )
|
||||
xx(ConstValue, )
|
||||
xx(FuncCall, )
|
||||
xx(ArrayAccess, )
|
||||
xx(MemberAccess, )
|
||||
xx(TypeRef, )
|
||||
|
||||
xx(PostInc, 1)
|
||||
xx(PostDec, 1)
|
||||
xx(PostInc, )
|
||||
xx(PostDec, )
|
||||
|
||||
xx(PreInc, 1)
|
||||
xx(PreDec, 1)
|
||||
xx(Negate, 1)
|
||||
xx(AntiNegate, 1)
|
||||
xx(BitNot, 1)
|
||||
xx(BoolNot, 1)
|
||||
xx(SizeOf, 1)
|
||||
xx(AlignOf, 1)
|
||||
xx(PreInc, )
|
||||
xx(PreDec, )
|
||||
xx(Negate, )
|
||||
xx(AntiNegate, )
|
||||
xx(BitNot, )
|
||||
xx(BoolNot, )
|
||||
xx(SizeOf, )
|
||||
xx(AlignOf, )
|
||||
|
||||
xx(Add, 2)
|
||||
xx(Sub, 2)
|
||||
xx(Mul, 2)
|
||||
xx(Div, 2)
|
||||
xx(Mod, 2)
|
||||
xx(Pow, 2)
|
||||
xx(CrossProduct, 2)
|
||||
xx(DotProduct, 2)
|
||||
xx(LeftShift, 2)
|
||||
xx(RightShift, 2)
|
||||
xx(Concat, 2)
|
||||
xx(Add, )
|
||||
xx(Sub, )
|
||||
xx(Mul, )
|
||||
xx(Div, )
|
||||
xx(Mod, )
|
||||
xx(Pow, )
|
||||
xx(CrossProduct, )
|
||||
xx(DotProduct, )
|
||||
xx(LeftShift, )
|
||||
xx(RightShift, )
|
||||
xx(Concat, )
|
||||
|
||||
xx(LT, 2)
|
||||
xx(LTEQ, 2)
|
||||
xx(LTGTEQ, 2)
|
||||
xx(Is, 2)
|
||||
xx(LT, )
|
||||
xx(LTEQ, )
|
||||
xx(LTGTEQ, )
|
||||
xx(Is, )
|
||||
|
||||
xx(EQEQ, 2)
|
||||
xx(APREQ, 2)
|
||||
xx(EQEQ, )
|
||||
xx(APREQ, )
|
||||
|
||||
xx(BitAnd, 2)
|
||||
xx(BitOr, 2)
|
||||
xx(BitXor, 2)
|
||||
xx(BoolAnd, 2)
|
||||
xx(BoolOr, 2)
|
||||
xx(BitAnd, )
|
||||
xx(BitOr, )
|
||||
xx(BitXor, )
|
||||
xx(BoolAnd, )
|
||||
xx(BoolOr, )
|
||||
|
||||
xx(Scope, 0)
|
||||
xx(Scope, )
|
||||
|
||||
xx(Trinary, 2)
|
||||
xx(Trinary, )
|
||||
|
||||
xx(Cast, 1)
|
||||
xx(Cast, )
|
||||
|
||||
#undef xx
|
||||
|
|
|
@ -476,8 +476,6 @@ struct ZCC_OpProto
|
|||
|
||||
struct ZCC_OpInfoType
|
||||
{
|
||||
BYTE Nary:2; // n-ary-ness of operator
|
||||
|
||||
const char *OpName;
|
||||
ZCC_OpProto *Protos;
|
||||
|
||||
|
@ -497,17 +495,6 @@ void ZCC_InitOperators();
|
|||
|
||||
extern ZCC_OpInfoType ZCC_OpInfo[PEX_COUNT_OF];
|
||||
|
||||
static inline bool IsUnaryOp(EZCCExprType op)
|
||||
{
|
||||
assert((unsigned)op < (unsigned)PEX_COUNT_OF);
|
||||
return ZCC_OpInfo[op].Nary == 1;
|
||||
}
|
||||
static inline bool IsBinaryOp(EZCCExprType op)
|
||||
{
|
||||
assert((unsigned)op < (unsigned)PEX_COUNT_OF);
|
||||
return ZCC_OpInfo[op].Nary == 2;
|
||||
}
|
||||
|
||||
struct ZCC_AST
|
||||
{
|
||||
ZCC_AST() : TopNode(NULL) {}
|
||||
|
|
Loading…
Reference in a new issue