Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Vectorize function calls with DIM_EXP() as dimension


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18580 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 7, 2014
1 parent 5526c33 commit e38e141
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
28 changes: 3 additions & 25 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -8129,33 +8129,11 @@ algorithm
(vect_exp_1, prop) = vectorizeCall(e, DAE.DIM_INTEGER(1) :: ad, slots, prop, info);
then
(vect_exp_1, prop);
/* TODO: Remove me :D */
case (e, (DAE.DIM_EXP(exp=_) :: ad), slots, prop, _)
equation
true = Flags.getConfigBool(Flags.CHECK_MODEL);
(vect_exp_1, prop) = vectorizeCall(e, DAE.DIM_INTEGER(1) :: ad, slots, prop, info);
then
(vect_exp_1, prop);

/* Scalar expression, i.e function call with unknown dimensions
case (e as DAE.CALL(path = fn,expLst = {arg},tuple_ = tuple_,builtin = builtin,ty = etp,inlineType=inl),(dim as DAE.DIM_UNKNOWN()) :: ad,slots,DAE.PROP(tp,c))
equation
exp_type = Types.simplifyType(Types.liftArray(tp, dim)) "pass type of vectorized result expr";
tickID = "i_" +& Util.tickStr();
crefID = ComponentReference.makeCrefIdent(tickID, DAE.T_INTEGER_DEFAULT, {});
vect_exp =
DAE.REDUCTION(
fn,
DAE.ASUB(arg, {DAE.CREF(crefID, DAE.T_INTEGER_DEFAULT)}),
tickID,
DAE.RANGE(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource), DAE.ICONST(1), NONE(), DAE.END()));
tp = Types.liftArray(tp, dim);
(vect_exp_1,prop) = vectorizeCall(vect_exp, ad, slots, DAE.PROP(tp,c));
then
(vect_exp_1,prop);*/

case (DAE.CALL(fn,es,attr),{DAE.DIM_UNKNOWN()},slots,prop as DAE.PROP(tp,c),_)
/* Single dimension is possible to change to a reduction */
case (DAE.CALL(fn,es,attr),{dim},slots,prop as DAE.PROP(tp,c),_)
equation
true = Types.dimNotFixed(dim);
(es,vect_exp) = vectorizeCallUnknownDimension(es,slots,{},NONE(),info);
tp0 = Types.liftArrayRight(tp, DAE.DIM_INTEGER(0));
tp = Types.liftArrayRight(tp, DAE.DIM_UNKNOWN());
Expand Down
11 changes: 11 additions & 0 deletions Compiler/FrontEnd/Types.mo
Expand Up @@ -7743,4 +7743,15 @@ algorithm
end matchcontinue;
end typeErrorSanityCheck;

public function dimNotFixed
input DAE.Dimension dim;
output Boolean b;
algorithm
b := match dim
case DAE.DIM_UNKNOWN() then true;
case DAE.DIM_EXP(exp=_) then true;
else false;
end match;
end dimNotFixed;

end Types;

0 comments on commit e38e141

Please sign in to comment.