[AVR] Add AVRRegisterInfo::splitReg function

No tests are included just yet - this is used from the pseudo
instruction expander pass, which hasn't been pulled in-tree yet.

llvm-svn: 283316
This commit is contained in:
Dylan McKay 2016-10-05 13:27:30 +00:00
parent e7c72cdbb0
commit 82ef77091c
2 changed files with 14 additions and 2 deletions

View File

@ -253,4 +253,14 @@ AVRRegisterInfo::getPointerRegClass(const MachineFunction &MF,
return &AVR::PTRDISPREGSRegClass;
}
void AVRRegisterInfo::splitReg(unsigned Reg,
unsigned &LoReg,
unsigned &HiReg) const {
assert(AVR::DREGSRegClass.contains(Reg) && "can only split 16-bit registers");
LoReg = getSubReg(Reg, AVR::sub_lo);
HiReg = getSubReg(Reg, AVR::sub_hi);
}
} // end of namespace llvm

View File

@ -42,13 +42,15 @@ public:
unsigned FIOperandNum,
RegScavenger *RS = NULL) const override;
/// Debug information queries.
unsigned getFrameRegister(const MachineFunction &MF) const override;
/// Returns a TargetRegisterClass used for pointer values.
const TargetRegisterClass *
getPointerRegClass(const MachineFunction &MF,
unsigned Kind = 0) const override;
/// Splits a 16-bit `DREGS` register into the lo/hi register pair.
/// \param Reg A 16-bit register to split.
void splitReg(unsigned Reg, unsigned &LoReg, unsigned &HiReg) const;
};
} // end namespace llvm