aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-18 07:29:35 +0000
committerChris Lattner <sabre@nondot.org>2004-07-18 07:29:35 +0000
commit67910e1eb024bb78cab2f4ffb48c3a79b5647f64 (patch)
tree32308cdf637219f94738026eecf75dfc3ef77f63
parent7330248482817762c810c0b20165f8f1b59af283 (diff)
CPR Fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14961 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPC32AsmPrinter.cpp4
-rw-r--r--lib/Target/PowerPC/PPC32ISelSimple.cpp6
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp4
-rw-r--r--lib/Target/PowerPC/PowerPCAsmPrinter.cpp4
-rw-r--r--lib/Target/PowerPC/PowerPCISelSimple.cpp6
5 files changed, 10 insertions, 14 deletions
diff --git a/lib/Target/PowerPC/PPC32AsmPrinter.cpp b/lib/Target/PowerPC/PPC32AsmPrinter.cpp
index e8b3ca2161..184922157d 100644
--- a/lib/Target/PowerPC/PPC32AsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPC32AsmPrinter.cpp
@@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
O << CI->getValue();
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
O << CI->getValue();
- else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
+ else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
// This is a constant address for a global variable or function. Use the
// name of the variable or function as the address value.
- O << Mang->getValueName(CPR->getValue());
+ O << Mang->getValueName(GV);
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
const TargetData &TD = TM.getTargetData();
switch(CE->getOpcode()) {
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 3b53905237..340cbe95ef 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -520,8 +520,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
} else if (isa<ConstantPointerNull>(C)) {
// Copy zero (null pointer) to the register.
BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
- } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
- unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
+ } else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
+ unsigned AddrReg = getReg(GV, MBB, IP);
BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
} else {
std::cerr << "Offending constant: " << *C << "\n";
@@ -2771,8 +2771,6 @@ void ISel::emitGEPOperation(MachineBasicBlock *MBB,
Value *Src, User::op_iterator IdxBegin,
User::op_iterator IdxEnd, unsigned TargetReg) {
const TargetData &TD = TM.getTargetData();
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Src))
- Src = CPR->getValue();
std::vector<Value*> GEPOps;
GEPOps.resize(IdxEnd-IdxBegin+1);
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index e8b3ca2161..184922157d 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
O << CI->getValue();
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
O << CI->getValue();
- else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
+ else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
// This is a constant address for a global variable or function. Use the
// name of the variable or function as the address value.
- O << Mang->getValueName(CPR->getValue());
+ O << Mang->getValueName(GV);
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
const TargetData &TD = TM.getTargetData();
switch(CE->getOpcode()) {
diff --git a/lib/Target/PowerPC/PowerPCAsmPrinter.cpp b/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
index e8b3ca2161..184922157d 100644
--- a/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
@@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
O << CI->getValue();
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
O << CI->getValue();
- else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
+ else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
// This is a constant address for a global variable or function. Use the
// name of the variable or function as the address value.
- O << Mang->getValueName(CPR->getValue());
+ O << Mang->getValueName(GV);
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
const TargetData &TD = TM.getTargetData();
switch(CE->getOpcode()) {
diff --git a/lib/Target/PowerPC/PowerPCISelSimple.cpp b/lib/Target/PowerPC/PowerPCISelSimple.cpp
index 3b53905237..340cbe95ef 100644
--- a/lib/Target/PowerPC/PowerPCISelSimple.cpp
+++ b/lib/Target/PowerPC/PowerPCISelSimple.cpp
@@ -520,8 +520,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
} else if (isa<ConstantPointerNull>(C)) {
// Copy zero (null pointer) to the register.
BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
- } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
- unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
+ } else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
+ unsigned AddrReg = getReg(GV, MBB, IP);
BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
} else {
std::cerr << "Offending constant: " << *C << "\n";
@@ -2771,8 +2771,6 @@ void ISel::emitGEPOperation(MachineBasicBlock *MBB,
Value *Src, User::op_iterator IdxBegin,
User::op_iterator IdxEnd, unsigned TargetReg) {
const TargetData &TD = TM.getTargetData();
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Src))
- Src = CPR->getValue();
std::vector<Value*> GEPOps;
GEPOps.resize(IdxEnd-IdxBegin+1);