diff options
author | Matthias Braun <matze@braunis.de> | 2017-05-26 02:25:20 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2017-05-26 02:25:20 +0000 |
commit | c93c0639939ffb93c6ab89d07b748681e9c4c8a4 (patch) | |
tree | 1bd5149abbf03da9368028c0a547e0375c280d2d /llvm/lib | |
parent | 240b9515e27e1c260aa9ac41ba9fb4d32c33bf9e (diff) | |
download | bcm5719-llvm-c93c0639939ffb93c6ab89d07b748681e9c4c8a4.tar.gz bcm5719-llvm-c93c0639939ffb93c6ab89d07b748681e9c4c8a4.zip |
Revert "LivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI"
Tentatively revert this to see if it fixes the buildbot stage2
breakages.
This reverts commit r303938.
This reverts commit r303954.
llvm-svn: 303960
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LivePhysRegs.cpp | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp index d90e8930598..9f7d7cf5484 100644 --- a/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -155,62 +155,48 @@ void LivePhysRegs::addBlockLiveIns(const MachineBasicBlock &MBB) { } } -/// Adds all callee saved registers to \p LiveRegs. -static void addCalleeSavedRegs(LivePhysRegs &LiveRegs, - const MachineFunction &MF) { +/// Add pristine registers to the given \p LiveRegs. This function removes +/// actually saved callee save registers when \p InPrologueEpilogue is false. +static void addPristines(LivePhysRegs &LiveRegs, const MachineFunction &MF, + const MachineFrameInfo &MFI, + const TargetRegisterInfo &TRI) { const MachineRegisterInfo &MRI = MF.getRegInfo(); - for (const MCPhysReg *CSR = MRI.getCalleeSavedRegs(); CSR && *CSR; ++CSR) + for (const MCPhysReg *CSR = MRI.getCalleeSavedRegs(); CSR && *CSR; + ++CSR) LiveRegs.addReg(*CSR); -} - -/// Adds pristine registers to the given \p LiveRegs. Pristine registers are -/// callee saved registers that are unused in the function. -static void addPristines(LivePhysRegs &LiveRegs, const MachineFunction &MF) { - const MachineFrameInfo &MFI = MF.getFrameInfo(); - if (!MFI.isCalleeSavedInfoValid()) - return; - /// Add all callee saved regs, then remove the ones that are saved+restored. - addCalleeSavedRegs(LiveRegs, MF); - /// Remove the ones that are not saved/restored; they are pristine. for (const CalleeSavedInfo &Info : MFI.getCalleeSavedInfo()) LiveRegs.removeReg(Info.getReg()); } void LivePhysRegs::addLiveOutsNoPristines(const MachineBasicBlock &MBB) { - if (!MBB.succ_empty()) { - // To get the live-outs we simply merge the live-ins of all successors. - for (const MachineBasicBlock *Succ : MBB.successors()) - addBlockLiveIns(*Succ); - } else if (MBB.isReturnBlock()) { - // For the return block: Add all callee saved registers that are saved and - // restored (somewhere); This does not include callee saved registers that - // are unused and hence not saved and restored; they are called pristine. - const MachineFunction &MF = *MBB.getParent(); - const MachineFrameInfo &MFI = MF.getFrameInfo(); - if (MFI.isCalleeSavedInfoValid()) { - for (const CalleeSavedInfo &Info : MFI.getCalleeSavedInfo()) - addReg(Info.getReg()); - } - } + // To get the live-outs we simply merge the live-ins of all successors. + for (const MachineBasicBlock *Succ : MBB.successors()) + addBlockLiveIns(*Succ); } void LivePhysRegs::addLiveOuts(const MachineBasicBlock &MBB) { - if (!MBB.succ_empty()) { - addLiveOutsNoPristines(MBB); - const MachineFunction &MF = *MBB.getParent(); - addPristines(*this, MF); - } else if (MBB.isReturnBlock()) { - // For the return block: Add all callee saved registers. - const MachineFunction &MF = *MBB.getParent(); - const MachineFrameInfo &MFI = MF.getFrameInfo(); - if (MFI.isCalleeSavedInfoValid()) - addCalleeSavedRegs(*this, MF); + const MachineFunction &MF = *MBB.getParent(); + const MachineFrameInfo &MFI = MF.getFrameInfo(); + if (MFI.isCalleeSavedInfoValid()) { + if (MBB.isReturnBlock()) { + // The return block has no successors whose live-ins we could merge + // below. So instead we add the callee saved registers manually. + const MachineRegisterInfo &MRI = MF.getRegInfo(); + for (const MCPhysReg *I = MRI.getCalleeSavedRegs(); *I; ++I) + addReg(*I); + } else { + addPristines(*this, MF, MFI, *TRI); + } } + + addLiveOutsNoPristines(MBB); } void LivePhysRegs::addLiveIns(const MachineBasicBlock &MBB) { const MachineFunction &MF = *MBB.getParent(); - addPristines(*this, MF); + const MachineFrameInfo &MFI = MF.getFrameInfo(); + if (MFI.isCalleeSavedInfoValid()) + addPristines(*this, MF, MFI, *TRI); addBlockLiveIns(MBB); } |