Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/coreclr/src/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,10 @@ class CodeGenPhase final : public Phase
}

protected:
virtual void DoPhase() override
virtual PhaseStatus DoPhase() override
{
(codeGen->*action)();
return PhaseStatus::MODIFIED_EVERYTHING;
}

private:
Expand Down
28 changes: 10 additions & 18 deletions src/coreclr/src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4195,19 +4195,7 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags

// Import: convert the instrs in each basic block to a tree based intermediate representation
//
auto importPhase = [this]() {
fgImport();

assert(!fgComputePredsDone);
if (fgCheapPredsValid)
{
// Remove cheap predecessors before inlining and fat call transformation;
// allowing the cheap predecessor lists to be inserted causes problems
// with splitting existing blocks.
fgRemovePreds();
}
};
DoPhase(this, PHASE_IMPORTATION, importPhase);
DoPhase(this, PHASE_IMPORTATION, &Compiler::fgImport);

// Transform indirect calls that require control flow expansion.
//
Expand Down Expand Up @@ -4412,11 +4400,15 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags

// Clone code in finallys to reduce overhead for non-exceptional paths
//
auto cloneFinallyPhase = [this]() {
fgCloneFinally();
fgUpdateFinallyTargetFlags();
};
DoPhase(this, PHASE_CLONE_FINALLY, cloneFinallyPhase);
DoPhase(this, PHASE_CLONE_FINALLY, &Compiler::fgCloneFinally);

#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)

// Update finally target flags after EH optimizations
//
DoPhase(this, PHASE_UPDATE_FINALLY_FLAGS, &Compiler::fgUpdateFinallyTargetFlags);

#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)

#if DEBUG
if (lvaEnregEHVars)
Expand Down
31 changes: 21 additions & 10 deletions src/coreclr/src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,13 @@ enum class PhaseChecks
CHECK_ALL
};

// Specify compiler data that a phase might modify
enum class PhaseStatus : unsigned
{
MODIFIED_NOTHING,
MODIFIED_EVERYTHING
};

// The following enum provides a simple 1:1 mapping to CLR API's
enum API_ICorJitInfo_Names
{
Expand Down Expand Up @@ -4359,31 +4366,35 @@ class Compiler

void fgInit();

void fgImport();
PhaseStatus fgImport();

void fgTransformIndirectCalls();
PhaseStatus fgTransformIndirectCalls();

void fgTransformPatchpoints();
PhaseStatus fgTransformPatchpoints();

void fgInline();
PhaseStatus fgInline();

void fgRemoveEmptyTry();
PhaseStatus fgRemoveEmptyTry();

void fgRemoveEmptyFinally();
PhaseStatus fgRemoveEmptyFinally();

void fgMergeFinallyChains();
PhaseStatus fgMergeFinallyChains();

void fgCloneFinally();
PhaseStatus fgCloneFinally();

void fgCleanupContinuation(BasicBlock* continuation);

void fgUpdateFinallyTargetFlags();
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)

PhaseStatus fgUpdateFinallyTargetFlags();

void fgClearAllFinallyTargetBits();

void fgAddFinallyTargetFlags();

void fgTailMergeThrows();
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)

PhaseStatus fgTailMergeThrows();
void fgTailMergeThrowsFallThroughHelper(BasicBlock* predBlock,
BasicBlock* nonCanonicalBlock,
BasicBlock* canonicalBlock,
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/jit/compphases.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CompPhaseNameMacro(PHASE_EMPTY_TRY, "Remove empty try",
CompPhaseNameMacro(PHASE_EMPTY_FINALLY, "Remove empty finally", "EMPTYFIN", false, -1, false)
CompPhaseNameMacro(PHASE_MERGE_FINALLY_CHAINS, "Merge callfinally chains", "MRGCFCHN", false, -1, false)
CompPhaseNameMacro(PHASE_CLONE_FINALLY, "Clone finally", "CLONEFIN", false, -1, false)
CompPhaseNameMacro(PHASE_UPDATE_FINALLY_FLAGS, "Update finally target flags", "UPD-FTF", false, -1, false)
CompPhaseNameMacro(PHASE_COMPUTE_PREDS, "Compute preds", "PREDS", false, -1, false)
CompPhaseNameMacro(PHASE_EARLY_UPDATE_FLOW_GRAPH,"Update flow graph early pass", "UPD-FG-E", false, -1, false)
CompPhaseNameMacro(PHASE_STR_ADRLCL, "Morph - Structs/AddrExp", "MOR-STRAL",false, -1, false)
Expand Down
Loading