summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineRegisterInfo.cpp
diff options
context:
space:
mode:
authorTony Jiang <jtony@ca.ibm.com>2017-11-20 16:55:07 +0000
committerTony Jiang <jtony@ca.ibm.com>2017-11-20 16:55:07 +0000
commitf75f4d65730cef5646ac7472354e71f7df528df7 (patch)
tree65de16aafcb1aa64481bdedb31b0709d5a1a997a /llvm/lib/CodeGen/MachineRegisterInfo.cpp
parent45d25e12ab1153cd87f3b305470d3afd0c96a82f (diff)
downloadbcm5719-llvm-f75f4d65730cef5646ac7472354e71f7df528df7.tar.gz
bcm5719-llvm-f75f4d65730cef5646ac7472354e71f7df528df7.zip
[MachineCSE] Add new callback for is caller preserved or constant physregs
The instructions addis,addi, bl are used to calculate the address of TLS thread local variables. These TLS access code sequences are generated repeatedly every time the thread local variable is accessed. By communicating to Machine CSE that X2 is guaranteed to have the same value within the same function call (so called Caller Preserved Physical Register), the redundant TLS access code sequences are cleaned up. Differential Revision: https://reviews.llvm.org/D39173 llvm-svn: 318661
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineRegisterInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
index 84d130fae3c..dfa0a4af334 100644
--- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
@@ -487,6 +487,13 @@ bool MachineRegisterInfo::isConstantPhysReg(unsigned PhysReg) const {
return true;
}
+bool
+MachineRegisterInfo::isCallerPreservedOrConstPhysReg(unsigned PhysReg) const {
+ const TargetRegisterInfo *TRI = getTargetRegisterInfo();
+ return isConstantPhysReg(PhysReg) ||
+ TRI->isCallerPreservedPhysReg(PhysReg, *MF);
+}
+
/// markUsesInDebugValueAsUndef - Mark every DBG_VALUE referencing the
/// specified register as undefined which causes the DBG_VALUE to be
/// deleted during LiveDebugVariables analysis.
OpenPOWER on IntegriCloud