From: Dylan McKay Date: Wed, 5 Oct 2016 13:27:30 +0000 (+0000) Subject: [AVR] Add AVRRegisterInfo::splitReg function X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82ef77091c1d77d1ebdb353ee275dd452afe7ba5;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp b/llvm/lib/Target/AVR/AVRRegisterInfo.cpp index c119fa4..7f5002f 100644 --- a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp +++ b/llvm/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/llvm/lib/Target/AVR/AVRRegisterInfo.h b/llvm/lib/Target/AVR/AVRRegisterInfo.h index 59c0849..b97e32e 100644 --- a/llvm/lib/Target/AVR/AVRRegisterInfo.h +++ b/llvm/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