TIType Checkers::check_sinm(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         return in0;
     }
     case TIType::COMPLEX :
     {
         if (in0.cols == in0.rows)
         {
             return in0;
         }
         return TIType(gvn);
     }
     case TIType::DOUBLE :
     {
         if (in0.cols == in0.rows)
         {
             return in0;
         }
         return TIType(gvn);
     }
     default :
         return TIType(gvn);
     }
 }
Exemple #2
0
 TIType Checkers::check_abs(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         return in0;
     }
     case TIType::COMPLEX :
     {
         return TIType(gvn, TIType::DOUBLE, in0.rows, in0.cols);
     }
     case TIType::DOUBLE :
     {
         return in0;
     }
     case TIType::INT16 :
     {
         return in0;
     }
     case TIType::INT32 :
     {
         return in0;
     }
     case TIType::INT64 :
     {
         return in0;
     }
     case TIType::INT8 :
     {
         return in0;
     }
     case TIType::UINT16 :
     {
         return in0;
     }
     case TIType::UINT32 :
     {
         return in0;
     }
     case TIType::UINT64 :
     {
         return in0;
     }
     case TIType::UINT8 :
     {
         return in0;
     }
     default :
         return TIType(gvn);
     }
 }
TIType Checkers::check_imult(GVN & gvn, const TIType & in0)
{
    switch (in0.type)
    {
        case TIType::COMPLEX :
        {
            return in0;
        }
        case TIType::DOUBLE :
        {
            return TIType(gvn, TIType::COMPLEX, in0.rows, in0.cols);
        }
        default :
            return TIType(gvn);
    }
}
 TIType Checkers::check_isreal(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::COMPLEX :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::DOUBLE :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     default :
         return TIType(gvn);
     }
 }
 TIType Checkers::check_____unaryminus____(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         return in0;
     }
     case TIType::COMPLEX :
     {
         return in0;
     }
     case TIType::DOUBLE :
     {
         return in0;
     }
     case TIType::INT16 :
     {
         return in0;
     }
     case TIType::INT32 :
     {
         return in0;
     }
     case TIType::INT64 :
     {
         return in0;
     }
     case TIType::INT8 :
     {
         return in0;
     }
     case TIType::UINT16 :
     {
         return in0;
     }
     case TIType::UINT32 :
     {
         return in0;
     }
     case TIType::UINT64 :
     {
         return in0;
     }
     case TIType::UINT8 :
     {
         return in0;
     }
     default :
         return TIType(gvn);
     }
 }
TIType Checkers::check_ones(GVN & gvn, const TIType & in0, const TIType & in1)
{
    if (in0.type == TIType::DOUBLE)
    {
        if (in1.type == TIType::DOUBLE)
        {
            if (in0.rows == 1 && in0.cols == 1 && in1.rows == 1 && in1.cols == 1)
            {
                return TIType(gvn, TIType::DOUBLE, -2, -2);
            }
        }
        else
        {
            return TIType(gvn);
        }
        return TIType(gvn);
    }
    else
    {
        return TIType(gvn);
    }
}
TIType Checkers::check_tanh(GVN & gvn, const TIType & in0)
{
    switch (in0.type)
    {
    case TIType::EMPTY :
    {
        return in0;
    }
    case TIType::COMPLEX :
    {
        return in0;
    }
    case TIType::DOUBLE :
    {
        return in0;
    }
    default :
        return TIType(gvn);
    }
}
 TIType Checkers::check_isreal(GVN & gvn, const TIType & in0, const TIType & in1)
 {
     switch (in0.type)
     {
     case TIType::COMPLEX :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::DOUBLE :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     default :
         return TIType(gvn);
     }
 }
Exemple #9
0
std::vector<TIType> Block::addCall(AnalysisVisitor & visitor, const unsigned int lhs, const symbol::Symbol & sym, std::vector<TIType> & in, ast::CallExp * callexp)
{
    tools::SymbolMap<Info>::iterator it;
    Block * block = getDefBlock(sym, it, false);
    types::InternalType * pIT = nullptr;
    std::vector<TIType> out(lhs, TIType(visitor.getGVN()));
    TIType type;

    if (block)
    {
        type = it->second.type;
    }
    else
    {
        type = DataManager::getSymInScilabContext(getGVN(), sym, pIT);
    }

    switch (type.type)
    {
        case TIType::FUNCTION:
        {
            if (lhs > 0)
            {
                TIType ty = Checkers::check(getGVN(), sym.getName(), in);
                if (ty.type != TIType::UNKNOWN && ty.hasInvalidDims())
                {
                    out[0] = ty.asUnknownMatrix();
                }
                else
                {
                    out[0] = ty;
                }
            }
            break;
        }
        case TIType::MACRO:
        {
            if (pIT)
            {
                visitor.getPMC().getOutTypes(visitor, dm->getMacroDef(static_cast<types::Macro *>(pIT)), in, out);
            }
            else
            {
                if (it->second.exp && it->second.exp->isFunctionDec())
                {
                    DeclaredMacroDef macrodef(static_cast<ast::FunctionDec *>(it->second.exp));
                    visitor.getPMC().getOutTypes(visitor, &macrodef, in, out);
                }
                else
                {
                    DataManager::getSymInScilabContext(getGVN(), sym, pIT);
                    visitor.getPMC().getOutTypes(visitor, dm->getMacroDef(static_cast<types::Macro *>(pIT)), in, out);
                }
            }
            break;
        }
        case TIType::MACROFILE:
        {
            DataManager::getSymInScilabContext(getGVN(), sym, pIT);
            visitor.getPMC().getOutTypes(visitor, dm->getMacroDef(static_cast<types::MacroFile *>(pIT)->getMacro()), in, out);
            break;
        }
        default:
        {
        }
    }

    return out;
}
bool MemInitAnalyzer::analyze(AnalysisVisitor & visitor, const unsigned int lhs, ast::CallExp & e)
{
    const ast::exps_t args = e.getArgs();
    if (args.size() == 2)
    {
        ast::Exp * first = *args.begin();
        ast::Exp * second = *std::next(args.begin());

        first->accept(visitor);
        Result R1 = visitor.getResult();
        visitor.getDM().releaseTmp(R1.getTempId(), first);
        second->accept(visitor);
        Result & R2 = visitor.getResult();
        visitor.getDM().releaseTmp(R2.getTempId(), second);
        double val;
        SymbolicDimension rows, cols;
        bool empty = false;

        if (R1.getConstant().getDblValue(val))
        {
            const int nrows = tools::cast<int>(val);
            if (nrows <= 0)
            {
                empty = true;
            }
            else
            {
                rows = SymbolicDimension(visitor.getGVN(), nrows);
            }
        }
        else if (GVN::Value * gvnValue = R1.getConstant().getGVNValue())
        {
            rows.setValue(gvnValue);
            rows.setGVN(&visitor.getGVN());
        }
        else
        {
            return false;
        }

        if (!empty)
        {
            if (R2.getConstant().getDblValue(val))
            {
                const int ncols = tools::cast<int>(val);
                if (ncols <= 0)
                {
                    empty = true;
                }
                else
                {
                    cols = SymbolicDimension(visitor.getGVN(), ncols);
                }
            }
            else if (GVN::Value * gvnValue = R2.getConstant().getGVNValue())
            {
                cols.setValue(gvnValue);
                cols.setGVN(&visitor.getGVN());
            }
            else
            {
                return false;
            }
        }

        if (empty)
        {
            e.getDecorator().setResult(TIType(visitor.getGVN(), TIType::EMPTY));
        }
        else
        {
            bool res = visitor.getCM().check(ConstraintManager::POSITIVE, rows.getValue());
            if (res)
            {
                res = visitor.getCM().check(ConstraintManager::POSITIVE, cols.getValue());
                if (!res)
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
            TIType resT(visitor.getGVN(), TIType::DOUBLE, rows, cols);
            e.getDecorator().setResult(Result(resT, visitor.getDM().getTmpId(resT, false)));
        }
        visitor.setResult(e.getDecorator().res);

        return true;
    }

    return false;
}
void AnalysisVisitor::visitInVarDecCtxt(ast::ListExp & e)
{
    e.getStart().accept(*this);
    Result & Rstart = e.getStart().getDecorator().getResult();
    e.getEnd().accept(*this);
    Result & Rend = e.getEnd().getDecorator().getResult();
    e.getStep().accept(*this);
    Result & Rstep = e.getStep().getDecorator().getResult();

    double start = 1;
    double step = 1;
    double end = 1;
    if ((Rstart.getConstant().getDblValue(start) || Rstep.getConstant().getDblValue(step)
            || Rend.getConstant().getDblValue(end)) &&
            (step == 0 || tools::isNaN(step) || !tools::isFinite(step)
             || tools::isNaN(start) || !tools::isFinite(start)
             ||  tools::isNaN(end) || !tools::isFinite(end)))
    {
        // We have an invalid list
        e.getDecorator().setResult(Result(TIType(dm.getGVN(), TIType::EMPTY), -1));
        return;
    }

    ast::VarDec & vd = *static_cast<ast::VarDec *>(e.getParent());
    const symbol::Symbol & sym = vd.getSymbol();
    GVN::Value * startRange = nullptr;
    GVN::Value * endRange = nullptr;
    Result & res = e.getDecorator().setResult(Result(TIType(dm.getGVN(), TIType::DOUBLE), -1));

    if (Rstart.getConstant().getGVNValue(getGVN(), startRange) && Rend.getConstant().getGVNValue(getGVN(), endRange))
    {
        // Start & End are GVN values
        res.setRange(SymbolicRange(getGVN(), startRange, endRange));
    }
    else
    {
        SymbolicRange & rangeStart = Rstart.getRange();
        if (rangeStart.isValid())
        {
            // Start is an iterator: for i=1:N, for j=i:N, ... in the second for "i" in "i:n" is an iterator
            if (endRange || Rend.getConstant().getGVNValue(getGVN(), endRange))
            {
                // Start is an iterator and End is GVN value
                res.setRange(SymbolicRange(getGVN(), rangeStart.getStart(), endRange));
            }
            else
            {
                SymbolicRange & rangeEnd = Rend.getRange();
                if (rangeEnd.isValid())
                {
                    // Start & End are iterators
                    res.setRange(SymbolicRange(getGVN(), rangeStart.getStart(), rangeEnd.getEnd()));
                }
            }
        }
        else if (startRange || Rstart.getConstant().getGVNValue(getGVN(), startRange))
        {
            // Start is a GVN value
            SymbolicRange & rangeEnd = Rend.getRange();
            if (rangeEnd.isValid())
            {
                // Start is a GVN value and End is an iterator
                res.setRange(SymbolicRange(getGVN(), startRange, rangeEnd.getEnd()));
            }
        }
    }

    setResult(res);
}
void AnalysisVisitor::visit(ast::ListExp & e)
{
    logger.log(L"ListExp", e.getLocation());
    if (e.getParent()->isVarDec())
    {
        visitInVarDecCtxt(e);
        return;
    }

    e.getStart().accept(*this);
    Result & Rstart = e.getStart().getDecorator().getResult();
    e.getEnd().accept(*this);
    Result & Rend = e.getEnd().getDecorator().getResult();
    e.getStep().accept(*this);
    Result & Rstep = e.getStep().getDecorator().getResult();

    double start = 1;
    double step = 1;
    double end = 1;
    if (Rstart.getConstant().getDblValue(start) && Rstep.getConstant().getDblValue(step) && Rend.getConstant().getDblValue(end))
    {
        // Start, Step & End are constant !
        double out;
        int type = ForList64::checkList(start, end, step, out);

        switch (type)
        {
            case 0:
                e.getDecorator().setResult(Result(TIType(dm.getGVN(), TIType::EMPTY), -1));
                break;
            case 1:
                e.getDecorator().setResult(Result(TIType(dm.getGVN(), TIType::DOUBLE), -1));
                break;
            case 2:
            {
                const uint64_t N = ForList64::size(start, end, step);
                TIType T(dm.getGVN(), TIType::DOUBLE, 1, N);
                if (N == 1)
                {
                    out = start;
                }
                e.getDecorator().setResult(Result(T, dm.getTmpId(T, false)));
                break;
            }
            default:
                break;
        }
        e.setValues(start, step, end, out);
        setResult(e.getDecorator().res);

        return;
    }

    if (step == 0 || tools::isNaN(step) || !tools::isFinite(step)
            || tools::isNaN(start) || !tools::isFinite(start)
            ||  tools::isNaN(end) || !tools::isFinite(end))
    {
        e.getDecorator().setResult(Result(TIType(dm.getGVN(), TIType::EMPTY), -1));
        return;
    }

    if (!Rstep.getConstant().getDblValue(step) || (step != -1 && step != 1))
    {
        Result & res = e.getDecorator().setResult(Result(TIType(dm.getGVN(), Rstart.getType().type, false), -1));
        setResult(res);
        return;
    }

    if (!Rstart.getType().isscalar() || !Rend.getType().isscalar())
    {
        Result & res = e.getDecorator().setResult(Result(TIType(dm.getGVN(), Rstart.getType().type, false), -1));
        setResult(res);
        return;
    }

    GVN::Value * gvnStart;
    if (Rstart.getConstant().getDblValue(start))
    {
        if (tools::getIntType(start) == tools::NOTANINT)
        {
            gvnStart = getGVN().getValue((double)tools::cast<int>(start + step));
        }
        else
        {
            gvnStart = getGVN().getValue((double)tools::cast<int>(start));
        }
    }
    else
    {
        gvnStart = Rstart.getConstant().getGVNValue();
        if (!gvnStart)
        {
            Result & res = e.getDecorator().setResult(Result(TIType(dm.getGVN(), Rstart.getType().type, false), -1));
            setResult(res);
            return;
        }
    }

    GVN::Value * gvnEnd;

    if (Rend.getConstant().getDblValue(end))
    {
        if (tools::getIntType(end) == tools::NOTANINT)
        {
            gvnEnd = getGVN().getValue((double)tools::cast<int>(end - step));
        }
        else
        {
            gvnEnd = getGVN().getValue((double)tools::cast<int>(end));
        }
    }
    else
    {
        gvnEnd = Rend.getConstant().getGVNValue();
        if (!gvnEnd)
        {
            Result & res = e.getDecorator().setResult(Result(TIType(dm.getGVN(), Rstart.getType().type, false), -1));
            setResult(res);
            return;
        }
    }

    GVN::Value * ONEValue = getGVN().getValue(int64_t(1));
    SymbolicDimension ONE(getGVN(), ONEValue);
    GVN::Value * v;

    if (gvnStart->value == gvnEnd->value)
    {
        Result & res = e.getDecorator().setResult(Result(TIType(getGVN(), TIType::DOUBLE, ONE, ONE)));
        setResult(res);
        return;
    }

    if (step == 1)
    {
        v = getGVN().getValue(OpValue::Kind::MINUS, *gvnEnd, *gvnStart);
    }
    else
    {
        v = getGVN().getValue(OpValue::Kind::MINUS, *gvnStart, *gvnEnd);
    }
    v = getGVN().getValue(OpValue::Kind::PLUS, *v, *ONEValue);

    if (v->poly->constant < 0 && v->poly->isCoeffNegative(false))
    {
        TIType type(getGVN(), TIType::EMPTY);
        e.getDecorator().res = Result(type);
    }
    else
    {
        bool res = getCM().check(ConstraintManager::POSITIVE, v);
        if (res)
        {
            TIType type(getGVN(), TIType::DOUBLE, ONE, SymbolicDimension(getGVN(), v));
            e.getDecorator().setResult(type);
        }
        else
        {
            Result & res = e.getDecorator().setResult(Result(TIType(dm.getGVN(), Rstart.getType().type, false), -1));
            setResult(res);
            return;
        }
    }

    setResult(e.getDecorator().res);
}
Exemple #13
0
 TIType Checkers::check_size(GVN & gvn, const TIType & in0, const TIType & in1)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::BOOLEAN :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::COMPLEX :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::DOUBLE :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT16 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT32 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT64 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT8 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::POLYNOMIAL :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::STRING :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::SPARSE :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT16 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT32 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT64 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT8 :
     {
         if (in1.type == TIType::STRING)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::DOUBLE, 1, 1);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     default :
         return TIType(gvn);
     }
 }
TIType Checkers::check_____power____(GVN & gvn, const TIType & in0, const TIType & in1)
{
    switch (in0.type)
    {
        case TIType::EMPTY :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in0;
                }
                case TIType::BOOLEAN :
                {
                    return in0;
                }
                case TIType::COMPLEX :
                {
                    return in0;
                }
                case TIType::DOUBLE :
                {
                    return in0;
                }
                case TIType::INT16 :
                {
                    return in0;
                }
                case TIType::INT32 :
                {
                    return in0;
                }
                case TIType::INT64 :
                {
                    return in0;
                }
                case TIType::INT8 :
                {
                    return in0;
                }
                case TIType::UINT16 :
                {
                    return in0;
                }
                case TIType::UINT32 :
                {
                    return in0;
                }
                case TIType::UINT64 :
                {
                    return in0;
                }
                case TIType::UINT8 :
                {
                    return in0;
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::BOOLEAN :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::COMPLEX :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::COMPLEX, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::COMPLEX, -2, -2);
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::DOUBLE, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::DOUBLE, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::COMPLEX :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::BOOLEAN :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::COMPLEX, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::COMPLEX, -2, -2);
                }
                case TIType::COMPLEX :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::COMPLEX, -2, -2);
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::COMPLEX, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::COMPLEX, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::DOUBLE :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::BOOLEAN :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::DOUBLE, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::DOUBLE, -2, -2);
                }
                case TIType::COMPLEX :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::COMPLEX, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::COMPLEX, -2, -2);
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::COMPLEX, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::COMPLEX, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::COMPLEX, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT16, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT8, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT8, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT8, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT8, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::INT16 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT16, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT16, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT16, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::INT32 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::INT64 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::INT8 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::INT8, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::INT8, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT16, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::INT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::INT8, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT8, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT8, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::UINT16 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::UINT32 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::UINT64 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        case TIType::UINT8 :
        {
            switch (in1.type)
            {
                case TIType::EMPTY :
                {
                    return in1;
                }
                case TIType::DOUBLE :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT8, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT8, -2, -2);
                }
                case TIType::INT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::INT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::INT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::INT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT8, in1.rows, in1.cols);
                    }
                    return TIType(gvn, TIType::UINT8, -2, -2);
                }
                case TIType::UINT16 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT16, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT16, -2, -2);
                }
                case TIType::UINT32 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT32, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT32, -2, -2);
                }
                case TIType::UINT64 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return TIType(gvn, TIType::UINT64, in0.rows, in0.rows);
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT64, -2, -2);
                }
                case TIType::UINT8 :
                {
                    if (in0.cols == in0.rows && in1.rows == 1 && in1.cols == 1)
                    {
                        return in0;
                    }
                    if (in0.rows == 1 && in0.cols == 1)
                    {
                        return in1;
                    }
                    return TIType(gvn, TIType::UINT8, -2, -2);
                }
                default :
                    return TIType(gvn);
            }
            return TIType(gvn);
        }
        default :
            return TIType(gvn);
    }
}
bool SymbolicList::getType(GVN & gvn, TIType & type) const
{
    double dstart, dstep, dend;
    bool known = false;
    if (symbolic)
    {
        const MultivariatePolynomial & mpStart = *start.gvnVal->poly;
        const MultivariatePolynomial & mpStep = *step.gvnVal->poly;
        const MultivariatePolynomial & mpEnd = *end.gvnVal->poly;
        if (mpStart.isConstant() && mpStep.isConstant() && mpEnd.isConstant())
        {
            dstart = mpStart.constant;
            dstep = mpStep.constant;
            dend = mpEnd.constant;
            known = true;
        }
    }
    else
    {
        dstart = start.dval;
        dstep = step.dval;
        dend = end.dval;
        known = true;
    }

    if (known)
    {
        double out;
        int _type = ForList64::checkList(dstart, dend, dstep, out);

        switch (_type)
        {
            case 0:
                type = TIType(gvn, TIType::EMPTY);
                return true;
            case 1:
                type = TIType(gvn, TIType::DOUBLE);
                return true;
            case 2:
            {
                const uint64_t N = ForList64::size(dstart, dend, dstep);
                type = TIType(gvn, TIType::DOUBLE, 1, N);
                return true;
            }
            default:
                return false;
        }
    }

    GVN::Value * gvnStart = start.gvnVal, * gvnStep = step.gvnVal, * gvnEnd = end.gvnVal;
    if (!gvnStep->poly->isConstant())
    {
        return false;
    }

    dstep = gvnStep->poly->constant;
    if (dstep == 0)
    {
        type = TIType(gvn, TIType::EMPTY);
        return true;
    }

    if (dstep != -1 && dstep != 1)
    {
        // TODO : we must be able to handle general step (even if -1 or 1 seem to be the most frequent values)
        // but it implies that we need a symbolic division on polynomials.
        return false;
    }

    GVN::Value * ONEValue = gvn.getValue(1.);
    SymbolicDimension ONE(gvn, ONEValue);

    if (gvnStart->value == gvnEnd->value)
    {
        type = TIType(gvn, TIType::DOUBLE, ONE, ONE);
        return true;
    }

    GVN::Value * v;
    if (dstep == 1)
    {
        v = gvn.getValue(OpValue::Kind::MINUS, *gvnEnd, *gvnStart);
    }
    else
    {
        v = gvn.getValue(OpValue::Kind::MINUS, *gvnStart, *gvnEnd);
    }
    v = gvn.getValue(OpValue::Kind::PLUS, *v, *ONEValue);
    if (v->poly->constant < 0 && v->poly->isCoeffNegative(false))
    {
        type = TIType(gvn, TIType::EMPTY);
        return true;
    }

    type = TIType(gvn, TIType::DOUBLE, ONE, SymbolicDimension(gvn, v));
    return true;
}
Exemple #16
0
 TIType Checkers::check_or(GVN & gvn, const TIType & in0, const TIType & in1)
 {
     switch (in0.type)
     {
     case TIType::BOOLEAN :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::COMPLEX :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::DOUBLE :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT16 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT32 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT64 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT8 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT16 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT32 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT64 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT8 :
     {
         switch (in1.type)
         {
         case TIType::DOUBLE :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         case TIType::STRING :
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::BOOLEAN, 1, 1);
             }
             return TIType(gvn);
         }
         default :
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     default :
         return TIType(gvn);
     }
 }
Exemple #17
0
 TIType Checkers::check_or(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::BOOLEAN :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::COMPLEX :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::DOUBLE :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::INT16 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::INT32 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::INT64 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::INT8 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::UINT16 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::UINT32 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::UINT64 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     case TIType::UINT8 :
     {
         return TIType(gvn, TIType::BOOLEAN, 1, 1);
     }
     default :
         return TIType(gvn);
     }
 }
 TIType Checkers::check_iconvert(GVN & gvn, const TIType & in0, const TIType & in1)
 {
     switch (in0.type)
     {
     case TIType::DOUBLE :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT16 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT32 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT64 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT8 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT16 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT32 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT64 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT8 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in1.rows == 1 && in1.cols == 1)
             {
                 return TIType(gvn, TIType::UNKNOWN, in0.rows, in0.cols);
             }
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     default :
         return TIType(gvn);
     }
 }
 TIType Checkers::check_typeof(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::BOOLEAN :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::COMPLEX :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::CELL :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::DOUBLE :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::FUNCTION :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::INT16 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::INT32 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::INT64 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::INT8 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::LIST :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::LIBRARY :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::MACRO :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::MACROFILE :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::MLIST :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::POLYNOMIAL :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::STRING :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::SPARSE :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::STRUCT :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::TLIST :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::UINT16 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::UINT32 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::UINT64 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     case TIType::UINT8 :
     {
         return TIType(gvn, TIType::STRING, 1, 1);
     }
     default :
         return TIType(gvn);
     }
 }
 TIType Checkers::check_zeros(GVN & gvn)
 {
     return TIType(gvn, TIType::DOUBLE, 1, 1);
 }
 TIType Checkers::check_matrix(GVN & gvn, const TIType & in0, const TIType & in1, const TIType & in2)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return in0;
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::BOOLEAN :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::BOOLEAN, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::COMPLEX :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::COMPLEX, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::DOUBLE :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::DOUBLE, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT16 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::INT16, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT32 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::INT32, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT64 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::INT64, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::INT8 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::INT8, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::POLYNOMIAL :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::POLYNOMIAL, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::STRING :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::STRING, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::SPARSE :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::SPARSE, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT16 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::UINT16, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT32 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::UINT32, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT64 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::UINT64, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     case TIType::UINT8 :
     {
         if (in1.type == TIType::DOUBLE)
         {
             if (in2.type == TIType::DOUBLE)
             {
                 if (in1.rows == 1 && in1.cols == 1 && in2.rows == 1 && in2.cols == 1)
                 {
                     return TIType(gvn, TIType::UINT8, -2, -2);
                 }
             }
             else
             {
                 return TIType(gvn);
             }
             return TIType(gvn);
         }
         else
         {
             return TIType(gvn);
         }
         return TIType(gvn);
     }
     default :
         return TIType(gvn);
     }
 }
TIType Checkers::check_sum(GVN & gvn, const TIType & in0)
{
    switch (in0.type)
    {
        case TIType::EMPTY :
        {
            return in0;
        }
        case TIType::COMPLEX :
        {
            return TIType(gvn, TIType::COMPLEX, 1, 1);
        }
        case TIType::DOUBLE :
        {
            return TIType(gvn, TIType::DOUBLE, 1, 1);
        }
        case TIType::INT16 :
        {
            return TIType(gvn, TIType::INT16, 1, 1);
        }
        case TIType::INT32 :
        {
            return TIType(gvn, TIType::INT32, 1, 1);
        }
        case TIType::INT64 :
        {
            return TIType(gvn, TIType::INT64, 1, 1);
        }
        case TIType::INT8 :
        {
            return TIType(gvn, TIType::INT8, 1, 1);
        }
        case TIType::UINT16 :
        {
            return TIType(gvn, TIType::UINT16, 1, 1);
        }
        case TIType::UINT32 :
        {
            return TIType(gvn, TIType::UINT32, 1, 1);
        }
        case TIType::UINT64 :
        {
            return TIType(gvn, TIType::UINT64, 1, 1);
        }
        case TIType::UINT8 :
        {
            return TIType(gvn, TIType::UINT8, 1, 1);
        }
        default :
            return TIType(gvn);
    }
}
Exemple #23
0
 TIType Checkers::check_size(GVN & gvn, const TIType & in0)
 {
     switch (in0.type)
     {
     case TIType::EMPTY :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::BOOLEAN :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::COMPLEX :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::DOUBLE :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::INT16 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::INT32 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::INT64 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::INT8 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::POLYNOMIAL :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::STRING :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::SPARSE :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::UINT16 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::UINT32 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::UINT64 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     case TIType::UINT8 :
     {
         return TIType(gvn, TIType::DOUBLE, 1, 1);
     }
     default :
         return TIType(gvn);
     }
 }