84 unsigned NumElts = CDS->getNumElements();
85 assert(NumElts != 0 &&
"Can't have an empty CDS");
87 if (CDS->getElementAsInteger(NumElts-1) != 0)
91 for (
unsigned i = 0; i != NumElts-1; ++i)
92 if (CDS->getElementAsInteger(i) == 0)
98 if (isa<ConstantAggregateZero>(C))
99 return cast<ArrayType>(C->
getType())->getNumElements() == 1;
107 assert(!Suffix.
empty());
112 NameStr.append(Suffix.
begin(), Suffix.
end());
136 "Can only be used for global definitions");
185 dyn_cast<IntegerType>(ATy->getElementType())) {
186 if ((ITy->getBitWidth() == 8 || ITy->getBitWidth() == 16 ||
187 ITy->getBitWidth() == 32) &&
189 if (ITy->getBitWidth() == 8)
191 if (ITy->getBitWidth() == 16)
194 assert(ITy->getBitWidth() == 32 &&
"Unknown width");
280 bool UsesLabelDifference,
const Function &
F)
const {
284 if (UsesLabelDifference)
324 switch (Encoding & 0x70) {
static SectionKind getReadOnlyWithRelLocal()
Instances of this class represent a uniqued identifier for a section in the current translation unit...
static SectionKind getKindForGlobal(const GlobalValue *GV, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
virtual MCSection * getSectionForJumpTable(const Function &F, Mangler &Mang, const TargetMachine &TM) const
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static SectionKind getDataRel()
static SectionKind getDataRelLocal()
const char * getPrivateGlobalPrefix() const
static SectionKind getMergeableConst8()
bool hasAvailableExternallyLinkage() const
static SectionKind getMergeableConst16()
virtual void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const
static SectionKind getMergeable1ByteCString()
static SectionKind getCommon()
virtual MCSection * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const =0
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
static SectionKind getMergeableConst4()
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
const Triple & getTargetTriple() const
bool hasCommonLinkage() const
static SectionKind getBSS()
static SectionKind getMergeable4ByteCString()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
This method must be called before any actual lowering is done.
Base class for the full range of assembler expressions which are needed for parsing.
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
Represent a reference to a symbol from inside an expression.
Context object for machine code objects.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
ArrayType - Class to represent array types.
virtual const MCExpr * getDebugThreadLocalSymbol(const MCSymbol *Sym) const
Create a symbol reference to describe the given TLS variable when emitting the address in debug info...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
static SectionKind getThreadData()
MCContext & getContext() const
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix, Mangler &Mang, const TargetMachine &TM) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
MCSection * DataSection
Section directive for standard data.
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
static SectionKind getBSSLocal()
Streaming machine code generation interface.
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
CodeModel::Model getCodeModel() const
Returns the code model.
MCSection * SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isSuitableForBSS(const GlobalVariable *GV, bool NoZerosInBSS)
SectionKind - This is a simple POD value that classifies the properties of a section.
Class to represent integer types.
virtual MCSection * getSectionForConstant(SectionKind Kind, const Constant *C) const
Given a constant with the SectionKind, return a section that it should be placed in.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
unsigned NoZerosInBSS
NoZerosInBSS - By default some codegens place zero-initialized data to .bss section.
MCSymbol * getSymbol(const GlobalValue *GV, Mangler &Mang) const
bool hasExternalLinkage() const
PossibleRelocationsTy getRelocationInfo() const
getRelocationInfo - This method classifies the entry according to whether or not it may generate a re...
static SectionKind getThreadBSS()
virtual void EmitLabel(MCSymbol *Symbol)
Emit a label for Symbol into the current section.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
const DataLayout * getDataLayout() const
Deprecated in 3.7, will be removed in 3.8.
static SectionKind getDataNoRel()
Type * getType() const
All values are typed, get the type of this value.
static SectionKind getReadOnlyWithRel()
bool isNullValue() const
isNullValue - Return true if this is the value that would be returned by getNullValue.
virtual void emitPersonalityValue(MCStreamer &Streamer, const TargetMachine &TM, const MCSymbol *Sym) const
void InitMCObjectFileInfo(const Triple &TT, Reloc::Model RM, CodeModel::Model CM, MCContext &ctx)
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
virtual const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const
Return an MCExpr to use for a reference to the specified global variable from exception handling info...
static bool IsNullTerminatedString(const Constant *C)
IsNullTerminatedString - Return true if the specified constant (which is known to have a type that is...
static SectionKind getMergeable2ByteCString()
virtual ~TargetLoweringObjectFile()
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
static SectionKind getBSSExtern()
bool hasLocalLinkage() const
const ARM::ArchExtKind Kind
bool hasUnnamedAddr() const
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI) const
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
virtual MCSection * getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const =0
Targets should implement this method to assign a section to globals with an explicit section specfied...
static SectionKind getReadOnly()
MachineModuleInfo - This class contains meta information specific to a module.
This file describes how to lower LLVM code to machine code.
bool empty() const
empty - Check if the string is empty.
static SectionKind getText()