Esempio n. 1
0
const IRTree::IStm* CConditionalWrapper::ToConditional( const Temp::CLabel* t, const Temp::CLabel* f ) const
{
	auto asBinop = dynamic_cast< const IRTree::CBinop* >( exp );
	if( asBinop != nullptr ) {
		return binopToConditional( asBinop, t, f );
	} else {
		return new IRTree::CCJump( IRTree::CJ_NotEqual, exp, new IRTree::CConst( 0 ), t, f );
	}
}
IIRStm* CConditionalWrapper::ToConditional( CLabel* t, CLabel* f ) const
{
    auto asBinop = dynamic_cast< const CIRBinOp* >( exp );
    if( asBinop != nullptr ) {
        return binopToConditional( asBinop, t, f );
    } else {
        return new CIRCjump( NE, exp, new CIRConst( 0 ), t, f );
    }
}