@@ -2233,7 +2233,9 @@ class FlowGraphNaturalLoop
22332233 bool HasDef (unsigned lclNum);
22342234
22352235 bool CanDuplicate (INDEBUG(const char ** reason));
2236+ bool CanDuplicateWithEH (INDEBUG(const char ** reason));
22362237 void Duplicate (BasicBlock** insertAfter, BlockToBlockMap* map, weight_t weightScale);
2238+ void DuplicateWithEH (BasicBlock** insertAfter, BlockToBlockMap* map, weight_t weightScale);
22372239
22382240 bool MayExecuteBlockMultipleTimesPerIteration (BasicBlock* block);
22392241
@@ -2557,6 +2559,29 @@ struct RelopImplicationInfo
25572559 bool reverseSense = false ;
25582560};
25592561
2562+ // ------------------------------------------------------------------------
2563+ // CloneTryInfo
2564+ //
2565+ // Describes information needed to clone a try region, and information
2566+ // produced by cloning that region
2567+ //
2568+ struct CloneTryInfo
2569+ {
2570+ CloneTryInfo (Compiler* comp);
2571+
2572+ // bbID based traits and vector
2573+ //
2574+ BitVecTraits Traits;
2575+ BitVec Visited;
2576+
2577+ BlockToBlockMap* Map = nullptr ;
2578+ jitstd::vector<BasicBlock*>* BlocksToClone = nullptr ;
2579+ weight_t ProfileScale = 0.0 ;
2580+ unsigned EHIndexShift = 0 ;
2581+ bool AddEdges = false ;
2582+ bool ScaleOriginalBlockProfile = false ;
2583+ };
2584+
25602585/*
25612586XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25622587XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -3001,7 +3026,7 @@ class Compiler
30013026
30023027 void fgRemoveEHTableEntry (unsigned XTnum);
30033028
3004- EHblkDsc* fgAddEHTableEntry (unsigned XTnum);
3029+ EHblkDsc* fgTryAddEHTableEntries (unsigned XTnum, unsigned count = 1 , bool deferAdding = false );
30053030
30063031 void fgSortEHTable ();
30073032
@@ -5359,6 +5384,10 @@ class Compiler
53595384
53605385 PhaseStatus fgCloneFinally ();
53615386
5387+ bool fgCanCloneTryRegion (BasicBlock* tryEntry);
5388+
5389+ BasicBlock* fgCloneTryRegion (BasicBlock* tryEntry, CloneTryInfo& info, BasicBlock** insertAfter = nullptr );
5390+
53625391 void fgUpdateACDsBeforeEHTableEntryRemoval (unsigned XTnum);
53635392
53645393 void fgCleanupContinuation (BasicBlock* continuation);
@@ -12264,6 +12293,13 @@ class EHClauses
1226412293 assert ((m_begin != nullptr ) || (m_begin == m_end));
1226512294 }
1226612295
12296+ EHClauses (Compiler* comp, EHblkDsc* begin)
12297+ : m_begin(begin)
12298+ , m_end(comp->compHndBBtab + comp->compHndBBtabCount)
12299+ {
12300+ assert ((m_begin != nullptr ) || (m_begin == m_end));
12301+ }
12302+
1226712303 iterator begin () const
1226812304 {
1226912305 return iterator (m_begin);
0 commit comments