From e09411dd68534824b0a79749da44589983061d07 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 8 Feb 2014 14:53:28 +0000 Subject: Pass the Mangler by reference. It is never null and it is not used in casts, so there is no reason to use a pointer. This matches how we pass TM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201025 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../llvm/CodeGen/TargetLoweringObjectFileImpl.h | 26 +++++------ include/llvm/Target/TargetLoweringObjectFile.h | 25 ++++++----- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 16 ++++--- lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 2 +- lib/CodeGen/AsmPrinter/DwarfCFIException.cpp | 2 +- lib/CodeGen/AsmPrinter/Win64Exception.cpp | 2 +- lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 50 +++++++++++----------- lib/Target/ARM/ARMAsmPrinter.cpp | 2 +- lib/Target/ARM/ARMTargetObjectFile.cpp | 4 +- lib/Target/ARM/ARMTargetObjectFile.h | 2 +- lib/Target/Hexagon/HexagonTargetObjectFile.cpp | 7 +-- lib/Target/Hexagon/HexagonTargetObjectFile.h | 2 +- lib/Target/Mips/MipsTargetObjectFile.cpp | 2 +- lib/Target/Mips/MipsTargetObjectFile.h | 2 +- lib/Target/NVPTX/NVPTXTargetObjectFile.h | 2 +- lib/Target/PowerPC/PPCTargetObjectFile.cpp | 6 +-- lib/Target/PowerPC/PPCTargetObjectFile.h | 2 +- lib/Target/Sparc/SparcTargetObjectFile.cpp | 6 +-- lib/Target/Sparc/SparcTargetObjectFile.h | 2 +- lib/Target/TargetLoweringObjectFile.cpp | 12 +++--- lib/Target/X86/X86TargetObjectFile.cpp | 12 +++--- lib/Target/X86/X86TargetObjectFile.h | 6 +-- lib/Target/XCore/XCoreAsmPrinter.cpp | 4 +- lib/Target/XCore/XCoreTargetObjectFile.cpp | 4 +- lib/Target/XCore/XCoreTargetObjectFile.h | 4 +- 25 files changed, 103 insertions(+), 101 deletions(-) diff --git a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h index 9660a065a0..c43a0a6c70 100644 --- a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h +++ b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h @@ -46,25 +46,25 @@ public: const MCSection *getSectionForConstant(SectionKind Kind) const LLVM_OVERRIDE; const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; /// Return an MCExpr to use for a reference to the specified type info global /// variable from exception handling information. - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, + const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const LLVM_OVERRIDE; // The symbol that gets passed to .cfi_personality. - MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, + MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const LLVM_OVERRIDE; void InitializeELF(bool UseInitArray_); @@ -87,16 +87,16 @@ public: /// Emit the module flags that specify the garbage collection information. void emitModuleFlags(MCStreamer &Streamer, ArrayRef ModuleFlags, - Mangler *Mang, const TargetMachine &TM) const + Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; @@ -105,18 +105,18 @@ public: /// This hook allows targets to selectively decide not to emit the /// UsedDirective for some symbols in llvm.used. /// FIXME: REMOVE this (rdar://7071300) - bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const + bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const LLVM_OVERRIDE; /// The mach-o version of this method defaults to returning a stub reference. - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, + const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const LLVM_OVERRIDE; // The symbol that gets passed to .cfi_personality. - MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, + MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const LLVM_OVERRIDE; }; @@ -127,12 +127,12 @@ public: virtual ~TargetLoweringObjectFileCOFF() {} const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; @@ -144,7 +144,7 @@ public: /// emission is implemented for COFF. void emitModuleFlags(MCStreamer &Streamer, ArrayRef ModuleFlags, - Mangler *Mang, const TargetMachine &TM) const + Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; }; diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h index 59bb8b436c..c4a3f1cd28 100644 --- a/include/llvm/Target/TargetLoweringObjectFile.h +++ b/include/llvm/Target/TargetLoweringObjectFile.h @@ -64,16 +64,15 @@ public: } /// Emit the module flags that the platform cares about. - virtual void emitModuleFlags(MCStreamer &, - ArrayRef, - Mangler *, const TargetMachine &) const { - } + virtual void emitModuleFlags(MCStreamer &Streamer, + ArrayRef Flags, + Mangler &Mang, const TargetMachine &TM) const {} /// This hook allows targets to selectively decide not to emit the /// UsedDirective for some symbols in llvm.used. /// FIXME: REMOVE this (rdar://7071300) virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, - Mangler *) const { + Mangler &Mang) const { return GV != 0; } @@ -90,14 +89,14 @@ public: /// variable or function definition. This should not be passed external (or /// available externally) globals. const MCSection *SectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const; /// This method computes the appropriate section to emit the specified global /// variable or function definition. This should not be passed external (or /// available externally) globals. const MCSection *SectionForGlobal(const GlobalValue *GV, - Mangler *Mang, + Mangler &Mang, const TargetMachine &TM) const { return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM); } @@ -107,11 +106,11 @@ public: /// assume that GV->hasSection() is true. virtual const MCSection * getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const = 0; + Mangler &Mang, const TargetMachine &TM) const = 0; /// Allow the target to completely override section assignment of a global. virtual const MCSection * - getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang, + getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler &Mang, SectionKind Kind) const { return 0; } @@ -119,7 +118,7 @@ public: /// Return an MCExpr to use for a reference to the specified global variable /// from exception handling information. virtual const MCExpr * - getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, + getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const; @@ -134,7 +133,7 @@ public: // The symbol that gets passed to .cfi_personality. virtual MCSymbol * - getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, + getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const; const MCExpr * @@ -157,14 +156,14 @@ public: virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const; virtual const MCExpr * - getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler *Mang) const { + getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang) const { return 0; } protected: virtual const MCSection * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const; + Mangler &Mang, const TargetMachine &TM) const; }; } // end namespace llvm diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 89da65eb3f..30be6d1fc2 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -372,7 +372,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { // Handle local BSS symbols. if (MAI->hasMachoZeroFillDirective()) { const MCSection *TheSection = - getObjFileLowering().SectionForGlobal(GV, GVKind, Mang, TM); + getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM); // .zerofill __DATA, __bss, _foo, 400, 5 OutStreamer.EmitZerofill(TheSection, GVSym, Size, Align); return; @@ -401,7 +401,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { } const MCSection *TheSection = - getObjFileLowering().SectionForGlobal(GV, GVKind, Mang, TM); + getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM); // Handle the zerofill directive on darwin, which is a special form of BSS // emission. @@ -492,7 +492,8 @@ void AsmPrinter::EmitFunctionHeader() { // Print the 'header' of function. const Function *F = MF->getFunction(); - OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection( + getObjFileLowering().SectionForGlobal(F, *Mang, TM)); EmitVisibility(CurrentFnSym, F->getVisibility()); EmitLinkage(F, CurrentFnSym); @@ -935,7 +936,7 @@ bool AsmPrinter::doFinalization(Module &M) { SmallVector ModuleFlags; M.getModuleFlagsMetadata(ModuleFlags); if (!ModuleFlags.empty()) - getObjFileLowering().emitModuleFlags(OutStreamer, ModuleFlags, Mang, TM); + getObjFileLowering().emitModuleFlags(OutStreamer, ModuleFlags, *Mang, TM); // Make sure we wrote out everything we need. OutStreamer.Flush(); @@ -1155,7 +1156,8 @@ void AsmPrinter::EmitJumpTableInfo() { // FIXME: this isn't the right predicate, should be based on the MCSection // for the function. F->isWeakForLinker()) { - OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F,Mang,TM)); + OutStreamer.SwitchSection( + getObjFileLowering().SectionForGlobal(F, *Mang, TM)); } else { // Otherwise, drop it in the readonly section. const MCSection *ReadOnlySection = @@ -1339,7 +1341,7 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) { for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { const GlobalValue *GV = dyn_cast(InitList->getOperand(i)->stripPointerCasts()); - if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang)) + if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang)) OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip); } } @@ -1544,7 +1546,7 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) { } if (const MCExpr *RelocExpr = - AP.getObjFileLowering().getExecutableRelativeSymbol(CE, AP.Mang)) + AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang)) return RelocExpr; switch (CE->getOpcode()) { diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index 2dfa98cc62..d98fb841e5 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -143,7 +143,7 @@ void AsmPrinter::EmitTTypeReference(const GlobalValue *GV, const TargetLoweringObjectFile &TLOF = getObjFileLowering(); const MCExpr *Exp = - TLOF.getTTypeGlobalReference(GV, Mang, MMI, Encoding, OutStreamer); + TLOF.getTTypeGlobalReference(GV, *Mang, MMI, Encoding, OutStreamer); OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding)); } else OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding)); diff --git a/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp b/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp index 0f41b93f99..ed51f50c40 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp @@ -119,7 +119,7 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) { if (!shouldEmitPersonality) return; - const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI); + const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI); Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding); Asm->OutStreamer.EmitDebugLabel diff --git a/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/lib/CodeGen/AsmPrinter/Win64Exception.cpp index 4844cf65d2..eda444bd69 100644 --- a/lib/CodeGen/AsmPrinter/Win64Exception.cpp +++ b/lib/CodeGen/AsmPrinter/Win64Exception.cpp @@ -101,7 +101,7 @@ void Win64Exception::endFunction(const MachineFunction *) { if (shouldEmitPersonality) { const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()]; - const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI); + const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI); Asm->OutStreamer.PushSection(); Asm->OutStreamer.EmitWin64EHHandlerData(); diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 3621b58287..168bcf27ed 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -45,17 +45,17 @@ using namespace dwarf; MCSymbol * TargetLoweringObjectFileELF::getCFIPersonalitySymbol(const GlobalValue *GV, - Mangler *Mang, + Mangler &Mang, MachineModuleInfo *MMI) const { unsigned Encoding = getPersonalityEncoding(); switch (Encoding & 0x70) { default: report_fatal_error("We do not support this DWARF encoding yet!"); case dwarf::DW_EH_PE_absptr: - return getSymbol(*Mang, GV); + return getSymbol(Mang, GV); case dwarf::DW_EH_PE_pcrel: { return getContext().GetOrCreateSymbol(StringRef("DW.ref.") + - getSymbol(*Mang, GV)->getName()); + getSymbol(Mang, GV)->getName()); } } } @@ -88,20 +88,20 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer, } const MCExpr *TargetLoweringObjectFileELF:: -getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, +getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { if (Encoding & dwarf::DW_EH_PE_indirect) { MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo(); - MCSymbol *SSym = getSymbolWithGlobalValueBase(*Mang, GV, ".DW.stub"); + MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, ".DW.stub"); // Add information about the stub reference to ELFMMI so that the stub // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -199,7 +199,7 @@ getELFSectionFlags(SectionKind K) { const MCSection *TargetLoweringObjectFileELF:: getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { StringRef SectionName = GV->getSection(); // Infer section flags from the section name if we can. @@ -232,7 +232,7 @@ static const char *getSectionPrefixForGlobal(SectionKind Kind) { const MCSection *TargetLoweringObjectFileELF:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { // If we have -ffunction-section or -fdata-section then we should emit the // global value to a uniqued section specifically for it. bool EmitUniquedSection; @@ -249,7 +249,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Prefix = getSectionPrefixForGlobal(Kind); SmallString<128> Name(Prefix, Prefix+strlen(Prefix)); - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); Name.append(Sym->getName().begin(), Sym->getName().end()); StringRef Group = ""; unsigned Flags = getELFSectionFlags(Kind); @@ -416,7 +416,7 @@ getDepLibFromLinkerOpt(StringRef LinkerOption) const { void TargetLoweringObjectFileMachO:: emitModuleFlags(MCStreamer &Streamer, ArrayRef ModuleFlags, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { unsigned VersionVal = 0; unsigned ImageInfoFlags = 0; MDNode *LinkerOptions = 0; @@ -490,7 +490,7 @@ emitModuleFlags(MCStreamer &Streamer, const MCSection *TargetLoweringObjectFileMachO:: getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { // Parse the section specifier and create it if valid. StringRef Segment, Section; unsigned TAA = 0, StubSize = 0; @@ -529,7 +529,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, const MCSection *TargetLoweringObjectFileMachO:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { // Handle thread local data. if (Kind.isThreadBSS()) return TLSBSSSection; @@ -611,7 +611,7 @@ TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const { /// not to emit the UsedDirective for some symbols in llvm.used. // FIXME: REMOVE this (rdar://7071300) bool TargetLoweringObjectFileMachO:: -shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const { +shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const { /// On Darwin, internally linked data beginning with "L" or "l" does not have /// the directive emitted (this occurs in ObjC metadata). if (!GV) return false; @@ -621,7 +621,7 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const { // FIXME: ObjC metadata is currently emitted as internal symbols that have // \1L and \0l prefixes on them. Fix them to be Private/LinkerPrivate and // this horrible hack can go away. - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l') return false; } @@ -630,7 +630,7 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const { } const MCExpr *TargetLoweringObjectFileMachO:: -getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, +getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { // The mach-o version of this method defaults to returning a stub reference. @@ -639,7 +639,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfoMachO &MachOMMI = MMI->getObjFileInfo(); - MCSymbol *SSym = getSymbolWithGlobalValueBase(*Mang, GV, "$non_lazy_ptr"); + MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, "$non_lazy_ptr"); // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. @@ -647,7 +647,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) : MachOMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -661,19 +661,19 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, } MCSymbol *TargetLoweringObjectFileMachO:: -getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, +getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const { // The mach-o version of this method defaults to returning a stub reference. MachineModuleInfoMachO &MachOMMI = MMI->getObjFileInfo(); - MCSymbol *SSym = getSymbolWithGlobalValueBase(*Mang, GV, "$non_lazy_ptr"); + MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, "$non_lazy_ptr"); // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } @@ -721,7 +721,7 @@ getCOFFSectionFlags(SectionKind K) { const MCSection *TargetLoweringObjectFileCOFF:: getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { int Selection = 0; unsigned Characteristics = getCOFFSectionFlags(Kind); StringRef Name = GV->getSection(); @@ -729,7 +729,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, if (GV->isWeakForLinker()) { Selection = COFF::IMAGE_COMDAT_SELECT_ANY; Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT; - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); COMDATSymName = Sym->getName(); } return getContext().getCOFFSection(Name, @@ -754,7 +754,7 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) { const MCSection *TargetLoweringObjectFileCOFF:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { // If this global is linkonce/weak and the target handles this by emitting it // into a 'uniqued' section name, create and return the section now. @@ -763,7 +763,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, unsigned Characteristics = getCOFFSectionFlags(Kind); Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT; - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); return getContext().getCOFFSection(Name, Characteristics, Kind, Sym->getName(), COFF::IMAGE_COMDAT_SELECT_ANY); @@ -795,7 +795,7 @@ getDepLibFromLinkerOpt(StringRef LinkerOption) const { void TargetLoweringObjectFileCOFF:: emitModuleFlags(MCStreamer &Streamer, ArrayRef ModuleFlags, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { MDNode *LinkerOptions = 0; // Look for the "Linker Options" flag, since it's the only one we support. diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index 68820f4332..5a81a73ff6 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -474,7 +474,7 @@ void ARMAsmPrinter::EmitStartOfAsmFile(Module &M) { // Now any user defined text sections from function attributes. for (Module::iterator F = M.begin(), e = M.end(); F != e; ++F) if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage()) - TextSections.insert(TLOFMacho.SectionForGlobal(F, Mang, TM)); + TextSections.insert(TLOFMacho.SectionForGlobal(F, *Mang, TM)); // Now the coalescable sections. TextSections.insert(TLOFMacho.getTextCoalSection()); TextSections.insert(TLOFMacho.getConstTextCoalSection()); diff --git a/lib/Target/ARM/ARMTargetObjectFile.cpp b/lib/Target/ARM/ARMTargetObjectFile.cpp index e6b8cce091..9ada6a8c20 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.cpp +++ b/lib/Target/ARM/ARMTargetObjectFile.cpp @@ -42,12 +42,12 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx, } const MCExpr *ARMElfTargetObjectFile:: -getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, +getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only"); - return MCSymbolRefExpr::Create(getSymbol(*Mang, GV), + return MCSymbolRefExpr::Create(getSymbol(Mang, GV), MCSymbolRefExpr::VK_ARM_TARGET2, getContext()); } diff --git a/lib/Target/ARM/ARMTargetObjectFile.h b/lib/Target/ARM/ARMTargetObjectFile.h index b3460c491b..9ee1324e68 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.h +++ b/lib/Target/ARM/ARMTargetObjectFile.h @@ -28,7 +28,7 @@ public: void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE; - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, + const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const diff --git a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp index 7773cff2d2..c97526eed2 100644 --- a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp +++ b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp @@ -85,9 +85,10 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM, return false; } -const MCSection *HexagonTargetObjectFile:: -SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { +const MCSection * +HexagonTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, Mangler &Mang, + const TargetMachine &TM) const { // Handle Small Section classification here. if (Kind.isBSS() && IsGlobalInSmallSection(GV, TM, Kind)) diff --git a/lib/Target/Hexagon/HexagonTargetObjectFile.h b/lib/Target/Hexagon/HexagonTargetObjectFile.h index 73fa47975b..fdc24a6b20 100644 --- a/lib/Target/Hexagon/HexagonTargetObjectFile.h +++ b/lib/Target/Hexagon/HexagonTargetObjectFile.h @@ -31,7 +31,7 @@ namespace llvm { bool IsSmallDataEnabled () const; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; }; diff --git a/lib/Target/Mips/MipsTargetObjectFile.cpp b/lib/Target/Mips/MipsTargetObjectFile.cpp index a476c5c324..13f9408f4e 100644 --- a/lib/Target/Mips/MipsTargetObjectFile.cpp +++ b/lib/Target/Mips/MipsTargetObjectFile.cpp @@ -88,7 +88,7 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM, const MCSection *MipsTargetObjectFile:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { // TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*" // sections? diff --git a/lib/Target/Mips/MipsTargetObjectFile.h b/lib/Target/Mips/MipsTargetObjectFile.h index 11d70db5ba..d61e8fd038 100644 --- a/lib/Target/Mips/MipsTargetObjectFile.h +++ b/lib/Target/Mips/MipsTargetObjectFile.h @@ -30,7 +30,7 @@ namespace llvm { const TargetMachine &TM) const; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; }; diff --git a/lib/Target/NVPTX/NVPTXTargetObjectFile.h b/lib/Target/NVPTX/NVPTXTargetObjectFile.h index 31a3c1bd95..4872fc484f 100644 --- a/lib/Target/NVPTX/NVPTXTargetObjectFile.h +++ b/lib/Target/NVPTX/NVPTXTargetObjectFile.h @@ -92,7 +92,7 @@ public: } const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE { return DataSection; diff --git a/lib/Target/PowerPC/PPCTargetObjectFile.cpp b/lib/Target/PowerPC/PPCTargetObjectFile.cpp index 32678674f9..2e8605c15e 100644 --- a/lib/Target/PowerPC/PPCTargetObjectFile.cpp +++ b/lib/Target/PowerPC/PPCTargetObjectFile.cpp @@ -22,9 +22,9 @@ Initialize(MCContext &Ctx, const TargetMachine &TM) { InitializeELF(TM.Options.UseInitArray); } -const MCSection * PPC64LinuxTargetObjectFile:: -SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { +const MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal( + const GlobalValue *GV, SectionKind Kind, Mangler &Mang, + const TargetMachine &TM) const { const MCSection *DefaultSection = TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM); diff --git a/lib/Target/PowerPC/PPCTargetObjectFile.h b/lib/Target/PowerPC/PPCTargetObjectFile.h index 8042a790f7..475ebd8a71 100644 --- a/lib/Target/PowerPC/PPCTargetObjectFile.h +++ b/lib/Target/PowerPC/PPCTargetObjectFile.h @@ -23,7 +23,7 @@ namespace llvm { void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; diff --git a/lib/Target/Sparc/SparcTargetObjectFile.cpp b/lib/Target/Sparc/SparcTargetObjectFile.cpp index 4913ea75fd..f7cefd0b63 100644 --- a/lib/Target/Sparc/SparcTargetObjectFile.cpp +++ b/lib/Target/Sparc/SparcTargetObjectFile.cpp @@ -16,20 +16,20 @@ using namespace llvm; const MCExpr *SparcELFTargetObjectFile:: -getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, +getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { if (Encoding & dwarf::DW_EH_PE_pcrel) { MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo(); - MCSymbol *SSym = getSymbolWithGlobalValueBase(*Mang, GV, ".DW.stub"); + MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, ".DW.stub"); // Add information about the stub reference to ELFMMI so that the stub // gets emitted by the asmprinter. MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { - MCSymbol *Sym = getSymbol(*Mang, GV); + MCSymbol *Sym = getSymbol(Mang, GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); } diff --git a/lib/Target/Sparc/SparcTargetObjectFile.h b/lib/Target/Sparc/SparcTargetObjectFile.h index 5884e5d97a..fb97bdac8e 100644 --- a/lib/Target/Sparc/SparcTargetObjectFile.h +++ b/lib/Target/Sparc/SparcTargetObjectFile.h @@ -23,7 +23,7 @@ public: TargetLoweringObjectFileELF() {} - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, + const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index b62577e080..8c98dd87b6 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -120,9 +120,9 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase( } MCSymbol *TargetLoweringObjectFile:: -getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, +getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const { - return getSymbol(*Mang, GV); + return getSymbol(Mang, GV); } void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer, @@ -264,7 +264,7 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV, /// the specified global variable or function definition. This should not /// be passed external (or available externally) globals. const MCSection *TargetLoweringObjectFile:: -SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang, +SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const { // Select section name. if (GV->hasSection()) @@ -280,7 +280,7 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang, const MCSection * TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, + Mangler &Mang, const TargetMachine &TM) const{ assert(!Kind.isThreadLocal() && "Doesn't support TLS"); @@ -311,11 +311,11 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const { /// reference to the specified global variable from exception /// handling information. const MCExpr *TargetLoweringObjectFile:: -getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, +getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { const MCSymbolRefExpr *Ref = - MCSymbolRefExpr::Create(getSymbol(*Mang, GV), getContext()); + MCSymbolRefExpr::Create(getSymbol(Mang, GV), getContext()); return getTTypeReference(Ref, Encoding, Streamer); } diff --git a/lib/Target/X86/X86TargetObjectFile.cpp b/lib/Target/X86/X86TargetObjectFile.cpp index bc1064e17f..bf28495c80 100644 --- a/lib/Target/X86/X86TargetObjectFile.cpp +++ b/lib/Target/X86/X86TargetObjectFile.cpp @@ -19,14 +19,14 @@ using namespace llvm; using namespace dwarf; const MCExpr *X86_64MachoTargetObjectFile:: -getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, +getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which // is an indirect pc-relative reference. if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) { - const MCSymbol *Sym = getSymbol(*Mang, GV); + const MCSymbol *Sym = getSymbol(Mang, GV); const MCExpr *Res = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext()); const MCExpr *Four = MCConstantExpr::Create(4, getContext()); @@ -38,9 +38,9 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, } MCSymbol *X86_64MachoTargetObjectFile:: -getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, +getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const { - return getSymbol(*Mang, GV); + return getSymbol(Mang, GV); } void @@ -57,7 +57,7 @@ X86LinuxTargetObjectFile::getDebugThreadLocalSymbol( const MCExpr * X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE, - Mangler *Mang) const { + Mangler &Mang) const { // We are looking for the difference of two symbols, need a subtraction // operation. const SubOperator *Sub = dyn_cast(CE); @@ -103,5 +103,5 @@ X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE, return 0; return MCSymbolRefExpr::Create( - getSymbol(*Mang, GVLHS), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext()); + getSymbol(Mang, GVLHS), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext()); } diff --git a/lib/Target/X86/X86TargetObjectFile.h b/lib/Target/X86/X86TargetObjectFile.h index 77046e2b42..6220b9acf9 100644 --- a/lib/Target/X86/X86TargetObjectFile.h +++ b/lib/Target/X86/X86TargetObjectFile.h @@ -20,7 +20,7 @@ namespace llvm { /// x86-64. class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO { public: - const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, + const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const @@ -28,7 +28,7 @@ namespace llvm { // getCFIPersonalitySymbol - The symbol that gets passed to // .cfi_personality. - MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, + MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, MachineModuleInfo *MMI) const LLVM_OVERRIDE; }; @@ -46,7 +46,7 @@ namespace llvm { /// \brief This implementation is used for Windows targets on x86 and x86-64. class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF { const MCExpr *getExecutableRelativeSymbol(const ConstantExpr *CE, - Mangler *Mang) const + Mangler &Mang) const LLVM_OVERRIDE; }; diff --git a/lib/Target/XCore/XCoreAsmPrinter.cpp b/lib/Target/XCore/XCoreAsmPrinter.cpp index fe030fa4c2..1edd33c5f0 100644 --- a/lib/Target/XCore/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/XCoreAsmPrinter.cpp @@ -113,9 +113,9 @@ void XCoreAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { return; const DataLayout *TD = TM.getDataLayout(); - OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM)); + OutStreamer.SwitchSection( + getObjFileLowering().SectionForGlobal(GV, *Mang, TM)); - MCSymbol *GVSym = getSymbol(GV); const Constant *C = GV->getInitializer(); unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType()); diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp index 61eb2b51f3..cf565e7a1e 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.cpp +++ b/lib/Target/XCore/XCoreTargetObjectFile.cpp @@ -120,7 +120,7 @@ static unsigned getXCoreSectionFlags(SectionKind K) { const MCSection *XCoreTargetObjectFile:: getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { + Mangler &Mang, const TargetMachine &TM) const { StringRef SectionName = GV->getSection(); // Infer section flags from the section name if we can. Kind = getXCoreKindForNamedSection(SectionName, Kind); @@ -129,7 +129,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, } const MCSection *XCoreTargetObjectFile:: -SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang, +SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const{ if (Kind.isText()) return TextSection; if (Kind.isMergeable1ByteCString()) return CStringSection; diff --git a/lib/Target/XCore/XCoreTargetObjectFile.h b/lib/Target/XCore/XCoreTargetObjectFile.h index fee84256b8..47d7fad8ee 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.h +++ b/lib/Target/XCore/XCoreTargetObjectFile.h @@ -24,12 +24,12 @@ static const unsigned CodeModelLargeSize = 256; void Initialize(MCContext &Ctx, const TargetMachine &TM); const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; const MCSection *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler *Mang, + SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const LLVM_OVERRIDE; -- cgit v1.2.3