LLVM
15.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/ADT/Triple.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/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 <cassert>
#include <string>
Go to the source code of this file.
Definition at line 1960 of file TargetLoweringObjectFileImpl.cpp.
References assert(), llvm::APInt::getBitWidth(), 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 670 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, TM, and llvm::MCAsmInfo::useIntegratedAssembler().
Referenced by selectExplicitSectionGlobal().
Definition at line 1505 of file TargetLoweringObjectFileImpl.cpp.
References llvm::MCAsmInfo::isSectionAtomizableBySymbols().
Referenced by llvm::TargetLoweringObjectFileMachO::getNameWithPrefix().
|
static |
Definition at line 1237 of file TargetLoweringObjectFileImpl.cpp.
References llvm::GlobalValue::getComdat(), and llvm::report_fatal_error().
Referenced by llvm::TargetLoweringObjectFileMachO::getExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileMachO::SelectSectionForGlobal().
|
static |
Definition at line 1535 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, llvm::SectionKind::isBSS(), llvm::SectionKind::isExclude(), llvm::SectionKind::isMetadata(), llvm::SectionKind::isReadOnly(), llvm::SectionKind::isReadOnlyWithRel(), llvm::SectionKind::isText(), llvm::SectionKind::isThreadLocal(), isThumb(), llvm::SectionKind::isWriteable(), llvm::Triple::thumb, and TM.
Referenced by llvm::TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(), llvm::TargetLoweringObjectFileCOFF::getSectionForJumpTable(), and llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal().
|
static |
Definition at line 1643 of file TargetLoweringObjectFileImpl.cpp.
Referenced by llvm::TargetLoweringObjectFileCOFF::getSectionForJumpTable(), and llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal().
|
static |
Definition at line 1877 of file TargetLoweringObjectFileImpl.cpp.
References llvm::format(), llvm::MCContext::getAssociativeCOFFSection(), llvm::MCContext::getCOFFSection(), llvm::SectionKind::getData(), llvm::SectionKind::getReadOnly(), llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA, llvm::COFF::IMAGE_SCN_MEM_READ, and llvm::COFF::IMAGE_SCN_MEM_WRITE.
Referenced by llvm::TargetLoweringObjectFileCOFF::getStaticCtorSection(), and llvm::TargetLoweringObjectFileCOFF::getStaticDtorSection().
|
static |
Definition at line 1574 of file TargetLoweringObjectFileImpl.cpp.
References assert(), 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 540 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::GlobalValue::getComdat(), llvm::Comdat::NoDeduplicate, and llvm::report_fatal_error().
Referenced by llvm::TargetLoweringObjectFileELF::getSectionForLSDA(), selectELFSectionForGlobal(), and selectExplicitSectionGlobal().
|
static |
Definition at line 437 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Triple::ELF, llvm::SectionKind::getBSS(), llvm::SectionKind::getExclude(), llvm::getInstrProfSectionName(), llvm::SectionKind::getMetadata(), llvm::SectionKind::getThreadBSS(), and llvm::SectionKind::getThreadData().
Referenced by selectExplicitSectionGlobal().
|
static |
Definition at line 510 of file TargetLoweringObjectFileImpl.cpp.
References llvm::SectionKind::isExclude(), llvm::SectionKind::isExecuteOnly(), llvm::SectionKind::isMergeableConst(), llvm::SectionKind::isMergeableCString(), llvm::SectionKind::isMetadata(), llvm::SectionKind::isText(), llvm::SectionKind::isThreadLocal(), llvm::SectionKind::isWriteable(), 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 617 of file TargetLoweringObjectFileImpl.cpp.
References F, llvm::Module::getDataLayout(), llvm::GlobalValue::getParent(), llvm::DataLayout::getPreferredAlign(), getSectionPrefixForGlobal(), llvm::cl::Prefix, and TM.
Referenced by calcUniqueIDUpdateFlagsAndSize(), and selectELFSectionForGlobal().
|
static |
Definition at line 488 of file TargetLoweringObjectFileImpl.cpp.
References hasPrefix(), llvm::SectionKind::isBSS(), llvm::SectionKind::isThreadBSS(), llvm::ELF::SHT_FINI_ARRAY, llvm::ELF::SHT_INIT_ARRAY, 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 572 of file TargetLoweringObjectFileImpl.cpp.
References assert().
Referenced by selectELFSectionForGlobal(), selectExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileXCOFF::SelectSectionForGlobal().
|
static |
Definition at line 554 of file TargetLoweringObjectFileImpl.cpp.
References llvm::GlobalObject::getMetadata(), llvm::MDNode::getOperand(), llvm::report_fatal_error(), and TM.
Referenced by selectELFSectionForGlobal(), and selectExplicitSectionGlobal().
|
static |
Definition at line 73 of file TargetLoweringObjectFileImpl.cpp.
References M, llvm::Module::Require, and llvm::IndexedInstrProf::Version.
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 598 of file TargetLoweringObjectFileImpl.cpp.
References llvm_unreachable.
Referenced by getELFSectionNameForGlobal(), and selectWasmSectionForGlobal().
|
static |
Definition at line 1591 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, 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 1041 of file TargetLoweringObjectFileImpl.cpp.
References llvm::format(), llvm::MCContext::getELFSection(), llvm::MCSymbol::getName(), 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 2042 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::GlobalValue::getComdat(), and llvm::report_fatal_error().
Referenced by llvm::TargetLoweringObjectFileWasm::getExplicitSectionGlobal(), and selectWasmSectionForGlobal().
|
static |
Definition at line 2055 of file TargetLoweringObjectFileImpl.cpp.
References llvm::SectionKind::isMergeableCString(), llvm::SectionKind::isThreadLocal(), llvm::wasm::WASM_SEG_FLAG_STRINGS, and llvm::wasm::WASM_SEG_FLAG_TLS.
Referenced by llvm::TargetLoweringObjectFileWasm::getExplicitSectionGlobal(), and selectWasmSectionForGlobal().
Definition at line 483 of file TargetLoweringObjectFileImpl.cpp.
References llvm::cl::Prefix.
Referenced by getELFSectionType().
Definition at line 1971 of file TargetLoweringObjectFileImpl.cpp.
References APIntToHexString(), E, llvm::Type::getArrayNumElements(), llvm::Type::getPrimitiveSizeInBits(), llvm::APInt::getZero(), and I.
Referenced by llvm::TargetLoweringObjectFileCOFF::getSectionForConstant().
|
static |
Definition at line 824 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, llvm::MCContext::GenericSectionID, getELFComdat(), llvm::MCContext::getELFSection(), getELFSectionNameForGlobal(), getELFSectionType(), getEntrySizeForKind(), llvm::ELF::SHF_GROUP, and TM.
Referenced by llvm::TargetLoweringObjectFileELF::getSectionForJumpTable(), llvm::TargetLoweringObjectFileELF::getUniqueSectionForFunction(), selectELFSectionForGlobal(), and llvm::TargetLoweringObjectFileELF::SelectSectionForGlobal().
|
static |
Definition at line 861 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, TM, and llvm::MCAsmInfo::useIntegratedAssembler().
|
static |
Definition at line 744 of file TargetLoweringObjectFileImpl.cpp.
References llvm::Comdat::Any, assert(), Attrs, llvm::MCAsmInfo::binutilsIsAtLeast(), calcUniqueIDUpdateFlagsAndSize(), llvm::LLVMContext::diagnose(), F, llvm::MCContext::getAsmInfo(), llvm::GlobalVariable::getAttributes(), llvm::Value::getContext(), getELFComdat(), getELFKindForNamedSection(), llvm::MCContext::getELFSection(), getELFSectionFlags(), getELFSectionType(), getEntrySizeForKind(), getLinkedToSymbol(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::GlobalObject::getSection(), llvm::Module::getSourceFileName(), llvm::GlobalVariable::hasImplicitSection(), llvm::ELF::SHF_GROUP, llvm::ELF::SHF_MERGE, TM, and llvm::MCAsmInfo::useIntegratedAssembler().
Referenced by llvm::TargetLoweringObjectFileELF::getExplicitSectionGlobal(), and llvm::TargetLoweringObjectFileELF::getUniqueSectionForFunction().
|
static |
Definition at line 2099 of file TargetLoweringObjectFileImpl.cpp.
References F, llvm::MCContext::GenericSectionID, getSectionPrefixForGlobal(), getWasmComdat(), llvm::MCContext::getWasmSection(), getWasmSectionFlags(), and TM.
Referenced by llvm::TargetLoweringObjectFileWasm::SelectSectionForGlobal().