Skip to content

Commit

Permalink
- add cases for DAE.DEFINE and DAE.EQUEQUATION in BackendDAECreate.lo…
Browse files Browse the repository at this point in the history
…werWhenEq2

- add missing case of alias exp "not a"

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13409 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Oct 16, 2012
1 parent 3f6e9b6 commit 4efd73f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -1323,7 +1323,7 @@ algorithm
list<BackendDAE.Equation> eqnl;
list<BackendDAE.WhenOperator> reinit;
DAE.Exp cre,e,cond,level;
DAE.ComponentRef cr;
DAE.ComponentRef cr,cr2;
list<DAE.Element> xs,eqns;
DAE.Element el;
DAE.ElementSource source;
Expand All @@ -1335,6 +1335,20 @@ algorithm
Absyn.Path functionName;

case ({},_,_,_,_) then (iEquationLst,iReinitStatementLst);
case (DAE.EQUEQUATION(cr1 = cr,cr2 = cr2, source = source) :: xs,_,_,_,_)
equation
e = Expression.crefExp(cr2);
(eqnl,reinit) = lowerWhenEqn2(xs,inCond, functionTree, BackendDAE.WHEN_EQUATION(1,BackendDAE.WHEN_EQ(inCond,cr,e,NONE()),source) :: iEquationLst, iReinitStatementLst);
then
(eqnl,reinit);

case (DAE.DEFINE(componentRef = cr,exp = e, source = source) :: xs,_,_,_,_)
equation
(e,source,_) = Inline.inlineExp(e, (SOME(functionTree),{DAE.NORM_INLINE()}), source);
(eqnl,reinit) = lowerWhenEqn2(xs,inCond, functionTree, BackendDAE.WHEN_EQUATION(1,BackendDAE.WHEN_EQ(inCond,cr,e,NONE()),source) :: iEquationLst, iReinitStatementLst);
then
(eqnl,reinit);

case (DAE.EQUATION(exp = (cre as DAE.CREF(componentRef = cr)),scalar = e, source = source) :: xs,_,_,_,_)
equation
(e,source,_) = Inline.inlineExp(e, (SOME(functionTree),{DAE.NORM_INLINE()}), source);
Expand Down
2 changes: 2 additions & 0 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -2014,6 +2014,8 @@ algorithm
case (DAE.UNARY(DAE.UMINUS(_),DAE.CREF(componentRef = cr))) then (true,cr);
// alias -a
case (DAE.UNARY(DAE.UMINUS_ARR(_),DAE.CREF(componentRef = cr))) then (true,cr);
// alias not a
case (DAE.LUNARY(DAE.NOT(_),DAE.CREF(componentRef = cr))) then (true,cr);
end match;
end aliasExp;

Expand Down

0 comments on commit 4efd73f

Please sign in to comment.