Skip to content

Commit

Permalink
- fix impure testcase by adding the keyword impure
Browse files Browse the repository at this point in the history
- add Boolean isImpure to DAE.CALL_ATTR
- protect impure functions from evaluating to constant values


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15322 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Feb 25, 2013
1 parent e61aa41 commit 878156e
Show file tree
Hide file tree
Showing 22 changed files with 90 additions and 84 deletions.
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendDAECreate.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1489,15 +1489,15 @@ algorithm
// make sure is not constrain as we don't support it.
true = boolNot(Util.isEqual(functionName, Absyn.IDENT("constrain")));
e = List.fold(conditions, makeIfExp, DAE.BCONST(true));
(beqns, eqns) = lowerIfEquationAsserts1(eqns, condition, conditions, brancheqns1, DAE.ALGORITHM(DAE.ALGORITHM_STMTS({DAE.STMT_IF(e, {DAE.STMT_NORETCALL(DAE.CALL(functionName, explst, DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())), source)}, DAE.NOELSE(), source)}), source)::inEqns);
(beqns, eqns) = lowerIfEquationAsserts1(eqns, condition, conditions, brancheqns1, DAE.ALGORITHM(DAE.ALGORITHM_STMTS({DAE.STMT_IF(e, {DAE.STMT_NORETCALL(DAE.CALL(functionName, explst, DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())), source)}, DAE.NOELSE(), source)}), source)::inEqns);
then
(beqns, eqns);
case (DAE.NORETCALL(functionName = functionName, functionArgs=explst, source=source)::eqns, SOME(e), _, _, _)
equation
// make sure is not constrain as we don't support it.
true = boolNot(Util.isEqual(functionName, Absyn.IDENT("constrain")));
e = List.fold(conditions, makeIfExp, e);
(beqns, eqns) = lowerIfEquationAsserts1(eqns, condition, conditions, brancheqns1, DAE.ALGORITHM(DAE.ALGORITHM_STMTS({DAE.STMT_IF(e, {DAE.STMT_NORETCALL(DAE.CALL(functionName, explst, DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())), source)}, DAE.NOELSE(), source)}), source)::inEqns);
(beqns, eqns) = lowerIfEquationAsserts1(eqns, condition, conditions, brancheqns1, DAE.ALGORITHM(DAE.ALGORITHM_STMTS({DAE.STMT_IF(e, {DAE.STMT_NORETCALL(DAE.CALL(functionName, explst, DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())), source)}, DAE.NOELSE(), source)}), source)::inEqns);
then
(beqns, eqns);
case (eqn::eqns, _, _, _, _)
Expand Down Expand Up @@ -2332,7 +2332,7 @@ algorithm
b2 = Flags.getConfigBool(Flags.CHECK_MODEL);
true = boolOr(b1, b2);
(functionArgs, source, _) = Inline.inlineExps(functionArgs, (SOME(functionTree), {DAE.NORM_INLINE()}), source);
alg = DAE.ALGORITHM_STMTS({DAE.STMT_NORETCALL(DAE.CALL(functionName, functionArgs, DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())), source)});
alg = DAE.ALGORITHM_STMTS({DAE.STMT_NORETCALL(DAE.CALL(functionName, functionArgs, DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())), source)});
then
(inEquations, BackendDAE.ALGORITHM(0, alg, source)::inREquations, inIEquations);

Expand Down
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4497,7 +4497,7 @@ algorithm
case (e as DAE.CREF(componentRef=cref, ty = et as DAE.T_COMPLEX(varLst=varLst,complexClassType=ClassInf.RECORD(fname))), xlist, functions, inputVars, paramVars, stateVars, knownVars, allVars, diffVars, _)
equation
expList1 = List.map1(varLst,Expression.generateCrefsExpFromExpVar,cref);
e1 = DAE.CALL(fname,expList1,DAE.CALL_ATTR(et,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
e1 = DAE.CALL(fname,expList1,DAE.CALL_ATTR(et,false,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
then
differentiateWithRespectToXVec(e1,xlist, functions, inputVars, paramVars, stateVars, knownVars, allVars, diffVars, inMatrixName);
// case for arrays
Expand Down Expand Up @@ -7475,13 +7475,13 @@ algorithm
equation
ty = Expression.typeof(e);
then
((DAE.RELATION(e,DAE.NEQUAL(ty),DAE.CALL(Absyn.IDENT("pre"),{e},DAE.CALL_ATTR(ty,false,true,DAE.NO_INLINE(),DAE.NO_TAIL())),-1,NONE()),true));
((DAE.RELATION(e,DAE.NEQUAL(ty),DAE.CALL(Absyn.IDENT("pre"),{e},DAE.CALL_ATTR(ty,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL())),-1,NONE()),true));
// edge(b) = b and not pre(b)
case((DAE.CALL(path=Absyn.IDENT(name = "edge"),expLst={e}),_))
equation
ty = Expression.typeof(e);
then
((DAE.LBINARY(e,DAE.AND(ty),DAE.LUNARY(DAE.NOT(ty),DAE.CALL(Absyn.IDENT("pre"),{e},DAE.CALL_ATTR(ty,false,true,DAE.NO_INLINE(),DAE.NO_TAIL())))),true));
((DAE.LBINARY(e,DAE.AND(ty),DAE.LUNARY(DAE.NOT(ty),DAE.CALL(Absyn.IDENT("pre"),{e},DAE.CALL_ATTR(ty,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL())))),true));
case _ then tpl;
end matchcontinue;
end traverserExpreplaceEdgeChange;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendDAETransform.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ algorithm
case (BackendDAE.NORETCALL(functionName=functionName,functionArgs=functionArgs,source=source)::res,_,_)
equation
(res1,ext_arg_1) = traverseBackendDAEExpsWhenOperator(res,func,inTypeA);
((DAE.CALL(path=functionName,expLst=functionArgs),ext_arg_2)) = Expression.traverseExp(DAE.CALL(functionName,functionArgs,DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())),func,ext_arg_1);
((DAE.CALL(path=functionName,expLst=functionArgs),ext_arg_2)) = Expression.traverseExp(DAE.CALL(functionName,functionArgs,DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())),func,ext_arg_1);
then
(BackendDAE.NORETCALL(functionName,functionArgs,source)::res1,ext_arg_2);

Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendDAEUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2596,7 +2596,7 @@ algorithm outExp := matchcontinue(inExp)
expl = List.map1(varLst,Expression.generateCrefsExpFromExpVar,cr);
i = listLength(expl);
true = intGt(i,0);
e_new = DAE.CALL(name,expl,DAE.CALL_ATTR(t,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
e_new = DAE.CALL(name,expl,DAE.CALL_ATTR(t,false,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
restpl = Expression.traverseExp(e_new, traversingextendArrExp, (funcs,true));
then
(restpl);
Expand Down
10 changes: 5 additions & 5 deletions Compiler/BackEnd/Derive.mo
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ algorithm
expl = List.map1(varLst,Expression.generateCrefsExpFromExpVar,cr);
expl_1 = List.map1(expl, differentiateExpTime, inVariables);
then
DAE.CALL(a,expl_1,DAE.CALL_ATTR(tp,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
DAE.CALL(a,expl_1,DAE.CALL_ATTR(tp,false,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
// case for arrays
case ((e as DAE.CREF(componentRef = cr,ty = tp as DAE.T_ARRAY(dims=_))),(_,BackendDAE.SHARED(functionTree=functions)))
equation
Expand Down Expand Up @@ -247,7 +247,7 @@ algorithm
case ((e as DAE.CREF(componentRef = cr,ty = tp)),(timevars,_))
equation
// ({BackendDAE.VAR(varKind = BackendDAE.STATE(index=_))},_) = BackendVariable.getVar(cr, timevars);
then DAE.CALL(Absyn.IDENT("der"),{e},DAE.CALL_ATTR(tp,false,true,DAE.NO_INLINE(),DAE.NO_TAIL()));
then DAE.CALL(Absyn.IDENT("der"),{e},DAE.CALL_ATTR(tp,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL()));

// der(sign(x)) -> 0
case (DAE.CALL(path = Absyn.IDENT("sign"),expLst = {e}),_)
Expand Down Expand Up @@ -820,7 +820,7 @@ algorithm
list<DAE.Exp> expl,expl1,dexpl;
BackendDAE.Variables timevars;
Absyn.Path a,da;
Boolean b,c;
Boolean b,c,isImpure;
DAE.InlineType dinl;
DAE.Type ty;
DAE.FunctionTree functions;
Expand All @@ -832,7 +832,7 @@ algorithm
String typstring,dastring;
DAE.TailCall tc;

case (DAE.CALL(path=a,expLst=expl,attr=DAE.CALL_ATTR(tuple_=b,builtin=c,ty=ty,tailCall=tc)),(timevars,BackendDAE.SHARED(functionTree=functions)))
case (DAE.CALL(path=a,expLst=expl,attr=DAE.CALL_ATTR(tuple_=b,builtin=c,isImpure=isImpure,ty=ty,tailCall=tc)),(timevars,BackendDAE.SHARED(functionTree=functions)))
equation
// get function mapper
(mapper,tp) = getFunctionMapper(a,functions);
Expand All @@ -844,7 +844,7 @@ algorithm
dexpl = List.map1(expl1,differentiateExpTime,inVarsandFuncs);
expl1 = listAppend(expl,dexpl);
then
DAE.CALL(da,expl1,DAE.CALL_ATTR(ty,b,c,dinl,tc));
DAE.CALL(da,expl1,DAE.CALL_ATTR(ty,b,c,isImpure,dinl,tc));

case (DAE.CALL(path=a,expLst=expl),(timevars,BackendDAE.SHARED(functionTree=functions)))
equation
Expand Down
4 changes: 2 additions & 2 deletions Compiler/BackEnd/IndexReduction.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5201,7 +5201,7 @@ algorithm
e2 = generateSetExpressions(ifdexplst,index-1,crconexppre);
eqn = Util.if_(intGt(rang,1),BackendDAE.ARRAY_EQUATION({rang},crsetexp,e1,DAE.emptyElementSource,false),BackendDAE.EQUATION(crsetexp,e1,DAE.emptyElementSource,false));
tp = Expression.typeof(crsetexp);
deqn = Util.if_(intGt(rang,1),BackendDAE.ARRAY_EQUATION({rang},DAE.CALL(Absyn.IDENT("der"),{crsetexp},DAE.CALL_ATTR(tp,false,true,DAE.NO_INLINE(),DAE.NO_TAIL())),e2,DAE.emptyElementSource,false),BackendDAE.EQUATION(DAE.CALL(Absyn.IDENT("der"),{crsetexp},DAE.callAttrBuiltinReal),e2,DAE.emptyElementSource,false));
deqn = Util.if_(intGt(rang,1),BackendDAE.ARRAY_EQUATION({rang},DAE.CALL(Absyn.IDENT("der"),{crsetexp},DAE.CALL_ATTR(tp,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL())),e2,DAE.emptyElementSource,false),BackendDAE.EQUATION(DAE.CALL(Absyn.IDENT("der"),{crsetexp},DAE.callAttrBuiltinReal),e2,DAE.emptyElementSource,false));
startvalues = generateStartExpressions(istartvalues,index-1,contstartExp);
varlst = setVarLstStartValue(isetvarlst,startvalues,{});
then
Expand Down Expand Up @@ -5233,7 +5233,7 @@ protected
DAE.Type tp;
algorithm
tp := Expression.typeof(inExp);
outExp := DAE.CALL(Absyn.IDENT("der"),{inExp},DAE.CALL_ATTR(tp,false,true,DAE.NO_INLINE(),DAE.NO_TAIL()));
outExp := DAE.CALL(Absyn.IDENT("der"),{inExp},DAE.CALL_ATTR(tp,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
end makeder;

protected function changeVarToStartValue "
Expand Down
6 changes: 3 additions & 3 deletions Compiler/BackEnd/PartFn.mo
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ algorithm

case(DAE.NORETCALL(p,elst,source),dae)
equation
((DAE.CALL(path=p,expLst=elst_1),dae)) = Expression.traverseExp(DAE.CALL(p,elst,DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())),elabExp,dae);
((DAE.CALL(path=p,expLst=elst_1),dae)) = Expression.traverseExp(DAE.CALL(p,elst,DAE.CALL_ATTR(DAE.T_NORETCALL_DEFAULT, false, false, false, DAE.NORM_INLINE(), DAE.NO_TAIL())),elabExp,dae);
then
(DAE.NORETCALL(p,elst_1,source),dae);

Expand Down Expand Up @@ -1486,7 +1486,7 @@ algorithm
then
((DAE.CALL(new_p,args_1,attr),(p,inputs,dae,current)));
// fix calls to function pointer
case((DAE.CALL(orig_p,args,DAE.CALL_ATTR(ty,tup,false,inl,tc)),(p,inputs,dae,current)))
case((DAE.CALL(orig_p,args,DAE.CALL_ATTR(ty,tup,false,false,inl,tc)),(p,inputs,dae,current)))
equation
failure(_ = DAEUtil.getNamedFunctionFromList(orig_p,dae)); // if function exists, do not replace call
crefs = List.map(inputs,DAEUtil.varCref);
Expand All @@ -1496,7 +1496,7 @@ algorithm
args_1 = listAppend(args,args2);
ty_1 = Expression.unboxExpType(ty);
then
((DAE.CALL(p,args_1,DAE.CALL_ATTR(ty_1,tup,false,inl,tc)),(p,inputs,dae,current)));
((DAE.CALL(p,args_1,DAE.CALL_ATTR(ty_1,tup,false,false,inl,tc)),(p,inputs,dae,current)));
case((e,(p,inputs,dae,current))) then ((e,(p,inputs,dae,current)));
end matchcontinue;
end fixCall;
Expand Down
6 changes: 3 additions & 3 deletions Compiler/BackEnd/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9390,7 +9390,7 @@ algorithm
case( (e as DAE.BINARY(exp1 = e1, operator = DAE.DIV(ty), exp2 = e2), source))
equation
se = generateDivExpErrorMsg(e, e2, source);
then ((DAE.CALL(Absyn.IDENT("DIVISION"), {e1, e2, DAE.SCONST(se)}, DAE.CALL_ATTR(ty, false, true, DAE.NO_INLINE(), DAE.NO_TAIL())), source ));
then ((DAE.CALL(Absyn.IDENT("DIVISION"), {e1, e2, DAE.SCONST(se)}, DAE.CALL_ATTR(ty, false, true, false, DAE.NO_INLINE(), DAE.NO_TAIL())), source ));
/*
case( (e as DAE.BINARY(exp1 = e1, operator = DAE.DIV_ARR(ty), exp2 = e2), dlowmode as (dlow, _)))
then ((e, dlowmode ));
Expand All @@ -9404,7 +9404,7 @@ algorithm
case( (e as DAE.BINARY(exp1 = e1, operator = DAE.DIV_ARRAY_SCALAR(ty), exp2 = e2), source))
equation
se = generateDivExpErrorMsg(e, e2, source);
then ((DAE.CALL(Absyn.IDENT("DIVISION_ARRAY_SCALAR"), {e1, e2, DAE.SCONST(se)}, DAE.CALL_ATTR(ty, false, true, DAE.NO_INLINE(), DAE.NO_TAIL())), source ));
then ((DAE.CALL(Absyn.IDENT("DIVISION_ARRAY_SCALAR"), {e1, e2, DAE.SCONST(se)}, DAE.CALL_ATTR(ty, false, true, false, DAE.NO_INLINE(), DAE.NO_TAIL())), source ));

case( (e as DAE.BINARY(exp1 = e1, operator = DAE.DIV_SCALAR_ARRAY(ty), exp2 = e2), source))
equation
Expand All @@ -9414,7 +9414,7 @@ algorithm
case( (e as DAE.BINARY(exp1 = e1, operator = DAE.DIV_SCALAR_ARRAY(ty), exp2 = e2), source))
equation
se = generateDivExpErrorMsg(e, e2, source);
then ((DAE.CALL(Absyn.IDENT("DIVISION_SCALAR_ARRAY"), {e1, e2, DAE.SCONST(se)}, DAE.CALL_ATTR(ty, false, true, DAE.NO_INLINE(), DAE.NO_TAIL())), source));
then ((DAE.CALL(Absyn.IDENT("DIVISION_SCALAR_ARRAY"), {e1, e2, DAE.SCONST(se)}, DAE.CALL_ATTR(ty, false, true, false, DAE.NO_INLINE(), DAE.NO_TAIL())), source));
case _ then (inExp);
end matchcontinue;
end traversingDivExpFinder;
Expand Down
17 changes: 9 additions & 8 deletions Compiler/FrontEnd/Ceval.mo
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,18 @@ algorithm
then
(cache,v,stOpt);

// adrpo: TODO! this needs more work as if we don't have a symtab we run into unloading of dlls problem
case (cache,env,(e as DAE.CALL(path = funcpath,expLst = expl)),impl,stOpt,msg)
// adrpo: TODO! this needs more work as if we don't have a symtab we run into unloading of dlls problem
// lochel: do not evaluate impure function calls
case (cache, env, (e as DAE.CALL(path=funcpath, expLst=expl, attr=DAE.CALL_ATTR(isImpure=false))), impl, stOpt, msg)
equation
// do not handle Connection.isRoot here!
false = stringEq("Connection.isRoot", Absyn.pathString(funcpath));
// do not roll back errors generated by evaluating the arguments
(cache,vallst,stOpt) = cevalList(cache,env, expl, impl, stOpt, msg);
(cache, vallst, stOpt) = cevalList(cache, env, expl, impl, stOpt, msg);

(cache,newval,stOpt)= CevalScript.cevalCallFunction(cache, env, e, vallst, impl, stOpt, msg);
(cache, newval, stOpt)= CevalScript.cevalCallFunction(cache, env, e, vallst, impl, stOpt, msg);
then
(cache,newval,stOpt);
(cache, newval, stOpt);

// Try Interactive functions last
case (cache,env,(e as DAE.CALL(path = _)),(impl as true),SOME(st),msg)
Expand Down Expand Up @@ -870,22 +871,22 @@ algorithm
DAE.Exp e;
Absyn.Path p;
list<DAE.Exp> el;
Boolean t, b;
Boolean t, b, isImpure;
DAE.InlineType i;
DAE.Dimensions dims;
Values.Value v;
DAE.Type cevalType, ty;
DAE.TailCall tc;

case (e as DAE.CALL(path = p, expLst = el, attr = DAE.CALL_ATTR(tuple_ = t, builtin = b,
case (e as DAE.CALL(path = p, expLst = el, attr = DAE.CALL_ATTR(tuple_ = t, builtin = b, isImpure=isImpure,
ty = DAE.T_ARRAY(dims = dims), inlineType = i, tailCall = tc)), _, _, _)
equation
true = Expression.arrayContainWholeDimension(dims);
(_, v, _) = ceval(inCache, inEnv, e, true, NONE(), MSG(inInfo));
ty = Types.typeOfValue(v);
cevalType = Types.simplifyType(ty);
then
(DAE.CALL(p, el, DAE.CALL_ATTR(cevalType, t, b, i, tc)), DAE.PROP(ty, DAE.C_PARAM()));
(DAE.CALL(p, el, DAE.CALL_ATTR(cevalType, t, b, isImpure, i, tc)), DAE.PROP(ty, DAE.C_PARAM()));
end match;
end cevalWholedimRetCall;

Expand Down
2 changes: 2 additions & 0 deletions Compiler/FrontEnd/ConnectUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,7 @@ algorithm
ty,
false,
false,
false,
DAE.NO_INLINE(),
DAE.NO_TAIL()));
end makeInStreamCall;
Expand All @@ -3058,6 +3059,7 @@ algorithm
ty,
false,
true,
false,
DAE.NO_INLINE(),
DAE.NO_TAIL()));
end makePositiveMaxCall;
Expand Down
11 changes: 6 additions & 5 deletions Compiler/FrontEnd/DAE.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1395,18 +1395,19 @@ public uniontype TailCall
end TAIL;
end TailCall;

public constant CallAttributes callAttrBuiltinBool = CALL_ATTR(T_BOOL_DEFAULT,false,true,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinInteger = CALL_ATTR(T_INTEGER_DEFAULT,false,true,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinReal = CALL_ATTR(T_REAL_DEFAULT,false,true,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinString = CALL_ATTR(T_STRING_DEFAULT,false,true,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinOther = CALL_ATTR(T_UNKNOWN_DEFAULT,false,true,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinBool = CALL_ATTR(T_BOOL_DEFAULT,false,true,false,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinInteger = CALL_ATTR(T_INTEGER_DEFAULT,false,true,false,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinReal = CALL_ATTR(T_REAL_DEFAULT,false,true,false,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinString = CALL_ATTR(T_STRING_DEFAULT,false,true,false,NO_INLINE(),NO_TAIL());
public constant CallAttributes callAttrBuiltinOther = CALL_ATTR(T_UNKNOWN_DEFAULT,false,true,false,NO_INLINE(),NO_TAIL());

public
uniontype CallAttributes
record CALL_ATTR
Type ty "The type of the return value, if several return values this is undefined";
Boolean tuple_ "tuple" ;
Boolean builtin "builtin Function call" ;
Boolean isImpure "if the function has prefix *impure* is true, else false";
InlineType inlineType;
TailCall tailCall "Input variables of the function if the call is tail-recursive";
end CALL_ATTR;
Expand Down
12 changes: 5 additions & 7 deletions Compiler/FrontEnd/Expression.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3271,8 +3271,7 @@ algorithm
end expPow;


public function expMaxScalar
"function: expMax
public function expMaxScalar "function: expMax
author: Frenkel TUD 2011-04
returns max(e1,e2)."
input DAE.Exp e1;
Expand All @@ -3282,11 +3281,10 @@ protected
Type tp;
algorithm
tp := typeof(e1);
outExp := DAE.CALL(Absyn.IDENT("max"),{e1,e2},DAE.CALL_ATTR(tp,false,true,DAE.NO_INLINE(),DAE.NO_TAIL()));
outExp := DAE.CALL(Absyn.IDENT("max"),{e1,e2},DAE.CALL_ATTR(tp,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
end expMaxScalar;

public function expMinScalar
"function: expMin
public function expMinScalar "function: expMin
author: Frenkel TUD 2011-04
returns min(e1,e2)."
input DAE.Exp e1;
Expand All @@ -3297,7 +3295,7 @@ protected
Boolean b;
algorithm
tp := typeof(e1);
outExp := DAE.CALL(Absyn.IDENT("min"),{e1,e2},DAE.CALL_ATTR(tp,false,true,DAE.NO_INLINE(),DAE.NO_TAIL()));
outExp := DAE.CALL(Absyn.IDENT("min"),{e1,e2},DAE.CALL_ATTR(tp,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
end expMinScalar;

public function makeProductVector "takes and expression e1 and a list of expressisions {v1,v2,...,vn} and returns
Expand Down Expand Up @@ -8524,7 +8522,7 @@ public function makeBuiltinCall
output DAE.Exp call;
annotation(__OpenModelica_EarlyInline = true);
algorithm
call := DAE.CALL(Absyn.IDENT(name),args,DAE.CALL_ATTR(result_type,false,true,DAE.NO_INLINE(),DAE.NO_TAIL()));
call := DAE.CALL(Absyn.IDENT(name),args,DAE.CALL_ATTR(result_type,false,true,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
end makeBuiltinCall;

public function reductionIterName
Expand Down

0 comments on commit 878156e

Please sign in to comment.