summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMRegisterInfo.td
diff options
context:
space:
mode:
authorTilmann Scheller <tilmann.scheller@googlemail.com>2013-09-05 11:10:31 +0000
committerTilmann Scheller <tilmann.scheller@googlemail.com>2013-09-05 11:10:31 +0000
commit10b5086e6e945b830ff909821240eff5c4a42bfc (patch)
treec7480522b0cf9d0240672fae665b76dadc4f9da0 /lib/Target/ARM/ARMRegisterInfo.td
parent16277c4698f36a756c540fae326874774156aaed (diff)
downloadllvm-10b5086e6e945b830ff909821240eff5c4a42bfc.tar.gz
llvm-10b5086e6e945b830ff909821240eff5c4a42bfc.tar.bz2
llvm-10b5086e6e945b830ff909821240eff5c4a42bfc.tar.xz
ARM: Add GPR register class excluding LR for use with the ADR instruction.
This improves code generation for jump tables by avoiding the emission of "mov pc, lr" which could fool the processor into believing this is a return from a function causing mispredicts. The code generation logic for jump tables uses ADR to materialize the address of the jump target. Patch by Daniel Stewart! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMRegisterInfo.td')
-rw-r--r--lib/Target/ARM/ARMRegisterInfo.td8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMRegisterInfo.td b/lib/Target/ARM/ARMRegisterInfo.td
index 90c6a965ac..51ecaf7c46 100644
--- a/lib/Target/ARM/ARMRegisterInfo.td
+++ b/lib/Target/ARM/ARMRegisterInfo.td
@@ -240,6 +240,14 @@ def rGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, SP, PC)> {
}];
}
+// jtGPR - Jump Table General Purpose Registers.
+// Used by the Thumb2 instructions to prevent Thumb2 jump tables
+// from using the LR. The implementation of the jump table uses a mov pc, rA
+// type instruction to jump into the table. Use of the LR register (as in
+// mov pc, lr) can cause the ARM branch predictor to think it is returning
+// from a function instead. This causes a mispredict and a pipe flush.
+def jtGPR : RegisterClass<"ARM", [i32], 32, (sub rGPR, LR)>;
+
// Thumb registers are R0-R7 normally. Some instructions can still use
// the general GPR register class above (MOV, e.g.)
def tGPR : RegisterClass<"ARM", [i32], 32, (trunc GPR, 8)>;