mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
Fixed ConstantPoolIndex operand asm print bug. This fixed 2005-07-17-INT-To-FP
and 2005-05-12-Int64ToFP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a3f332bdc3
commit
a09bd8190c
@ -115,6 +115,20 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
std::cerr << "Shouldn't use addPCDisp() when building X86 MachineInstrs";
|
std::cerr << "Shouldn't use addPCDisp() when building X86 MachineInstrs";
|
||||||
abort ();
|
abort ();
|
||||||
return;
|
return;
|
||||||
|
case MachineOperand::MO_ConstantPoolIndex: {
|
||||||
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
|
if (!isMemOp) O << '$';
|
||||||
|
O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
|
||||||
|
<< MO.getConstantPoolIndex();
|
||||||
|
if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
|
||||||
|
O << "-\"L" << getFunctionNumber() << "$pb\"";
|
||||||
|
int Offset = MO.getOffset();
|
||||||
|
if (Offset > 0)
|
||||||
|
O << "+" << Offset;
|
||||||
|
else if (Offset < 0)
|
||||||
|
O << Offset;
|
||||||
|
return;
|
||||||
|
}
|
||||||
case MachineOperand::MO_GlobalAddress: {
|
case MachineOperand::MO_GlobalAddress: {
|
||||||
bool isCallOp = Modifier && !strcmp(Modifier, "call");
|
bool isCallOp = Modifier && !strcmp(Modifier, "call");
|
||||||
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
@ -198,16 +212,8 @@ void X86ATTAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DispSpec.isGlobalAddress()) {
|
if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex()) {
|
||||||
printOperand(MI, Op+3, "mem");
|
printOperand(MI, Op+3, "mem");
|
||||||
} else if (DispSpec.isConstantPoolIndex()) {
|
|
||||||
O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
|
|
||||||
<< DispSpec.getConstantPoolIndex();
|
|
||||||
if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
|
|
||||||
O << "-\"L" << getFunctionNumber() << "$pb\"";
|
|
||||||
if (DispSpec.getOffset())
|
|
||||||
O << "+" << DispSpec.getOffset();
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
int DispVal = DispSpec.getImmedValue();
|
int DispVal = DispSpec.getImmedValue();
|
||||||
if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg()))
|
if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg()))
|
||||||
|
@ -109,6 +109,21 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
|
|||||||
assert(0 && "Shouldn't use addPCDisp() when building X86 MachineInstrs");
|
assert(0 && "Shouldn't use addPCDisp() when building X86 MachineInstrs");
|
||||||
abort ();
|
abort ();
|
||||||
return;
|
return;
|
||||||
|
case MachineOperand::MO_ConstantPoolIndex: {
|
||||||
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
|
if (!isMemOp) O << "OFFSET ";
|
||||||
|
O << "[" << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
|
||||||
|
<< MO.getConstantPoolIndex();
|
||||||
|
if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
|
||||||
|
O << "-\"L" << getFunctionNumber() << "$pb\"";
|
||||||
|
int Offset = MO.getOffset();
|
||||||
|
if (Offset > 0)
|
||||||
|
O << " + " << Offset;
|
||||||
|
else if (Offset < 0)
|
||||||
|
O << Offset;
|
||||||
|
O << "]";
|
||||||
|
return;
|
||||||
|
}
|
||||||
case MachineOperand::MO_GlobalAddress: {
|
case MachineOperand::MO_GlobalAddress: {
|
||||||
bool isCallOp = Modifier && !strcmp(Modifier, "call");
|
bool isCallOp = Modifier && !strcmp(Modifier, "call");
|
||||||
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
@ -192,19 +207,10 @@ void X86IntelAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){
|
|||||||
NeedPlus = true;
|
NeedPlus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DispSpec.isGlobalAddress()) {
|
if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex()) {
|
||||||
if (NeedPlus)
|
if (NeedPlus)
|
||||||
O << " + ";
|
O << " + ";
|
||||||
printOp(DispSpec, "mem");
|
printOp(DispSpec, "mem");
|
||||||
} else if (DispSpec.isConstantPoolIndex()) {
|
|
||||||
O << "[" << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
|
|
||||||
<< DispSpec.getConstantPoolIndex();
|
|
||||||
if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
|
|
||||||
O << "-\"L" << getFunctionNumber() << "$pb\"";
|
|
||||||
if (DispSpec.getOffset())
|
|
||||||
O << " + " << DispSpec.getOffset();
|
|
||||||
O << "]";
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
int DispVal = DispSpec.getImmedValue();
|
int DispVal = DispSpec.getImmedValue();
|
||||||
if (DispVal || (!BaseReg.getReg() && !IndexReg.getReg())) {
|
if (DispVal || (!BaseReg.getReg() && !IndexReg.getReg())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user