const IRTree::IStm* CConditionalWrapper::binopToConditional( const IRTree::CBinop* binop, const Temp::CLabel* t, const Temp::CLabel* f ) const { switch( binop->binop ) { case IRTree::B_And: return andBinopToConditional( binop, t, f ); //case IRTree::LSHIFT: //return new IRTree::CCJump( IRTree::B_Less, binop->left.get(), binop->right.get(), t, f ); //case IRTree::RSHIFT: return new IRTree::CCJump( IRTree::CJ_Greater, binop->left, binop->right, t, f ); case IRTree::B_Plus: case IRTree::B_Minus: case IRTree::B_Mul: case IRTree::B_Division: case IRTree::B_Xor: return new IRTree::CCJump( IRTree::CJ_NotEqual, binop, new IRTree::CConst( 0 ), t, f ); default: //assert( false ); return nullptr; } }
IIRStm* CConditionalWrapper::binopToConditional( const CIRBinOp* binop, CLabel* t, CLabel* f ) const { switch( binop->operation ) { case AND: return andBinopToConditional( binop, t, f ); case LESS: return new CIRCjump( LESS, binop->left, binop->right, t, f ); case GT: return new CIRCjump( GT, binop->left, binop->right, t, f ); case PLUS: case MINUS: case MUL: case DIV: case XOR: return new CIRCjump( NE, binop, new CIRConst( 0 ), t, f ); default: assert( false ); return nullptr; } }