summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCRegisterInfo.h
diff options
context:
space:
mode:
authorLei Huang <lei@ca.ibm.com>2017-06-15 18:29:59 +0000
committerLei Huang <lei@ca.ibm.com>2017-06-15 18:29:59 +0000
commitb4733ca8c5e5dedfaa1ed60163a05a13c05440b5 (patch)
treee381be03e92df310a3839e4677e06ebdb3bfd79e /llvm/lib/Target/PowerPC/PPCRegisterInfo.h
parentf7e804157ee3b91f020bd5b3abc941e45a698d34 (diff)
downloadbcm5719-llvm-b4733ca8c5e5dedfaa1ed60163a05a13c05440b5.tar.gz
bcm5719-llvm-b4733ca8c5e5dedfaa1ed60163a05a13c05440b5.zip
[MachineLICM] Hoist TOC-based address instructions
Add condition for MachineLICM to safely hoist instructions that utilize non constant registers that are reserved. On PPC, global variable access is done through the table of contents (TOC) which is always in register X2. The ABI reserves this register in any functions that have calls or access global variables. A call through a function pointer involves saving, changing and restoring this register around the call and thus MachineLICM does not consider it to be invariant. We can however guarantee the register is preserved across the call and thus is invariant. Differential Revision: https://reviews.llvm.org/D33562 llvm-svn: 305490
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCRegisterInfo.h')
-rw-r--r--llvm/lib/Target/PowerPC/PPCRegisterInfo.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.h b/llvm/lib/Target/PowerPC/PPCRegisterInfo.h
index 4a96327fe55..0bbb71fdf9f 100644
--- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.h
+++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.h
@@ -83,6 +83,7 @@ public:
void adjustStackMapLiveOutMask(uint32_t *Mask) const override;
BitVector getReservedRegs(const MachineFunction &MF) const override;
+ bool isCallerPreservedPhysReg(unsigned PhysReg, const MachineFunction &MF) const override;
/// We require the register scavenger.
bool requiresRegisterScavenging(const MachineFunction &MF) const override {
OpenPOWER on IntegriCloud