summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsMachineFunction.cpp
diff options
context:
space:
mode:
authorReed Kotler <rkotler@mips.com>2012-10-28 06:02:37 +0000
committerReed Kotler <rkotler@mips.com>2012-10-28 06:02:37 +0000
commit3589dd74acc93c371344752602bea02904c774fb (patch)
tree2d35c3ea78bc31c331f8c45445a01d06f0b2ebec /llvm/lib/Target/Mips/MipsMachineFunction.cpp
parent27501e787c945e1f344072468d6b695d2b8827a9 (diff)
downloadbcm5719-llvm-3589dd74acc93c371344752602bea02904c774fb.tar.gz
bcm5719-llvm-3589dd74acc93c371344752602bea02904c774fb.zip
This patch is for the implementation of mips16 complex pattern addr16.
Previously mips16 was sharing the pattern addr which is used for mips32 and mips64. This had a number of problems: 1) Storing and loading byte and halfword quantities for mips16 has particular problems due to the primarily non mips16 nature of SP. When we must load/store byte/halfword stack objects in a function, we must create a mips16 alias register for SP. This functionality is tested in stchar.ll. 2) We need to have an FP register under certain conditions (such as dynamically sized alloca). We use mips16 register S0 for this purpose. In this case, we also use this register when accessing frame objects so this issue also affects the complex pattern addr16. This functionality is tested in alloca16.ll. The Mips16InstrInfo.td has been updated to use addr16 instead of addr. The complex pattern C++ function for addr has been copied to addr16 and updated to reflect the above issues. llvm-svn: 166897
Diffstat (limited to 'llvm/lib/Target/Mips/MipsMachineFunction.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsMachineFunction.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsMachineFunction.cpp b/llvm/lib/Target/Mips/MipsMachineFunction.cpp
index 362173eda3a..5ff19aba026 100644
--- a/llvm/lib/Target/Mips/MipsMachineFunction.cpp
+++ b/llvm/lib/Target/Mips/MipsMachineFunction.cpp
@@ -43,4 +43,17 @@ unsigned MipsFunctionInfo::getGlobalBaseReg() {
return GlobalBaseReg = MF.getRegInfo().createVirtualRegister(RC);
}
+bool MipsFunctionInfo::mips16SPAliasRegSet() const {
+ return Mips16SPAliasReg;
+}
+unsigned MipsFunctionInfo::getMips16SPAliasReg() {
+ // Return if it has already been initialized.
+ if (Mips16SPAliasReg)
+ return Mips16SPAliasReg;
+
+ const TargetRegisterClass *RC;
+ RC=(const TargetRegisterClass*)&Mips::CPU16RegsRegClass;
+ return Mips16SPAliasReg = MF.getRegInfo().createVirtualRegister(RC);
+}
+
void MipsFunctionInfo::anchor() { }
OpenPOWER on IntegriCloud