Skip to content

Commit

Permalink
- More inline calls
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7747 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 22, 2011
1 parent 2c6a6ee commit 31a72ac
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Compiler/BackEnd/SimCode.mo
Expand Up @@ -757,6 +757,7 @@ end createAssertforSqrt;
public function createDAEString
input String inString;
output DAE.Exp outExp;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outExp := DAE.SCONST(inString);
end createDAEString;
Expand Down Expand Up @@ -3655,6 +3656,7 @@ end createNonlinearResidualEquations;
protected function makeSES_RESIDUAL
input DAE.Exp inExp;
output SimEqSystem outSimEqn;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outSimEqn := SES_RESIDUAL(inExp);
end makeSES_RESIDUAL;
Expand Down
12 changes: 9 additions & 3 deletions Compiler/FrontEnd/Absyn.mo
Expand Up @@ -1076,6 +1076,7 @@ public function getNewTimeStamp "Function: getNewTimeStamp
generate a new timestamp with edittime>buildtime.
"
output TimeStamp ts;
annotation(__OpenModelica_EarlyInline = true);
algorithm
ts := TIMESTAMP(0.0,1.0);
end getNewTimeStamp;
Expand Down Expand Up @@ -2137,15 +2138,18 @@ algorithm
end traverseExpBidirIterator;

public function makeIdentPathFromString ""
input String s;
output Path p;
algorithm p := IDENT(s);
input String s;
output Path p;
annotation(__OpenModelica_EarlyInline = true);
algorithm
p := IDENT(s);
end makeIdentPathFromString;

public function makeQualifiedPathFromStrings ""
input String s1;
input String s2;
output Path p;
annotation(__OpenModelica_EarlyInline = true);
algorithm
p := QUALIFIED(s1,IDENT(s2));
end makeQualifiedPathFromStrings;
Expand Down Expand Up @@ -2255,6 +2259,7 @@ end expCref;
public function crefExp "returns the componentRef of an expression if matches."
input ComponentRef cr;
output Exp exp;
annotation(__OpenModelica_EarlyInline = true);
algorithm
exp := CREF(cr);
end crefExp;
Expand Down Expand Up @@ -4989,6 +4994,7 @@ public function makeCons
input Exp e1;
input Exp e2;
output Exp e;
annotation(__OpenModelica_EarlyInline = true);
algorithm
e := CONS(e1,e2);
end makeCons;
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/Ceval.mo
Expand Up @@ -2710,6 +2710,7 @@ end cevalStringListStringChar;
protected function generateValueString
input String str;
output Values.Value val;
annotation(__OpenModelica_EarlyInline = true);
algorithm
val := Values.STRING(str);
end generateValueString;
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/CevalFunction.mo
Expand Up @@ -850,6 +850,7 @@ protected function makeFunctionVariable
input DAE.Type inType;
input DAE.Binding inBinding;
output DAE.Var outVar;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outVar := DAE.TYPES_VAR(
inName,
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/ComponentReference.mo
Expand Up @@ -162,6 +162,7 @@ public function makeDummyCref
"@author: adrpo
This function creates a dummy component reference"
output DAE.ComponentRef outCrefIdent;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outCrefIdent := dummyCref; // shareCref(dummyCref);
end makeDummyCref;
Expand Down
4 changes: 4 additions & 0 deletions Compiler/FrontEnd/ConnectUtil.mo
Expand Up @@ -1439,6 +1439,7 @@ protected function makeInStreamCall
"Creates an inStream call expression."
input DAE.Exp inStreamExp;
output DAE.Exp outInStreamCall;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outInStreamCall := DAE.CALL(Absyn.IDENT("inStream"), {inStreamExp}, false,
false, DAE.ET_OTHER(), DAE.NO_INLINE());
Expand All @@ -1448,6 +1449,7 @@ protected function makePositiveMaxCall
"Generates a max(flow_exp, eps) call."
input DAE.Exp inFlowExp;
output DAE.Exp outPositiveMaxCall;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outPositiveMaxCall := DAE.CALL(Absyn.IDENT("max"),
{inFlowExp, DAE.RCONST(1e-15)}, false, true, DAE.ET_REAL(), DAE.NO_INLINE());
Expand Down Expand Up @@ -1733,6 +1735,7 @@ protected function newFlowSet "function: newFlowSet
input Connect.Face inFace;
input DAE.ElementSource source "the origin of the element";
output Connect.Set outSet;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outSet := Connect.FLOW({(inComponentRef, inFace, source)});
end newFlowSet;
Expand Down Expand Up @@ -1807,6 +1810,7 @@ protected function newStreamSet "function: newStreamSet
input Connect.Face inFace;
input DAE.ElementSource source "the origin of the element";
output Connect.Set outSet;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outSet := Connect.STREAM({(inStreamCref, inFlowCref, inFace, source)});
end newStreamSet;
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/DAEUtil.mo
Expand Up @@ -4387,6 +4387,7 @@ end valueStr;

public function avlTreeNew "Return an empty tree"
output DAE.AvlTree tree;
annotation(__OpenModelica_EarlyInline = true);
algorithm
tree := emptyFuncTree; // DAE.AVLTREENODE(NONE(),0,NONE(),NONE());
end avlTreeNew;
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/Env.mo
Expand Up @@ -1684,6 +1684,7 @@ end AvlTreeValue;

public function avlTreeNew "Return an empty tree"
output AvlTree tree;
annotation(__OpenModelica_EarlyInline = true);
algorithm
tree := AVLTREENODE(NONE(),0,NONE(),NONE());
end avlTreeNew;
Expand Down
4 changes: 4 additions & 0 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -464,6 +464,7 @@ public function intDimension
"Converts an integer to an array dimension."
input Integer value;
output DAE.Dimension dim;
annotation(__OpenModelica_EarlyInline = true);
algorithm
dim := DAE.DIM_INTEGER(value);
end intDimension;
Expand Down Expand Up @@ -2825,6 +2826,7 @@ public function makeIntegerExp
"Creates an integer constant expression given the integer input."
input Integer i;
output DAE.Exp e;
annotation(__OpenModelica_EarlyInline = true);
algorithm
e := DAE.ICONST(i);
end makeIntegerExp;
Expand Down Expand Up @@ -2980,6 +2982,7 @@ public function makeIndexSubscript
Creates a Subscript INDEX from an Expression."
input DAE.Exp exp;
output Subscript subscript;
annotation(__OpenModelica_EarlyInline = true);
algorithm
subscript := DAE.INDEX(exp);
end makeIndexSubscript;
Expand All @@ -2988,6 +2991,7 @@ public function makeVar "Creates a Var given a name and Type"
input String name;
input Type tp;
output Var v;
annotation(__OpenModelica_EarlyInline = true);
algorithm
v:= DAE.COMPLEX_VAR(name,tp);
end makeVar;
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -516,6 +516,7 @@ protected function addCast
input DAE.Exp inExp;
input Type inType;
output DAE.Exp outExp;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outExp:=DAE.CAST(inType,inExp);
end addCast;
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/InnerOuter.mo
Expand Up @@ -1579,6 +1579,7 @@ public function emptyInstInner
input Prefix.Prefix innerPrefix;
input String name;
output InstInner outInstInner;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outInstInner := INST_INNER(innerPrefix, name, Absyn.UNSPECIFIED(), "", Absyn.IDENT(""), "", NONE(), {});
end emptyInstInner;
Expand Down
7 changes: 6 additions & 1 deletion Compiler/FrontEnd/Inst.mo
Expand Up @@ -9885,7 +9885,6 @@ algorithm
ty1 = setFullyQualifiedTypename(ty,fpath);

env_1 = Env.extendFrameT(env_1, n, ty1);

// set the source of this element
source = DAEUtil.createElementSource(info, Env.getEnvPath(env), PrefixUtil.prefixToCrefOpt(pre), NONE(), NONE());
then
Expand Down Expand Up @@ -14644,6 +14643,12 @@ algorithm
name = ComponentReference.printComponentRefStr(cr);
Error.addSourceMessage(Error.FUNCTION_ELEMENT_WRONG_PROTECTION,{name,"protected","public"},DAEUtil.getElementSourceFileInfo(source));
then fail();

case (DAE.ALGORITHM(algorithm_=DAE.ALGORITHM_STMTS({DAE.STMT_ASSIGN(exp=DAE.METARECORDCALL(path=_))})),info)
equation
// We need to know the inlineType to make a good notification
// Error.addSourceMessage(true,Error.COMPILER_NOTIFICATION, {"metarecordcall"}, info);
then ();
case (DAE.ALGORITHM(algorithm_=_),_) then ();
else
equation
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/Lookup.mo
Expand Up @@ -2114,7 +2114,7 @@ protected function buildRecordConstructorResultElt
input SCode.Ident id;
input Env.Env env;
output SCode.Element outElement;
list<SCode.SubMod> submodlst;
annotation(__OpenModelica_EarlyInline = true);
algorithm
//print(" creating element of type: " +& id +& "\n");
//print(" with generated mods:" +& SCode.printSubs1Str(submodlst) +& "\n");
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/ValuesUtil.mo
Expand Up @@ -139,6 +139,7 @@ protected function valueExpTypeExpVar "help function to valueExpType"
input DAE.ExpType etp;
input String name;
output DAE.ExpVar expVar;
annotation(__OpenModelica_EarlyInline = true);
algorithm
expVar := DAE.COMPLEX_VAR(name,etp);
end valueExpTypeExpVar;
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Template/TplAbsyn.mo
Expand Up @@ -1763,6 +1763,7 @@ public function tplStatement
input Ident inOutArg;

output MMExp outStmt;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outStmt := MM_ASSIGN( {inOutArg},
MM_FN_CALL( PATH_IDENT("Tpl",IDENT(inFunName)),
Expand All @@ -1776,6 +1777,7 @@ public function pushBlockStatement
input Ident inOutArg;

output MMExp outStmt;
annotation(__OpenModelica_EarlyInline = true);
algorithm
outStmt :=
MM_ASSIGN(
Expand Down

0 comments on commit 31a72ac

Please sign in to comment.