This is an archive of the discontinued LLVM Phabricator instance.

Add SsaContext: Template to access generic IR functionality
Needs ReviewPublic

Authored by nhaehnle on Dec 9 2020, 2:44 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Some functionality cannot be accessed directly from templates in a
straightforward generic way at all, and other functionality could be
accessed but only inefficiently.

Examples are:

  • Given an SSA value, determining the basic block in which it is defined (if any) isn't possible in MachineIR without access to MachineRegisterInfo.
  • Printing an llvm::Value properly requires a ModuleSlotTracker whose creation is expensive. Printing large functions can become prohibitively slow unless the ModuleSlotTracker is cached.

Each supported IR provides an implementation of the SsaContext
"concept" defined in this patch through which such functionality can be
exposed.

Change-Id: I7ed2b5c7698e6f3784db6201bcdb842173e23379

Diff Detail