Split MORPH into multiple phases. (#7314)
authorPeter Kukol <pkukol@users.noreply.github.com>
Fri, 23 Sep 2016 00:26:08 +0000 (17:26 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Sep 2016 00:26:08 +0000 (17:26 -0700)
* Split MORPH into multiple phases.

src/jit/compiler.cpp
src/jit/compphases.h
src/jit/morph.cpp

index e5fd4cf..07613e7 100644 (file)
@@ -4094,6 +4094,8 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, CORJIT_F
         fgRemovePreds();
     }
 
+    EndPhase(PHASE_IMPORTATION);
+
     if (compIsForInlining())
     {
         /* Quit inlining if fgImport() failed for any reason. */
@@ -4112,8 +4114,6 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, CORJIT_F
 
     assert(!compDonotInline());
 
-    EndPhase(PHASE_IMPORTATION);
-
     // Maybe the caller was not interested in generating code
     if (compIsForImportOnly())
     {
@@ -4162,7 +4162,7 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, CORJIT_F
     /* Massage the trees so that we can generate code out of them */
 
     fgMorph();
-    EndPhase(PHASE_MORPH);
+    EndPhase(PHASE_MORPH_END);
 
     /* GS security checks for unsafe buffers */
     if (getNeedsGSSecurityCookie())
index f193d04..fa3d585 100644 (file)
 CompPhaseNameMacro(PHASE_PRE_IMPORT,             "Pre-import",                     "PRE-IMP",  false, -1)
 CompPhaseNameMacro(PHASE_IMPORTATION,            "Importation",                    "IMPORT",   false, -1)
 CompPhaseNameMacro(PHASE_POST_IMPORT,            "Post-import",                    "POST-IMP", false, -1)
-CompPhaseNameMacro(PHASE_MORPH,                  "Morph",                          "MORPH",    false, -1)
+CompPhaseNameMacro(PHASE_MORPH_INIT,             "Morph - Init",                   "MOR-INIT" ,false, -1)
+CompPhaseNameMacro(PHASE_MORPH_INLINE,           "Morph - Inlining",               "MOR-INL",  false, -1)
+CompPhaseNameMacro(PHASE_MORPH_IMPBYREF,         "Morph - ByRefs",                 "MOR-BYREF",false, -1)
+CompPhaseNameMacro(PHASE_STR_ADRLCL,             "Morph - Structs/AddrExp",        "MOR-STRAL",false, -1)
+CompPhaseNameMacro(PHASE_MORPH_GLOBAL,           "Morph - Global",                 "MOR-GLOB", false, -1)
+CompPhaseNameMacro(PHASE_MORPH_END,              "Morph - Finish",                 "MOR-END",  false, -1)
 CompPhaseNameMacro(PHASE_GS_COOKIE,              "GS Cookie",                      "GS-COOK",  false, -1)
 CompPhaseNameMacro(PHASE_COMPUTE_PREDS,          "Compute preds",                  "PREDS",    false, -1)
 CompPhaseNameMacro(PHASE_MARK_GC_POLL_BLOCKS,    "Mark GC poll blocks",            "GC-POLL",  false, -1)
@@ -55,7 +60,7 @@ CompPhaseNameMacro(PHASE_OPTIMIZE_INDEX_CHECKS,  "Optimize index checks",
 
 #if FEATURE_VALNUM_CSE
 CompPhaseNameMacro(PHASE_OPTIMIZE_VALNUM_CSES,   "Optimize Valnum CSEs",           "OPT-CSE",  false, -1)
-#endif  
+#endif
 
 CompPhaseNameMacro(PHASE_VN_COPY_PROP,           "VN based copy prop",             "CP-PROP",  false, -1)
 #if ASSERTION_PROP
index 0ca2954..99f1da4 100644 (file)
@@ -16846,6 +16846,8 @@ void Compiler::fgMorph()
     fgDebugCheckBBlist(false, false);
 #endif // DEBUG
 
+    EndPhase(PHASE_MORPH_INIT);
+
     /* Inline */
     fgInline();
 #if 0
@@ -16855,6 +16857,8 @@ void Compiler::fgMorph()
 
     RecordStateAtEndOfInlining(); // Record "start" values for post-inlining cycles and elapsed time.
 
+    EndPhase(PHASE_MORPH_INLINE);
+
 #ifdef DEBUG
     /* Inliner could add basic blocks. Check that the flowgraph data is up-to-date */
     fgDebugCheckBBlist(false, false);
@@ -16863,6 +16867,8 @@ void Compiler::fgMorph()
     /* For x64 and ARM64 we need to mark irregular parameters early so that they don't get promoted */
     fgMarkImplicitByRefArgs();
 
+    EndPhase(PHASE_MORPH_IMPBYREF);
+
     /* Promote struct locals if necessary */
     fgPromoteStructs();
 
@@ -16875,10 +16881,14 @@ void Compiler::fgMorph()
     fgStress64RsltMul();
 #endif // DEBUG
 
+    EndPhase(PHASE_STR_ADRLCL);
+
     /* Morph the trees in all the blocks of the method */
 
     fgMorphBlocks();
 
+    EndPhase(PHASE_MORPH_GLOBAL);
+
 #if 0
     JITDUMP("trees after fgMorphBlocks\n");
     DBEXEC(VERBOSE, fgDispBasicBlocks(true));