summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDylan McKay <dylanmckay34@gmail.com>2016-10-05 13:27:30 +0000
committerDylan McKay <dylanmckay34@gmail.com>2016-10-05 13:27:30 +0000
commit82ef77091c1d77d1ebdb353ee275dd452afe7ba5 (patch)
treeba940a806b5e916441187f182590e5d54d044cea /llvm/lib/Target
parente7c72cdbb0ba7f1ac3ef85b972ad524f79c46af9 (diff)
downloadbcm5719-llvm-82ef77091c1d77d1ebdb353ee275dd452afe7ba5.tar.gz
bcm5719-llvm-82ef77091c1d77d1ebdb353ee275dd452afe7ba5.zip
[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
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AVR/AVRRegisterInfo.cpp10
-rw-r--r--llvm/lib/Target/AVR/AVRRegisterInfo.h6
2 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp b/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
index c119fa4de8d..7f5002f1608 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 59c0849d209..b97e32ea203 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
OpenPOWER on IntegriCloud