Skip to content

Commit 05a1ae9

Browse files
committed
Deprecate TR_TraceTempUsage with envvar
This tracing option counts the number of stores to temp slots by doing a linear walk of the treetops. It seems overkill to have two separate tracing optimizations for this, and it seems like something that would be used during debugging anyways as this information can be obtained otherwise via a simple grep. In light of this we deprecate the two options related to tracing temp counts, and rather than deleting the code we leave it under an envvar. Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
1 parent 0dc5c03 commit 05a1ae9

File tree

3 files changed

+10
-38
lines changed

3 files changed

+10
-38
lines changed

compiler/control/OMROptions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,8 +1215,6 @@ TR::OptionTable OMR::Options::_jitOptions[] = {
12151215
{"traceStripMining", "L\ttrace strip mining", TR::Options::traceOptimization, stripMining, 0, "P"},
12161216
{"traceStructuralAnalysis", "L\ttrace structural analysis", SET_OPTION_BIT(TR_TraceSA), "P"},
12171217
{"traceSwitchAnalyzer", "L\ttrace switch analyzer", TR::Options::traceOptimization, switchAnalyzer, 0, "P"},
1218-
{"traceTempUsage", "L\ttrace number of temps used", SET_OPTION_BIT(TR_TraceTempUsage), "P"},
1219-
{"traceTempUsageMore", "L\ttrace usage of temps, showing each temp used", SET_OPTION_BIT(TR_TraceTempUsageMore), "P"},
12201218
{"traceTreeCleansing", "L\ttrace tree cleansing", TR::Options::traceOptimization, treesCleansing, 0, "P"},
12211219
{"traceTreePatternMatching", "L\ttrace the functioning of the TR_Pattern framework", SET_OPTION_BIT(TR_TraceTreePatternMatching), "F"},
12221220
{"traceTrees", "L\tdump trees after each compilation phase", SET_OPTION_BIT(TR_TraceTrees), "P" },

compiler/control/OMROptions.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,8 @@ enum TR_CompilationOptions
819819
TR_DisableRecognizedMethods = 0x00000040 + 25,
820820
TR_DisableBitOpcode = 0x00000080 + 25,
821821
// Available = 0x00000100 + 25,
822-
TR_TraceTempUsage = 0x00000200 + 25,
823-
TR_TraceTempUsageMore = 0x00000400 + 25,
822+
// Available = 0x00000200 + 25,
823+
// Available = 0x00000400 + 25,
824824
// Available = 0x00000800 + 25,
825825
// Available = 0x00001000 + 25,
826826
TR_TracePREForOptimalSubNodeReplacement = 0x00002000 + 25,

compiler/optimizer/OMROptimizer.cpp

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,12 +2177,14 @@ int32_t OMR::Optimizer::performOptimization(const OptimizationStrategy *optimiza
21772177

21782178
manager->performChecks();
21792179

2180-
if (comp()->getOption(TR_TraceTempUsage) || comp()->getOption(TR_TraceTempUsageMore))
2180+
static const bool enableCountTemps = feGetEnv("TR_EnableCountTemps") != NULL;
2181+
if (enableCountTemps)
21812182
{
2182-
TR::TreeTop * tt = 0;
21832183
int32_t tempCount = 0;
21842184

2185-
for (tt = getMethodSymbol()->getFirstTreeTop(); tt; tt = tt->getNextTreeTop())
2185+
traceMsg(comp(), "Temps seen (if any): ");
2186+
2187+
for (TR::TreeTop *tt = getMethodSymbol()->getFirstTreeTop(); tt; tt = tt->getNextTreeTop())
21862188
{
21872189
TR::Node * ttNode = tt->getNode();
21882190

@@ -2198,41 +2200,13 @@ int32_t OMR::Optimizer::performOptimization(const OptimizationStrategy *optimiza
21982200
if ((symRef->getSymbol()->getKind() == TR::Symbol::IsAutomatic) &&
21992201
symRef->isTemporary(comp()))
22002202
{
2201-
tempCount += 1;
2202-
}
2203-
}
2204-
}
2205-
2206-
comp()->getDebug()->trace("Number of temps seen = %d", tempCount);
2207-
2208-
if (comp()->getOption(TR_TraceTempUsageMore) &&
2209-
(tempCount > 0))
2210-
{
2211-
comp()->getDebug()->trace(": ");
2212-
2213-
for (tt = getMethodSymbol()->getFirstTreeTop(); tt; tt = tt->getNextTreeTop())
2214-
{
2215-
TR::Node * ttNode = tt->getNode();
2216-
2217-
if (ttNode->getOpCodeValue() == TR::treetop)
2218-
{
2219-
ttNode = ttNode->getFirstChild();
2220-
}
2221-
2222-
if (ttNode->getOpCode().isStore() && ttNode->getOpCode().hasSymbolReference())
2223-
{
2224-
TR::SymbolReference * symRef = ttNode->getSymbolReference();
2225-
2226-
if ((symRef->getSymbol()->getKind() == TR::Symbol::IsAutomatic) &&
2227-
symRef->isTemporary(comp()))
2228-
{
2229-
comp()->getDebug()->trace("%s ", comp()->getDebug()->getName(ttNode->getSymbolReference()));
2230-
}
2203+
++tempCount;
2204+
traceMsg(comp(), "%s ", comp()->getDebug()->getName(ttNode->getSymbolReference()));
22312205
}
22322206
}
22332207
}
22342208

2235-
comp()->getDebug()->trace("\n");
2209+
traceMsg(comp(), "\nNumber of temps seen = %d\n", tempCount);
22362210
}
22372211

22382212
if (comp()->getOption(TR_TraceOptDetails) || comp()->getOption(TR_TraceOptTrees))

0 commit comments

Comments
 (0)