mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
Use a consistent argument order in TargetLoweringObjectFile.
These methods normally call each other and it is really annoying if the arguments are in different order. The more common rule was that the arguments specific to call are first (GV, Encoding, Suffix) and the auxiliary objects (Mang, TM) come after. This patch changes the exceptions. llvm-svn: 201044
This commit is contained in:
parent
3070639d19
commit
8815574a16
@ -57,9 +57,9 @@ public:
|
|||||||
|
|
||||||
/// Return an MCExpr to use for a reference to the specified type info global
|
/// Return an MCExpr to use for a reference to the specified type info global
|
||||||
/// variable from exception handling information.
|
/// variable from exception handling information.
|
||||||
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
|
||||||
|
unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI,
|
MachineModuleInfo *MMI,
|
||||||
unsigned Encoding,
|
|
||||||
MCStreamer &Streamer) const
|
MCStreamer &Streamer) const
|
||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
|
|
||||||
@ -109,9 +109,9 @@ public:
|
|||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
|
|
||||||
/// The mach-o version of this method defaults to returning a stub reference.
|
/// 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,
|
||||||
|
unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI,
|
MachineModuleInfo *MMI,
|
||||||
unsigned Encoding,
|
|
||||||
MCStreamer &Streamer) const
|
MCStreamer &Streamer) const
|
||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
|
|
||||||
|
@ -109,27 +109,28 @@ public:
|
|||||||
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.
|
/// Allow the target to completely override section assignment of a global.
|
||||||
virtual const MCSection *
|
virtual const MCSection *getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
||||||
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler &Mang,
|
SectionKind Kind,
|
||||||
SectionKind Kind) const {
|
Mangler &Mang) const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an MCExpr to use for a reference to the specified global variable
|
/// Return an MCExpr to use for a reference to the specified global variable
|
||||||
/// from exception handling information.
|
/// from exception handling information.
|
||||||
virtual const MCExpr *
|
virtual const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
unsigned Encoding,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
Mangler &Mang,
|
||||||
MCStreamer &Streamer) const;
|
MachineModuleInfo *MMI,
|
||||||
|
MCStreamer &Streamer) const;
|
||||||
|
|
||||||
/// Return the MCSymbol for the specified global value. This symbol is the
|
/// Return the MCSymbol for the specified global value. This symbol is the
|
||||||
/// main label that is the address of the global
|
/// main label that is the address of the global
|
||||||
MCSymbol *getSymbol(Mangler &M, const GlobalValue *GV) const;
|
MCSymbol *getSymbol(const GlobalValue *GV, Mangler &M) const;
|
||||||
|
|
||||||
/// Return the MCSymbol for a private symbol with global value name as its
|
/// Return the MCSymbol for a private symbol with global value name as its
|
||||||
/// base, with the specified suffix.
|
/// base, with the specified suffix.
|
||||||
MCSymbol *getSymbolWithGlobalValueBase(Mangler &M, const GlobalValue *GV,
|
MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,
|
||||||
StringRef Suffix) const;
|
StringRef Suffix, Mangler &M) const;
|
||||||
|
|
||||||
// The symbol that gets passed to .cfi_personality.
|
// The symbol that gets passed to .cfi_personality.
|
||||||
virtual MCSymbol *
|
virtual MCSymbol *
|
||||||
|
@ -312,7 +312,7 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {
|
MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {
|
||||||
return getObjFileLowering().getSymbol(*Mang, GV);
|
return getObjFileLowering().getSymbol(GV, *Mang);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitGlobalVariable - Emit the specified global variable to the .s file.
|
/// EmitGlobalVariable - Emit the specified global variable to the .s file.
|
||||||
@ -2075,7 +2075,7 @@ MCSymbol *AsmPrinter::GetJTSetSymbol(unsigned UID, unsigned MBBID) const {
|
|||||||
|
|
||||||
MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,
|
MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,
|
||||||
StringRef Suffix) const {
|
StringRef Suffix) const {
|
||||||
return getObjFileLowering().getSymbolWithGlobalValueBase(*Mang, GV, Suffix);
|
return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
|
/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
|
||||||
|
@ -143,7 +143,7 @@ void AsmPrinter::EmitTTypeReference(const GlobalValue *GV,
|
|||||||
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
|
||||||
|
|
||||||
const MCExpr *Exp =
|
const MCExpr *Exp =
|
||||||
TLOF.getTTypeGlobalReference(GV, *Mang, MMI, Encoding, OutStreamer);
|
TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, MMI, OutStreamer);
|
||||||
OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
|
OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
|
||||||
} else
|
} else
|
||||||
OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
|
OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
|
||||||
|
@ -52,10 +52,10 @@ TargetLoweringObjectFileELF::getCFIPersonalitySymbol(const GlobalValue *GV,
|
|||||||
default:
|
default:
|
||||||
report_fatal_error("We do not support this DWARF encoding yet!");
|
report_fatal_error("We do not support this DWARF encoding yet!");
|
||||||
case dwarf::DW_EH_PE_absptr:
|
case dwarf::DW_EH_PE_absptr:
|
||||||
return getSymbol(Mang, GV);
|
return getSymbol(GV, Mang);
|
||||||
case dwarf::DW_EH_PE_pcrel: {
|
case dwarf::DW_EH_PE_pcrel: {
|
||||||
return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +
|
return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +
|
||||||
getSymbol(Mang, GV)->getName());
|
getSymbol(GV, Mang)->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,21 +87,20 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
|
|||||||
Streamer.EmitSymbolValue(Sym, Size);
|
Streamer.EmitSymbolValue(Sym, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCExpr *TargetLoweringObjectFileELF::
|
const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||||
MCStreamer &Streamer) const {
|
|
||||||
|
|
||||||
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
||||||
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
||||||
|
|
||||||
MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, ".DW.stub");
|
MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
|
||||||
|
|
||||||
// Add information about the stub reference to ELFMMI so that the stub
|
// Add information about the stub reference to ELFMMI so that the stub
|
||||||
// gets emitted by the asmprinter.
|
// gets emitted by the asmprinter.
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
||||||
if (StubSym.getPointer() == 0) {
|
if (StubSym.getPointer() == 0) {
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +109,8 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
|||||||
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
|
||||||
getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
MMI, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SectionKind
|
static SectionKind
|
||||||
@ -249,7 +248,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
Prefix = getSectionPrefixForGlobal(Kind);
|
Prefix = getSectionPrefixForGlobal(Kind);
|
||||||
|
|
||||||
SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
|
SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
Name.append(Sym->getName().begin(), Sym->getName().end());
|
Name.append(Sym->getName().begin(), Sym->getName().end());
|
||||||
StringRef Group = "";
|
StringRef Group = "";
|
||||||
unsigned Flags = getELFSectionFlags(Kind);
|
unsigned Flags = getELFSectionFlags(Kind);
|
||||||
@ -621,7 +620,7 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const {
|
|||||||
// FIXME: ObjC metadata is currently emitted as internal symbols that have
|
// FIXME: ObjC metadata is currently emitted as internal symbols that have
|
||||||
// \1L and \0l prefixes on them. Fix them to be Private/LinkerPrivate and
|
// \1L and \0l prefixes on them. Fix them to be Private/LinkerPrivate and
|
||||||
// this horrible hack can go away.
|
// this horrible hack can go away.
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')
|
if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -629,17 +628,16 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCExpr *TargetLoweringObjectFileMachO::
|
const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||||
MCStreamer &Streamer) const {
|
|
||||||
// The mach-o version of this method defaults to returning a stub reference.
|
// The mach-o version of this method defaults to returning a stub reference.
|
||||||
|
|
||||||
if (Encoding & DW_EH_PE_indirect) {
|
if (Encoding & DW_EH_PE_indirect) {
|
||||||
MachineModuleInfoMachO &MachOMMI =
|
MachineModuleInfoMachO &MachOMMI =
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||||
|
|
||||||
MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, "$non_lazy_ptr");
|
MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);
|
||||||
|
|
||||||
// Add information about the stub reference to MachOMMI so that the stub
|
// Add information about the stub reference to MachOMMI so that the stub
|
||||||
// gets emitted by the asmprinter.
|
// gets emitted by the asmprinter.
|
||||||
@ -647,7 +645,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
|||||||
GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :
|
GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :
|
||||||
MachOMMI.getGVStubEntry(SSym);
|
MachOMMI.getGVStubEntry(SSym);
|
||||||
if (StubSym.getPointer() == 0) {
|
if (StubSym.getPointer() == 0) {
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,7 +655,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
return TargetLoweringObjectFile::
|
||||||
getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
getTTypeGlobalReference(GV, Encoding, Mang, MMI, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *TargetLoweringObjectFileMachO::
|
MCSymbol *TargetLoweringObjectFileMachO::
|
||||||
@ -667,13 +665,13 @@ getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
|||||||
MachineModuleInfoMachO &MachOMMI =
|
MachineModuleInfoMachO &MachOMMI =
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||||
|
|
||||||
MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, "$non_lazy_ptr");
|
MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);
|
||||||
|
|
||||||
// Add information about the stub reference to MachOMMI so that the stub
|
// Add information about the stub reference to MachOMMI so that the stub
|
||||||
// gets emitted by the asmprinter.
|
// gets emitted by the asmprinter.
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
||||||
if (StubSym.getPointer() == 0) {
|
if (StubSym.getPointer() == 0) {
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,7 +727,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
if (GV->isWeakForLinker()) {
|
if (GV->isWeakForLinker()) {
|
||||||
Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
|
Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
|
||||||
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
COMDATSymName = Sym->getName();
|
COMDATSymName = Sym->getName();
|
||||||
}
|
}
|
||||||
return getContext().getCOFFSection(Name,
|
return getContext().getCOFFSection(Name,
|
||||||
@ -763,7 +761,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
||||||
|
|
||||||
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
return getContext().getCOFFSection(Name, Characteristics,
|
return getContext().getCOFFSection(Name, Characteristics,
|
||||||
Kind, Sym->getName(),
|
Kind, Sym->getName(),
|
||||||
COFF::IMAGE_COMDAT_SELECT_ANY);
|
COFF::IMAGE_COMDAT_SELECT_ANY);
|
||||||
|
@ -41,13 +41,12 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
|
|||||||
SectionKind::getMetadata());
|
SectionKind::getMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCExpr *ARMElfTargetObjectFile::
|
const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||||
MCStreamer &Streamer) const {
|
|
||||||
assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
|
assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
|
||||||
|
|
||||||
return MCSymbolRefExpr::Create(getSymbol(Mang, GV),
|
return MCSymbolRefExpr::Create(getSymbol(GV, Mang),
|
||||||
MCSymbolRefExpr::VK_ARM_TARGET2,
|
MCSymbolRefExpr::VK_ARM_TARGET2,
|
||||||
getContext());
|
getContext());
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,9 @@ public:
|
|||||||
|
|
||||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE;
|
void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE;
|
||||||
|
|
||||||
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
|
||||||
|
unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI,
|
MachineModuleInfo *MMI,
|
||||||
unsigned Encoding,
|
|
||||||
MCStreamer &Streamer) const
|
MCStreamer &Streamer) const
|
||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
|
|
||||||
|
@ -14,22 +14,20 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
|
||||||
const MCExpr *SparcELFTargetObjectFile::
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
|
||||||
MCStreamer &Streamer) const {
|
|
||||||
|
|
||||||
if (Encoding & dwarf::DW_EH_PE_pcrel) {
|
if (Encoding & dwarf::DW_EH_PE_pcrel) {
|
||||||
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
||||||
|
|
||||||
MCSymbol *SSym = getSymbolWithGlobalValueBase(Mang, GV, ".DW.stub");
|
MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
|
||||||
|
|
||||||
// Add information about the stub reference to ELFMMI so that the stub
|
// Add information about the stub reference to ELFMMI so that the stub
|
||||||
// gets emitted by the asmprinter.
|
// gets emitted by the asmprinter.
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
||||||
if (StubSym.getPointer() == 0) {
|
if (StubSym.getPointer() == 0) {
|
||||||
MCSymbol *Sym = getSymbol(Mang, GV);
|
MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +36,6 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
|||||||
MCSymbolRefExpr::Create(SSym, Ctx), Ctx);
|
MCSymbolRefExpr::Create(SSym, Ctx), Ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFileELF::
|
return TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
GV, Encoding, Mang, MMI, Streamer);
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ public:
|
|||||||
TargetLoweringObjectFileELF()
|
TargetLoweringObjectFileELF()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
|
||||||
|
unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI,
|
MachineModuleInfo *MMI,
|
||||||
unsigned Encoding,
|
|
||||||
MCStreamer &Streamer) const
|
MCStreamer &Streamer) const
|
||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
@ -101,15 +101,15 @@ static bool IsNullTerminatedString(const Constant *C) {
|
|||||||
|
|
||||||
/// Return the MCSymbol for the specified global value. This
|
/// Return the MCSymbol for the specified global value. This
|
||||||
/// symbol is the main label that is the address of the global.
|
/// symbol is the main label that is the address of the global.
|
||||||
MCSymbol *TargetLoweringObjectFile::getSymbol(Mangler &M,
|
MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,
|
||||||
const GlobalValue *GV) const {
|
Mangler &M) const {
|
||||||
SmallString<60> NameStr;
|
SmallString<60> NameStr;
|
||||||
M.getNameWithPrefix(NameStr, GV);
|
M.getNameWithPrefix(NameStr, GV);
|
||||||
return Ctx->GetOrCreateSymbol(NameStr.str());
|
return Ctx->GetOrCreateSymbol(NameStr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
|
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
|
||||||
Mangler &M, const GlobalValue *GV, StringRef Suffix) const {
|
const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
|
||||||
assert(!Suffix.empty());
|
assert(!Suffix.empty());
|
||||||
|
|
||||||
SmallString<60> NameStr;
|
SmallString<60> NameStr;
|
||||||
@ -122,7 +122,7 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
|
|||||||
MCSymbol *TargetLoweringObjectFile::
|
MCSymbol *TargetLoweringObjectFile::
|
||||||
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI) const {
|
MachineModuleInfo *MMI) const {
|
||||||
return getSymbol(Mang, GV);
|
return getSymbol(GV, Mang);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
|
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
|
||||||
@ -310,12 +310,11 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
|
|||||||
/// getTTypeGlobalReference - Return an MCExpr to use for a
|
/// getTTypeGlobalReference - Return an MCExpr to use for a
|
||||||
/// reference to the specified global variable from exception
|
/// reference to the specified global variable from exception
|
||||||
/// handling information.
|
/// handling information.
|
||||||
const MCExpr *TargetLoweringObjectFile::
|
const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||||
MCStreamer &Streamer) const {
|
|
||||||
const MCSymbolRefExpr *Ref =
|
const MCSymbolRefExpr *Ref =
|
||||||
MCSymbolRefExpr::Create(getSymbol(Mang, GV), getContext());
|
MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
|
||||||
|
|
||||||
return getTTypeReference(Ref, Encoding, Streamer);
|
return getTTypeReference(Ref, Encoding, Streamer);
|
||||||
}
|
}
|
||||||
|
@ -18,29 +18,28 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace dwarf;
|
using namespace dwarf;
|
||||||
|
|
||||||
const MCExpr *X86_64MachoTargetObjectFile::
|
const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding,
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||||
MCStreamer &Streamer) const {
|
|
||||||
|
|
||||||
// On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
|
// On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
|
||||||
// is an indirect pc-relative reference.
|
// is an indirect pc-relative reference.
|
||||||
if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
|
if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
|
||||||
const MCSymbol *Sym = getSymbol(Mang, GV);
|
const MCSymbol *Sym = getSymbol(GV, Mang);
|
||||||
const MCExpr *Res =
|
const MCExpr *Res =
|
||||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
|
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
|
||||||
const MCExpr *Four = MCConstantExpr::Create(4, getContext());
|
const MCExpr *Four = MCConstantExpr::Create(4, getContext());
|
||||||
return MCBinaryExpr::CreateAdd(Res, Four, getContext());
|
return MCBinaryExpr::CreateAdd(Res, Four, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFileMachO::
|
return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
||||||
getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
GV, Encoding, Mang, MMI, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *X86_64MachoTargetObjectFile::
|
MCSymbol *X86_64MachoTargetObjectFile::
|
||||||
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI) const {
|
MachineModuleInfo *MMI) const {
|
||||||
return getSymbol(Mang, GV);
|
return getSymbol(GV, Mang);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -103,5 +102,5 @@ X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return MCSymbolRefExpr::Create(
|
return MCSymbolRefExpr::Create(
|
||||||
getSymbol(Mang, GVLHS), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());
|
getSymbol(GVLHS, Mang), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@ namespace llvm {
|
|||||||
/// x86-64.
|
/// x86-64.
|
||||||
class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
|
class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
|
||||||
public:
|
public:
|
||||||
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
|
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
|
||||||
|
unsigned Encoding, Mangler &Mang,
|
||||||
MachineModuleInfo *MMI,
|
MachineModuleInfo *MMI,
|
||||||
unsigned Encoding,
|
|
||||||
MCStreamer &Streamer) const
|
MCStreamer &Streamer) const
|
||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user