31 "no-kernel-info-end-lto",
32 cl::desc(
"remove the kernel-info pass at the end of the full LTO pipeline"),
42 : TheTarget(
T),
DL(DataLayoutString), TargetTriple(TT),
44 MRI(nullptr), MII(nullptr), STI(nullptr), RequireStructuredCFG(
false),
72 auto *GV = dyn_cast<GlobalVariable>(GO);
75 return Name.consume_front(Prefix) && (
Name.empty() ||
Name[0] ==
'.');
82 if (GO->hasSection()) {
84 return IsPrefix(
Name,
".ltext");
89 if (GV->isThreadLocal())
94 if (
auto CM = GV->getCodeModel()) {
105 if (GV->hasSection()) {
107 return IsPrefix(
Name,
".lbss") || IsPrefix(
Name,
".ldata") ||
108 IsPrefix(
Name,
".lrodata");
114 if (!GV->getValueType()->isSized())
118 if (GV->isDeclaration() && (GV->getName() ==
"__ehdr_start" ||
119 GV->getName().starts_with(
"__start_") ||
120 GV->getName().starts_with(
"__stop_")))
131 if (!GV->isDeclarationForLinker() &&
156#define RESET_OPTION(X, Y) \
158 Options.X = F.getFnAttribute(Y).getValueAsBool(); \
164 RESET_OPTION(NoSignedZerosFPMath,
"no-signed-zeros-fp-math");
222 if (TT.isOSBinFormatCOFF()) {
233 isa<GlobalVariable>(GV))
246 if (TT.isOSBinFormatGOFF())
249 if (TT.isOSBinFormatMachO()) {
255 assert(TT.isOSBinFormatELF() || TT.isOSBinFormatWasm() ||
256 TT.isOSBinFormatXCOFF());
270 if (IsSharedLibrary) {
284 if (SelectedModel > Model)
285 return SelectedModel;
297 bool MayAlwaysUsePrivate)
const {
328 return {INT_MAX, INT_MAX};
329 std::pair<int, int> Ret;
330 if (!
Version.consumeInteger(10, Ret.first) &&
Version.consume_front(
"."))
331 Version.consumeInteger(10, Ret.second);
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Module.h This file contains the declarations for the Module class.
static TLSModel::Model getSelectedTLSModel(const GlobalValue *GV)
Get the IR-specified TLS model for Var.
cl::opt< bool > NoKernelInfoEndLTO("no-kernel-info-end-lto", cl::desc("remove the kernel-info pass at the end of the full LTO pipeline"), cl::init(false), cl::Hidden)
#define RESET_OPTION(X, Y)
A parsed version of the target data layout string in and methods for querying it.
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Tagged union holding either a T or a Error.
bool hasPrivateLinkage() const
bool hasExternalWeakLinkage() const
ThreadLocalMode getThreadLocalMode() const
bool hasDLLImportStorageClass() const
bool isDeclarationForLinker() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM_ABI const GlobalObject * getAliaseeObject() const
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
Context object for machine code objects.
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
MCContext & getContext() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_ABI void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
PIELevel::Level getPIELevel() const
Returns the PIE level (small or large model)
bool isReadOnlyWithRel() const
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Analysis pass providing the TargetTransformInfo.
virtual void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const
Mangler & getMangler() const
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
virtual MCSymbol * getTargetSymbol(const GlobalValue *GV, const TargetMachine &TM) const
Targets that have a special convention for their symbols could use this hook to return a specialized ...
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
bool isPositionIndependent() const
uint64_t getMaxCodeSize() const
Returns the maximum code size possible under the code model.
const Triple & getTargetTriple() const
bool useTLSDESC() const
Returns true if this target uses TLS Descriptors.
uint64_t LargeDataThreshold
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
virtual TargetLoweringObjectFile * getObjFileLowering() const
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
virtual TargetTransformInfo getTargetTransformInfo(const Function &F) const
Return a TargetTransformInfo for a given function.
const DataLayout DL
DataLayout for the target: keep ABI type size and alignment.
bool shouldAssumeDSOLocal(const GlobalValue *GV) const
virtual Expected< std::unique_ptr< MCStreamer > > createMCStreamer(raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Ctx)
static std::pair< int, int > parseBinutilsVersion(StringRef Version)
TargetIRAnalysis getTargetIRAnalysis() const
Get a TargetIRAnalysis appropriate for the target.
MCSymbol * getSymbol(const GlobalValue *GV) const
CodeModel::Model getCodeModel() const
Returns the code model.
bool isLargeGlobalValue(const GlobalValue *GV) const
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
TargetMachine(const Target &T, StringRef DataLayoutString, const Triple &TargetTriple, StringRef CPU, StringRef FS, const TargetOptions &Options)
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
unsigned EnableTLSDESC
EnableTLSDESC - This flag enables TLS Descriptors.
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
An abstract base class for streams implementations that also support a pwrite operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
constexpr uint64_t maxUIntN(uint64_t N)
Gets the maximum value for a N-bit unsigned integer.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Implement std::hash so that hash_code can be used in STL containers.