Reduce the number of times we query the subtarget for the same information.

llvm-svn: 299278
This commit is contained in:
Eric Christopher 2017-03-31 23:12:27 +00:00
parent cf965f2f03
commit 60a245e0ff
1 changed files with 4 additions and 5 deletions

View File

@ -266,14 +266,13 @@ static unsigned findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB) {
if (&MF->front() == MBB)
return AArch64::X9;
const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo();
LivePhysRegs LiveRegs(&TRI);
const AArch64Subtarget &Subtarget = MF->getSubtarget<AArch64Subtarget>();
const AArch64RegisterInfo *TRI = Subtarget.getRegisterInfo();
LivePhysRegs LiveRegs(TRI);
LiveRegs.addLiveIns(*MBB);
// Mark callee saved registers as used so we will not choose them.
const AArch64Subtarget &Subtarget = MF->getSubtarget<AArch64Subtarget>();
const AArch64RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs(MF);
const MCPhysReg *CSRegs = TRI->getCalleeSavedRegs(MF);
for (unsigned i = 0; CSRegs[i]; ++i)
LiveRegs.addReg(CSRegs[i]);