/// 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,
+ unsigned Encoding, Mangler &Mang,
MachineModuleInfo *MMI,
- unsigned Encoding,
MCStreamer &Streamer) const
LLVM_OVERRIDE;
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,
+ unsigned Encoding, Mangler &Mang,
MachineModuleInfo *MMI,
- unsigned Encoding,
MCStreamer &Streamer) const
LLVM_OVERRIDE;
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,
- SectionKind Kind) const {
+ virtual const MCSection *getSpecialCasedSectionGlobals(const GlobalValue *GV,
+ SectionKind Kind,
+ Mangler &Mang) const {
return 0;
}
/// 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,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const;
+ virtual const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+ unsigned Encoding,
+ Mangler &Mang,
+ MachineModuleInfo *MMI,
+ MCStreamer &Streamer) const;
/// Return the MCSymbol for the specified global value. This symbol is the
/// 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
/// base, with the specified suffix.
- MCSymbol *getSymbolWithGlobalValueBase(Mangler &M, const GlobalValue *GV,
- StringRef Suffix) const;
+ MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,
+ StringRef Suffix, Mangler &M) const;
// The symbol that gets passed to .cfi_personality.
virtual MCSymbol *
}
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.
MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,
StringRef Suffix) const {
- return getObjFileLowering().getSymbolWithGlobalValueBase(*Mang, GV, Suffix);
+ return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang);
}
/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
const MCExpr *Exp =
- TLOF.getTTypeGlobalReference(GV, *Mang, MMI, Encoding, OutStreamer);
+ TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, MMI, OutStreamer);
OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
} else
OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
default:
report_fatal_error("We do not support this DWARF encoding yet!");
case dwarf::DW_EH_PE_absptr:
- return getSymbol(Mang, GV);
+ return getSymbol(GV, Mang);
case dwarf::DW_EH_PE_pcrel: {
return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +
- getSymbol(Mang, GV)->getName());
+ getSymbol(GV, Mang)->getName());
}
}
}
Streamer.EmitSymbolValue(Sym, Size);
}
-const MCExpr *TargetLoweringObjectFileELF::
-getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const {
+const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
+ const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
+ MachineModuleInfo *MMI, 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(GV, ".DW.stub", Mang);
// 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(GV, Mang);
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
}
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
}
- return TargetLoweringObjectFile::
- getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
+ return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
+ MMI, Streamer);
}
static SectionKind
Prefix = getSectionPrefixForGlobal(Kind);
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());
StringRef Group = "";
unsigned Flags = getELFSectionFlags(Kind);
// 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(GV, Mang);
if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')
return false;
}
return true;
}
-const MCExpr *TargetLoweringObjectFileMachO::
-getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const {
+const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
+ const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
+ MachineModuleInfo *MMI, MCStreamer &Streamer) const {
// The mach-o version of this method defaults to returning a stub reference.
if (Encoding & DW_EH_PE_indirect) {
MachineModuleInfoMachO &MachOMMI =
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
// gets emitted by the asmprinter.
GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :
MachOMMI.getGVStubEntry(SSym);
if (StubSym.getPointer() == 0) {
- MCSymbol *Sym = getSymbol(Mang, GV);
+ MCSymbol *Sym = getSymbol(GV, Mang);
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
}
}
return TargetLoweringObjectFile::
- getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
+ getTTypeGlobalReference(GV, Encoding, Mang, MMI, Streamer);
}
MCSymbol *TargetLoweringObjectFileMachO::
MachineModuleInfoMachO &MachOMMI =
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
// gets emitted by the asmprinter.
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
if (StubSym.getPointer() == 0) {
- MCSymbol *Sym = getSymbol(Mang, GV);
+ MCSymbol *Sym = getSymbol(GV, Mang);
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
}
if (GV->isWeakForLinker()) {
Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
- MCSymbol *Sym = getSymbol(Mang, GV);
+ MCSymbol *Sym = getSymbol(GV, Mang);
COMDATSymName = Sym->getName();
}
return getContext().getCOFFSection(Name,
unsigned Characteristics = getCOFFSectionFlags(Kind);
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
- MCSymbol *Sym = getSymbol(Mang, GV);
+ MCSymbol *Sym = getSymbol(GV, Mang);
return getContext().getCOFFSection(Name, Characteristics,
Kind, Sym->getName(),
COFF::IMAGE_COMDAT_SELECT_ANY);
SectionKind::getMetadata());
}
-const MCExpr *ARMElfTargetObjectFile::
-getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const {
+const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
+ const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
+ MachineModuleInfo *MMI, MCStreamer &Streamer) const {
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,
getContext());
}
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,
- unsigned Encoding,
MCStreamer &Streamer) const
LLVM_OVERRIDE;
using namespace llvm;
-
-const MCExpr *SparcELFTargetObjectFile::
-getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const {
+const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
+ const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
+ MachineModuleInfo *MMI, 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(GV, ".DW.stub", Mang);
// 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(GV, Mang);
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
}
MCSymbolRefExpr::Create(SSym, Ctx), Ctx);
}
- return TargetLoweringObjectFileELF::
- getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
+ return TargetLoweringObjectFileELF::getTTypeGlobalReference(
+ GV, Encoding, Mang, MMI, Streamer);
}
TargetLoweringObjectFileELF()
{}
- const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
+ const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+ unsigned Encoding, Mangler &Mang,
MachineModuleInfo *MMI,
- unsigned Encoding,
MCStreamer &Streamer) const
LLVM_OVERRIDE;
};
/// Return the MCSymbol for the specified global value. This
/// symbol is the main label that is the address of the global.
-MCSymbol *TargetLoweringObjectFile::getSymbol(Mangler &M,
- const GlobalValue *GV) const {
+MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,
+ Mangler &M) const {
SmallString<60> NameStr;
M.getNameWithPrefix(NameStr, GV);
return Ctx->GetOrCreateSymbol(NameStr.str());
}
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
- Mangler &M, const GlobalValue *GV, StringRef Suffix) const {
+ const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
assert(!Suffix.empty());
SmallString<60> NameStr;
MCSymbol *TargetLoweringObjectFile::
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
MachineModuleInfo *MMI) const {
- return getSymbol(Mang, GV);
+ return getSymbol(GV, Mang);
}
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
/// getTTypeGlobalReference - Return an MCExpr to use for a
/// reference to the specified global variable from exception
/// handling information.
-const MCExpr *TargetLoweringObjectFile::
-getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const {
+const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
+ const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
+ MachineModuleInfo *MMI, MCStreamer &Streamer) const {
const MCSymbolRefExpr *Ref =
- MCSymbolRefExpr::Create(getSymbol(Mang, GV), getContext());
+ MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
return getTTypeReference(Ref, Encoding, Streamer);
}
using namespace llvm;
using namespace dwarf;
-const MCExpr *X86_64MachoTargetObjectFile::
-getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI, unsigned Encoding,
- MCStreamer &Streamer) const {
+const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
+ const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
+ MachineModuleInfo *MMI, 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(GV, Mang);
const MCExpr *Res =
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
const MCExpr *Four = MCConstantExpr::Create(4, getContext());
return MCBinaryExpr::CreateAdd(Res, Four, getContext());
}
- return TargetLoweringObjectFileMachO::
- getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
+ return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
+ GV, Encoding, Mang, MMI, Streamer);
}
MCSymbol *X86_64MachoTargetObjectFile::
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
MachineModuleInfo *MMI) const {
- return getSymbol(Mang, GV);
+ return getSymbol(GV, Mang);
}
void
return 0;
return MCSymbolRefExpr::Create(
- getSymbol(Mang, GVLHS), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());
+ getSymbol(GVLHS, Mang), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());
}
/// x86-64.
class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
public:
- const MCExpr *getTTypeGlobalReference(const GlobalValue *GV, Mangler &Mang,
+ const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+ unsigned Encoding, Mangler &Mang,
MachineModuleInfo *MMI,
- unsigned Encoding,
MCStreamer &Streamer) const
LLVM_OVERRIDE;