10 #ifndef LLVM_MC_MCASSEMBLER_H
11 #define LLVM_MC_MCASSEMBLER_H
27 #include "llvm/Support/DataTypes.h"
41 class MCSubtargetInfo;
73 bool AlignToBundleEnd;
75 uint8_t BundlePadding;
100 uint8_t BundlePadding,
MCSection *Parent =
nullptr);
156 :
MCFragment(FType, HasInstructions, 0, Sec) {}
175 template<
unsigned ContentsSize>
193 template<
unsigned ContentsSize,
unsigned FixupsSize>
273 Inst(Inst), STI(STI) {}
303 unsigned MaxBytesToEmit;
307 unsigned MaxBytesToEmit,
MCSection *Sec =
nullptr)
309 EmitNops(
false), Value(Value),
310 ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
350 assert((!ValueSize || (Size % ValueSize) == 0) &&
351 "Fill size must be a multiple of the value size!");
445 AddrDelta(&AddrDelta) {
548 typedef std::vector<IndirectSymbolData>::const_iterator
552 typedef std::vector<DataRegionData>::const_iterator
584 std::vector<IndirectSymbolData> IndirectSymbols;
586 std::vector<DataRegionData> DataRegions;
589 std::vector<std::vector<std::string>> LinkerOptions;
592 std::vector<std::string> FileNames;
606 unsigned BundleAlignSize;
608 unsigned RelaxAll : 1;
609 unsigned SubsectionsViaSymbols : 1;
616 unsigned ELFHeaderEFlags;
640 uint64_t &
Value)
const;
664 bool relaxDwarfCallFrameFragment(
MCAsmLayout &Layout,
670 std::pair<uint64_t, bool> handleFixup(
const MCAsmLayout &Layout,
708 VersionMinInfo.
Major = Major;
709 VersionMinInfo.
Minor = Minor;
710 VersionMinInfo.
Update = Update;
756 assert((Size == 0 || !(Size & (Size - 1))) &&
757 "Expect a power-of-two bundle align size");
758 BundleAlignSize = Size;
770 size_t size()
const {
return Sections.size(); }
796 return IndirectSymbols;
800 return IndirectSymbols.begin();
803 return IndirectSymbols.begin();
807 return IndirectSymbols.end();
810 return IndirectSymbols.end();
820 return LinkerOptions;
834 return DataRegions.begin();
839 return DataRegions.end();
862 Sections.push_back(&Section);
872 if (std::find(FileNames.begin(), FileNames.end(), FileName) ==
874 FileNames.push_back(FileName);
891 uint64_t FOffset, uint64_t FSize);
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)
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
MCAlignFragment(unsigned Alignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit, MCSection *Sec=nullptr)
static bool classof(const MCFragment *F)
MCOrgFragment(const MCExpr &Offset, int8_t Value, MCSection *Sec=nullptr)
unsigned getValueSize() const
std::vector< DataRegionData >::iterator data_region_iterator
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta, MCSection *Sec=nullptr)
static bool classof(const MCFragment *F)
const MCLOHContainer & getLOHContainer() const
void setVersionMinInfo(MCVersionMinType Kind, unsigned Major, unsigned Minor, unsigned Update)
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
unsigned getAlignment() const
const MCExpr & getAddrDelta() const
pointee_iterator< SectionListType::const_iterator > const_iterator
std::vector< MCSection * > SectionListType
MCFillFragment(int64_t Value, unsigned ValueSize, uint64_t Size, MCSection *Sec=nullptr)
unsigned getBundleAlignSize() const
const VersionMinInfoType & getVersionMinInfo() const
MachO deployment target version information.
bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
void writeFragmentPadding(const MCFragment &F, uint64_t FSize, MCObjectWriter *OW) const
Write the necessary bundle padding to the given object writer.
Interface implemented by fragments that contain encoded instructions and/or data. ...
MCCodeEmitter & getEmitter() const
static bool classof(const MCFragment *F)
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
This is a compact (memory-size-wise) fragment for holding an encoded instruction (non-relaxable) that...
const MCSubtargetInfo & getSubtargetInfo()
std::vector< IndirectSymbolData > & getIndirectSymbols()
bool registerSection(MCSection &Section)
unsigned getELFHeaderEFlags() const
ELF e_header flags.
MCContext & getContext() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
const MCExpr & getOffset() const
symbol_iterator symbol_begin()
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
const MCInst & getInst() const
enum llvm::DataRegionData::KindTy Kind
Interface implemented by fragments that contain encoded instructions and/or data. ...
fixup_iterator fixup_end()
const_fixup_iterator fixup_end() const
Encapsulates the layout of an assembly file at a particular point in time.
std::vector< DataRegionData >::const_iterator const_data_region_iterator
void setEmitNops(bool Value)
void setRelaxAll(bool Value)
Base class for the full range of assembler expressions which are needed for parsing.
unsigned getMaxBytesToEmit() const
void setAlignToBundleEnd(bool V)
void setSubsectionsViaSymbols(bool Value)
int64_t getLineDelta() const
void destroy()
Destroys the current fragment.
ArrayRef< std::string > getFileNames()
Context object for machine code objects.
void setHasInstructions(bool V)
MCObjectWriter & getWriter() const
static bool classof(const MCFragment *F)
static bool classof(const MCFragment *F)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void setBundleAlignSize(unsigned Size)
const MCSymbol * getSymbol()
MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSection *Sec=nullptr)
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
MCEncodedFragmentWithContents(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
const MCSymbol * getAtom(const MCSymbol &S) const
Find the symbol which defines the atom containing the given symbol, or null if there is no such symbo...
std::vector< IndirectSymbolData >::const_iterator const_indirect_symbol_iterator
SmallVectorImpl< char > & getContents()
const MCExpr & getAddrDelta() const
MCSafeSEHFragment(const MCSymbol *Sym, MCSection *Sec=nullptr)
Instances of this class represent a single low-level machine instruction.
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI, MCSection *Sec=nullptr)
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
const_data_region_iterator data_region_begin() const
static bool classof(const MCFragment *F)
void writeSectionData(const MCSection *Section, const MCAsmLayout &Layout) const
Emit the section contents using the given object writer.
const_symbol_iterator symbol_end() const
ilist_sentinel_traits - A fragment for template traits for intrusive list that provides default senti...
const_fixup_iterator fixup_begin() const
uint64_t computeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const
Compute the effective fragment size assuming it is laid out at the given SectionAddress and FragmentO...
static bool classof(const MCFragment *F)
const_iterator end() const
FragmentType getKind() const
MCCodeEmitter - Generic instruction encoding interface.
static bool classof(const MCFragment *F)
pointee_iterator< SymbolDataListType::iterator > symbol_iterator
SmallVectorImpl< MCFixup > & getFixups()
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
const_symbol_iterator symbol_begin() const
size_t symbol_size() const
void setIsRegistered(bool Value)
bool isRegistered() const
data_region_iterator data_region_begin()
static bool classof(const MCFragment *F)
const SmallString< 8 > & getContents() const
iterator_range< symbol_iterator > symbol_range
const_indirect_symbol_iterator indirect_symbol_end() const
bool isSymbolLinkerVisible(const MCSymbol &SD) const
Check whether a particular symbol is visible to the linker and is required in the symbol table...
PowerPC TLS Dynamic Call Fixup
const SmallVectorImpl< char > & getContents() const
uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCFragment *F, uint64_t FOffset, uint64_t FSize)
Compute the amount of padding required before the fragment F to obey bundling restrictions, where FOffset is the fragment's offset in its section and FSize is the fragment's size.
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
std::vector< std::vector< std::string > > & getLinkerOptions()
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
MCCompactEncodedInstFragment(MCSection *Sec=nullptr)
indirect_symbol_iterator indirect_symbol_begin()
bool isBundlingEnabled() const
An iterator type that allows iterating over the pointees via some other iterator. ...
MCLOHContainer & getLOHContainer()
MCSection * getParent() const
void addFileName(StringRef FileName)
const SmallString< 8 > & getContents() const
A range adaptor for a pair of iterators.
Target - Wrapper for Target specific information.
SmallVectorImpl< MCFixup >::const_iterator const_fixup_iterator
MachO specific deployment target version info.
SmallString< 8 > & getContents()
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
static bool classof(const MCFragment *F)
bool getSubsectionsViaSymbols() const
Interface implemented by fragments that contain encoded instructions and/or data and also have fixups...
const MCSymbol * getAtom() const
ilist_node - Base class that provides next/prev services for nodes that use ilist_nextprev_traits or ...
const_symbol_range symbols() const
static bool classof(const MCFragment *F)
MCAsmBackend & getBackend() const
const SmallString< 8 > & getContents() const
fixup_iterator fixup_begin()
MCSubtargetInfo - Generic base class for all target subtargets.
iterator_range< const_symbol_iterator > const_symbol_range
SmallString< 8 > & getContents()
unsigned getValueSize() const
data_region_iterator data_region_end()
void setLayoutOrder(unsigned Value)
void reset()
Reuse an assembler instance.
Fragment for data and encoded instructions.
const_iterator begin() const
const_data_region_iterator data_region_end() const
const ARM::ArchExtKind Kind
const SmallVectorImpl< MCFixup > & getFixups() const
LLVM Value Representation.
Generic interface to target specific assembler backends.
indirect_symbol_iterator indirect_symbol_end()
This class implements an extremely fast bulk output stream that can only output to a stream...
const MCExpr & getValue() const
unsigned getLayoutOrder() const
static bool classof(const MCFragment *F)
const_indirect_symbol_iterator indirect_symbol_begin() const
StringRef - Represent a constant reference to a string, i.e.
std::vector< DataRegionData > & getDataRegions()
SmallString< 8 > & getContents()
std::vector< IndirectSymbolData >::iterator indirect_symbol_iterator
void setParent(MCSection *Value)
MCDataFragment(MCSection *Sec=nullptr)
MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec=nullptr)
const MCSymbol * getSymbol() const
pointee_iterator< SectionListType::iterator > iterator
void Finish()
Finish - Do final processing and write the object to the output stream.
SmallVectorImpl< MCFixup >::iterator fixup_iterator
void setInst(const MCInst &Value)
pointee_iterator< SymbolDataListType::const_iterator > const_symbol_iterator
size_t data_region_size() const
std::vector< const MCSymbol * > SymbolDataListType
symbol_iterator symbol_end()
void setAtom(const MCSymbol *Value)