diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-12 19:42:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-12 19:42:40 +0000 |
commit | f9b5bd0a49b3f697b130833cd6799b75e2af625d (patch) | |
tree | 358dae643112b22e265461ef3e8b5c01882f622e /lib/Target/X86/AsmPrinter/X86MCInstLower.cpp | |
parent | bced50a70358ed0ecc8e892c41d6d347c3295bce (diff) | |
download | external_llvm-f9b5bd0a49b3f697b130833cd6799b75e2af625d.zip external_llvm-f9b5bd0a49b3f697b130833cd6799b75e2af625d.tar.gz external_llvm-f9b5bd0a49b3f697b130833cd6799b75e2af625d.tar.bz2 |
eliminate the string form of DecorateCygMingName
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98373 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86MCInstLower.cpp')
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86MCInstLower.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index 8eaeeac..8dabaac 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -23,6 +23,7 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/Target/Mangler.h" #include "llvm/Support/FormattedStream.h" #include "llvm/ADT/SmallString.h" @@ -54,7 +55,21 @@ GetSymbolFromOperand(const MachineOperand &MO) const { SmallString<128> Name; - if (MO.isGlobal()) { + if (!MO.isGlobal()) { + assert(MO.isSymbol()); + Name += AsmPrinter.MAI->getGlobalPrefix(); + Name += MO.getSymbolName(); + } else if (getSubtarget().isTargetCygMing() && + isa<Function>(MO.getGlobal())) { + const GlobalValue *GV = MO.getGlobal(); + MCSymbol *Sym = Mang->getSymbol(GV); + X86COFFMachineModuleInfo &COFFMMI = + AsmPrinter.MMI->getObjFileInfo<X86COFFMachineModuleInfo>(); + COFFMMI.DecorateCygMingName(Sym, Ctx, cast<Function>(GV), + *AsmPrinter.TM.getTargetData()); + Name.append(Sym->getName().begin(), Sym->getName().end()); + } else { + const GlobalValue *GV = MO.getGlobal(); bool isImplicitlyPrivate = false; if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB || MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY || @@ -62,18 +77,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const { MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE) isImplicitlyPrivate = true; - const GlobalValue *GV = MO.getGlobal(); Mang->getNameWithPrefix(Name, GV, isImplicitlyPrivate); - - if (getSubtarget().isTargetCygMing()) { - X86COFFMachineModuleInfo &COFFMMI = - AsmPrinter.MMI->getObjFileInfo<X86COFFMachineModuleInfo>(); - COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData()); - } - } else { - assert(MO.isSymbol()); - Name += AsmPrinter.MAI->getGlobalPrefix(); - Name += MO.getSymbolName(); } // If the target flags on the operand changes the name of the symbol, do that |