aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/KrancThorn.m
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2009-04-28 07:41:27 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2009-04-28 07:41:27 +0200
commit64a3d04dd9bc50a2f0dee9d2e0d4f86e490ac160 (patch)
tree047c683f63e17f8fdffa21dc1427a327c2a34667 /Tools/CodeGen/KrancThorn.m
parentd5fa254650bd6a19ecfc703b8020591440fb574a (diff)
Make common subexpression elimination (CSE) optional and disabled by default
This is now controlled with an option UseCSE to CreateThorn.
Diffstat (limited to 'Tools/CodeGen/KrancThorn.m')
-rw-r--r--Tools/CodeGen/KrancThorn.m13
1 files changed, 8 insertions, 5 deletions
diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m
index 88cd973..20f7f44 100644
--- a/Tools/CodeGen/KrancThorn.m
+++ b/Tools/CodeGen/KrancThorn.m
@@ -32,6 +32,7 @@ BeginPackage["sym`"];
ExtendedRealParameters,ExtendedIntParameters,ExtendedKeywordParameters,
Parameters,
EvolutionTimelevels,
+ UseCSE,
PartialDerivatives, InheritedImplementations, ConditionalOnKeyword, ConditionalOnKeywords, ReflectionSymmetries, ZeroDimensions, CollectList, Interior, Boundary, BoundaryWithGhosts, Where, PreDefinitions, AllowedSymbols, UseLoopControl};
@@ -86,7 +87,8 @@ Module[{allowed = {Calculations,
EvolutionTimelevels, RealParameters, IntParameters, KeywordParameters,
InheritedRealParameters,InheritedIntParameters,InheritedKeywordParameters,
ExtendedRealParameters,ExtendedIntParameters,ExtendedKeywordParameters,
- PartialDerivatives, ReflectionSymmetries, ZeroDimensions, UseLoopControl},
+ PartialDerivatives, ReflectionSymmetries, ZeroDimensions, UseLoopControl,
+ UseCSE},
used, unrecognized},
used = Map[First, l];
@@ -110,7 +112,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts___] :=
interface, evolvedGroupDefinitions, rhsGroupDefinitions, thornspec,
allParams, boundarySources, reflectionSymmetries,
realParamDefs, intParamDefs,
- pDefs, useLoopControl},
+ pDefs, useLoopControl, useCSE},
(* Return[];*)
@@ -141,6 +143,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts___] :=
partialDerivs = lookupDefault[{opts}, PartialDerivatives, {}];
reflectionSymmetries = lookupDefault[{opts}, ReflectionSymmetries, {}];
useLoopControl = lookupDefault[{opts}, UseLoopControl, False];
+ useCSE = lookupDefault[{opts}, UseCSE, False];
(* Print["partialDerivs == ", partialDerivs];*)
@@ -239,7 +242,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts___] :=
Map[unqualifiedName, inheritedIntParams],
Map[unqualifiedName, inheritedKeywordParams]];
InfoMessage[Terse, "Creating calculation source files"];
- calcSources = Map[CreateSetterSourceWrapper[#, allParams, partialDerivs, useLoopControl] &, calcs];
+ calcSources = Map[CreateSetterSourceWrapper[#, allParams, partialDerivs, useLoopControl, useCSE] &, calcs];
calcFilenames = Map[lookup[#, Name] <> ext &, calcs];
@@ -763,13 +766,13 @@ createKrancScheduleFile[calcs_, groups_, evolvedGroups_, nonevolvedGroups_, thor
];
-CreateSetterSourceWrapper[calc_, parameters_, derivs_, useLoopControl_] :=
+CreateSetterSourceWrapper[calc_, parameters_, derivs_, useLoopControl_, useCSE_] :=
Module[{modCalc},
modCalc = Join[calc /. ((Equations -> {es___}) -> (Equations -> {{es}})),
{Parameters -> parameters},
{PartialDerivatives -> derivs}];
- source = CreateSetterSource[{modCalc}, False, useLoopControl, Include ->
+ source = CreateSetterSource[{modCalc}, False, useLoopControl, useCSE, Include ->
If[useLoopControl, {"loopcontrol.h"}, {}]];
Return[source]
];