Skip to content

Commit

Permalink
- check if types equal for alias equation
Browse files Browse the repository at this point in the history
- expexted output
- check if variables replacable

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14300 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Dec 9, 2012
1 parent dc3a7aa commit 70a9142
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Compiler/BackEnd/BackendDAEOptimize.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,7 @@ algorithm
DAE.ElementSource source;
BackendDAE.EqSystem syst;
BackendDAE.Shared shared;
DAE.Type t1,t2;

// a = const
// wbraun:
Expand Down Expand Up @@ -1874,6 +1875,10 @@ algorithm
then (cr,k,es,syst,shared,eqTy);
case ({var,var2},BackendDAE.EQUATION(exp=e1,scalar=e2,source=source),syst as BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),shared)
equation
// check if types equal
BackendDAE.VAR(varType=t1) = var;
BackendDAE.VAR(varType=t2) = var2;
true = Types.equivtypes(t1, t2);
cr = BackendVariable.varCref(var);
cre = Expression.crefExp(cr);
(es,{}) = ExpressionSolve.solve(e1,e2,cre);
Expand All @@ -1882,10 +1887,14 @@ algorithm
then (cr,k,es,syst,shared,eqTy);
case ({var2,var},BackendDAE.EQUATION(exp=e1,scalar=e2,source=source),syst as BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),shared)
equation
// check if types equal
BackendDAE.VAR(varType=t1) = var2;
BackendDAE.VAR(varType=t2) = var;
true = Types.equivtypes(t1, t2);
cr = BackendVariable.varCref(var);
cre = Expression.crefExp(cr);
(es,{}) = ExpressionSolve.solve(e1,e2,cre);
(_,j::_) = BackendVariable.getVar(cr, vars);
(_,j::_) = BackendVariable.getVar(cr, vars);
(cr,k,es,syst,shared,eqTy)= simpleEquation1(BackendDAE.EQUATION(cre,es,source),var,j,cr,es,source,syst,shared);
then (cr,k,es,syst,shared,eqTy);
end matchcontinue;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/RemoveSimpleEquations.mo
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ algorithm
repl := BackendVarTransform.emptyReplacementsSized(size);
// check for unreplacable crefs
unreplacable := HashSet.emptyHashSet();
//unreplacable := BackendDAEUtil.traverseBackendDAEExps(dae,traverserUnreplacable,HashSet.emptyHashSet());
unreplacable := BackendDAEUtil.traverseBackendDAEExps(dae,traverserUnreplacable,unreplacable);
Debug.fcall(Flags.DUMP_REPL, print, "Unreplacable Crefs:\n");
Debug.fcall(Flags.DUMP_REPL, BaseHashSet.dumpHashSet, unreplacable);
// traverse all systems and remove simple equations
Expand Down

0 comments on commit 70a9142

Please sign in to comment.