2010-02-15 22:37:53 +00:00
|
|
|
//==-- llvm/CodeGen/TargetLoweringObjectFileImpl.h - Object Info -*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements classes used to handle lowerings specific to common
|
|
|
|
// object file formats.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
|
|
|
|
#define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
|
|
|
|
|
2012-12-03 17:02:12 +00:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2010-02-15 22:37:53 +00:00
|
|
|
#include "llvm/MC/SectionKind.h"
|
|
|
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class MachineModuleInfo;
|
|
|
|
class Mangler;
|
|
|
|
class MCAsmInfo;
|
|
|
|
class MCExpr;
|
|
|
|
class MCSection;
|
|
|
|
class MCSectionMachO;
|
|
|
|
class MCSymbol;
|
|
|
|
class MCContext;
|
|
|
|
class GlobalValue;
|
|
|
|
class TargetMachine;
|
|
|
|
|
|
|
|
|
|
|
|
class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
|
2012-06-19 00:48:28 +00:00
|
|
|
bool UseInitArray;
|
|
|
|
|
2010-02-15 22:37:53 +00:00
|
|
|
public:
|
2011-07-20 05:58:47 +00:00
|
|
|
virtual ~TargetLoweringObjectFileELF() {}
|
2011-04-16 03:51:21 +00:00
|
|
|
|
2014-02-08 06:07:27 +00:00
|
|
|
void emitPersonalityValue(MCStreamer &Streamer, const TargetMachine &TM,
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSymbol *Sym) const override;
|
2011-01-23 05:43:40 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// Given a constant with the SectionKind, return a section that it should be
|
|
|
|
/// placed in.
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *getSectionForConstant(SectionKind Kind) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-02-08 06:07:27 +00:00
|
|
|
const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
|
2014-03-02 09:09:27 +00:00
|
|
|
SectionKind Kind, Mangler &Mang,
|
|
|
|
const TargetMachine &TM) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-02-08 06:07:27 +00:00
|
|
|
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
2014-03-02 09:09:27 +00:00
|
|
|
SectionKind Kind, Mangler &Mang,
|
|
|
|
const TargetMachine &TM) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// Return an MCExpr to use for a reference to the specified type info global
|
|
|
|
/// variable from exception handling information.
|
2014-02-19 17:23:20 +00:00
|
|
|
const MCExpr *
|
|
|
|
getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
|
|
|
|
Mangler &Mang, const TargetMachine &TM,
|
2014-03-02 09:09:27 +00:00
|
|
|
MachineModuleInfo *MMI,
|
|
|
|
MCStreamer &Streamer) const override;
|
2011-04-27 23:08:15 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
// The symbol that gets passed to .cfi_personality.
|
2014-02-08 14:53:28 +00:00
|
|
|
MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
2014-02-19 17:23:20 +00:00
|
|
|
const TargetMachine &TM,
|
2014-03-02 09:09:27 +00:00
|
|
|
MachineModuleInfo *MMI) const override;
|
2012-01-25 22:24:19 +00:00
|
|
|
|
2012-06-19 00:48:28 +00:00
|
|
|
void InitializeELF(bool UseInitArray_);
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *
|
|
|
|
getStaticCtorSection(unsigned Priority = 65535) const override;
|
|
|
|
const MCSection *
|
|
|
|
getStaticDtorSection(unsigned Priority = 65535) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
|
|
|
|
public:
|
2011-07-20 05:58:47 +00:00
|
|
|
virtual ~TargetLoweringObjectFileMachO() {}
|
2011-01-23 05:43:40 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// Extract the dependent library name from a linker option string. Returns
|
|
|
|
/// StringRef() if the option does not specify a library.
|
2014-03-02 09:09:27 +00:00
|
|
|
StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const override;
|
2014-01-21 18:31:27 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// Emit the module flags that specify the garbage collection information.
|
2014-02-08 06:07:27 +00:00
|
|
|
void emitModuleFlags(MCStreamer &Streamer,
|
|
|
|
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
2014-03-02 09:09:27 +00:00
|
|
|
Mangler &Mang, const TargetMachine &TM) const override;
|
2012-02-14 21:28:13 +00:00
|
|
|
|
2014-03-02 09:09:27 +00:00
|
|
|
bool isSectionAtomizableBySymbols(const MCSection &Section) const override;
|
2014-02-19 17:23:20 +00:00
|
|
|
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *
|
|
|
|
SelectSectionForGlobal(const GlobalValue *GV,
|
|
|
|
SectionKind Kind, Mangler &Mang,
|
|
|
|
const TargetMachine &TM) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *
|
|
|
|
getExplicitSectionGlobal(const GlobalValue *GV,
|
|
|
|
SectionKind Kind, Mangler &Mang,
|
|
|
|
const TargetMachine &TM) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *getSectionForConstant(SectionKind Kind) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// The mach-o version of this method defaults to returning a stub reference.
|
2014-02-19 17:23:20 +00:00
|
|
|
const MCExpr *
|
|
|
|
getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
|
|
|
|
Mangler &Mang, const TargetMachine &TM,
|
2014-03-02 09:09:27 +00:00
|
|
|
MachineModuleInfo *MMI,
|
|
|
|
MCStreamer &Streamer) const override;
|
2010-02-21 20:28:15 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
// The symbol that gets passed to .cfi_personality.
|
2014-02-08 14:53:28 +00:00
|
|
|
MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
2014-02-19 17:23:20 +00:00
|
|
|
const TargetMachine &TM,
|
2014-03-02 09:09:27 +00:00
|
|
|
MachineModuleInfo *MMI) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
|
|
|
|
public:
|
2011-07-20 05:58:47 +00:00
|
|
|
virtual ~TargetLoweringObjectFileCOFF() {}
|
2010-05-07 17:17:41 +00:00
|
|
|
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *
|
|
|
|
getExplicitSectionGlobal(const GlobalValue *GV,
|
|
|
|
SectionKind Kind, Mangler &Mang,
|
|
|
|
const TargetMachine &TM) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
|
2014-03-02 09:09:27 +00:00
|
|
|
const MCSection *
|
|
|
|
SelectSectionForGlobal(const GlobalValue *GV,
|
|
|
|
SectionKind Kind, Mangler &Mang,
|
|
|
|
const TargetMachine &TM) const override;
|
2013-04-25 19:34:41 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// Extract the dependent library name from a linker option string. Returns
|
|
|
|
/// StringRef() if the option does not specify a library.
|
2014-03-02 09:09:27 +00:00
|
|
|
StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const override;
|
2014-01-21 18:31:27 +00:00
|
|
|
|
2014-02-07 22:45:13 +00:00
|
|
|
/// Emit Obj-C garbage collection and linker options. Only linker option
|
|
|
|
/// emission is implemented for COFF.
|
2014-02-08 06:07:27 +00:00
|
|
|
void emitModuleFlags(MCStreamer &Streamer,
|
|
|
|
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
2014-03-02 09:09:27 +00:00
|
|
|
Mangler &Mang, const TargetMachine &TM) const override;
|
2010-02-15 22:37:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|