diff options
author | Mark Lacey <mark.lacey@apple.com> | 2013-08-14 23:50:09 +0000 |
---|---|---|
committer | Mark Lacey <mark.lacey@apple.com> | 2013-08-14 23:50:09 +0000 |
commit | 03fe68e0a9c0fdd196f62899cb44b6f9a56dd7c8 (patch) | |
tree | ad445ad6a2275fcdaf877e9a5f3f16e972d330b7 /include/llvm/CodeGen/MachineRegisterInfo.h | |
parent | 1feb5854aeeda897e9318c8193d187673c8576b8 (diff) | |
download | llvm-03fe68e0a9c0fdd196f62899cb44b6f9a56dd7c8.tar.gz llvm-03fe68e0a9c0fdd196f62899cb44b6f9a56dd7c8.tar.bz2 llvm-03fe68e0a9c0fdd196f62899cb44b6f9a56dd7c8.tar.xz |
Notify LiveRangeEdit of new virtual registers.
Add a delegate class to MachineRegisterInfo with a single virtual
function, MRI_NoteNewVirtualRegister(). Update LiveRangeEdit to inherit
from this delegate class and override the definition of the callback
with an implementation that tracks the newly created virtual registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188435 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineRegisterInfo.h')
-rw-r--r-- | include/llvm/CodeGen/MachineRegisterInfo.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index 7a6dcd0589..4fb1ac90aa 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -27,7 +27,17 @@ namespace llvm { /// registers, including vreg register classes, use/def chains for registers, /// etc. class MachineRegisterInfo { +public: + class Delegate { + public: + virtual void MRI_NoteNewVirtualRegister(unsigned Reg) {} + + virtual ~Delegate() {} + }; + +private: const TargetMachine &TM; + Delegate *TheDelegate; /// IsSSA - True when the machine function is in SSA form and virtual /// registers have a single def. @@ -116,6 +126,23 @@ public: return TM.getRegisterInfo(); } + void resetDelegate(Delegate *delegate) { + // Ensure another delegate does not take over unless the current + // delegate first unattaches itself. If we ever need to multicast + // notifications, we will need to change to using a list. + assert(TheDelegate == delegate && + "Only the current delegate can perform reset!"); + TheDelegate = 0; + } + + void setDelegate(Delegate *delegate) { + assert(delegate && !TheDelegate && + "Attempted to set delegate to null, or to change it without " + "first resetting it!"); + + TheDelegate = delegate; + } + //===--------------------------------------------------------------------===// // Function State //===--------------------------------------------------------------------===// |