LLVM 19.0.0git
Functions | Variables
TargetLoweringObjectFileImpl.cpp File Reference
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/CodeGen/BasicBlockSectionUtils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PseudoProbe.h"
#include "llvm/IR/Type.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionGOFF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionWasm.h"
#include "llvm/MC/MCSectionXCOFF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/MCValue.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/Base64.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/TargetParser/Triple.h"
#include <cassert>
#include <string>

Go to the source code of this file.

Functions

static void GetObjCImageInfo (Module &M, unsigned &Version, unsigned &Flags, StringRef &Section)
 
static SectionKind getELFKindForNamedSection (StringRef Name, SectionKind K)
 
static bool hasPrefix (StringRef SectionName, StringRef Prefix)
 
static unsigned getELFSectionType (StringRef Name, SectionKind K)
 
static unsigned getELFSectionFlags (SectionKind K)
 
static const ComdatgetELFComdat (const GlobalValue *GV)
 
static const MCSymbolELFgetLinkedToSymbol (const GlobalObject *GO, const TargetMachine &TM)
 
static unsigned getEntrySizeForKind (SectionKind Kind)
 
static StringRef getSectionPrefixForGlobal (SectionKind Kind, bool IsLarge)
 Return the section prefix name used by options FunctionsSections and DataSections.
 
static SmallString< 128 > getELFSectionNameForGlobal (const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, unsigned EntrySize, bool UniqueSectionName)
 
static unsigned calcUniqueIDUpdateFlagsAndSize (const GlobalObject *GO, StringRef SectionName, SectionKind Kind, const TargetMachine &TM, MCContext &Ctx, Mangler &Mang, unsigned &Flags, unsigned &EntrySize, unsigned &NextUniqueID, const bool Retain, const bool ForceUnique)
 Calculate an appropriate unique ID for a section, and update Flags, EntrySize and NextUniqueID where appropriate.
 
static std::tuple< StringRef, bool, unsignedgetGlobalObjectInfo (const GlobalObject *GO, const TargetMachine &TM)
 
static MCSectionselectExplicitSectionGlobal (const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM, MCContext &Ctx, Mangler &Mang, unsigned &NextUniqueID, bool Retain, bool ForceUnique)
 
static MCSectionELFselectELFSectionForGlobal (MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned Flags, unsigned *NextUniqueID, const MCSymbolELF *AssociatedSymbol)
 
static MCSectionselectELFSectionForGlobal (MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool Retain, bool EmitUniqueSection, unsigned Flags, unsigned *NextUniqueID)
 
static MCSectionELFgetStaticStructorSection (MCContext &Ctx, bool UseInitArray, bool IsCtor, unsigned Priority, const MCSymbol *KeySym)
 
static void checkMachOComdat (const GlobalValue *GV)
 
static bool canUsePrivateLabel (const MCAsmInfo &AsmInfo, const MCSection &Section)
 
static unsigned getCOFFSectionFlags (SectionKind K, const TargetMachine &TM)
 
static const GlobalValuegetComdatGVForCOFF (const GlobalValue *GV)
 
static int getSelectionForCOFF (const GlobalValue *GV)
 
static StringRef getCOFFSectionNameForUniqueGlobal (SectionKind Kind)
 
static MCSectionCOFFgetCOFFStaticStructorSection (MCContext &Ctx, const Triple &T, bool IsCtor, unsigned Priority, const MCSymbol *KeySym, MCSectionCOFF *Default)
 
static std::string APIntToHexString (const APInt &AI)
 
static std::string scalarConstantToHexString (const Constant *C)
 
static const ComdatgetWasmComdat (const GlobalValue *GV)
 
static unsigned getWasmSectionFlags (SectionKind K, bool Retain)
 
static MCSectionWasmselectWasmSectionForGlobal (MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned *NextUniqueID, bool Retain)
 

Variables

static cl::opt< boolJumpTableInFunctionSection ("jumptable-in-function-section", cl::Hidden, cl::init(false), cl::desc("Putting Jump Table in function section"))
 

Function Documentation

◆ APIntToHexString()

static std::string APIntToHexString ( const APInt AI)
static

◆ calcUniqueIDUpdateFlagsAndSize()

static unsigned calcUniqueIDUpdateFlagsAndSize ( const GlobalObject GO,
StringRef  SectionName,
SectionKind  Kind,
const TargetMachine TM,
MCContext Ctx,
Mangler Mang,
unsigned Flags,
unsigned EntrySize,
unsigned NextUniqueID,
const bool  Retain,
const bool  ForceUnique 
)
static

◆ canUsePrivateLabel()

static bool canUsePrivateLabel ( const MCAsmInfo AsmInfo,
const MCSection Section 
)
static

◆ checkMachOComdat()

static void checkMachOComdat ( const GlobalValue GV)
static

◆ getCOFFSectionFlags()

static unsigned getCOFFSectionFlags ( SectionKind  K,
const TargetMachine TM 
)
static

◆ getCOFFSectionNameForUniqueGlobal()

static StringRef getCOFFSectionNameForUniqueGlobal ( SectionKind  Kind)
static

◆ getCOFFStaticStructorSection()

static MCSectionCOFF * getCOFFStaticStructorSection ( MCContext Ctx,
const Triple T,
bool  IsCtor,
unsigned  Priority,
const MCSymbol KeySym,
MCSectionCOFF Default 
)
static

◆ getComdatGVForCOFF()

static const GlobalValue * getComdatGVForCOFF ( const GlobalValue GV)
static

◆ getELFComdat()

static const Comdat * getELFComdat ( const GlobalValue GV)
static

◆ getELFKindForNamedSection()

static SectionKind getELFKindForNamedSection ( StringRef  Name,
SectionKind  K 
)
static

◆ getELFSectionFlags()

static unsigned getELFSectionFlags ( SectionKind  K)
static

◆ getELFSectionNameForGlobal()

static SmallString< 128 > getELFSectionNameForGlobal ( const GlobalObject GO,
SectionKind  Kind,
Mangler Mang,
const TargetMachine TM,
unsigned  EntrySize,
bool  UniqueSectionName 
)
static

◆ getELFSectionType()

static unsigned getELFSectionType ( StringRef  Name,
SectionKind  K 
)
static

◆ getEntrySizeForKind()

static unsigned getEntrySizeForKind ( SectionKind  Kind)
static

Definition at line 590 of file TargetLoweringObjectFileImpl.cpp.

References assert().

Referenced by selectELFSectionForGlobal(), and selectExplicitSectionGlobal().

◆ getGlobalObjectInfo()

static std::tuple< StringRef, bool, unsigned > getGlobalObjectInfo ( const GlobalObject GO,
const TargetMachine TM 
)
static

◆ getLinkedToSymbol()

static const MCSymbolELF * getLinkedToSymbol ( const GlobalObject GO,
const TargetMachine TM 
)
static

◆ GetObjCImageInfo()

static void GetObjCImageInfo ( Module M,
unsigned Version,
unsigned Flags,
StringRef Section 
)
static

◆ getSectionPrefixForGlobal()

static StringRef getSectionPrefixForGlobal ( SectionKind  Kind,
bool  IsLarge 
)
static

Return the section prefix name used by options FunctionsSections and DataSections.

Definition at line 616 of file TargetLoweringObjectFileImpl.cpp.

References llvm_unreachable.

Referenced by getELFSectionNameForGlobal(), and selectWasmSectionForGlobal().

◆ getSelectionForCOFF()

static int getSelectionForCOFF ( const GlobalValue GV)
static

◆ getStaticStructorSection()

static MCSectionELF * getStaticStructorSection ( MCContext Ctx,
bool  UseInitArray,
bool  IsCtor,
unsigned  Priority,
const MCSymbol KeySym 
)
static

◆ getWasmComdat()

static const Comdat * getWasmComdat ( const GlobalValue GV)
static

◆ getWasmSectionFlags()

static unsigned getWasmSectionFlags ( SectionKind  K,
bool  Retain 
)
static

◆ hasPrefix()

static bool hasPrefix ( StringRef  SectionName,
StringRef  Prefix 
)
static

Definition at line 505 of file TargetLoweringObjectFileImpl.cpp.

Referenced by getELFSectionType().

◆ scalarConstantToHexString()

static std::string scalarConstantToHexString ( const Constant C)
static

◆ selectELFSectionForGlobal() [1/2]

static MCSectionELF * selectELFSectionForGlobal ( MCContext Ctx,
const GlobalObject GO,
SectionKind  Kind,
Mangler Mang,
const TargetMachine TM,
bool  EmitUniqueSection,
unsigned  Flags,
unsigned NextUniqueID,
const MCSymbolELF AssociatedSymbol 
)
static

◆ selectELFSectionForGlobal() [2/2]

static MCSection * selectELFSectionForGlobal ( MCContext Ctx,
const GlobalObject GO,
SectionKind  Kind,
Mangler Mang,
const TargetMachine TM,
bool  Retain,
bool  EmitUniqueSection,
unsigned  Flags,
unsigned NextUniqueID 
)
static

◆ selectExplicitSectionGlobal()

static MCSection * selectExplicitSectionGlobal ( const GlobalObject GO,
SectionKind  Kind,
const TargetMachine TM,
MCContext Ctx,
Mangler Mang,
unsigned NextUniqueID,
bool  Retain,
bool  ForceUnique 
)
static

◆ selectWasmSectionForGlobal()

static MCSectionWasm * selectWasmSectionForGlobal ( MCContext Ctx,
const GlobalObject GO,
SectionKind  Kind,
Mangler Mang,
const TargetMachine TM,
bool  EmitUniqueSection,
unsigned NextUniqueID,
bool  Retain 
)
static

Variable Documentation

◆ JumpTableInFunctionSection

cl::opt< bool > JumpTableInFunctionSection("jumptable-in-function-section", cl::Hidden, cl::init(false), cl::desc("Putting Jump Table in function section")) ( "jumptable-in-function-section"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Putting Jump Table in function section")   
)
static