Skip to content

Commit

Permalink
- small naming change and some other small things.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8899 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed May 10, 2011
1 parent 0b60ab9 commit ceff610
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 31 deletions.
10 changes: 5 additions & 5 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -2163,7 +2163,7 @@ algorithm

case (stateexpcall,dummyderexp,BackendDAE.DAE(v,kv,ev,av as BackendDAE.ALIASVARS(aliasVars = aliasVars),eqns,seqns,ie,ae,al,BackendDAE.EVENT_INFO(wclst,zeroCrossingLst),eoc),m,mt,{})
equation
((_, _, av)) = BackendVariable.traverseBackendDAEVars(aliasVars,traverereplaceAliasVarsBindExp,(stateexpcall, dummyderexp, av));
((_, _, av)) = BackendVariable.traverseBackendDAEVars(aliasVars,traverseReplaceAliasVarsBindExp,(stateexpcall, dummyderexp, av));
(ie1,(al1,ae1,wclst1,_,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(ie,traversereplaceDummyDer,(al, ae, wclst, replaceDummyDer2Exp,(stateexpcall,dummyderexp)));
(ie1,(al1,ae1,wclst1,_,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(ie,traversereplaceDummyDer,(al, ae, wclst, replaceDummyDer2Exp,(stateexpcall,dummyderexp)));
(seqns1,(al2,ae2,wclst2,_,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(seqns,traversereplaceDummyDer,(al1, ae1, wclst1, replaceDummyDer2Exp,(stateexpcall,dummyderexp)));
Expand Down Expand Up @@ -2622,9 +2622,9 @@ algorithm
outTpl := Expression.traverseExp(e,replaceDummyDerOthersExpFinder,vars);
end replaceDummyDerOthersExp;

protected function traverereplaceAliasVarsBindExp
"function traverereplaceAliasVarsBindExp
Helper funciton to replaceDummyDer.
protected function traverseReplaceAliasVarsBindExp
"function traverseReplaceAliasVarsBindExp
Helper function to replaceDummyDer.
Replaces all variable bindings of the alias variables."
input tuple<BackendDAE.Var, tuple<DAE.Exp,DAE.Exp,BackendDAE.AliasVariables>> inTpl;
output tuple<BackendDAE.Var, tuple<DAE.Exp,DAE.Exp,BackendDAE.AliasVariables>> outTpl;
Expand All @@ -2645,7 +2645,7 @@ algorithm
then ((v,(e1,e2,av)));
case inTpl then inTpl;
end matchcontinue;
end traverereplaceAliasVarsBindExp;
end traverseReplaceAliasVarsBindExp;

protected function replaceDummyDerOthersExpFinder
"function: replaceDummyDerOthersExpFinder
Expand Down
40 changes: 20 additions & 20 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -1310,23 +1310,23 @@ algorithm
HashTable2.HashTable aliasMappingsCref,aliasMappingsCref1;
HashTable4.HashTable aliasMappingsExp,aliasMappingsExp1;
BackendDAE.Variables aliasVariables;
BackendDAE.AliasVariables Aliases;
BackendDAE.AliasVariables aliases;
DAE.ComponentRef cr;
DAE.Exp exp;
BackendDAE.Var v;
list<BackendDAE.Var> rest;
case ({},Aliases) then Aliases;
case ({},aliases) then aliases;
case (v::rest,BackendDAE.ALIASVARS(aliasMappingsCref,aliasMappingsExp,aliasVariables))
equation
aliasVariables = BackendVariable.addVar(v,aliasVariables);
exp = BackendVariable.varBindExp(v);
cr = BackendVariable.varCref(v);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("++++ added Alias eqn : ",cr," = ",exp,"\n"));
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("++++ added Alias eqn: ",cr," = ",exp,"\n"));
aliasMappingsCref1 = BaseHashTable.addNoUpdCheck((cr,exp),aliasMappingsCref);
aliasMappingsExp1 = BaseHashTable.addNoUpdCheck((exp,cr),aliasMappingsExp);
Aliases = addAliasVariables(rest,BackendDAE.ALIASVARS(aliasMappingsCref1,aliasMappingsExp1,aliasVariables));
aliases = addAliasVariables(rest,BackendDAE.ALIASVARS(aliasMappingsCref1,aliasMappingsExp1,aliasVariables));
then
Aliases;
aliases;
case (_,_)
equation
print("- BackendDAEUtil.addAliasVariables failed\n");
Expand Down Expand Up @@ -1376,55 +1376,55 @@ algorithm
local
HashTable4.HashTable aliasMappingsExp;
BackendDAE.Variables aliasVariables;
BackendDAE.AliasVariables Aliases;
BackendDAE.AliasVariables aliases;
BackendDAE.Var v;
list<BackendDAE.Var> vars;
DAE.Exp exp,exp1;
DAE.ComponentRef cr1;
list<tuple<HashTable4.Key,HashTable4.Value>> tableList;
list<String> str;

case (Aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
case (aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
equation
exp1 = Expression.crefExp(inCref);
cr1 = BaseHashTable.get(exp1,aliasMappingsExp);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("update ComponentRef : ",inCref," with Exp : ",inExp,"\n"));
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("update ComponentRef: ",inCref," with Exp : ",inExp,"\n"));

tableList = BaseHashTable.hashTableList(aliasMappingsExp);
Aliases = updateAliasVars(tableList,exp1,inExp,Aliases);
aliases = updateAliasVars(tableList,exp1,inExp,aliases);

v = BackendVariable.setBindExp(v,inExp);

Aliases = addAliasVariables({v},Aliases);
aliases = addAliasVariables({v},aliases);
then
Aliases;
aliases;

case (Aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
case (aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
equation
exp1 = Expression.crefExp(inCref);
exp = Expression.negate(exp1);
(exp,_) = ExpressionSimplify.simplify1(exp);
cr1 = BaseHashTable.get(exp,aliasMappingsExp);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("update ComponentRef : ",inCref," with ",inExp,"\n"));
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("update ComponentRef: ",inCref," with ",inExp,"\n"));

tableList = BaseHashTable.hashTableList(aliasMappingsExp);
Aliases = updateAliasVars(tableList,exp1,inExp,Aliases);
aliases = updateAliasVars(tableList,exp1,inExp,aliases);

v = BackendVariable.setBindExp(v,inExp);

Aliases = addAliasVariables({v},Aliases);
aliases = addAliasVariables({v},aliases);
then
Aliases;
aliases;

case (Aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
case (aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
equation
exp1 = Expression.crefExp(inCref);
failure(_ = BaseHashTable.get(exp1,aliasMappingsExp));
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,(" Search for ",inCref," with binding : ",inExp," failed.\n"));
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,(" Search for ",inCref," with binding: ",inExp," failed.\n"));
v = BackendVariable.setBindExp(v,inExp);
Aliases = addAliasVariables({v},Aliases);
aliases = addAliasVariables({v},aliases);
then
Aliases;
aliases;
//case (inAliasVariables,_,_) then inAliasVariables;
case (_,_,_,_)
equation
Expand Down
33 changes: 27 additions & 6 deletions Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -1133,6 +1133,7 @@ algorithm
Option<SCode.Comment> comment;
DAE.Flow flowPrefix;
DAE.Stream streamPrefix;
BackendDAE.Var oVar;

case (BackendDAE.VAR(varName = cr,
varKind = kind,
Expand All @@ -1147,7 +1148,10 @@ algorithm
comment = comment,
flowPrefix = flowPrefix,
streamPrefix = streamPrefix),new_kind)
then BackendDAE.VAR(cr,new_kind,dir,tp,bind,v,dim,i,source,attr,comment,flowPrefix,streamPrefix);
equation
oVar = BackendDAE.VAR(cr,new_kind,dir,tp,bind,v,dim,i,source,attr,comment,flowPrefix,streamPrefix); // referenceUpdate(inVar, 2, new_kind);
then
oVar;
end match;
end setVarKind;

Expand All @@ -1174,6 +1178,7 @@ algorithm
Option<SCode.Comment> comment;
DAE.Flow flowPrefix;
DAE.Stream streamPrefix;
BackendDAE.Var oVar;

case (BackendDAE.VAR(varName = cr,
varKind = kind,
Expand All @@ -1188,7 +1193,10 @@ algorithm
comment = comment,
flowPrefix = flowPrefix,
streamPrefix = streamPrefix),new_i)
then BackendDAE.VAR(cr,kind,dir,tp,bind,v,dim,new_i,source,attr,comment,flowPrefix,streamPrefix);
equation
oVar = BackendDAE.VAR(cr,kind,dir,tp,bind,v,dim,new_i,source,attr,comment,flowPrefix,streamPrefix); // referenceUpdate(inVar, 8, new_i);
then
oVar;
end match;
end setVarIndex;

Expand All @@ -1214,6 +1222,7 @@ algorithm
Option<SCode.Comment> comment;
DAE.Flow flowPrefix;
DAE.Stream streamPrefix;
BackendDAE.Var oVar;

case (BackendDAE.VAR(varName = cr,
varKind = kind,
Expand All @@ -1226,8 +1235,12 @@ algorithm
values = attr,
comment = comment,
flowPrefix = flowPrefix,
streamPrefix = streamPrefix),inBindExp)
then BackendDAE.VAR(cr,kind,dir,tp,SOME(inBindExp),v,dim,i,source,attr,comment,flowPrefix,streamPrefix);
streamPrefix = streamPrefix),
inBindExp)
equation
oVar = BackendDAE.VAR(cr,kind,dir,tp,SOME(inBindExp),v,dim,i,source,attr,comment,flowPrefix,streamPrefix); // referenceUpdate(inVar, 5, SOME(inBindExp));
then
oVar;
end match;
end setBindExp;

Expand All @@ -1253,6 +1266,7 @@ algorithm
Option<SCode.Comment> comment;
DAE.Flow flowPrefix;
DAE.Stream streamPrefix;
BackendDAE.Var oVar;

case (BackendDAE.VAR(varName = cr,
varKind = kind,
Expand All @@ -1267,7 +1281,10 @@ algorithm
comment = comment,
flowPrefix = flowPrefix,
streamPrefix = streamPrefix),inBindValue)
then BackendDAE.VAR(cr,kind,dir,tp,bind,SOME(inBindValue),dim,i,source,attr,comment,flowPrefix,streamPrefix);
equation
oVar = BackendDAE.VAR(cr,kind,dir,tp,bind,SOME(inBindValue),dim,i,source,attr,comment,flowPrefix,streamPrefix); // referenceUpdate(inVar, 6, SOME(inBindValue));
then
oVar;
end match;
end setBindValue;

Expand All @@ -1293,6 +1310,7 @@ algorithm
Option<SCode.Comment> comment;
DAE.Flow flowPrefix;
DAE.Stream streamPrefix;
BackendDAE.Var oVar;

case (BackendDAE.VAR(varName = cr,
varKind = kind,
Expand All @@ -1306,7 +1324,10 @@ algorithm
comment = comment,
flowPrefix = flowPrefix,
streamPrefix = streamPrefix),varDirection)
then BackendDAE.VAR(cr,kind,varDirection,tp,bind,v,dim,i,source,attr,comment,flowPrefix,streamPrefix);
equation
oVar = BackendDAE.VAR(cr,kind,varDirection,tp,bind,v,dim,i,source,attr,comment,flowPrefix,streamPrefix); // referenceUpdate(inVar, 3, varDirection);
then
oVar;
end match;
end setVarDirection;

Expand Down

0 comments on commit ceff610

Please sign in to comment.