This is an archive of the discontinued LLVM Phabricator instance.

[WinEHPrepare] Add rudimentary support for the new EH instructions
ClosedPublic

Authored by majnemer on Aug 4 2015, 1:23 AM.

Details

Summary

This adds somewhat basic preparation functionality including:

  • Formation of funclets via coloring basic blocks.
  • Cloning of polychromatic blocks to ensure that funclets have unique program counters.
  • Demotion of values used between different funclets.
  • Some amount of cleanup once we have removed predecessors from basic blocks.
  • Verification that we are left with a CFG that makes some amount of sense.

N.B. Arguments and numbering still need to be done.

Diff Detail

Event Timeline

majnemer updated this revision to Diff 31303.Aug 4 2015, 1:23 AM
majnemer retitled this revision from to [WinEHPrepare] Add rudimentary support for the new EH instructions.
majnemer updated this object.
majnemer added reviewers: rnk, JosephTremoulet.
majnemer added a subscriber: llvm-commits.
majnemer updated this revision to Diff 31336.Aug 5 2015, 12:56 AM
  • handle phi nodes
  • Handle PHI nodes prefacing EH pads too
majnemer updated this revision to Diff 31338.Aug 5 2015, 1:19 AM
  • handle phi nodes
  • Handle PHI nodes prefacing EH pads too
  • PHIs don't need to be postprocessed
rnk edited edge metadata.Aug 6 2015, 11:38 AM

The demotion logic seems pretty heinous, but I hear improvements are on the way, so I'm not going to dig too much into it.

lib/CodeGen/WinEHPrepare.cpp
2922

I expect many cleanup funclets will be one BB. SmallVector<1>?

2926–2927

pop_back_val?

2942–2947

I think you can remove the IsCatch and IsCleanup predicates and stop at either kind of ret. If the CFG gets mangled, this will stop us from going off into the weeds earlier.

3244

Do you want these in a release build? #ifndef NDEBUG?

This revision was automatically updated to reflect the committed changes.