Go to the documentation of this file.
9 #ifndef LLVM_MC_MCASSEMBLER_H
10 #define LLVM_MC_MCASSEMBLER_H
36 class MCBoundaryAlignFragment;
37 class MCCVDefRangeFragment;
38 class MCCVInlineLineTableFragment;
39 class MCDwarfCallFrameFragment;
40 class MCDwarfLineAddrFragment;
41 class MCEncodedFragment;
44 class MCPseudoProbeAddrFragment;
45 class MCRelaxableFragment;
46 class MCSymbolRefExpr;
91 std::vector<IndirectSymbolData>::const_iterator;
95 std::vector<DataRegionData>::const_iterator;
102 bool EmitBuildVersion;
117 std::unique_ptr<MCAsmBackend> Backend;
119 std::unique_ptr<MCCodeEmitter> Emitter;
121 std::unique_ptr<MCObjectWriter> Writer;
127 std::vector<IndirectSymbolData> IndirectSymbols;
129 std::vector<DataRegionData> DataRegions;
132 std::vector<std::vector<std::string>> LinkerOptions;
135 std::vector<std::pair<std::string, size_t>> FileNames;
151 unsigned BundleAlignSize;
154 bool SubsectionsViaSymbols : 1;
155 bool IncrementalLinkerCompatible : 1;
162 unsigned ELFHeaderEFlags;
214 bool relaxDwarfCallFrameFragment(
MCAsmLayout &Layout,
224 std::tuple<MCValue, uint64_t, bool>
244 std::unique_ptr<MCCodeEmitter> Emitter,
245 std::unique_ptr<MCObjectWriter> Writer);
284 VersionInfo.EmitBuildVersion =
false;
285 VersionInfo.TypeOrPlatform.Type =
Type;
286 VersionInfo.Major =
Major;
287 VersionInfo.Minor =
Minor;
288 VersionInfo.Update =
Update;
294 VersionInfo.EmitBuildVersion =
true;
295 VersionInfo.TypeOrPlatform.Platform =
Platform;
296 VersionInfo.Major =
Major;
297 VersionInfo.Minor =
Minor;
298 VersionInfo.Update =
Update;
303 return DarwinTargetVariantVersionInfo;
309 DarwinTargetVariantVersionInfo.EmitBuildVersion =
true;
310 DarwinTargetVariantVersionInfo.TypeOrPlatform.Platform =
Platform;
311 DarwinTargetVariantVersionInfo.Major =
Major;
312 DarwinTargetVariantVersionInfo.Minor =
Minor;
313 DarwinTargetVariantVersionInfo.Update =
Update;
314 DarwinTargetVariantVersionInfo.SDKVersion =
SDKVersion;
351 return IncrementalLinkerCompatible;
354 IncrementalLinkerCompatible =
Value;
365 assert((Size == 0 || !(Size & (Size - 1))) &&
366 "Expect a power-of-two bundle align size");
367 BundleAlignSize = Size;
379 size_t size()
const {
return Sections.size(); }
405 return IndirectSymbols;
409 return IndirectSymbols.begin();
412 return IndirectSymbols.begin();
416 return IndirectSymbols.end();
419 return IndirectSymbols.end();
429 return LinkerOptions;
443 return DataRegions.begin();
448 return DataRegions.end();
484 FileNames.emplace_back(std::string(FileName), Symbols.size());
501 const MCEncodedFragment *
F,
uint64_t FOffset,
506 #endif // LLVM_MC_MCASSEMBLER_H
MCAsmBackend & getBackend() const
indirect_symbol_iterator indirect_symbol_end()
unsigned getELFHeaderEFlags() const
ELF e_header flags.
data_region_iterator data_region_begin()
This is an optimization pass for GlobalISel generic memory operations.
std::vector< const MCSymbol * > SymbolDataListType
void Finish()
Finish - Do final processing and write the object to the output stream.
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Fragment representing the binary annotations produced by the .cv_inline_linetable directive.
std::vector< Symver > Symvers
size_t data_region_size() const
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
Context object for machine code objects.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
const_symbol_iterator symbol_begin() const
Target - Wrapper for Target specific information.
MCAssembler & operator=(const MCAssembler &)=delete
std::vector< std::vector< std::string > > & getLinkerOptions()
void setDarwinTargetVariantBuildVersion(MachO::PlatformType Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
void setIsThumbFunc(const MCSymbol *Func)
Flag a function symbol as the target of a .thumb_func directive.
const_indirect_symbol_iterator indirect_symbol_end() const
data_region_iterator data_region_end()
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...
The instances of the Type class are immutable: once they are created, they are never changed.
void reset()
Reuse an assembler instance.
indirect_symbol_iterator indirect_symbol_begin()
void setIncrementalLinkerCompatible(bool Value)
const MCSymbolRefExpr * From
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
const_symbol_range symbols() const
VersionTuple SDKVersion
An optional version of the SDK that was used to build the source.
void writeSectionData(raw_ostream &OS, const MCSection *Section, const MCAsmLayout &Layout) const
Emit the section contents to OS.
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
const_data_region_iterator data_region_begin() const
symbol_iterator symbol_begin()
dxil DXContainer Global Emitter
Generic interface to target specific assembler backends.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Represents a location in source code.
MCContext & getContext() const
const_symbol_iterator symbol_end() const
const MCLOHContainer & getLOHContainer() const
This class implements an extremely fast bulk output stream that can only output to a stream.
Represents a version number in the form major[.minor[.subminor[.build]]].
MCCodeEmitter * getEmitterPtr() const
void setBundleAlignSize(unsigned Size)
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
std::vector< IndirectSymbolData >::const_iterator const_indirect_symbol_iterator
std::vector< DataRegionData > & getDataRegions()
MCObjectWriter * getWriterPtr() const
Interface implemented by fragments that contain encoded instructions and/or data.
MCCodeEmitter & getEmitter() const
const_data_region_iterator data_region_end() const
symbol_iterator symbol_end()
unsigned getBundleAlignSize() const
bool isSymbolLinkerVisible(const MCSymbol &SD) const
Check whether a particular symbol is visible to the linker and is required in the symbol table,...
MCAssembler(MCContext &Context, std::unique_ptr< MCAsmBackend > Backend, std::unique_ptr< MCCodeEmitter > Emitter, std::unique_ptr< MCObjectWriter > Writer)
Construct a new assembler instance.
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...
void setELFHeaderEFlags(unsigned Flags)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
size_t indirect_symbol_size() const
const MCSymbolRefExpr * To
const_iterator begin() const
bool isIncrementalLinkerCompatible() const
void setRelaxAll(bool Value)
std::vector< DataRegionData >::const_iterator const_data_region_iterator
Represent a reference to a symbol from inside an expression.
std::vector< IndirectSymbolData > & getIndirectSymbols()
size_t symbol_size() const
MCVersionMinType Type
Used when EmitBuildVersion==false.
StringRef - Represent a constant reference to a string, i.e.
enum llvm::DataRegionData::KindTy Kind
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Instances of this class represent a uniqued identifier for a section in the current translation unit.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
MutableArrayRef< std::pair< std::string, size_t > > getFileNames()
void setVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion=VersionTuple())
void layout(MCAsmLayout &Layout)
void addFileName(StringRef FileName)
Encapsulates the layout of an assembly file at a particular point in time.
MCCodeEmitter - Generic instruction encoding interface.
MCLOHContainer & getLOHContainer()
MachO::PlatformType Platform
Used when EmitBuildVersion==true.
struct { bool EmitBuildVersion VersionInfoType
MachO specific deployment target version info.
union llvm::MCAssembler::@305 TypeOrPlatform
void setDWARFLinetableParams(MCDwarfLineTableParams P)
bool registerSection(MCSection &Section)
uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCEncodedFragment *F, uint64_t FOffset, uint64_t FSize)
Compute the amount of padding required before the fragment F to obey bundling restrictions,...
const VersionInfoType & getVersionInfo() const
MachO deployment target version information.
void setBuildVersion(MachO::PlatformType Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion=VersionTuple())
const_iterator end() const
const VersionInfoType & getDarwinTargetVariantVersionInfo() const
std::vector< MCSection * > SectionListType
A range adaptor for a pair of iterators.
void setSubsectionsViaSymbols(bool Value)
std::vector< DataRegionData >::iterator data_region_iterator
void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F, uint64_t FSize) const
Write the necessary bundle padding to OS.
This represents an "assembler immediate".
const_indirect_symbol_iterator indirect_symbol_begin() const
MCAsmBackend * getBackendPtr() const
An iterator type that allows iterating over the pointees via some other iterator.
bool getSubsectionsViaSymbols() const
MCDwarfLineTableParams getDWARFLinetableParams() const
std::vector< IndirectSymbolData >::iterator indirect_symbol_iterator
bool isBundlingEnabled() const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Fragment representing the .cv_def_range directive.
LLVM Value Representation.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Represents required padding such that a particular other set of fragments does not cross a particular...
MCObjectWriter & getWriter() const
std::vector< CGProfileEntry > CGProfile