mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-24 12:55:45 +00:00
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. llvm-svn: 201025
This commit is contained in:
parent
1d50d1310d
commit
8d47aa1e4e
@ -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<Module::ModuleFlagEntry> 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<Module::ModuleFlagEntry> ModuleFlags,
|
||||
Mangler *Mang, const TargetMachine &TM) const
|
||||
Mangler &Mang, const TargetMachine &TM) const
|
||||
LLVM_OVERRIDE;
|
||||
};
|
||||
|
||||
|
@ -64,16 +64,15 @@ public:
|
||||
}
|
||||
|
||||
/// Emit the module flags that the platform cares about.
|
||||
virtual void emitModuleFlags(MCStreamer &,
|
||||
ArrayRef<Module::ModuleFlagEntry>,
|
||||
Mangler *, const TargetMachine &) const {
|
||||
}
|
||||
virtual void emitModuleFlags(MCStreamer &Streamer,
|
||||
ArrayRef<Module::ModuleFlagEntry> 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
|
||||
|
@ -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<Module::ModuleFlagEntry, 8> 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<GlobalValue>(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()) {
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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<MachineModuleInfoELF>();
|
||||
|
||||
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<Module::ModuleFlagEntry> 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<MachineModuleInfoMachO>();
|
||||
|
||||
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<MachineModuleInfoMachO>();
|
||||
|
||||
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<Module::ModuleFlagEntry> 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.
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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?
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<MachineModuleInfoELF>();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<SubOperator>(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());
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user