10 #ifndef LLVM_MC_MCASSEMBLER_H
11 #define LLVM_MC_MCASSEMBLER_H
21 #include "llvm/Support/DataTypes.h"
45 void operator=(const
MCFragment&) LLVM_DELETED_FUNCTION;
133 virtual void anchor();
135 uint8_t BundlePadding;
147 return BundlePadding;
171 virtual void anchor();
202 virtual void anchor();
205 bool HasInstructions;
208 bool AlignToBundleEnd;
217 HasInstructions(
false), AlignToBundleEnd(
false)
255 virtual void anchor();
258 bool AlignToBundleEnd;
286 virtual void anchor();
330 virtual void anchor();
343 unsigned MaxBytesToEmit;
354 Value(_Value),ValueSize(_ValueSize),
355 MaxBytesToEmit(_MaxBytesToEmit), EmitNops(
false) {}
379 virtual void anchor();
395 Value(_Value), ValueSize(_ValueSize), Size(_Size) {
396 assert((!ValueSize || (Size % ValueSize) == 0) &&
397 "Fill size must be a multiple of the value size!");
417 virtual void anchor();
428 Offset(&_Offset),
Value(_Value) {}
445 virtual void anchor();
477 virtual void anchor();
493 LineDelta(_LineDelta), AddrDelta(&_AddrDelta) { Contents.
push_back(0); }
513 virtual void anchor();
524 AddrDelta(&_AddrDelta) { Contents.
push_back(0); }
573 unsigned LayoutOrder;
583 bool BundleGroupBeforeFirstInst;
592 unsigned HasInstructions : 1;
648 return BundleLockState;
652 BundleLockState = NewState;
656 return BundleGroupBeforeFirstInst;
660 BundleGroupBeforeFirstInst = IsFirst;
750 assert(
isCommon() &&
"Not a 'common' symbol!");
765 assert(
isCommon() &&
"Not a 'common' symbol!");
823 typedef std::vector<IndirectSymbolData>::const_iterator
827 typedef std::vector<DataRegionData>::const_iterator
833 void operator=(const
MCAssembler&) LLVM_DELETED_FUNCTION;
864 std::vector<std::vector<std::
string> > LinkerOptions;
881 unsigned BundleAlignSize;
884 unsigned NoExecStack : 1;
885 unsigned SubsectionsViaSymbols : 1;
892 unsigned ELFHeaderEFlags;
933 bool relaxDwarfCallFrameFragment(
MCAsmLayout &Layout,
964 return ThumbFuncs.
count(Func);
1007 return SubsectionsViaSymbols;
1010 SubsectionsViaSymbols = Value;
1020 return BundleAlignSize != 0;
1024 return BundleAlignSize;
1028 assert((Size == 0 || !(Size & (Size - 1))) &&
1029 "Expect a power-of-two bundle align size");
1030 BundleAlignSize = Size;
1045 size_t size()
const {
return Sections.size(); }
1070 return IndirectSymbols;
1074 return IndirectSymbols.begin();
1077 return IndirectSymbols.begin();
1081 return IndirectSymbols.end();
1084 return IndirectSymbols.end();
1094 return LinkerOptions;
1109 return DataRegions.begin();
1112 return DataRegions.begin();
1116 return DataRegions.end();
1119 return DataRegions.end();
1130 assert(Entry &&
"Missing section data!");
1135 bool *Created = 0) {
1138 if (Created) *Created = !Entry;
1147 assert(Entry &&
"Missing symbol data!");
1152 bool *Created = 0) {
1155 if (Created) *Created = !Entry;
1163 return FileNames.begin();
1167 return FileNames.end();
1173 FileNames.push_back(FileName);
void setParent(MCSectionData *Value)
void setIsThumbFunc(const MCSymbol *Func)
Flag a function symbol as the target of a .thumb_func directive.
size_t indirect_symbol_size() const
void setELFHeaderEFlags(unsigned Flags)
void push_back(const T &Elt)
void setExternal(bool Value)
fixup_iterator fixup_end()
static bool classof(const MCFragment *F)
unsigned getValueSize() const
std::vector< DataRegionData >::iterator data_region_iterator
virtual ~MCEncodedFragment()
void setFlags(uint32_t Value)
setFlags - Set the (implementation defined) symbol flags.
bool isBundleLocked() const
virtual bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
const_reverse_iterator rbegin() const
FragmentListType::const_reverse_iterator const_reverse_iterator
const MCExpr * getSize() const
static bool classof(const MCFragment *F)
void setBundleLockState(BundleLockStateType NewState)
unsigned getAlignment() const
const MCExpr & getAddrDelta() const
MCFillFragment(int64_t _Value, unsigned _ValueSize, uint64_t _Size, MCSectionData *SD=0)
SmallVectorImpl< MCFixup >::iterator fixup_iterator
unsigned getBundleAlignSize() const
bool getNoExecStack() const
virtual const SmallVectorImpl< char > & getContents() const
MCDataFragment(MCSectionData *SD=0)
SmallVectorImpl< MCFixup >::const_iterator const_fixup_iterator
MCDwarfLineAddrFragment(int64_t _LineDelta, const MCExpr &_AddrDelta, MCSectionData *SD=0)
MCCodeEmitter & getEmitter() const
SymbolDataListType::const_iterator const_symbol_iterator
virtual SmallVectorImpl< char > & getContents()
void setBundleGroupBeforeFirstInst(bool IsFirst)
SymbolDataListType & getSymbolList()
std::vector< IndirectSymbolData > & getIndirectSymbols()
bool hasInstructions() const
unsigned getELFHeaderEFlags() const
ELF e_header flags.
MCContext & getContext() const
virtual bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
const MCSymbol & getSymbol() const
const FragmentListType & getFragmentList() const
const MCExpr & getOffset() const
BundleLockStateType getBundleLockState() const
symbol_iterator symbol_begin()
const MCInst & getInst() const
MCAlignFragment(unsigned _Alignment, int64_t _Value, unsigned _ValueSize, unsigned _MaxBytesToEmit, MCSectionData *SD=0)
reverse_iterator rbegin()
MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSectionData *SD=0)
virtual const SmallVectorImpl< char > & getContents() const
const_iterator begin() const
enum llvm::DataRegionData::KindTy Kind
SmallVectorImpl< MCFixup > & getFixups()
virtual SmallVectorImpl< char > & getContents()=0
uint64_t getIndex() const
getIndex - Get the (implementation defined) index.
virtual uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment. Used for bundling. By default, no padding is inserted. Note that padding size is restricted to 8 bits. This is an optimization to reduce the amount of space used for each fragment. In practice, larger padding should never be required.
iplist< MCFragment > FragmentListType
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, MCSectionData *SD=0)
const MCSymbolData * getAtom(const MCSymbolData *Symbol) const
std::vector< DataRegionData >::const_iterator const_data_region_iterator
virtual bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
void setEmitNops(bool Value)
virtual fixup_iterator fixup_end()=0
unsigned IsPrivateExtern
IsPrivateExtern - True if this symbol is private extern.
void setRelaxAll(bool Value)
virtual void setAlignToBundleEnd(bool V)
virtual bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
virtual bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
unsigned getMaxBytesToEmit() const
SectionDataListType::const_iterator const_iterator
virtual fixup_iterator fixup_begin()=0
uint64_t getCommonSize() const
getCommonSize - Return the size of a 'common' symbol.
MCSectionData & getSectionData(const MCSection &Section) const
const SymbolDataListType & getSymbolList() const
BundleLockStateType
Express the state of bundle locked groups while emitting code.
void setSubsectionsViaSymbols(bool Value)
int64_t getLineDelta() const
MCRelaxableFragment(const MCInst &_Inst, MCSectionData *SD=0)
reverse_iterator rbegin()
bool count(PtrType Ptr) const
count - Return true if the specified pointer is in the set.
MCObjectWriter & getWriter() const
static bool classof(const MCFragment *F)
static bool classof(const MCFragment *F)
iplist< MCSymbolData > SymbolDataListType
MCFragment * getFragment() const
void setBundleAlignSize(unsigned Size)
std::vector< IndirectSymbolData >::const_iterator const_indirect_symbol_iterator
const MCSection & getSection() const
const MCExpr & getAddrDelta() const
const SmallVectorImpl< MCFixup > & getFixups() const
void setAtom(MCSymbolData *Value)
unsigned getOrdinal() const
virtual ~MCEncodedFragmentWithFixups()
virtual void setBundlePadding(uint8_t N)
Set the padding size for this fragment. By default it's a no-op, and only some fragments have a meani...
const_data_region_iterator data_region_begin() const
static bool classof(const MCFragment *F)
virtual void setBundlePadding(uint8_t N)
Set the padding size for this fragment. By default it's a no-op, and only some fragments have a meani...
MCSectionData * getParent() const
void setPrivateExtern(bool Value)
MCOrgFragment(const MCExpr &_Offset, int8_t _Value, MCSectionData *SD=0)
SectionDataListType & getSectionList()
const_symbol_iterator symbol_end() const
unsigned getLayoutOrder() const
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const
void setNoExecStack(bool Value)
void setLayoutOrder(unsigned Value)
uint64_t computeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const
static bool classof(const MCFragment *F)
uint32_t getFlags() const
getFlags - Get the (implementation defined) symbol flags.
const_iterator end() const
void setCommon(uint64_t Size, unsigned Align)
FragmentType getKind() const
MCCodeEmitter - Generic instruction encoding interface.
MCSymbolData * getAtom() const
virtual void setHasInstructions(bool V)
virtual void setAlignToBundleEnd(bool V)
MCDwarfCallFrameFragment(const MCExpr &_AddrDelta, MCSectionData *SD=0)
const SmallVectorImpl< MCFixup > & getFixups() const
void setOrdinal(unsigned Value)
uint64_t getOffset() const
virtual SmallVectorImpl< char > & getContents()
void setIndex(uint64_t Value)
setIndex - Set the (implementation defined) index.
const_symbol_iterator symbol_begin() const
FragmentListType & getFragmentList()
FileNameVectorType::const_iterator const_file_name_iterator
size_t symbol_size() const
MCFragment * Fragment
Fragment - The fragment this symbol's value is relative to, if any.
virtual const SmallVectorImpl< char > & getContents() const
iplist< MCSectionData > SectionDataListType
data_region_iterator data_region_begin()
static bool classof(const MCFragment *F)
const SmallString< 8 > & getContents() const
MCSymbolData & getOrCreateSymbolData(const MCSymbol &Symbol, bool *Created=0)
const_indirect_symbol_iterator indirect_symbol_end() const
MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD=0)
bool isSymbolLinkerVisible(const MCSymbol &SD) const
const_fixup_iterator fixup_end() const
MCSymbolData & getSymbolData(const MCSymbol &Symbol) const
virtual SmallVectorImpl< char > & getContents()
std::vector< std::vector< std::string > > & getLinkerOptions()
virtual void setAlignToBundleEnd(bool V)
const_fixup_iterator fixup_begin() const
void setOffset(uint64_t Value)
indirect_symbol_iterator indirect_symbol_begin()
std::vector< std::string > FileNameVectorType
unsigned getCommonAlignment() const
getCommonAlignment - Return the alignment of a 'common' symbol.
const_iterator end() const
uint64_t Index
Index - Index field, for use by the object file implementation.
bool isBundlingEnabled() const
unsigned getAlignment() const
bool isCommon() const
isCommon - Is this a 'common' symbol.
const_file_name_iterator file_names_begin() const
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
void addFileName(StringRef FileName)
virtual bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
const SmallString< 8 > & getContents() const
void setHasInstructions(bool Value)
#define LLVM_DELETED_FUNCTION
const MCExpr * SymbolSize
unsigned CommonAlign
CommonAlign - The alignment of the symbol, if it is 'common'.
virtual bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
const_file_name_iterator file_names_end() const
SmallString< 8 > & getContents()
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
void setSize(const MCExpr *SS)
const SectionDataListType & getSectionList() const
FragmentListType::reverse_iterator reverse_iterator
MCSectionData * SectionData
static bool classof(const MCFragment *F)
bool getSubsectionsViaSymbols() const
uint64_t CommonSize
CommonSize - The size of the symbol, if it is 'common', or 0.
MCSectionData & getOrCreateSectionData(const MCSection &Section, bool *Created=0)
static bool classof(const MCFragment *F)
MCAsmBackend & getBackend() const
const SmallString< 8 > & getContents() const
void setFragment(MCFragment *Value)
const_reverse_iterator rend() const
fixup_iterator fixup_end()
void setAlignment(unsigned Value)
SmallString< 8 > & getContents()
fixup_iterator fixup_begin()
SectionDataListType::iterator iterator
unsigned getValueSize() const
static bool classof(const MCFragment *F)
data_region_iterator data_region_end()
const_fixup_iterator fixup_begin() const
void setLayoutOrder(unsigned Value)
const_iterator begin() const
fixup_iterator fixup_begin()
const_data_region_iterator data_region_end() const
LLVM Value Representation.
MCAsmBackend - Generic interface to target specific assembler backends.
bool isPrivateExtern() const
indirect_symbol_iterator indirect_symbol_end()
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
void writeSectionData(const MCSectionData *Section, const MCAsmLayout &Layout) const
Emit the section contents using the given object writer.
const MCExpr & getValue() const
virtual SmallVectorImpl< MCFixup > & getFixups()=0
unsigned getLayoutOrder() const
static bool classof(const MCFragment *F)
const_indirect_symbol_iterator indirect_symbol_begin() const
std::vector< DataRegionData > & getDataRegions()
SmallString< 8 > & getContents()
std::vector< IndirectSymbolData >::iterator indirect_symbol_iterator
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
MCCompactEncodedInstFragment(MCSectionData *SD=0)
SymbolDataListType::iterator symbol_iterator
iterator getSubsectionInsertionPoint(unsigned Subsection)
void setInst(const MCInst &Value)
FragmentListType::iterator iterator
virtual uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment. Used for bundling. By default, no padding is inserted. Note that padding size is restricted to 8 bits. This is an optimization to reduce the amount of space used for each fragment. In practice, larger padding should never be required.
SmallVectorImpl< MCFixup > & getFixups()
size_t data_region_size() const
const_fixup_iterator fixup_end() const
void modifyFlags(uint32_t Value, uint32_t Mask)
modifyFlags - Modify the flags via a mask
bool isBundleGroupBeforeFirstInst() const
symbol_iterator symbol_end()