mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
CPR Fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14961 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7330248482
commit
67910e1eb0
@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
|
|||||||
O << CI->getValue();
|
O << CI->getValue();
|
||||||
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
||||||
O << CI->getValue();
|
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
|
// This is a constant address for a global variable or function. Use the
|
||||||
// name of the variable or function as the address value.
|
// 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)) {
|
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
switch(CE->getOpcode()) {
|
switch(CE->getOpcode()) {
|
||||||
|
@ -520,8 +520,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
|
|||||||
} else if (isa<ConstantPointerNull>(C)) {
|
} else if (isa<ConstantPointerNull>(C)) {
|
||||||
// Copy zero (null pointer) to the register.
|
// Copy zero (null pointer) to the register.
|
||||||
BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
|
BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
|
||||||
} else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
|
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
|
||||||
unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
|
unsigned AddrReg = getReg(GV, MBB, IP);
|
||||||
BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
|
BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Offending constant: " << *C << "\n";
|
std::cerr << "Offending constant: " << *C << "\n";
|
||||||
@ -2771,8 +2771,6 @@ void ISel::emitGEPOperation(MachineBasicBlock *MBB,
|
|||||||
Value *Src, User::op_iterator IdxBegin,
|
Value *Src, User::op_iterator IdxBegin,
|
||||||
User::op_iterator IdxEnd, unsigned TargetReg) {
|
User::op_iterator IdxEnd, unsigned TargetReg) {
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Src))
|
|
||||||
Src = CPR->getValue();
|
|
||||||
|
|
||||||
std::vector<Value*> GEPOps;
|
std::vector<Value*> GEPOps;
|
||||||
GEPOps.resize(IdxEnd-IdxBegin+1);
|
GEPOps.resize(IdxEnd-IdxBegin+1);
|
||||||
|
@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
|
|||||||
O << CI->getValue();
|
O << CI->getValue();
|
||||||
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
||||||
O << CI->getValue();
|
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
|
// This is a constant address for a global variable or function. Use the
|
||||||
// name of the variable or function as the address value.
|
// 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)) {
|
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
switch(CE->getOpcode()) {
|
switch(CE->getOpcode()) {
|
||||||
|
@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
|
|||||||
O << CI->getValue();
|
O << CI->getValue();
|
||||||
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
||||||
O << CI->getValue();
|
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
|
// This is a constant address for a global variable or function. Use the
|
||||||
// name of the variable or function as the address value.
|
// 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)) {
|
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
switch(CE->getOpcode()) {
|
switch(CE->getOpcode()) {
|
||||||
|
@ -520,8 +520,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
|
|||||||
} else if (isa<ConstantPointerNull>(C)) {
|
} else if (isa<ConstantPointerNull>(C)) {
|
||||||
// Copy zero (null pointer) to the register.
|
// Copy zero (null pointer) to the register.
|
||||||
BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
|
BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
|
||||||
} else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
|
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
|
||||||
unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
|
unsigned AddrReg = getReg(GV, MBB, IP);
|
||||||
BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
|
BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Offending constant: " << *C << "\n";
|
std::cerr << "Offending constant: " << *C << "\n";
|
||||||
@ -2771,8 +2771,6 @@ void ISel::emitGEPOperation(MachineBasicBlock *MBB,
|
|||||||
Value *Src, User::op_iterator IdxBegin,
|
Value *Src, User::op_iterator IdxBegin,
|
||||||
User::op_iterator IdxEnd, unsigned TargetReg) {
|
User::op_iterator IdxEnd, unsigned TargetReg) {
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Src))
|
|
||||||
Src = CPR->getValue();
|
|
||||||
|
|
||||||
std::vector<Value*> GEPOps;
|
std::vector<Value*> GEPOps;
|
||||||
GEPOps.resize(IdxEnd-IdxBegin+1);
|
GEPOps.resize(IdxEnd-IdxBegin+1);
|
||||||
|
Loading…
Reference in New Issue
Block a user