Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  + Changed Static.elabBuiltinTranspose so that it sets the correct constness on the elaborated expression.
  + Added testcase mofiles/Transpose2
- Added missing RTOpts failtrace guard in Inst.instElement.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5419 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Apr 29, 2010
1 parent 32b6ae1 commit b3e951c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions Compiler/Inst.mo
Expand Up @@ -5548,6 +5548,7 @@ algorithm
attributes=SCode.ATTR(variability=vt),typeSpec = Absyn.TPATH(t,_),cc=cc),_),_,_,_)
local Absyn.ComponentRef tref; SCode.Variability vt;
equation
true = RTOpts.debugFlag("failtrace");
failure((_,cl,cenv) = Lookup.lookupClass(cache,env, t, false));
s = Absyn.pathString(t);
scope_str = Env.printEnvPathStr(env);
Expand Down
13 changes: 7 additions & 6 deletions Compiler/Static.mo
Expand Up @@ -3452,6 +3452,7 @@ algorithm
tuple<DAE.TType, Option<Absyn.Path>> eltp,newtp;
Integer dim1,dim2,dimMax;
DAE.Properties prop;
DAE.Const c;
list<Env.Frame> env;
Absyn.Exp matexp;
DAE.Exp exp_1,exp;
Expand All @@ -3460,38 +3461,38 @@ algorithm

case (cache,env,{matexp},_,impl) /* impl try symbolically transpose the ARRAY expression */
equation
(cache,DAE.ARRAY(tp,sc,expl),DAE.PROP((DAE.T_ARRAY(d1,(DAE.T_ARRAY(d2,eltp),_)),_),_),_,dae1)
(cache,DAE.ARRAY(tp,sc,expl),DAE.PROP((DAE.T_ARRAY(d1,(DAE.T_ARRAY(d2,eltp),_)),_),c),_,dae1)
= elabExp(cache,env, matexp, impl, NONE,true);
dim1 = Types.arraydimInt(d1);
exp_2 = elabBuiltinTranspose2(expl, 1, dim1);
newtp = (DAE.T_ARRAY(d2,(DAE.T_ARRAY(d1,eltp),NONE)),NONE);
prop = DAE.PROP(newtp,DAE.C_VAR());
prop = DAE.PROP(newtp,c);
then
(cache,DAE.ARRAY(tp,sc,exp_2),prop,dae1);
case (cache,env,{matexp},_,impl) /* try symbolically transpose the MATRIX expression */
local
Integer sc;
list<list<tuple<DAE.Exp, Boolean>>> expl,exp_2;
equation
(cache,DAE.MATRIX(tp,sc,expl),DAE.PROP((DAE.T_ARRAY(d1,(DAE.T_ARRAY(d2,eltp),_)),_),_),_,dae1)
(cache,DAE.MATRIX(tp,sc,expl),DAE.PROP((DAE.T_ARRAY(d1,(DAE.T_ARRAY(d2,eltp),_)),_),c),_,dae1)
= elabExp(cache,env, matexp, impl, NONE,true);
dim1 = Types.arraydimInt(d1);
dim2 = Types.arraydimInt(d2);
dimMax = intMax(dim1, dim2);
exp_2 = elabBuiltinTranspose3(expl, 1, dimMax);
newtp = (DAE.T_ARRAY(d2,(DAE.T_ARRAY(d1,eltp),NONE)),NONE);
prop = DAE.PROP(newtp,DAE.C_VAR());
prop = DAE.PROP(newtp,c);
then
(cache,DAE.MATRIX(tp,sc,exp_2),prop,dae1);
case (cache,env,{matexp},_,impl) /* .. otherwise create transpose call */
local DAE.ExpType tp;
equation
(cache,exp_1,DAE.PROP((DAE.T_ARRAY(d1,(DAE.T_ARRAY(d2,eltp),_)),_),_),_,dae1)
(cache,exp_1,DAE.PROP((DAE.T_ARRAY(d1,(DAE.T_ARRAY(d2,eltp),_)),_),c),_,dae1)
= elabExp(cache,env, matexp, impl, NONE,true);
newtp = (DAE.T_ARRAY(d2,(DAE.T_ARRAY(d1,eltp),NONE)),NONE);
tp = Types.elabType(newtp);
exp = DAE.CALL(Absyn.IDENT("transpose"),{exp_1},false,true,tp,DAE.NO_INLINE);
prop = DAE.PROP(newtp,DAE.C_VAR());
prop = DAE.PROP(newtp,c);
then
(cache,exp,prop,dae1);
end matchcontinue;
Expand Down

0 comments on commit b3e951c

Please sign in to comment.