Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…#3531]

 - added option inline function with array type (defaulte= false)
  - option will be irnored insidedynamicStateSelection
  • Loading branch information
vruge authored and OpenModelica-Hudson committed Nov 10, 2015
1 parent 1c737e1 commit f401b32
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Compiler/BackEnd/IndexReduction.mo
Expand Up @@ -1251,7 +1251,10 @@ protected
list<BackendDAE.EqSystem> systs;
BackendDAE.Shared shared;
HashTableCrIntToExp.HashTable ht;
Boolean optionInlineArray = Flags.isSet(Flags.INLINE_FUNCTIONS_WITH_ARR);
algorithm
// skipp constraint for inlining of functions with protected array variables
Flags.set(Flags.INLINE_FUNCTIONS_WITH_ARR, true);
BackendDAE.DAE(systs, shared) := inDAE;
// do state selection
ht := HashTableCrIntToExp.emptyHashTable();
Expand All @@ -1260,6 +1263,7 @@ algorithm
(systs, shared) := List.map1Fold(systs, replaceDummyDerivatives, ht, shared);
end if;
outDAE := BackendDAE.DAE(systs, shared);
Flags.set(Flags.INLINE_FUNCTIONS_WITH_ARR, optionInlineArray);
end dynamicStateSelection;

protected function mapdynamicStateSelection
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/Inline.mo
Expand Up @@ -1081,7 +1081,7 @@ algorithm
then
(oInputs,oOutput,oBody,repl);
case (DAE.VAR(componentRef=cr,protection=DAE.PROTECTED(),ty=tp,binding=binding)::rest,_,_,_,_)
guard not Expression.isRecordType(tp)
guard not Expression.isRecordType(tp) and (not Expression.isArrayType(tp) or Flags.isSet(Flags.INLINE_FUNCTIONS_WITH_ARR))
equation
repl = addOptBindingReplacements(cr,binding,iRepl);
(oInputs,oOutput,oBody,repl) = getFunctionInputsOutputBody(rest,iInputs,iOutput,iBody,repl);
Expand Down
5 changes: 4 additions & 1 deletion Compiler/Util/Flags.mo
Expand Up @@ -466,6 +466,8 @@ constant DebugFlag DEBUG_DIFFERENTIATION_VERBOSE = DEBUG_FLAG(149, "debugDiffere
Util.gettext("Dumps verbose debug output for the differentiation process."));
constant DebugFlag FMU_EXPERIMENTAL = DEBUG_FLAG(150, "fmuExperimental", false,
Util.gettext("Include an extra function in the FMU fmi2GetSpecificDerivatives."));
constant DebugFlag INLINE_FUNCTIONS_WITH_ARR = DEBUG_FLAG(151, "inlineFunctionsWithArrays", false,
Util.gettext("Controls if function (with protected array variable) inlining should be performed."));


// This is a list of all debug flags, to keep track of which flags are used. A
Expand Down Expand Up @@ -623,7 +625,8 @@ constant list<DebugFlag> allDebugFlags = {
DUMP_FUNCTIONS,
DEBUG_DIFFERENTIATION,
DEBUG_DIFFERENTIATION_VERBOSE,
FMU_EXPERIMENTAL
FMU_EXPERIMENTAL,
INLINE_FUNCTIONS_WITH_ARR
};

public
Expand Down

0 comments on commit f401b32

Please sign in to comment.