llvm.org GIT mirror llvm / d62f1b4
inline GetGlobalValueSymbol into the rest its callers and remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98390 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
16 changed file(s) with 45 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
313313 /// debug tables.
314314 void printDeclare(const MachineInstr *MI) const;
315315
316 /// GetGlobalValueSymbol - Return the MCSymbol for the specified global
317 /// value.
318 MCSymbol *GetGlobalValueSymbol(const GlobalValue *GV) const;
319
320316 /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
321317 /// global value name as its base, with the specified suffix, and where the
322318 /// symbol is forced to have private linkage if ForcePrivate is true.
3737 #include "llvm/MC/MCSectionMachO.h"
3838 #include "llvm/MC/MCStreamer.h"
3939 #include "llvm/MC/MCSymbol.h"
40 #include "llvm/Target/Mangler.h"
4041 #include "llvm/Target/TargetData.h"
4142 #include "llvm/Target/TargetMachine.h"
4243 #include "llvm/Target/TargetOptions.h"
197198 bool isIndirect = Subtarget->isTargetDarwin() &&
198199 Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
199200 if (!isIndirect)
200 O << *GetGlobalValueSymbol(GV);
201 O << *Mang->getSymbol(GV);
201202 else {
202203 // FIXME: Remove this when Darwin transition to @GOT like syntax.
203204 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
210211 MMIMachO.getGVStubEntry(Sym);
211212 if (StubSym.getPointer() == 0)
212213 StubSym = MachineModuleInfoImpl::
213 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
214 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
214215 }
215216 } else {
216217 assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
315316 else if ((Modifier && strcmp(Modifier, "hi16") == 0) ||
316317 (TF & ARMII::MO_HI16))
317318 O << ":upper16:";
318 O << *GetGlobalValueSymbol(GV);
319 O << *Mang->getSymbol(GV);
319320
320321 printOffset(MO.getOffset());
321322
2020 #include "llvm/MC/MCExpr.h"
2121 #include "llvm/MC/MCInst.h"
2222 //#include "llvm/MC/MCStreamer.h"
23 #include "llvm/Target/Mangler.h"
2324 #include "llvm/Support/raw_ostream.h"
2425 #include "llvm/ADT/SmallString.h"
2526 using namespace llvm;
4445 case 0: break;
4546 }
4647
47 return Printer.GetGlobalValueSymbol(MO.getGlobal());
48 return Printer.Mang->getSymbol(MO.getGlobal());
4849 }
4950
5051 MCSymbol *ARMMCInstLower::
2323 #include "llvm/MC/MCStreamer.h"
2424 #include "llvm/MC/MCAsmInfo.h"
2525 #include "llvm/MC/MCSymbol.h"
26 #include "llvm/Target/Mangler.h"
2627 #include "llvm/Target/TargetLoweringObjectFile.h"
2728 #include "llvm/Target/TargetMachine.h"
2829 #include "llvm/Target/TargetRegistry.h"
108109 return;
109110
110111 case MachineOperand::MO_GlobalAddress:
111 O << *GetGlobalValueSymbol(MO.getGlobal());
112 O << *Mang->getSymbol(MO.getGlobal());
112113 return;
113114
114115 case MachineOperand::MO_JumpTableIndex:
2626 #include "llvm/MC/MCAsmInfo.h"
2727 #include "llvm/MC/MCContext.h"
2828 #include "llvm/MC/MCSymbol.h"
29 #include "llvm/Target/Mangler.h"
2930 #include "llvm/Target/TargetData.h"
3031 #include "llvm/Target/TargetLoweringObjectFile.h"
3132 #include "llvm/Target/TargetRegistry.h"
8485 O << *MO.getMBB()->getSymbol(OutContext);
8586 return;
8687 case MachineOperand::MO_GlobalAddress:
87 O << *GetGlobalValueSymbol(MO.getGlobal());
88 O << *Mang->getSymbol(MO.getGlobal());
8889 printOffset(MO.getOffset());
8990 break;
9091 case MachineOperand::MO_ExternalSymbol:
2323 #include "llvm/MC/MCStreamer.h"
2424 #include "llvm/MC/MCAsmInfo.h"
2525 #include "llvm/MC/MCSymbol.h"
26 #include "llvm/Target/Mangler.h"
2627 #include "llvm/Target/TargetLoweringObjectFile.h"
2728 #include "llvm/Target/TargetInstrInfo.h"
2829 #include "llvm/Target/TargetOptions.h"
310311 return;
311312 }
312313 }
313 O << *GetGlobalValueSymbol(MO.getGlobal());
314 O << *Mang->getSymbol(MO.getGlobal());
314315 return;
315316 default:
316317 O << "";
3030 #include "llvm/MC/MCStreamer.h"
3131 #include "llvm/MC/MCAsmInfo.h"
3232 #include "llvm/MC/MCSymbol.h"
33 #include "llvm/Target/Mangler.h"
3334 #include "llvm/Target/TargetData.h"
3435 #include "llvm/Target/TargetLoweringObjectFile.h"
3536 #include "llvm/Target/TargetMachine.h"
239240 return;
240241
241242 case MachineOperand::MO_GlobalAddress:
242 O << *GetGlobalValueSymbol(MO.getGlobal());
243 O << *Mang->getSymbol(MO.getGlobal());
243244 break;
244245
245246 case MachineOperand::MO_ExternalSymbol:
3131 #include "llvm/MC/MCInst.h"
3232 #include "llvm/MC/MCStreamer.h"
3333 #include "llvm/MC/MCSymbol.h"
34 #include "llvm/Target/Mangler.h"
3435 #include "llvm/Target/TargetData.h"
3536 #include "llvm/Target/TargetLoweringObjectFile.h"
3637 #include "llvm/Target/TargetRegistry.h"
108109 if (Offset)
109110 O << '(' << Offset << '+';
110111
111 O << *GetGlobalValueSymbol(MO.getGlobal());
112 O << *Mang->getSymbol(MO.getGlobal());
112113
113114 if (Offset)
114115 O << ')';
1919 #include "llvm/MC/MCContext.h"
2020 #include "llvm/MC/MCExpr.h"
2121 #include "llvm/MC/MCInst.h"
22 #include "llvm/Target/Mangler.h"
2223 #include "llvm/Support/raw_ostream.h"
2324 #include "llvm/Support/ErrorHandling.h"
2425 #include "llvm/ADT/SmallString.h"
3132 case 0: break;
3233 }
3334
34 return Printer.GetGlobalValueSymbol(MO.getGlobal());
35 return Printer.Mang->getSymbol(MO.getGlobal());
3536 }
3637
3738 MCSymbol *MSP430MCInstLower::
3030 #include "llvm/MC/MCStreamer.h"
3131 #include "llvm/MC/MCAsmInfo.h"
3232 #include "llvm/MC/MCSymbol.h"
33 #include "llvm/Target/Mangler.h"
3334 #include "llvm/Target/TargetData.h"
3435 #include "llvm/Target/TargetLoweringObjectFile.h"
3536 #include "llvm/Target/TargetMachine.h"
280281 return;
281282
282283 case MachineOperand::MO_GlobalAddress:
283 O << *GetGlobalValueSymbol(MO.getGlobal());
284 O << *Mang->getSymbol(MO.getGlobal());
284285 break;
285286
286287 case MachineOperand::MO_ExternalSymbol:
2424 #include "llvm/CodeGen/MachineModuleInfo.h"
2525 #include "llvm/MC/MCStreamer.h"
2626 #include "llvm/MC/MCSymbol.h"
27 #include "llvm/Target/Mangler.h"
2728 #include "llvm/Target/TargetRegistry.h"
2829 #include "llvm/Target/TargetLoweringObjectFile.h"
2930 #include "llvm/Support/ErrorHandling.h"
178179 return;
179180
180181 case MachineOperand::MO_GlobalAddress: {
181 MCSymbol *Sym = GetGlobalValueSymbol(MO.getGlobal());
182 MCSymbol *Sym = Mang->getSymbol(MO.getGlobal());
182183 // FIXME: currently we do not have a memcpy def coming in the module
183184 // by any chance, as we do not link in those as .bc lib. So these calls
184185 // are always external and it is safe to emit an extern.
311312 if (!I->isDeclaration() && !I->hasExternalLinkage())
312313 continue;
313314
314 MCSymbol *Sym = GetGlobalValueSymbol(I);
315 MCSymbol *Sym = Mang->getSymbol(I);
315316
316317 // Do not emit memcpy, memset, and memmove here.
317318 // Calls to these routines can be generated in two ways,
341342
342343 O << "\n" << MAI->getCommentString() << "Imported Variables - BEGIN" << "\n";
343344 for (unsigned j = 0; j < Items.size(); j++)
344 O << MAI->getExternDirective() << *GetGlobalValueSymbol(Items[j]) << "\n";
345 O << MAI->getExternDirective() << *Mang->getSymbol(Items[j]) << "\n";
345346 O << MAI->getCommentString() << "Imported Variables - END" << "\n";
346347 }
347348
352353
353354 O << "\n" << MAI->getCommentString() << "Exported Variables - BEGIN" << "\n";
354355 for (unsigned j = 0; j < Items.size(); j++)
355 O << MAI->getGlobalDirective() << *GetGlobalValueSymbol(Items[j]) << "\n";
356 O << MAI->getGlobalDirective() << *Mang->getSymbol(Items[j]) << "\n";
356357 O << MAI->getCommentString() << "Exported Variables - END" << "\n";
357358 }
358359
431432 for (unsigned j = 0; j < Items.size(); j++) {
432433 Constant *C = Items[j]->getInitializer();
433434 int AddrSpace = Items[j]->getType()->getAddressSpace();
434 O << *GetGlobalValueSymbol(Items[j]);
435 O << *Mang->getSymbol(Items[j]);
435436 EmitGlobalConstant(C, AddrSpace);
436437 }
437438 }
450451 Constant *C = Items[j]->getInitializer();
451452 const Type *Ty = C->getType();
452453 unsigned Size = TD->getTypeAllocSize(Ty);
453 O << *GetGlobalValueSymbol(Items[j]) << " RES " << Size << "\n";
454 O << *Mang->getSymbol(Items[j]) << " RES " << Size << "\n";
454455 }
455456 }
456457
202202 MMI->getObjFileInfo().getFnStubEntry(Sym);
203203 if (StubSym.getPointer() == 0)
204204 StubSym = MachineModuleInfoImpl::
205 StubValueTy(GetGlobalValueSymbol(GV),!GV->hasInternalLinkage());
205 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
206206 O << *Sym;
207207 return;
208208 }
302302
303303 void printTOCEntryLabel(const MachineInstr *MI, unsigned OpNo) {
304304 const MachineOperand &MO = MI->getOperand(OpNo);
305
306305 assert(MO.getType() == MachineOperand::MO_GlobalAddress);
307
308 const MCSymbol *Sym = GetGlobalValueSymbol(MO.getGlobal());
306 const MCSymbol *Sym = Mang->getSymbol(MO.getGlobal());
309307
310308 // Map symbol -> label of TOC entry.
311309 const MCSymbol *&TOCEntry = TOC[Sym];
430428 .getGVStubEntry(SymToPrint);
431429 if (StubSym.getPointer() == 0)
432430 StubSym = MachineModuleInfoImpl::
433 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
431 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
434432 } else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
435433 GV->hasAvailableExternallyLinkage()) {
436434 SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
440438 getHiddenGVStubEntry(SymToPrint);
441439 if (StubSym.getPointer() == 0)
442440 StubSym = MachineModuleInfoImpl::
443 StubValueTy(GetGlobalValueSymbol(GV),
444 !GV->hasInternalLinkage());
441 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
445442 } else {
446 SymToPrint = GetGlobalValueSymbol(GV);
443 SymToPrint = Mang->getSymbol(GV);
447444 }
448445 } else {
449 SymToPrint = GetGlobalValueSymbol(GV);
446 SymToPrint = Mang->getSymbol(GV);
450447 }
451448
452449 O << *SymToPrint;
790787 MCSymbol *NLPSym = GetSymbolWithGlobalValueBase(*I, "$non_lazy_ptr");
791788 MachineModuleInfoImpl::StubValueTy &StubSym =
792789 MMIMacho.getGVStubEntry(NLPSym);
793 StubSym = MachineModuleInfoImpl::
794 StubValueTy(GetGlobalValueSymbol(*I), true);
790 StubSym = MachineModuleInfoImpl::StubValueTy(Mang->getSymbol(*I), true);
795791 }
796792 }
797793 }
2020 #include "llvm/MC/MCAsmInfo.h"
2121 #include "llvm/MC/MCStreamer.h"
2222 #include "llvm/MC/MCSymbol.h"
23 #include "llvm/Target/Mangler.h"
2324 #include "llvm/Target/TargetRegistry.h"
2425 #include "llvm/ADT/StringExtras.h"
2526 #include "llvm/Support/FormattedStream.h"
8687 O << *MO.getMBB()->getSymbol(OutContext);
8788 return;
8889 case MachineOperand::MO_GlobalAddress:
89 O << *GetGlobalValueSymbol(MO.getGlobal());
90 O << *Mang->getSymbol(MO.getGlobal());
9091 break;
9192 case MachineOperand::MO_ExternalSymbol:
9293 O << MO.getSymbolName();
2828 #include "llvm/MC/MCStreamer.h"
2929 #include "llvm/MC/MCAsmInfo.h"
3030 #include "llvm/MC/MCSymbol.h"
31 #include "llvm/Target/Mangler.h"
3132 #include "llvm/Target/TargetData.h"
3233 #include "llvm/Target/TargetLoweringObjectFile.h"
3334 #include "llvm/Target/TargetRegistry.h"
9293 return;
9394 case MachineOperand::MO_GlobalAddress: {
9495 const GlobalValue *GV = MO.getGlobal();
95 O << *GetGlobalValueSymbol(GV);
96 O << *Mang->getSymbol(GV);
9697
9798 // Assemble calls via PLT for externally visible symbols if PIC.
9899 if (TM.getRelocationModel() == Reloc::PIC_ &&
157158 printOffset(MO.getOffset());
158159 break;
159160 case MachineOperand::MO_GlobalAddress:
160 O << *GetGlobalValueSymbol(MO.getGlobal());
161 O << *Mang->getSymbol(MO.getGlobal());
161162 break;
162163 case MachineOperand::MO_ExternalSymbol: {
163164 O << *GetExternalSymbolSymbol(MO.getSymbolName());
9696 assert(MO.isGlobal() && "Extern symbol not handled yet");
9797 StubSym =
9898 MachineModuleInfoImpl::
99 StubValueTy(AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()),
99 StubValueTy(AsmPrinter.Mang->getSymbol(MO.getGlobal()),
100100 !MO.getGlobal()->hasInternalLinkage());
101101 }
102102 return Sym;
110110 assert(MO.isGlobal() && "Extern symbol not handled yet");
111111 StubSym =
112112 MachineModuleInfoImpl::
113 StubValueTy(AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()),
113 StubValueTy(AsmPrinter.Mang->getSymbol(MO.getGlobal()),
114114 !MO.getGlobal()->hasInternalLinkage());
115115 }
116116 return Sym;
126126 if (MO.isGlobal()) {
127127 StubSym =
128128 MachineModuleInfoImpl::
129 StubValueTy(AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()),
129 StubValueTy(AsmPrinter.Mang->getSymbol(MO.getGlobal()),
130130 !MO.getGlobal()->hasInternalLinkage());
131131 } else {
132132 Name.erase(Name.end()-5, Name.end());
2929 #include "llvm/CodeGen/MachineJumpTableInfo.h"
3030 #include "llvm/MC/MCStreamer.h"
3131 #include "llvm/MC/MCSymbol.h"
32 #include "llvm/Target/Mangler.h"
3233 #include "llvm/Target/TargetData.h"
3334 #include "llvm/Target/TargetLoweringObjectFile.h"
3435 #include "llvm/Target/TargetRegistry.h"
128129 OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM));
129130
130131
131 MCSymbol *GVSym = GetGlobalValueSymbol(GV);
132 MCSymbol *GVSym = Mang->getSymbol(GV);
132133 Constant *C = GV->getInitializer();
133134 unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
134135
292293 O << *MO.getMBB()->getSymbol(OutContext);
293294 break;
294295 case MachineOperand::MO_GlobalAddress:
295 O << *GetGlobalValueSymbol(MO.getGlobal());
296 O << *Mang->getSymbol(MO.getGlobal());
296297 break;
297298 case MachineOperand::MO_ExternalSymbol:
298299 O << MO.getSymbolName();