Skip to content

Commit

Permalink
- added cse module
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23346 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Nov 13, 2014
1 parent abfc842 commit 11cfa24
Show file tree
Hide file tree
Showing 6 changed files with 471 additions and 3 deletions.
29 changes: 28 additions & 1 deletion Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -69,6 +69,7 @@ protected import Ceval;
protected import CheckModel;
protected import ClassInf;
protected import ClockIndexes;
protected import CommonSubExpression;
protected import ComponentReference;
protected import Config;
protected import DAEDump;
Expand Down Expand Up @@ -5112,6 +5113,31 @@ algorithm
sharedOut := BackendDAE.SHARED(knVars,externalObjects,aliasVars,initialEqs,removedEqs,constraints,classAttrs,cache,graph,functionTree,eventInfo,extObjClasses,backendDAEType,symjacs,info);
end replaceKnownVarsInShared;

public function replaceAliasVarsInShared"replaces the aliasVars in the BackendDAE.Shared
author:Waurich TUD 2014-11"
input BackendDAE.Shared sharedIn;
input BackendDAE.Variables aliasVars;
output BackendDAE.Shared sharedOut;
protected
BackendDAE.Variables knownVars,externalObjects;
BackendDAE.EquationArray initialEqs,removedEqs;
list<DAE.Constraint> constraints;
list<DAE.ClassAttributes> classAttrs;
FCore.Cache cache;
FCore.Graph graph;
DAE.FunctionTree functionTree;
BackendDAE.EventInfo eventInfo;
BackendDAE.ExternalObjectClasses extObjClasses;
BackendDAE.BackendDAEType backendDAEType;
BackendDAE.SymbolicJacobians symjacs;
BackendDAE.ExtraInfo info;
algorithm
BackendDAE.SHARED(knownVars=knownVars,externalObjects=externalObjects,initialEqs=initialEqs,removedEqs=removedEqs,
constraints=constraints,classAttrs=classAttrs,cache=cache,graph=graph,functionTree=functionTree,eventInfo=eventInfo,extObjClasses=extObjClasses,
backendDAEType=backendDAEType,symjacs=symjacs,info=info) := sharedIn;
sharedOut := BackendDAE.SHARED(knownVars,externalObjects,aliasVars,initialEqs,removedEqs,constraints,classAttrs,cache,graph,functionTree,eventInfo,extObjClasses,backendDAEType,symjacs,info);
end replaceAliasVarsInShared;

protected function adjacencyRowExpEnhanced
"author: Frenkel TUD 2012-05
Helper function to adjacencyRowEnhanced, investigates expressions for
Expand Down Expand Up @@ -7505,7 +7531,8 @@ algorithm
(BackendDAEOptimize.residualForm, "residualForm", false),
(ResolveLoops.resolveLoops, "resolveLoops", false),
(EvaluateFunctions.evalFunctions, "evalFunc", false),
(UnitCheck.unitChecking, "unitChecking", true)
(UnitCheck.unitChecking, "unitChecking", true),
(CommonSubExpression.commonSubExpressionReplacement, "comSubExp", false)
};
strPreOptModules := getPreOptModulesString();
strPreOptModules := Util.getOptionOrDefault(ostrPreOptModules,strPreOptModules);
Expand Down
18 changes: 18 additions & 0 deletions Compiler/BackEnd/BackendVarTransform.mo
Expand Up @@ -49,6 +49,7 @@ protected import BaseHashTable;
protected import BaseHashSet;
protected import BackendDAEUtil;
protected import BackendEquation;
protected import BackendVariable;
protected import ClassInf;
protected import ComponentReference;
protected import DAEUtil;
Expand Down Expand Up @@ -2605,6 +2606,23 @@ algorithm
end match;
end controlExp;

public function replaceBindingExp
input BackendDAE.Var varIn;
input VariableReplacements repl;
output BackendDAE.Var varOut;
algorithm
varOut := match(varIn,repl)
local
DAE.Exp exp;
case(BackendDAE.VAR(bindExp=SOME(exp)),_)
equation
exp = replaceExp(exp,repl,NONE());
then BackendVariable.setBindExp(varIn,SOME(exp));
case(BackendDAE.VAR(bindExp=NONE()),_)
then varIn;
end match;
end replaceBindingExp;

/*********************************************************/
/* dump replacements */
/*********************************************************/
Expand Down

0 comments on commit 11cfa24

Please sign in to comment.