summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCInstrInfo.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-03-19 18:51:05 +0000
committerHal Finkel <hfinkel@anl.gov>2013-03-19 18:51:05 +0000
commita548afc98fd4c61a8dfdd550ba57c37f2cfe3ed9 (patch)
tree4910f976b23e70ef04c16d7fd1249176db9eb363 /lib/Target/PowerPC/PPCInstrInfo.cpp
parentb05130e1b20ed17ae9d5ab3351933babd27213e1 (diff)
downloadllvm-a548afc98fd4c61a8dfdd550ba57c37f2cfe3ed9.tar.gz
llvm-a548afc98fd4c61a8dfdd550ba57c37f2cfe3ed9.tar.bz2
llvm-a548afc98fd4c61a8dfdd550ba57c37f2cfe3ed9.tar.xz
Prepare to make r0 an allocatable register on PPC
Currently the PPC r0 register is unconditionally reserved. There are two reasons for this: 1. r0 is treated specially (as the constant 0) by certain instructions, and so cannot be used with those instructions as a regular register. 2. r0 is used as a temporary register in the CR-register spilling process (where, under some circumstances, we require two GPRs). This change addresses the first reason by introducing a restricted register class (without r0) for use by those instructions that treat r0 specially. These register classes have a new pseudo-register, ZERO, which represents the r0-as-0 use. This has the side benefit of making the existing target code simpler (and easier to understand), and will make it clear to the register allocator that uses of r0 as 0 don't conflict will real uses of the r0 register. Once the CR spilling code is improved, we'll be able to allocate r0. Adding these extra register classes, for some reason unclear to me, causes requests to the target to copy 32-bit registers to 64-bit registers. The resulting code seems correct (and causes no test-suite failures), and the new test case covers this new kind of asymmetric copy. As r0 is still reserved, no functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177423 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r--lib/Target/PowerPC/PPCInstrInfo.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp
index 7fe7880934..378312c444 100644
--- a/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -422,6 +422,15 @@ void PPCInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
Opc = PPC::VOR;
else if (PPC::CRBITRCRegClass.contains(DestReg, SrcReg))
Opc = PPC::CROR;
+
+ // Asymmetric copies:
+
+ else if (PPC::GPRCRegClass.contains(DestReg) &&
+ PPC::G8RCRegClass.contains(SrcReg))
+ Opc = PPC::OR_64;
+ else if (PPC::G8RCRegClass.contains(DestReg) &&
+ PPC::GPRCRegClass.contains(SrcReg))
+ Opc = PPC::OR8_32;
else
llvm_unreachable("Impossible reg-to-reg copy");