continue;
}
-#if CAN_DISABLE_DFA
/* If we don't know lifetimes of variables, must be conservative */
-
- if (compiler->opts.MinOpts())
+ if (!compiler->backendRequiresLocalVarLifetimes())
{
varDsc->lvMustInit = true;
noway_assert(!varDsc->lvRegister);
}
else
-#endif // CAN_DISABLE_DFA
{
if (!varDsc->lvTracked)
{
public:
virtual void doLinearScan() = 0;
virtual void recordVarLocationsAtStartOfBB(BasicBlock* bb) = 0;
+ virtual bool willEnregisterLocalVars() const = 0;
};
LinearScanInterface* getLinearScanAllocator(Compiler* comp);
GenTreeCall* fgGetSharedCCtor(CORINFO_CLASS_HANDLE cls);
+ inline bool backendRequiresLocalVarLifetimes()
+ {
+#if defined(LEGACY_BACKEND)
+ return true;
+#else
+ return !opts.MinOpts() || m_pLinearScan->willEnregisterLocalVars();
+#endif
+ }
+
void fgLocalVarLiveness();
void fgLocalVarLivenessInit();
BasicBlock* block;
-#if CAN_DISABLE_DFA
-
- /* If we're not optimizing at all, things are simple */
-
- if (opts.MinOpts())
+ // If we don't require accurate local var lifetimes, things are simple.
+ if (!backendRequiresLocalVarLifetimes())
{
unsigned lclNum;
LclVarDsc* varDsc;
VarSetOps::Assign(this, block->bbVarUse, liveAll);
VarSetOps::Assign(this, block->bbVarDef, liveAll);
VarSetOps::Assign(this, block->bbLiveIn, liveAll);
- VarSetOps::Assign(this, block->bbLiveOut, liveAll);
block->bbMemoryUse = fullMemoryKindSet;
block->bbMemoryDef = fullMemoryKindSet;
block->bbMemoryLiveIn = fullMemoryKindSet;
VarSetOps::AssignNoCopy(this, block->bbLiveOut, VarSetOps::MakeEmpty(this));
break;
default:
+ VarSetOps::Assign(this, block->bbLiveOut, liveAll);
break;
}
}
return;
}
-#endif // CAN_DISABLE_DFA
-
// Avoid allocations in the long case.
VarSetOps::AssignNoCopy(this, fgCurUseSet, VarSetOps::MakeEmpty(this));
VarSetOps::AssignNoCopy(this, fgCurDefSet, VarSetOps::MakeEmpty(this));
void Compiler::fgLiveVarAnalysis(bool updateInternalOnly)
{
+ if (!backendRequiresLocalVarLifetimes())
+ {
+ return;
+ }
+
LiveVarAnalysis::Run(this, updateInternalOnly);
#ifdef DEBUG
fgExtendDbgLifetimes();
}
+ // Nothing more to be done if the backend does not require accurate local var lifetimes.
+ if (!backendRequiresLocalVarLifetimes())
+ {
+ fgLocalVarLivenessDone = true;
+ return;
+ }
+
/*-------------------------------------------------------------------------
* Variables involved in exception-handlers and finally blocks need
* to be specially marked
// For now we'll take the throughput hit of recomputing local liveness but in the long term
// we're striving to use the unified liveness computation (fgLocalVarLiveness) and stop
// computing it separately in LSRA.
- if (comp->lvaCount != 0)
+ if ((comp->lvaCount != 0) && comp->backendRequiresLocalVarLifetimes())
{
comp->lvaSortAgain = true;
}
// True if there are any register candidate lclVars available for allocation.
bool enregisterLocalVars;
+ virtual bool willEnregisterLocalVars() const
+ {
+ return enregisterLocalVars;
+ }
+
// Ordered list of RefPositions
RefPositionList refPositions;