Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Backend will now replace pre(a) with alias "a = -b" correctly:
  - Correct way is -pre(b); previously pre(-b) was used.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5405 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 28, 2010
1 parent 9227c01 commit 5770f89
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Compiler/VarTransform.mo
Expand Up @@ -1366,6 +1366,17 @@ algorithm
e3_1 = replaceExp(e3, repl, cond);
then
DAE.IFEXP(e1_1,e2_1,e3_1);
/* Special case when a variable in pre() is an alias for unary minus of another */
case (DAE.CALL(path = path as Absyn.IDENT("pre"),expLst = {e as DAE.CREF(componentRef = _)},tuple_ = t,builtin = c,ty=tp,inlineType=i),repl,cond)
local
Boolean t,c;
DAE.InlineType i;
DAE.ExpType ety,tp;
equation
true = replaceExpCond(cond, e);
DAE.UNARY(DAE.UMINUS(ety),e) = replaceExp(e, repl, cond);
then
DAE.UNARY(DAE.UMINUS(ety),DAE.CALL(path,{e},t,c,tp,i));
case ((e as DAE.CALL(path = path,expLst = expl,tuple_ = t,builtin = c,ty=tp,inlineType=inl)),repl,cond)
local Boolean t;
DAE.InlineType inl; DAE.ExpType tp;
Expand Down

0 comments on commit 5770f89

Please sign in to comment.