Page MenuHomePhabricator

Use template instead of void* -based type erasure in MachineRegistry

Authored by serge-sans-paille on Nov 7 2018, 5:52 AM.



Type safe version of MachinePassRegistry

Previous version used type erasure through a void* (*)() pointer,
which triggered gcc warning and implied a lot of reinterpret_cast.

This version should make it harder to hit ourselves in the foot.

Diff Detail


Event Timeline

kristina added a subscriber: kristina.

Pass manager related stuff, probably good idea to have Chandler or Fedor look over it since they've been doing a lot of work related to PM infrastructure.

This is the legacy PM, and specifically as it is implemented in codegen, so my opinions are few and far between... Not sure the benefits here are all that important, but maybe? Looping in folks w/ more backend feelings about this kind of thing.


The whole registry system isn't used much. The whole machine seems a little overengineered in retrospect (there only ever is a single listener for example). But making it typesafe seems sensible.

MatzeB accepted this revision.Nov 8 2018, 11:29 AM

Take my "meh" as LGTM if nobody objects in the next couple days.

This revision is now accepted and ready to land.Nov 8 2018, 11:29 AM

ok, thanks. The only goal of that patch is to silent disturbing warning, I'll apply it at the end of the day.

This revision now requires review to proceed.Nov 9 2018, 12:56 AM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 9 2018, 9:22 AM
Closed by commit rL346522: Type safe version of MachinePassRegistry (authored by serge_sans_paille, committed by ). · Explain Why
This revision was automatically updated to reflect the committed changes.