diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-15 23:55:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-15 23:55:16 +0000 |
commit | d1947ed2f824d2e9f4923fb6efc2aec4a6e3e96d (patch) | |
tree | 5ce784b9179fd0aed2a0104f7fccdc0072b37eb6 /lib/Target/Blackfin/AsmPrinter | |
parent | 263d989a719c1864862fc91f59193a6c2b55ca48 (diff) | |
download | external_llvm-d1947ed2f824d2e9f4923fb6efc2aec4a6e3e96d.zip external_llvm-d1947ed2f824d2e9f4923fb6efc2aec4a6e3e96d.tar.gz external_llvm-d1947ed2f824d2e9f4923fb6efc2aec4a6e3e96d.tar.bz2 |
supplement CurrentFnName with CurrentFnSym, which will eventually
replace it. Upgrade Alpha, Blackfin, and part of CellSPU to not
use mangler anymore. CellSPU needs more invasive surgery.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Blackfin/AsmPrinter')
-rw-r--r-- | lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp index 09f8b02..7fdf1e7 100644 --- a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp +++ b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp @@ -30,7 +30,6 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" -#include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/ErrorHandling.h" @@ -55,7 +54,7 @@ namespace { void printInstruction(const MachineInstr *MI); // autogenerated. static const char *getRegisterName(unsigned RegNo); - void emitLinkage(const std::string &n, GlobalValue::LinkageTypes l); + void emitLinkage(const MCSymbol *GVSym, GlobalValue::LinkageTypes l); bool runOnMachineFunction(MachineFunction &F); bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); @@ -71,23 +70,29 @@ extern "C" void LLVMInitializeBlackfinAsmPrinter() { RegisterAsmPrinter<BlackfinAsmPrinter> X(TheBlackfinTarget); } -void BlackfinAsmPrinter::emitLinkage(const std::string &name, - GlobalValue::LinkageTypes l) { - switch (l) { +void BlackfinAsmPrinter::emitLinkage(const MCSymbol *GVSym, + GlobalValue::LinkageTypes L) { + switch (L) { default: llvm_unreachable("Unknown linkage type!"); case GlobalValue::InternalLinkage: // Symbols default to internal. case GlobalValue::PrivateLinkage: case GlobalValue::LinkerPrivateLinkage: break; case GlobalValue::ExternalLinkage: - O << MAI->getGlobalDirective() << name << "\n"; + O << MAI->getGlobalDirective(); + GVSym->print(O, MAI); + O << "\n"; break; case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceODRLinkage: case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakODRLinkage: - O << MAI->getGlobalDirective() << name << "\n"; - O << MAI->getWeakDefDirective() << name << "\n"; + O << MAI->getGlobalDirective(); + GVSym->print(O, MAI); + O << "\n"; + O << MAI->getWeakDefDirective(); + GVSym->print(O, MAI); + O << "\n"; break; } } @@ -98,18 +103,24 @@ void BlackfinAsmPrinter::PrintGlobalVariable(const GlobalVariable* GV) { if (!GV->hasInitializer() || EmitSpecialLLVMGlobal(GV)) return; - std::string name = Mang->getMangledName(GV); + MCSymbol *GVSym = GetGlobalValueSymbol(GV); Constant *C = GV->getInitializer(); OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM)); - emitLinkage(name, GV->getLinkage()); + emitLinkage(GVSym, GV->getLinkage()); EmitAlignment(TD->getPreferredAlignmentLog(GV), GV); - printVisibility(name, GV->getVisibility()); - - O << "\t.type " << name << ", STT_OBJECT\n"; - O << "\t.size " << name << ',' << TD->getTypeAllocSize(C->getType()) << '\n'; - O << name << ":\n"; + printVisibility(GVSym, GV->getVisibility()); + + O << "\t.type "; + GVSym->print(O, MAI); + O << ", STT_OBJECT\n"; + O << "\t.size "; + GVSym->print(O, MAI); + O << "\n"; + O << ',' << TD->getTypeAllocSize(C->getType()) << '\n'; + GVSym->print(O, MAI); + O << ":\n"; EmitGlobalConstant(C); } @@ -124,11 +135,14 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { const Function *F = MF.getFunction(); OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(2, F); - emitLinkage(CurrentFnName, F->getLinkage()); - printVisibility(CurrentFnName, F->getVisibility()); + emitLinkage(CurrentFnSym, F->getLinkage()); + printVisibility(CurrentFnSym, F->getVisibility()); - O << "\t.type\t" << CurrentFnName << ", STT_FUNC\n" - << CurrentFnName << ":\n"; + O << "\t.type\t"; + CurrentFnSym->print(O, MAI); + O << ", STT_FUNC\n"; + CurrentFnSym->print(O, MAI); + O << ":\n"; if (DW) DW->BeginFunction(&MF); @@ -154,7 +168,11 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { } } - O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; + O << "\t.size "; + CurrentFnSym->print(O, MAI); + O << ", .-"; + CurrentFnSym->print(O, MAI); + O << "\n"; if (DW) DW->EndFunction(&MF); @@ -178,7 +196,7 @@ void BlackfinAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI); return; case MachineOperand::MO_GlobalAddress: - O << Mang->getMangledName(MO.getGlobal()); + GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI); printOffset(MO.getOffset()); break; case MachineOperand::MO_ExternalSymbol: |