LLVM 20.0.0git
|
#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/MCAsmInfoDarwin.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.
Variables | |
static cl::opt< bool > | JumpTableInFunctionSection ("jumptable-in-function-section", cl::Hidden, cl::init(false), cl::desc("Putting Jump Table in function section")) |
Definition at line 2039 of file TargetLoweringObjectFileImpl.cpp.
References assert(), llvm::APInt::getBitWidth(), Size, llvm::dwarf::toString(), and llvm::transform().
Referenced by scalarConstantToHexString().
|
static |
Calculate an appropriate unique ID for a section, and update Flags, EntrySize and NextUniqueID where appropriate.
Definition at line 690 of file TargetLoweringObjectFileImpl.cpp.
References llvm::MCAsmInfo::binutilsIsAtLeast(), llvm::MCContext::GenericSectionID, llvm::MCContext::getAsmInfo(), getELFSectionNameForGlobal(), llvm::MCContext::getELFUniqueIDForEntsize(), llvm::GlobalObject::getMetadata(), llvm::MCContext::isELFGenericMergeableSection(), llvm::MCContext::isELFImplicitMergeableSectionNamePrefix(), llvm::ELF::SHF_GNU_RETAIN, llvm::ELF::SHF_LINK_ORDER, llvm::ELF::SHF_MERGE, llvm::ELF::SHF_SUNW_NODISCARD, and llvm::MCAsmInfo::useIntegratedAssembler().
Referenced by selectExplicitSectionGlobal().
Definition at line 1557 of file TargetLoweringObjectFileImpl.cpp.
References llvm::MCAsmInfoDarwin::isSectionAtomizableBySymbols().
Referenced by llvm::TargetLoweringObjectFileMachO::getNameWithPrefix().
|
static |
Definition at line 1275 of file TargetLoweringObjectFileImpl.cpp.
References llvm::CallingConv::C, llvm::GlobalValue::getComdat(), and llvm::report_fatal_error().
Referenced by llvm::TargetLoweringObjectFileMachO::getExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileMachO::SelectSectionForGlobal().
|
static |
Definition at line 1587 of file TargetLoweringObjectFileImpl.cpp.
References llvm::COFF::IMAGE_SCN_CNT_CODE, llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA, llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA, llvm::COFF::IMAGE_SCN_LNK_REMOVE, llvm::COFF::IMAGE_SCN_MEM_16BIT, llvm::COFF::IMAGE_SCN_MEM_DISCARDABLE, llvm::COFF::IMAGE_SCN_MEM_EXECUTE, llvm::COFF::IMAGE_SCN_MEM_READ, llvm::COFF::IMAGE_SCN_MEM_WRITE, isThumb(), and llvm::Triple::thumb.
Referenced by llvm::TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(), llvm::TargetLoweringObjectFileCOFF::getSectionForJumpTable(), and llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal().
|
static |
Definition at line 1704 of file TargetLoweringObjectFileImpl.cpp.
Referenced by llvm::TargetLoweringObjectFileCOFF::getSectionForJumpTable(), and llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal().
|
static |
Definition at line 1945 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Default, llvm::format(), llvm::MCContext::getAssociativeCOFFSection(), llvm::MCContext::getCOFFSection(), llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA, llvm::COFF::IMAGE_SCN_MEM_READ, llvm::COFF::IMAGE_SCN_MEM_WRITE, Name, and OS.
Referenced by llvm::TargetLoweringObjectFileCOFF::getStaticCtorSection(), and llvm::TargetLoweringObjectFileCOFF::getStaticDtorSection().
|
static |
Definition at line 1626 of file TargetLoweringObjectFileImpl.cpp.
References assert(), llvm::CallingConv::C, llvm::GlobalValue::getComdat(), llvm::Module::getNamedValue(), llvm::GlobalValue::getParent(), and llvm::report_fatal_error().
Referenced by llvm::TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(), getSelectionForCOFF(), and llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal().
|
static |
Definition at line 566 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::CallingConv::C, llvm::GlobalValue::getComdat(), llvm::Comdat::NoDeduplicate, and llvm::report_fatal_error().
Referenced by getGlobalObjectInfo(), and llvm::TargetLoweringObjectFileELF::getSectionForLSDA().
|
static |
Definition at line 462 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Triple::ELF, llvm::SectionKind::getBSS(), llvm::getInstrProfSectionName(), llvm::SectionKind::getMetadata(), llvm::SectionKind::getThreadBSS(), llvm::SectionKind::getThreadData(), and Name.
Referenced by selectExplicitSectionGlobal().
|
static |
Definition at line 536 of file TargetLoweringObjectFileImpl.cpp.
References llvm::ELF::SHF_ALLOC, llvm::ELF::SHF_ARM_PURECODE, llvm::ELF::SHF_EXCLUDE, llvm::ELF::SHF_EXECINSTR, llvm::ELF::SHF_MERGE, llvm::ELF::SHF_STRINGS, llvm::ELF::SHF_TLS, and llvm::ELF::SHF_WRITE.
Referenced by llvm::TargetLoweringObjectFileELF::getUniqueSectionForFunction(), selectExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileELF::SelectSectionForGlobal().
|
static |
Definition at line 636 of file TargetLoweringObjectFileImpl.cpp.
References F, llvm::GlobalValue::getDataLayout(), llvm::DataLayout::getPreferredAlign(), getSectionPrefixForGlobal(), Name, and llvm::Align::value().
Referenced by calcUniqueIDUpdateFlagsAndSize(), and selectELFSectionForGlobal().
|
static |
Definition at line 509 of file TargetLoweringObjectFileImpl.cpp.
References hasPrefix(), Name, llvm::ELF::SHT_FINI_ARRAY, llvm::ELF::SHT_INIT_ARRAY, llvm::ELF::SHT_LLVM_LTO, llvm::ELF::SHT_LLVM_OFFLOADING, llvm::ELF::SHT_NOBITS, llvm::ELF::SHT_NOTE, llvm::ELF::SHT_PREINIT_ARRAY, and llvm::ELF::SHT_PROGBITS.
Referenced by selectELFSectionForGlobal(), and selectExplicitSectionGlobal().
|
static |
Definition at line 591 of file TargetLoweringObjectFileImpl.cpp.
References assert().
Referenced by selectELFSectionForGlobal(), and selectExplicitSectionGlobal().
|
static |
Definition at line 770 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::CallingConv::C, getELFComdat(), llvm::ELF::SHF_GROUP, and llvm::ELF::SHF_X86_64_LARGE.
Referenced by selectELFSectionForGlobal(), and selectExplicitSectionGlobal().
|
static |
Definition at line 580 of file TargetLoweringObjectFileImpl.cpp.
References llvm::MDOperand::get(), llvm::GlobalObject::getMetadata(), and llvm::MDNode::getOperand().
Referenced by selectELFSectionForGlobal(), and selectExplicitSectionGlobal().
|
static |
Definition at line 79 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Module::Require.
Referenced by llvm::TargetLoweringObjectFileELF::emitModuleMetadata(), llvm::TargetLoweringObjectFileMachO::emitModuleMetadata(), and llvm::TargetLoweringObjectFileCOFF::emitModuleMetadata().
|
static |
Return the section prefix name used by options FunctionsSections and DataSections.
Definition at line 617 of file TargetLoweringObjectFileImpl.cpp.
References llvm_unreachable.
Referenced by getELFSectionNameForGlobal(), and selectWasmSectionForGlobal().
|
static |
Definition at line 1643 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::CallingConv::C, llvm::Comdat::ExactMatch, llvm::GlobalValue::getAliaseeObject(), llvm::GlobalValue::getComdat(), getComdatGVForCOFF(), llvm::COFF::IMAGE_COMDAT_SELECT_ANY, llvm::COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE, llvm::COFF::IMAGE_COMDAT_SELECT_EXACT_MATCH, llvm::COFF::IMAGE_COMDAT_SELECT_LARGEST, llvm::COFF::IMAGE_COMDAT_SELECT_NODUPLICATES, llvm::COFF::IMAGE_COMDAT_SELECT_SAME_SIZE, llvm::Comdat::Largest, llvm::Comdat::NoDeduplicate, and llvm::Comdat::SameSize.
Referenced by llvm::TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal().
|
static |
Definition at line 1078 of file TargetLoweringObjectFileImpl.cpp.
References llvm::format(), llvm::MCContext::getELFSection(), llvm::MCSymbol::getName(), Name, llvm::ELF::SHF_ALLOC, llvm::ELF::SHF_GROUP, llvm::ELF::SHF_WRITE, llvm::ELF::SHT_FINI_ARRAY, llvm::ELF::SHT_INIT_ARRAY, and llvm::ELF::SHT_PROGBITS.
Referenced by llvm::TargetLoweringObjectFileELF::getStaticCtorSection(), and llvm::TargetLoweringObjectFileELF::getStaticDtorSection().
|
static |
Definition at line 2121 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::CallingConv::C, llvm::GlobalValue::getComdat(), and llvm::report_fatal_error().
Referenced by llvm::TargetLoweringObjectFileWasm::getExplicitSectionGlobal(), and selectWasmSectionForGlobal().
|
static |
Definition at line 2134 of file TargetLoweringObjectFileImpl.cpp.
References llvm::wasm::WASM_SEG_FLAG_RETAIN, llvm::wasm::WASM_SEG_FLAG_STRINGS, and llvm::wasm::WASM_SEG_FLAG_TLS.
Referenced by llvm::TargetLoweringObjectFileWasm::getExplicitSectionGlobal(), and selectWasmSectionForGlobal().
Definition at line 504 of file TargetLoweringObjectFileImpl.cpp.
Referenced by getELFSectionType().
Definition at line 2050 of file TargetLoweringObjectFileImpl.cpp.
References APIntToHexString(), llvm::CallingConv::C, llvm::Type::getArrayNumElements(), llvm::Type::getPrimitiveSizeInBits(), llvm::APInt::getZero(), I, and scalarConstantToHexString().
Referenced by llvm::TargetLoweringObjectFileCOFF::getSectionForConstant(), and scalarConstantToHexString().
|
static |
Definition at line 855 of file TargetLoweringObjectFileImpl.cpp.
References llvm::MCContext::GenericSectionID, llvm::MCContext::getELFSection(), getELFSectionNameForGlobal(), getELFSectionType(), getEntrySizeForKind(), getGlobalObjectInfo(), and Name.
Referenced by llvm::TargetLoweringObjectFileELF::getSectionForJumpTable(), llvm::TargetLoweringObjectFileELF::getUniqueSectionForFunction(), selectELFSectionForGlobal(), and llvm::TargetLoweringObjectFileELF::SelectSectionForGlobal().
|
static |
Definition at line 887 of file TargetLoweringObjectFileImpl.cpp.
References assert(), llvm::MCAsmInfo::binutilsIsAtLeast(), llvm::MCContext::getAsmInfo(), getLinkedToSymbol(), selectELFSectionForGlobal(), llvm::ELF::SHF_GNU_RETAIN, llvm::ELF::SHF_LINK_ORDER, llvm::ELF::SHF_SUNW_NODISCARD, and llvm::MCAsmInfo::useIntegratedAssembler().
|
static |
Definition at line 784 of file TargetLoweringObjectFileImpl.cpp.
References assert(), llvm::MCAsmInfo::binutilsIsAtLeast(), calcUniqueIDUpdateFlagsAndSize(), llvm::LLVMContext::diagnose(), llvm::MCContext::getAsmInfo(), llvm::GlobalVariable::getAttributes(), llvm::Value::getContext(), getELFKindForNamedSection(), llvm::MCContext::getELFSection(), getELFSectionFlags(), getELFSectionType(), getEntrySizeForKind(), getGlobalObjectInfo(), getLinkedToSymbol(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::GlobalObject::getSection(), llvm::Module::getSourceFileName(), llvm::GlobalVariable::hasImplicitSection(), llvm::ELF::SHF_MERGE, and llvm::MCAsmInfo::useIntegratedAssembler().
Referenced by llvm::TargetLoweringObjectFileELF::getExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileELF::getUniqueSectionForFunction().
|
static |
Definition at line 2190 of file TargetLoweringObjectFileImpl.cpp.
References llvm::CallingConv::C, F, llvm::MCContext::GenericSectionID, getSectionPrefixForGlobal(), getWasmComdat(), llvm::MCContext::getWasmSection(), getWasmSectionFlags(), and Name.
Referenced by llvm::TargetLoweringObjectFileWasm::SelectSectionForGlobal().