From 0b45c9957fb7ad47e653fb43d455f6727170dad0 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Sat, 8 Nov 2008 23:05:05 +0000 Subject: [PATCH] Temporary revert my last commit: it seems it's triggering some subtle bug in backend and breaks llvm-gcc git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58926 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/AsmPrinter.h | 3 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 7 ------- lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 11 +++++++---- lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 5 ++++- lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 12 ++++++++++-- lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp | 12 ++++++++++-- 6 files changed, 31 insertions(+), 19 deletions(-) diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 3b79b11f9d9..d3850a5fb36 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -362,9 +362,6 @@ namespace llvm { /// this is suported by the target. void printVisibility(const std::string& Name, unsigned Visibility) const; - /// printOffset - This is just convenient handler for printing offsets. - void printOffset(int64_t Offset) const; - private: const GlobalValue *findGlobalValue(const Constant* CV); void EmitLLVMUsedList(Constant *List); diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index c75957a6778..01854415090 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1520,13 +1520,6 @@ void AsmPrinter::printVisibility(const std::string& Name, } } -void AsmPrinter::printOffset(int64_t Offset) const { - if (Offset > 0) - O << '+' << Offset; - else if (Offset < 0) - O << Offset; -} - GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) { if (!S->usesMetadata()) return 0; diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index ae6c3544bb9..36cd98eb927 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -300,9 +300,12 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int opNum, FnStubs.insert(Name); } else O << Name; - - printOffset(MO.getOffset()); - + + if (MO.getOffset() > 0) + O << '+' << MO.getOffset(); + else if (MO.getOffset() < 0) + O << MO.getOffset(); + if (isCallOp && Subtarget->isTargetELF() && TM.getRelocationModel() == Reloc::PIC_) O << "(PLT)"; @@ -342,7 +345,7 @@ static void printSOImm(raw_ostream &O, int64_t V, const TargetAsmInfo *TAI) { assert(V < (1 << 12) && "Not a valid so_imm value!"); unsigned Imm = ARM_AM::getSOImmValImm(V); unsigned Rot = ARM_AM::getSOImmValRot(V); - + // Print low-level immediate formation info, per // A5.1.3: "Data-processing operands - Immediate". if (Rot) { diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 280003a776a..6c17dbece07 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -398,7 +398,10 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { } O << Name; - printOffset(MO.getOffset()); + if (MO.getOffset() > 0) + O << "+" << MO.getOffset(); + else if (MO.getOffset() < 0) + O << MO.getOffset(); if (GV->hasExternalWeakLinkage()) ExtWeakSymbols.insert(GV); diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 66319c39816..556757aaabf 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -344,7 +344,11 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, O << "@GOTOFF"; } - printOffset(MO.getOffset()); + int Offset = MO.getOffset(); + if (Offset > 0) + O << '+' << Offset; + else if (Offset < 0) + O << Offset; if (isMemOp && Subtarget->isPICStyleRIPRel() && !NotRIPRel) O << "(%rip)"; @@ -425,7 +429,11 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, if (GV->hasExternalWeakLinkage()) ExtWeakSymbols.insert(GV); - printOffset(MO.getOffset()); + int Offset = MO.getOffset(); + if (Offset > 0) + O << '+' << Offset; + else if (Offset < 0) + O << Offset; if (isThreadLocal) { if (TM.getRelocationModel() == Reloc::PIC_ || Subtarget->is64Bit()) diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp index 1d4a695bfc9..4868906a041 100644 --- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp @@ -235,7 +235,11 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO, if (!isMemOp) O << "OFFSET "; O << "[" << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_" << MO.getIndex(); - printOffset(MO.getOffset()); + int Offset = MO.getOffset(); + if (Offset > 0) + O << " + " << Offset; + else if (Offset < 0) + O << Offset; O << "]"; return; } @@ -254,7 +258,11 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO, O << "__imp_"; } O << Name; - printOffset(MO.getOffset()); + int Offset = MO.getOffset(); + if (Offset > 0) + O << " + " << Offset; + else if (Offset < 0) + O << Offset; return; } case MachineOperand::MO_ExternalSymbol: { -- 2.34.1