Skip to content

Commit

Permalink
- fixed Bugs in AliasEquations for clean testsuite
Browse files Browse the repository at this point in the history
 - added testsuite case to call only simulation tests


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8470 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Apr 3, 2011
1 parent 66cc37a commit cc945f6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
25 changes: 12 additions & 13 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -1378,9 +1378,10 @@ algorithm
case (Aliases as BackendDAE.ALIASVARS( varMappingsExp = aliasMappingsExp, aliasVars = aliasVariables),inCref,inExp,v)
equation
exp1 = Expression.crefExp(inCref);
exp1 = Expression.negate(exp1);
cr1 = BaseHashTable.get(exp1,aliasMappingsExp);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("update ComponentRef : ",inCref," with -",inExp,"\n"));
exp = Expression.negate(exp1);
exp = ExpressionSimplify.simplify1(exp);
cr1 = BaseHashTable.get(exp,aliasMappingsExp);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("update ComponentRef : ",inCref," with ",inExp,"\n"));

tableList = BaseHashTable.hashTableList(aliasMappingsExp);
Aliases = updateAliasVars(tableList,exp1,inExp,Aliases);
Expand All @@ -1395,7 +1396,7 @@ algorithm
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);
then
Expand Down Expand Up @@ -1433,6 +1434,7 @@ algorithm
case ({},_,_,inAliases) then inAliases;
case (((exp,cref))::rest,inExp1,inExp2,inAliases as BackendDAE.ALIASVARS(aliasVars=aliasvars))
equation
Debug.fcall("debugAlias",BackendDump.debugStrExpStr,("*** search for: ",inExp1,"\n"));
ty = Expression.typeof(inExp2);
(true,b,exp2) = compareExpAlias(exp,inExp1);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("*** got : ",cref," = Exp : ",exp2,"\n"));
Expand All @@ -1448,7 +1450,7 @@ algorithm
then aliasVariables;
case (((exp,cref))::rest,inExp1,inExp2,aliasVariables)
equation
Debug.fcall("debugAlias",BackendDump.debugStrExpStrCrefStr,("*** let ",exp," with binding Exp : ",cref,"\n"));
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("*** let ",cref," with binding Exp : ",exp,"\n"));
aliasVariables = updateAliasVars(rest,inExp1,inExp2,aliasVariables);
then aliasVariables;
end matchcontinue;
Expand All @@ -1466,23 +1468,20 @@ protected function compareExpAlias
algorithm
(outB, outB2, outExp) := matchcontinue(inExp1,inExp2)
local
DAE.Exp expNew, exp;
DAE.ExpType ty;
DAE.ComponentRef cref;
Boolean b;
// case a=a
case (inExp1,inExp2)
equation
expNew = inExp2;
true = Expression.expEqual(inExp1,expNew);
then (true,false, expNew);
true = Expression.expEqual(inExp1,inExp2);
then (true,false, inExp2);
// case a=-a
case (inExp1,inExp2)
case (DAE.UNARY(DAE.UMINUS(ty),inExp1),inExp2)
equation
ty = Expression.typeof(inExp2);
expNew = DAE.UNARY(DAE.UMINUS(ty),inExp2);
true = Expression.expEqual(inExp1,expNew);
then (true,true, expNew);
true = Expression.expEqual(inExp1,inExp2);
then (true,true, DAE.UNARY(DAE.UMINUS(ty),inExp2));
case (inExp1,_) then (false,false,inExp1);
end matchcontinue;
end compareExpAlias;
Expand Down
20 changes: 20 additions & 0 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -1750,6 +1750,26 @@ algorithm
print(a +& ComponentReference.printComponentRefStr(b) +& c +& ComponentReference.printComponentRefStr(d) +& e);
end debugStrCrefStrCrefStr;

public function debugExpStr
input tuple<DAE.Exp,String> inTpl;
protected
String b;
DAE.Exp a;
algorithm
(a,b) := inTpl;
print(ExpressionDump.printExpStr(a) +& b);
end debugExpStr;

public function debugStrExpStr
input tuple<String,DAE.Exp,String> inTpl;
protected
String a,c;
DAE.Exp b;
algorithm
(a,b,c) := inTpl;
print(a +& ExpressionDump.printExpStr(b) +& c);
end debugStrExpStr;

public function debugStrExpStrCrefStr
input tuple<String,DAE.Exp,String,DAE.ComponentRef,String> inTpl;
protected
Expand Down

0 comments on commit cc945f6

Please sign in to comment.