mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-08 19:18:32 +00:00
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
This commit is contained in:
@@ -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
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user