LLVM  16.0.0git
MCAssembler.h
Go to the documentation of this file.
1 //===- MCAssembler.h - Object File Generation -------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_MC_MCASSEMBLER_H
10 #define LLVM_MC_MCASSEMBLER_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/SmallPtrSet.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/ADT/iterator.h"
18 #include "llvm/MC/MCDirectives.h"
19 #include "llvm/MC/MCDwarf.h"
21 #include "llvm/MC/MCSymbol.h"
22 #include "llvm/Support/SMLoc.h"
24 #include <algorithm>
25 #include <cassert>
26 #include <cstddef>
27 #include <cstdint>
28 #include <memory>
29 #include <string>
30 #include <tuple>
31 #include <utility>
32 #include <vector>
33 
34 namespace llvm {
35 
36 class MCBoundaryAlignFragment;
37 class MCCVDefRangeFragment;
38 class MCCVInlineLineTableFragment;
39 class MCDwarfCallFrameFragment;
40 class MCDwarfLineAddrFragment;
41 class MCEncodedFragment;
42 class MCFixup;
43 class MCLEBFragment;
44 class MCPseudoProbeAddrFragment;
45 class MCRelaxableFragment;
46 class MCSymbolRefExpr;
47 class raw_ostream;
48 class MCAsmBackend;
49 class MCAsmLayout;
50 class MCContext;
51 class MCCodeEmitter;
52 class MCFragment;
53 class MCObjectWriter;
54 class MCSection;
55 class MCValue;
56 
57 // FIXME: This really doesn't belong here. See comments below.
61 };
62 
63 // FIXME: Ditto this. Purely so the Streamer and the ObjectWriter can talk
64 // to one another.
66  // This enum should be kept in sync w/ the mach-o definition in
67  // llvm/Object/MachOFormat.h.
71 };
72 
73 class MCAssembler {
74  friend class MCAsmLayout;
75 
76 public:
77  using SectionListType = std::vector<MCSection *>;
78  using SymbolDataListType = std::vector<const MCSymbol *>;
79 
82 
83  using const_symbol_iterator =
86 
89 
91  std::vector<IndirectSymbolData>::const_iterator;
92  using indirect_symbol_iterator = std::vector<IndirectSymbolData>::iterator;
93 
95  std::vector<DataRegionData>::const_iterator;
96  using data_region_iterator = std::vector<DataRegionData>::iterator;
97 
98  /// MachO specific deployment target version info.
99  // A Major version of 0 indicates that no version information was supplied
100  // and so the corresponding load command should not be emitted.
101  using VersionInfoType = struct {
102  bool EmitBuildVersion;
103  union {
104  MCVersionMinType Type; ///< Used when EmitBuildVersion==false.
105  MachO::PlatformType Platform; ///< Used when EmitBuildVersion==true.
106  } TypeOrPlatform;
107  unsigned Major;
108  unsigned Minor;
109  unsigned Update;
110  /// An optional version of the SDK that was used to build the source.
112  };
113 
114 private:
115  MCContext &Context;
116 
117  std::unique_ptr<MCAsmBackend> Backend;
118 
119  std::unique_ptr<MCCodeEmitter> Emitter;
120 
121  std::unique_ptr<MCObjectWriter> Writer;
122 
123  SectionListType Sections;
124 
125  SymbolDataListType Symbols;
126 
127  std::vector<IndirectSymbolData> IndirectSymbols;
128 
129  std::vector<DataRegionData> DataRegions;
130 
131  /// The list of linker options to propagate into the object file.
132  std::vector<std::vector<std::string>> LinkerOptions;
133 
134  /// List of declared file names
135  std::vector<std::pair<std::string, size_t>> FileNames;
136 
137  MCDwarfLineTableParams LTParams;
138 
139  /// The set of function symbols for which a .thumb_func directive has
140  /// been seen.
141  //
142  // FIXME: We really would like this in target specific code rather than
143  // here. Maybe when the relocation stuff moves to target specific,
144  // this can go with it? The streamer would need some target specific
145  // refactoring too.
146  mutable SmallPtrSet<const MCSymbol *, 32> ThumbFuncs;
147 
148  /// The bundle alignment size currently set in the assembler.
149  ///
150  /// By default it's 0, which means bundling is disabled.
151  unsigned BundleAlignSize;
152 
153  bool RelaxAll : 1;
154  bool SubsectionsViaSymbols : 1;
155  bool IncrementalLinkerCompatible : 1;
156 
157  /// ELF specific e_header flags
158  // It would be good if there were an MCELFAssembler class to hold this.
159  // ELF header flags are used both by the integrated and standalone assemblers.
160  // Access to the flags is necessary in cases where assembler directives affect
161  // which flags to be set.
162  unsigned ELFHeaderEFlags;
163 
164  /// Used to communicate Linker Optimization Hint information between
165  /// the Streamer and the .o writer
166  MCLOHContainer LOHContainer;
167 
168  VersionInfoType VersionInfo;
169  VersionInfoType DarwinTargetVariantVersionInfo;
170 
171  /// Evaluate a fixup to a relocatable expression and the value which should be
172  /// placed into the fixup.
173  ///
174  /// \param Layout The layout to use for evaluation.
175  /// \param Fixup The fixup to evaluate.
176  /// \param DF The fragment the fixup is inside.
177  /// \param Target [out] On return, the relocatable expression the fixup
178  /// evaluates to.
179  /// \param Value [out] On return, the value of the fixup as currently laid
180  /// out.
181  /// \param WasForced [out] On return, the value in the fixup is set to the
182  /// correct value if WasForced is true, even if evaluateFixup returns false.
183  /// \return Whether the fixup value was fully resolved. This is true if the
184  /// \p Value result is fixed, otherwise the value may change due to
185  /// relocation.
186  bool evaluateFixup(const MCAsmLayout &Layout, const MCFixup &Fixup,
187  const MCFragment *DF, MCValue &Target,
188  uint64_t &Value, bool &WasForced) const;
189 
190  /// Check whether a fixup can be satisfied, or whether it needs to be relaxed
191  /// (increased in size, in order to hold its value correctly).
192  bool fixupNeedsRelaxation(const MCFixup &Fixup, const MCRelaxableFragment *DF,
193  const MCAsmLayout &Layout) const;
194 
195  /// Check whether the given fragment needs relaxation.
196  bool fragmentNeedsRelaxation(const MCRelaxableFragment *IF,
197  const MCAsmLayout &Layout) const;
198 
199  /// Perform one layout iteration and return true if any offsets
200  /// were adjusted.
201  bool layoutOnce(MCAsmLayout &Layout);
202 
203  /// Perform one layout iteration of the given section and return true
204  /// if any offsets were adjusted.
205  bool layoutSectionOnce(MCAsmLayout &Layout, MCSection &Sec);
206 
207  /// Perform relaxation on a single fragment - returns true if the fragment
208  /// changes as a result of relaxation.
209  bool relaxFragment(MCAsmLayout &Layout, MCFragment &F);
210  bool relaxInstruction(MCAsmLayout &Layout, MCRelaxableFragment &IF);
211  bool relaxLEB(MCAsmLayout &Layout, MCLEBFragment &IF);
212  bool relaxBoundaryAlign(MCAsmLayout &Layout, MCBoundaryAlignFragment &BF);
213  bool relaxDwarfLineAddr(MCAsmLayout &Layout, MCDwarfLineAddrFragment &DF);
214  bool relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
216  bool relaxCVInlineLineTable(MCAsmLayout &Layout,
218  bool relaxCVDefRange(MCAsmLayout &Layout, MCCVDefRangeFragment &DF);
219  bool relaxPseudoProbeAddr(MCAsmLayout &Layout, MCPseudoProbeAddrFragment &DF);
220 
221  /// finishLayout - Finalize a layout, including fragment lowering.
222  void finishLayout(MCAsmLayout &Layout);
223 
224  std::tuple<MCValue, uint64_t, bool>
225  handleFixup(const MCAsmLayout &Layout, MCFragment &F, const MCFixup &Fixup);
226 
227 public:
228  struct Symver {
230  const MCSymbol *Sym;
232  // True if .symver *, *@@@* or .symver *, *, remove.
234  };
235  std::vector<Symver> Symvers;
236 
237  /// Construct a new assembler instance.
238  //
239  // FIXME: How are we going to parameterize this? Two obvious options are stay
240  // concrete and require clients to pass in a target like object. The other
241  // option is to make this abstract, and have targets provide concrete
242  // implementations as we do with AsmParser.
243  MCAssembler(MCContext &Context, std::unique_ptr<MCAsmBackend> Backend,
244  std::unique_ptr<MCCodeEmitter> Emitter,
245  std::unique_ptr<MCObjectWriter> Writer);
246  MCAssembler(const MCAssembler &) = delete;
247  MCAssembler &operator=(const MCAssembler &) = delete;
248  ~MCAssembler();
249 
250  /// Compute the effective fragment size assuming it is laid out at the given
251  /// \p SectionAddress and \p FragmentOffset.
253  const MCFragment &F) const;
254 
255  /// Find the symbol which defines the atom containing the given symbol, or
256  /// null if there is no such symbol.
257  const MCSymbol *getAtom(const MCSymbol &S) const;
258 
259  /// Check whether a particular symbol is visible to the linker and is required
260  /// in the symbol table, or whether it can be discarded by the assembler. This
261  /// also effects whether the assembler treats the label as potentially
262  /// defining a separate atom.
263  bool isSymbolLinkerVisible(const MCSymbol &SD) const;
264 
265  /// Emit the section contents to \p OS.
266  void writeSectionData(raw_ostream &OS, const MCSection *Section,
267  const MCAsmLayout &Layout) const;
268 
269  /// Check whether a given symbol has been flagged with .thumb_func.
270  bool isThumbFunc(const MCSymbol *Func) const;
271 
272  /// Flag a function symbol as the target of a .thumb_func directive.
273  void setIsThumbFunc(const MCSymbol *Func) { ThumbFuncs.insert(Func); }
274 
275  /// ELF e_header flags
276  unsigned getELFHeaderEFlags() const { return ELFHeaderEFlags; }
277  void setELFHeaderEFlags(unsigned Flags) { ELFHeaderEFlags = Flags; }
278 
279  /// MachO deployment target version information.
280  const VersionInfoType &getVersionInfo() const { return VersionInfo; }
281  void setVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor,
282  unsigned Update,
284  VersionInfo.EmitBuildVersion = false;
285  VersionInfo.TypeOrPlatform.Type = Type;
286  VersionInfo.Major = Major;
287  VersionInfo.Minor = Minor;
288  VersionInfo.Update = Update;
289  VersionInfo.SDKVersion = SDKVersion;
290  }
292  unsigned Minor, unsigned Update,
294  VersionInfo.EmitBuildVersion = true;
295  VersionInfo.TypeOrPlatform.Platform = Platform;
296  VersionInfo.Major = Major;
297  VersionInfo.Minor = Minor;
298  VersionInfo.Update = Update;
299  VersionInfo.SDKVersion = SDKVersion;
300  }
301 
303  return DarwinTargetVariantVersionInfo;
304  }
306  unsigned Major, unsigned Minor,
307  unsigned Update,
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;
315  }
316 
317  /// Reuse an assembler instance
318  ///
319  void reset();
320 
321  MCContext &getContext() const { return Context; }
322 
323  MCAsmBackend *getBackendPtr() const { return Backend.get(); }
324 
325  MCCodeEmitter *getEmitterPtr() const { return Emitter.get(); }
326 
327  MCObjectWriter *getWriterPtr() const { return Writer.get(); }
328 
329  MCAsmBackend &getBackend() const { return *Backend; }
330 
331  MCCodeEmitter &getEmitter() const { return *Emitter; }
332 
333  MCObjectWriter &getWriter() const { return *Writer; }
334 
335  MCDwarfLineTableParams getDWARFLinetableParams() const { return LTParams; }
337 
338  /// Finish - Do final processing and write the object to the output stream.
339  /// \p Writer is used for custom object writer (as the MCJIT does),
340  /// if not specified it is automatically created from backend.
341  void Finish();
342 
343  // Layout all section and prepare them for emission.
344  void layout(MCAsmLayout &Layout);
345 
346  // FIXME: This does not belong here.
347  bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; }
348  void setSubsectionsViaSymbols(bool Value) { SubsectionsViaSymbols = Value; }
349 
351  return IncrementalLinkerCompatible;
352  }
354  IncrementalLinkerCompatible = Value;
355  }
356 
357  bool getRelaxAll() const { return RelaxAll; }
358  void setRelaxAll(bool Value) { RelaxAll = Value; }
359 
360  bool isBundlingEnabled() const { return BundleAlignSize != 0; }
361 
362  unsigned getBundleAlignSize() const { return BundleAlignSize; }
363 
364  void setBundleAlignSize(unsigned Size) {
365  assert((Size == 0 || !(Size & (Size - 1))) &&
366  "Expect a power-of-two bundle align size");
367  BundleAlignSize = Size;
368  }
369 
370  /// \name Section List Access
371  /// @{
372 
373  iterator begin() { return Sections.begin(); }
374  const_iterator begin() const { return Sections.begin(); }
375 
376  iterator end() { return Sections.end(); }
377  const_iterator end() const { return Sections.end(); }
378 
379  size_t size() const { return Sections.size(); }
380 
381  /// @}
382  /// \name Symbol List Access
383  /// @{
384  symbol_iterator symbol_begin() { return Symbols.begin(); }
385  const_symbol_iterator symbol_begin() const { return Symbols.begin(); }
386 
387  symbol_iterator symbol_end() { return Symbols.end(); }
388  const_symbol_iterator symbol_end() const { return Symbols.end(); }
389 
392  return make_range(symbol_begin(), symbol_end());
393  }
394 
395  size_t symbol_size() const { return Symbols.size(); }
396 
397  /// @}
398  /// \name Indirect Symbol List Access
399  /// @{
400 
401  // FIXME: This is a total hack, this should not be here. Once things are
402  // factored so that the streamer has direct access to the .o writer, it can
403  // disappear.
404  std::vector<IndirectSymbolData> &getIndirectSymbols() {
405  return IndirectSymbols;
406  }
407 
409  return IndirectSymbols.begin();
410  }
412  return IndirectSymbols.begin();
413  }
414 
416  return IndirectSymbols.end();
417  }
419  return IndirectSymbols.end();
420  }
421 
422  size_t indirect_symbol_size() const { return IndirectSymbols.size(); }
423 
424  /// @}
425  /// \name Linker Option List Access
426  /// @{
427 
428  std::vector<std::vector<std::string>> &getLinkerOptions() {
429  return LinkerOptions;
430  }
431 
432  /// @}
433  /// \name Data Region List Access
434  /// @{
435 
436  // FIXME: This is a total hack, this should not be here. Once things are
437  // factored so that the streamer has direct access to the .o writer, it can
438  // disappear.
439  std::vector<DataRegionData> &getDataRegions() { return DataRegions; }
440 
441  data_region_iterator data_region_begin() { return DataRegions.begin(); }
443  return DataRegions.begin();
444  }
445 
446  data_region_iterator data_region_end() { return DataRegions.end(); }
448  return DataRegions.end();
449  }
450 
451  size_t data_region_size() const { return DataRegions.size(); }
452 
453  /// @}
454  /// \name Data Region List Access
455  /// @{
456 
457  // FIXME: This is a total hack, this should not be here. Once things are
458  // factored so that the streamer has direct access to the .o writer, it can
459  // disappear.
460  MCLOHContainer &getLOHContainer() { return LOHContainer; }
462  return const_cast<MCAssembler *>(this)->getLOHContainer();
463  }
464 
465  struct CGProfileEntry {
469  };
470  std::vector<CGProfileEntry> CGProfile;
471  /// @}
472  /// \name Backend Data Access
473  /// @{
474 
475  bool registerSection(MCSection &Section);
476 
477  void registerSymbol(const MCSymbol &Symbol, bool *Created = nullptr);
478 
480  return FileNames;
481  }
482 
483  void addFileName(StringRef FileName) {
484  FileNames.emplace_back(std::string(FileName), Symbols.size());
485  }
486 
487  /// Write the necessary bundle padding to \p OS.
488  /// Expects a fragment \p F containing instructions and its size \p FSize.
490  uint64_t FSize) const;
491 
492  /// @}
493 
494  void dump() const;
495 };
496 
497 /// Compute the amount of padding required before the fragment \p F to
498 /// obey bundling restrictions, where \p FOffset is the fragment's offset in
499 /// its section and \p FSize is the fragment's size.
500 uint64_t computeBundlePadding(const MCAssembler &Assembler,
501  const MCEncodedFragment *F, uint64_t FOffset,
502  uint64_t FSize);
503 
504 } // end namespace llvm
505 
506 #endif // LLVM_MC_MCASSEMBLER_H
llvm::MCAssembler::getBackend
MCAsmBackend & getBackend() const
Definition: MCAssembler.h:329
llvm::MCAssembler::begin
iterator begin()
Definition: MCAssembler.h:373
llvm::DataRegionData::Data
@ Data
Definition: MCAssembler.h:68
llvm::MCAssembler::indirect_symbol_end
indirect_symbol_iterator indirect_symbol_end()
Definition: MCAssembler.h:415
llvm::MCAssembler::getELFHeaderEFlags
unsigned getELFHeaderEFlags() const
ELF e_header flags.
Definition: MCAssembler.h:276
llvm::MCVersionMinType
MCVersionMinType
Definition: MCDirectives.h:67
llvm::MCAssembler::data_region_begin
data_region_iterator data_region_begin()
Definition: MCAssembler.h:441
MCDwarf.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::MCAssembler::SymbolDataListType
std::vector< const MCSymbol * > SymbolDataListType
Definition: MCAssembler.h:78
llvm::MCAssembler::Finish
void Finish()
Finish - Do final processing and write the object to the output stream.
Definition: MCAssembler.cpp:935
llvm::MCRelaxableFragment
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:270
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::MCCVInlineLineTableFragment
Fragment representing the binary annotations produced by the .cv_inline_linetable directive.
Definition: MCFragment.h:515
llvm::MCAssembler::Symvers
std::vector< Symver > Symvers
Definition: MCAssembler.h:235
llvm::MCAssembler::data_region_size
size_t data_region_size() const
Definition: MCAssembler.h:451
llvm::DataRegionData::Start
MCSymbol * Start
Definition: MCAssembler.h:69
llvm::MCAssembler::registerSymbol
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
Definition: MCAssembler.cpp:467
llvm::MCDwarfCallFrameFragment
Definition: MCFragment.h:480
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:76
StringRef.h
P
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
Definition: README-SSE.txt:411
llvm::MCAssembler::symbol_begin
const_symbol_iterator symbol_begin() const
Definition: MCAssembler.h:385
MCDirectives.h
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:145
llvm::MCAssembler::operator=
MCAssembler & operator=(const MCAssembler &)=delete
llvm::MCAssembler::getLinkerOptions
std::vector< std::vector< std::string > > & getLinkerOptions()
Definition: MCAssembler.h:428
llvm::AMDGPUISD::IF
@ IF
Definition: AMDGPUISelLowering.h:358
llvm::DataRegionData::JumpTable32
@ JumpTable32
Definition: MCAssembler.h:68
llvm::MCAssembler::setDarwinTargetVariantBuildVersion
void setDarwinTargetVariantBuildVersion(MachO::PlatformType Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Definition: MCAssembler.h:305
VersionTuple.h
llvm::MCAssembler::setIsThumbFunc
void setIsThumbFunc(const MCSymbol *Func)
Flag a function symbol as the target of a .thumb_func directive.
Definition: MCAssembler.h:273
llvm::MCAssembler::indirect_symbol_end
const_indirect_symbol_iterator indirect_symbol_end() const
Definition: MCAssembler.h:418
llvm::DataRegionData::JumpTable8
@ JumpTable8
Definition: MCAssembler.h:68
llvm::MCAssembler::data_region_end
data_region_iterator data_region_end()
Definition: MCAssembler.h:446
llvm::MCAssembler::computeFragmentSize
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...
Definition: MCAssembler.cpp:293
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::MCAssembler::reset
void reset()
Reuse an assembler instance.
Definition: MCAssembler.cpp:98
llvm::DataRegionData::KindTy
KindTy
Definition: MCAssembler.h:68
llvm::MCAssembler::Symver::Loc
SMLoc Loc
Definition: MCAssembler.h:229
llvm::MCAssembler::indirect_symbol_begin
indirect_symbol_iterator indirect_symbol_begin()
Definition: MCAssembler.h:408
llvm::MCAssembler::setIncrementalLinkerCompatible
void setIncrementalLinkerCompatible(bool Value)
Definition: MCAssembler.h:353
llvm::MCAssembler::CGProfileEntry::From
const MCSymbolRefExpr * From
Definition: MCAssembler.h:466
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:450
llvm::MCAssembler::symbols
const_symbol_range symbols() const
Definition: MCAssembler.h:391
llvm::MCAssembler::SDKVersion
VersionTuple SDKVersion
An optional version of the SDK that was used to build the source.
Definition: MCAssembler.h:111
llvm::MCAssembler::writeSectionData
void writeSectionData(raw_ostream &OS, const MCSection *Section, const MCAsmLayout &Layout) const
Emit the section contents to OS.
Definition: MCAssembler.cpp:731
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::MCAssembler::isThumbFunc
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
Definition: MCAssembler.cpp:135
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::MCAssembler::data_region_begin
const_data_region_iterator data_region_begin() const
Definition: MCAssembler.h:442
llvm::MCFragment
Definition: MCFragment.h:30
llvm::MCLOHContainer
Definition: MCLinkerOptimizationHint.h:136
llvm::MCAssembler::symbol_begin
symbol_iterator symbol_begin()
Definition: MCAssembler.h:384
llvm::MCAsmBackend
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
llvm::MCAssembler::Symver::Sym
const MCSymbol * Sym
Definition: MCAssembler.h:230
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:28
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::MCAssembler::getContext
MCContext & getContext() const
Definition: MCAssembler.h:321
llvm::MCDwarfLineTableParams
Definition: MCDwarf.h:244
llvm::MCAssembler::CGProfileEntry::Count
uint64_t Count
Definition: MCAssembler.h:468
MCSymbol.h
llvm::DataRegionData::End
MCSymbol * End
Definition: MCAssembler.h:70
llvm::MCAssembler::symbols
symbol_range symbols()
Definition: MCAssembler.h:390
llvm::DataRegionData
Definition: MCAssembler.h:65
SMLoc.h
llvm::MCAssembler::symbol_end
const_symbol_iterator symbol_end() const
Definition: MCAssembler.h:388
llvm::MCAssembler::getLOHContainer
const MCLOHContainer & getLOHContainer() const
Definition: MCAssembler.h:461
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::MachO::PlatformType
PlatformType
Definition: MachO.h:497
llvm::VersionTuple
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:31
SmallPtrSet.h
llvm::MCAssembler::getEmitterPtr
MCCodeEmitter * getEmitterPtr() const
Definition: MCAssembler.h:325
llvm::MCAssembler::Minor
unsigned Minor
Definition: MCAssembler.h:108
llvm::MCAssembler::setBundleAlignSize
void setBundleAlignSize(unsigned Size)
Definition: MCAssembler.h:364
DF
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
llvm::MCAssembler::const_indirect_symbol_iterator
std::vector< IndirectSymbolData >::const_iterator const_indirect_symbol_iterator
Definition: MCAssembler.h:91
llvm::MCDwarfLineAddrFragment
Definition: MCFragment.h:456
llvm::MCAssembler::getDataRegions
std::vector< DataRegionData > & getDataRegions()
Definition: MCAssembler.h:439
llvm::IndirectSymbolData::Symbol
MCSymbol * Symbol
Definition: MCAssembler.h:59
llvm::MCAssembler::getWriterPtr
MCObjectWriter * getWriterPtr() const
Definition: MCAssembler.h:327
llvm::MCEncodedFragment
Interface implemented by fragments that contain encoded instructions and/or data.
Definition: MCFragment.h:124
llvm::MCAssembler
Definition: MCAssembler.h:73
llvm::MCAssembler::getEmitter
MCCodeEmitter & getEmitter() const
Definition: MCAssembler.h:331
uint64_t
llvm::MCPseudoProbeAddrFragment
Definition: MCFragment.h:615
llvm::MCAssembler::data_region_end
const_data_region_iterator data_region_end() const
Definition: MCAssembler.h:447
llvm::MCAssembler::symbol_end
symbol_iterator symbol_end()
Definition: MCAssembler.h:387
llvm::MCAssembler::Update
unsigned Update
Definition: MCAssembler.h:109
llvm::MCAssembler::getBundleAlignSize
unsigned getBundleAlignSize() const
Definition: MCAssembler.h:362
iterator.h
llvm::MCAssembler::isSymbolLinkerVisible
bool isSymbolLinkerVisible(const MCSymbol &SD) const
Check whether a particular symbol is visible to the linker and is required in the symbol table,...
Definition: MCAssembler.cpp:166
llvm::MCAssembler::MCAssembler
MCAssembler(MCContext &Context, std::unique_ptr< MCAsmBackend > Backend, std::unique_ptr< MCCodeEmitter > Emitter, std::unique_ptr< MCObjectWriter > Writer)
Construct a new assembler instance.
Definition: MCAssembler.cpp:84
ArrayRef.h
llvm::MCAssembler::getAtom
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...
Definition: MCAssembler.cpp:177
llvm::MCAssembler::setELFHeaderEFlags
void setELFHeaderEFlags(unsigned Flags)
Definition: MCAssembler.h:277
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MCAssembler::indirect_symbol_size
size_t indirect_symbol_size() const
Definition: MCAssembler.h:422
llvm::MCAssembler::CGProfileEntry::To
const MCSymbolRefExpr * To
Definition: MCAssembler.h:467
llvm::MCAssembler::begin
const_iterator begin() const
Definition: MCAssembler.h:374
llvm::MCAssembler::isIncrementalLinkerCompatible
bool isIncrementalLinkerCompatible() const
Definition: MCAssembler.h:350
llvm::MCAssembler::getRelaxAll
bool getRelaxAll() const
Definition: MCAssembler.h:357
iterator_range.h
llvm::MCAssembler::setRelaxAll
void setRelaxAll(bool Value)
Definition: MCAssembler.h:358
llvm::MCAssembler::~MCAssembler
~MCAssembler()
llvm::MCAssembler::const_data_region_iterator
std::vector< DataRegionData >::const_iterator const_data_region_iterator
Definition: MCAssembler.h:95
llvm::MCSymbolRefExpr
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
llvm::MCAssembler::getIndirectSymbols
std::vector< IndirectSymbolData > & getIndirectSymbols()
Definition: MCAssembler.h:404
llvm::MCAssembler::symbol_size
size_t symbol_size() const
Definition: MCAssembler.h:395
llvm::MCAssembler::Type
MCVersionMinType Type
Used when EmitBuildVersion==false.
Definition: MCAssembler.h:104
llvm::IndirectSymbolData
Definition: MCAssembler.h:58
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::MCAssembler::Major
unsigned Major
Definition: MCAssembler.h:107
llvm::MCAssembler::Symver
Definition: MCAssembler.h:228
llvm::DataRegionData::Kind
enum llvm::DataRegionData::KindTy Kind
llvm::MCObjectWriter
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Definition: MCObjectWriter.h:34
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
S
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
Definition: README.txt:210
llvm::MCAssembler::getFileNames
MutableArrayRef< std::pair< std::string, size_t > > getFileNames()
Definition: MCAssembler.h:479
llvm::MCAssembler::setVersionMin
void setVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion=VersionTuple())
Definition: MCAssembler.h:281
llvm::DataRegionData::JumpTable16
@ JumpTable16
Definition: MCAssembler.h:68
llvm::MCAssembler::Symver::KeepOriginalSym
bool KeepOriginalSym
Definition: MCAssembler.h:233
llvm::MCAssembler::layout
void layout(MCAsmLayout &Layout)
Definition: MCAssembler.cpp:809
llvm::MCAssembler::addFileName
void addFileName(StringRef FileName)
Definition: MCAssembler.h:483
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::MCCodeEmitter
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:21
llvm::MCAssembler::getLOHContainer
MCLOHContainer & getLOHContainer()
Definition: MCAssembler.h:460
llvm::MCAssembler::Platform
MachO::PlatformType Platform
Used when EmitBuildVersion==true.
Definition: MCAssembler.h:105
llvm::MCAssembler::VersionInfoType
struct { bool EmitBuildVersion VersionInfoType
MachO specific deployment target version info.
Definition: MCAssembler.h:102
llvm::MCAssembler::Symver::Name
StringRef Name
Definition: MCAssembler.h:231
llvm::MCAssembler::TypeOrPlatform
union llvm::MCAssembler::@305 TypeOrPlatform
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::MCAssembler::setDWARFLinetableParams
void setDWARFLinetableParams(MCDwarfLineTableParams P)
Definition: MCAssembler.h:336
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::MCAssembler::registerSection
bool registerSection(MCSection &Section)
Definition: MCAssembler.cpp:127
MCLinkerOptimizationHint.h
llvm::MCAssembler::end
iterator end()
Definition: MCAssembler.h:376
llvm::MCLEBFragment
Definition: MCFragment.h:427
llvm::computeBundlePadding
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,...
Definition: MCFragment.cpp:213
llvm::MCAssembler::getVersionInfo
const VersionInfoType & getVersionInfo() const
MachO deployment target version information.
Definition: MCAssembler.h:280
llvm::MCAssembler::setBuildVersion
void setBuildVersion(MachO::PlatformType Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion=VersionTuple())
Definition: MCAssembler.h:291
llvm::MCAssembler::end
const_iterator end() const
Definition: MCAssembler.h:377
llvm::IndirectSymbolData::Section
MCSection * Section
Definition: MCAssembler.h:60
llvm::MCAssembler::getDarwinTargetVariantVersionInfo
const VersionInfoType & getDarwinTargetVariantVersionInfo() const
Definition: MCAssembler.h:302
llvm::MCAssembler::SectionListType
std::vector< MCSection * > SectionListType
Definition: MCAssembler.h:77
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::MCAssembler::dump
void dump() const
Definition: MCAssembler.cpp:1239
llvm::MCAssembler::setSubsectionsViaSymbols
void setSubsectionsViaSymbols(bool Value)
Definition: MCAssembler.h:348
llvm::MCAssembler::data_region_iterator
std::vector< DataRegionData >::iterator data_region_iterator
Definition: MCAssembler.h:96
llvm::MCAssembler::writeFragmentPadding
void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F, uint64_t FSize) const
Write the necessary bundle padding to OS.
Definition: MCAssembler.cpp:477
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:36
llvm::MCAssembler::size
size_t size() const
Definition: MCAssembler.h:379
llvm::MCAssembler::indirect_symbol_begin
const_indirect_symbol_iterator indirect_symbol_begin() const
Definition: MCAssembler.h:411
MachO.h
llvm::MCAssembler::getBackendPtr
MCAsmBackend * getBackendPtr() const
Definition: MCAssembler.h:323
llvm::pointee_iterator
An iterator type that allows iterating over the pointees via some other iterator.
Definition: iterator.h:320
llvm::MCAssembler::getSubsectionsViaSymbols
bool getSubsectionsViaSymbols() const
Definition: MCAssembler.h:347
llvm::MCAssembler::getDWARFLinetableParams
MCDwarfLineTableParams getDWARFLinetableParams() const
Definition: MCAssembler.h:335
llvm::MCAssembler::indirect_symbol_iterator
std::vector< IndirectSymbolData >::iterator indirect_symbol_iterator
Definition: MCAssembler.h:92
llvm::MCAssembler::isBundlingEnabled
bool isBundlingEnabled() const
Definition: MCAssembler.h:360
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
llvm::MCCVDefRangeFragment
Fragment representing the .cv_def_range directive.
Definition: MCFragment.h:548
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::MCAssembler::CGProfileEntry
Definition: MCAssembler.h:465
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:365
llvm::MCBoundaryAlignFragment
Represents required padding such that a particular other set of fragments does not cross a particular...
Definition: MCFragment.h:578
llvm::MCAssembler::getWriter
MCObjectWriter & getWriter() const
Definition: MCAssembler.h:333
llvm::MCAssembler::CGProfile
std::vector< CGProfileEntry > CGProfile
Definition: MCAssembler.h:470