diff options
Diffstat (limited to 'lib/Target/AVR/AVRRegisterInfo.cpp')
| -rw-r--r-- | lib/Target/AVR/AVRRegisterInfo.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/Target/AVR/AVRRegisterInfo.cpp b/lib/Target/AVR/AVRRegisterInfo.cpp index 808a85e459c1..a6b36f80485d 100644 --- a/lib/Target/AVR/AVRRegisterInfo.cpp +++ b/lib/Target/AVR/AVRRegisterInfo.cpp @@ -1,9 +1,8 @@ //===-- AVRRegisterInfo.cpp - AVR Register Information --------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -17,6 +16,7 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/IR/Function.h" #include "llvm/CodeGen/TargetFrameLowering.h" @@ -233,9 +233,9 @@ void AVRRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, // No need to set SREG as dead here otherwise if the next instruction is a // cond branch it will be using a dead register. - New = BuildMI(MBB, std::next(II), dl, TII.get(SubOpc), AVR::R29R28) - .addReg(AVR::R29R28, RegState::Kill) - .addImm(Offset - 63 + 1); + BuildMI(MBB, std::next(II), dl, TII.get(SubOpc), AVR::R29R28) + .addReg(AVR::R29R28, RegState::Kill) + .addImm(Offset - 63 + 1); Offset = 62; } @@ -245,7 +245,7 @@ void AVRRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, MI.getOperand(FIOperandNum + 1).ChangeToImmediate(Offset); } -unsigned AVRRegisterInfo::getFrameRegister(const MachineFunction &MF) const { +Register AVRRegisterInfo::getFrameRegister(const MachineFunction &MF) const { const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering(); if (TFI->hasFP(MF)) { // The Y pointer register @@ -273,4 +273,18 @@ void AVRRegisterInfo::splitReg(unsigned Reg, HiReg = getSubReg(Reg, AVR::sub_hi); } +bool AVRRegisterInfo::shouldCoalesce(MachineInstr *MI, + const TargetRegisterClass *SrcRC, + unsigned SubReg, + const TargetRegisterClass *DstRC, + unsigned DstSubReg, + const TargetRegisterClass *NewRC, + LiveIntervals &LIS) const { + if(this->getRegClass(AVR::PTRDISPREGSRegClassID)->hasSubClassEq(NewRC)) { + return false; + } + + return TargetRegisterInfo::shouldCoalesce(MI, SrcRC, SubReg, DstRC, DstSubReg, NewRC, LIS); +} + } // end of namespace llvm |
