aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-07-14 17:57:04 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-07-14 17:57:04 +0000
commit32caa8de629d9872e50264905b9a29b740c44db7 (patch)
treee73dfb1690afe8edcb3ca34b80079c0c988a0aad
parent8d442c2dc4aaf627969b052f597d101761f2a432 (diff)
Don't define the same register twice when loading a ConstantPointerRef to a reg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14819 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPC32ISelSimple.cpp8
-rw-r--r--lib/Target/PowerPC/PowerPCISelSimple.cpp8
2 files changed, 6 insertions, 10 deletions
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 3a81765b92..c986ca4afd 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -526,10 +526,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
// Copy zero (null pointer) to the register.
BuildMI(*MBB, IP, PPC32::ADDI, 2, R).addReg(PPC32::R0).addImm(0);
} else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
- BuildMI(*MBB, IP, PPC32::ADDIS, 2, R).addReg(PPC32::R0)
- .addGlobalAddress(CPR->getValue());
- BuildMI(*MBB, IP, PPC32::ORI, 2, R).addReg(PPC32::R0)
- .addGlobalAddress(CPR->getValue());
+ unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
+ BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
} else {
std::cerr << "Offending constant: " << C << "\n";
assert(0 && "Type not handled yet!");
@@ -551,7 +549,7 @@ void ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
PPC32::R7, PPC32::R8, PPC32::R9, PPC32::R10,
};
static const unsigned FPR[] = {
- PPC32::F1, PPC32::F2, PPC32::F3, PPC32::F4, PPC32::F5, PPC32::F6, PPC32::F7,
+ PPC32::F1, PPC32::F2, PPC32::F3, PPC32::F4, PPC32::F5, PPC32::F6, PPC32::F7,
PPC32::F8, PPC32::F9, PPC32::F10, PPC32::F11, PPC32::F12, PPC32::F13
};
diff --git a/lib/Target/PowerPC/PowerPCISelSimple.cpp b/lib/Target/PowerPC/PowerPCISelSimple.cpp
index 3a81765b92..c986ca4afd 100644
--- a/lib/Target/PowerPC/PowerPCISelSimple.cpp
+++ b/lib/Target/PowerPC/PowerPCISelSimple.cpp
@@ -526,10 +526,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
// Copy zero (null pointer) to the register.
BuildMI(*MBB, IP, PPC32::ADDI, 2, R).addReg(PPC32::R0).addImm(0);
} else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
- BuildMI(*MBB, IP, PPC32::ADDIS, 2, R).addReg(PPC32::R0)
- .addGlobalAddress(CPR->getValue());
- BuildMI(*MBB, IP, PPC32::ORI, 2, R).addReg(PPC32::R0)
- .addGlobalAddress(CPR->getValue());
+ unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
+ BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
} else {
std::cerr << "Offending constant: " << C << "\n";
assert(0 && "Type not handled yet!");
@@ -551,7 +549,7 @@ void ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
PPC32::R7, PPC32::R8, PPC32::R9, PPC32::R10,
};
static const unsigned FPR[] = {
- PPC32::F1, PPC32::F2, PPC32::F3, PPC32::F4, PPC32::F5, PPC32::F6, PPC32::F7,
+ PPC32::F1, PPC32::F2, PPC32::F3, PPC32::F4, PPC32::F5, PPC32::F6, PPC32::F7,
PPC32::F8, PPC32::F9, PPC32::F10, PPC32::F11, PPC32::F12, PPC32::F13
};