From 3d6fe50568c58aa525328f43b3e51ae80f05c57c Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Wed, 5 Oct 2016 13:27:30 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283316 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AVR/AVRRegisterInfo.cpp | 10 ++++++++++ lib/Target/AVR/AVRRegisterInfo.h | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/Target/AVR/AVRRegisterInfo.cpp b/lib/Target/AVR/AVRRegisterInfo.cpp index c119fa4de8d..7f5002f1608 100644 --- a/lib/Target/AVR/AVRRegisterInfo.cpp +++ b/lib/Target/AVR/AVRRegisterInfo.cpp @@ -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 + diff --git a/lib/Target/AVR/AVRRegisterInfo.h b/lib/Target/AVR/AVRRegisterInfo.h index 59c0849d209..b97e32ea203 100644 --- a/lib/Target/AVR/AVRRegisterInfo.h +++ b/lib/Target/AVR/AVRRegisterInfo.h @@ -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 -- 2.50.1