Skip to content

Commit

Permalink
- Refactoring. Exp.Type -> Exp.ExpType (and all types in ExpType are …
Browse files Browse the repository at this point in the history
…prefixed ET_ to make it possible to put the type in DAE.mo).

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4525 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 16, 2009
1 parent 6937e31 commit f4f0918
Show file tree
Hide file tree
Showing 29 changed files with 1,021 additions and 1,025 deletions.
16 changes: 8 additions & 8 deletions Compiler/Algorithm.mo
Expand Up @@ -300,7 +300,7 @@ algorithm
/* Don\'t use new rhs\', since type conversions of several output args
are not clearly defined. */
then
DAE.STMT_TUPLE_ASSIGN(Exp.OTHER(),expl,rhs);
DAE.STMT_TUPLE_ASSIGN(Exp.ET_OTHER(),expl,rhs);
case (lhs,lprop,rhs,rprop,_)
equation
Debug.fprint("failtrace", "- Algorithm.makeTupleAssignment failed\n");
Expand Down Expand Up @@ -329,10 +329,10 @@ algorithm
outType:=
matchcontinue (inType)
local tuple<Types.TType, Option<Absyn.Path>> t;
case ((DAE.T_INTEGER(varLstInt = _),_)) then Exp.INT();
case ((DAE.T_REAL(varLstReal = _),_)) then Exp.REAL();
case ((DAE.T_STRING(varLstString = _),_)) then Exp.STRING();
case ((DAE.T_BOOL(varLstBool = _),_)) then Exp.BOOL();
case ((DAE.T_INTEGER(varLstInt = _),_)) then Exp.ET_INT();
case ((DAE.T_REAL(varLstReal = _),_)) then Exp.ET_REAL();
case ((DAE.T_STRING(varLstString = _),_)) then Exp.ET_STRING();
case ((DAE.T_BOOL(varLstBool = _),_)) then Exp.ET_BOOL();
case ((DAE.T_ARRAY(arrayType = t),_)) then getTypeExpType(t);
case ((DAE.T_COMPLEX(_,{},SOME(t),_),_))
then getTypeExpType(t);
Expand All @@ -342,7 +342,7 @@ algorithm
// record assignments (which actually work just fine). // sjoelund // 2009-05-07
//print("Warning complex_varList not implemented for Array_assign\n");
then fail();
case ((_,_)) then Exp.OTHER(); /* was fail but records must be handled somehow */
case ((_,_)) then Exp.ET_OTHER(); /* was fail but records must be handled somehow */
end matchcontinue;
end getTypeExpType;

Expand Down Expand Up @@ -727,14 +727,14 @@ end getAllExpsElse;

protected function crefToExp "function: crefToExp
Creates an expression from a ComponentRef.
The type of the expression will become Exp.OTHER."
The type of the expression will become Exp.ET_OTHER."
input Exp.ComponentRef inComponentRef;
output Exp.Exp outExp;
algorithm
outExp:=
matchcontinue (inComponentRef)
local Exp.ComponentRef cref;
case cref then Exp.CREF(cref,Exp.OTHER());
case cref then Exp.CREF(cref,Exp.ET_OTHER());
end matchcontinue;
end crefToExp;

Expand Down
12 changes: 6 additions & 6 deletions Compiler/BackendVarTransform.mo
Expand Up @@ -131,12 +131,12 @@ algorithm
case (DAELow.WHEN_EQ(i,cr,e,NONE),repl) equation
e1 = VarTransform.replaceExp(e, repl, NONE);
e2 = Exp.simplify(e1);
Exp.CREF(cr1,_) = VarTransform.replaceExp(Exp.CREF(cr,Exp.OTHER()),repl,NONE);
Exp.CREF(cr1,_) = VarTransform.replaceExp(Exp.CREF(cr,Exp.ET_OTHER()),repl,NONE);
then DAELow.WHEN_EQ(i,cr1,e2,NONE);

// Replacements makes cr negative, a = -b
case (DAELow.WHEN_EQ(i,cr,e,NONE),repl) equation
Exp.UNARY(Exp.UMINUS(tp),Exp.CREF(cr1,_)) = VarTransform.replaceExp(Exp.CREF(cr,Exp.OTHER()),repl,NONE);
Exp.UNARY(Exp.UMINUS(tp),Exp.CREF(cr1,_)) = VarTransform.replaceExp(Exp.CREF(cr,Exp.ET_OTHER()),repl,NONE);
e1 = VarTransform.replaceExp(e, repl, NONE);
e2 = Exp.simplify(Exp.UNARY(Exp.UMINUS(tp),e1));
then DAELow.WHEN_EQ(i,cr1,e2,NONE);
Expand All @@ -145,13 +145,13 @@ algorithm
elsePart2 = replaceWhenEquation(elsePart,repl);
e1 = VarTransform.replaceExp(e, repl, NONE);
e2 = Exp.simplify(e1);
Exp.CREF(cr1,_) = VarTransform.replaceExp(Exp.CREF(cr,Exp.OTHER()),repl,NONE);
Exp.CREF(cr1,_) = VarTransform.replaceExp(Exp.CREF(cr,Exp.ET_OTHER()),repl,NONE);
then DAELow.WHEN_EQ(i,cr1,e2,SOME(elsePart2));

// Replacements makes cr negative, a = -b
case (DAELow.WHEN_EQ(i,cr,e,SOME(elsePart)),repl) equation
elsePart2 = replaceWhenEquation(elsePart,repl);
Exp.UNARY(Exp.UMINUS(tp),Exp.CREF(cr1,_)) = VarTransform.replaceExp(Exp.CREF(cr,Exp.OTHER()),repl,NONE);
Exp.UNARY(Exp.UMINUS(tp),Exp.CREF(cr1,_)) = VarTransform.replaceExp(Exp.CREF(cr,Exp.ET_OTHER()),repl,NONE);
e1 = VarTransform.replaceExp(e, repl, NONE);
e2 = Exp.simplify(Exp.UNARY(Exp.UMINUS(tp),e1));
then DAELow.WHEN_EQ(i,cr1,e2,SOME(elsePart2));
Expand Down Expand Up @@ -200,8 +200,8 @@ algorithm
(DAELow.EQUATION(e1_2,e2_2) :: es_1);
case ((DAELow.EQUEQUATION(cr1,cr2) :: es),repl)
equation
Exp.CREF(cr1,_) = VarTransform.replaceExp(Exp.CREF(cr1,Exp.OTHER()), repl, NONE);
Exp.CREF(cr2,_) = VarTransform.replaceExp(Exp.CREF(cr2,Exp.OTHER()), repl, NONE);
Exp.CREF(cr1,_) = VarTransform.replaceExp(Exp.CREF(cr1,Exp.ET_OTHER()), repl, NONE);
Exp.CREF(cr2,_) = VarTransform.replaceExp(Exp.CREF(cr2,Exp.ET_OTHER()), repl, NONE);
es_1 = replaceEquations(es, repl);
then
(DAELow.EQUEQUATION(cr1,cr2) :: es_1);
Expand Down

0 comments on commit f4f0918

Please sign in to comment.