LLVM  6.0.0svn
MCFragment.h
Go to the documentation of this file.
1 //===- MCFragment.h - Fragment type hierarchy -------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_MC_MCFRAGMENT_H
11 #define LLVM_MC_MCFRAGMENT_H
12 
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/SmallString.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/ADT/ilist_node.h"
18 #include "llvm/MC/MCFixup.h"
19 #include "llvm/MC/MCInst.h"
20 #include "llvm/Support/Casting.h"
21 #include "llvm/Support/SMLoc.h"
22 #include <cstdint>
23 #include <utility>
24 
25 namespace llvm {
26 
27 class MCSection;
28 class MCSubtargetInfo;
29 class MCSymbol;
30 
31 class MCFragment : public ilist_node_with_parent<MCFragment, MCSection> {
32  friend class MCAsmLayout;
33 
34 public:
35  enum FragmentType : uint8_t {
50  };
51 
52 private:
54 
55 protected:
57 
58 private:
59  /// \brief Should this fragment be aligned to the end of a bundle?
60  bool AlignToBundleEnd;
61 
62  uint8_t BundlePadding;
63 
64  /// LayoutOrder - The layout order of this fragment.
65  unsigned LayoutOrder;
66 
67  /// The data for the section this fragment is in.
68  MCSection *Parent;
69 
70  /// Atom - The atom this fragment is in, as represented by it's defining
71  /// symbol.
72  const MCSymbol *Atom;
73 
74  /// \name Assembler Backend Data
75  /// @{
76  //
77  // FIXME: This could all be kept private to the assembler implementation.
78 
79  /// Offset - The offset of this fragment in its section. This is ~0 until
80  /// initialized.
81  uint64_t Offset;
82 
83  /// @}
84 
85 protected:
86  MCFragment(FragmentType Kind, bool HasInstructions,
87  uint8_t BundlePadding, MCSection *Parent = nullptr);
88 
89  ~MCFragment();
90 
91 public:
92  MCFragment() = delete;
93  MCFragment(const MCFragment &) = delete;
94  MCFragment &operator=(const MCFragment &) = delete;
95 
96  /// Destroys the current fragment.
97  ///
98  /// This must be used instead of delete as MCFragment is non-virtual.
99  /// This method will dispatch to the appropriate subclass.
100  void destroy();
101 
102  FragmentType getKind() const { return Kind; }
103 
104  MCSection *getParent() const { return Parent; }
105  void setParent(MCSection *Value) { Parent = Value; }
106 
107  const MCSymbol *getAtom() const { return Atom; }
108  void setAtom(const MCSymbol *Value) { Atom = Value; }
109 
110  unsigned getLayoutOrder() const { return LayoutOrder; }
111  void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
112 
113  /// \brief Does this fragment have instructions emitted into it? By default
114  /// this is false, but specific fragment types may set it to true.
115  bool hasInstructions() const { return HasInstructions; }
116 
117  /// \brief Should this fragment be placed at the end of an aligned bundle?
118  bool alignToBundleEnd() const { return AlignToBundleEnd; }
119  void setAlignToBundleEnd(bool V) { AlignToBundleEnd = V; }
120 
121  /// \brief Get the padding size that must be inserted before this fragment.
122  /// Used for bundling. By default, no padding is inserted.
123  /// Note that padding size is restricted to 8 bits. This is an optimization
124  /// to reduce the amount of space used for each fragment. In practice, larger
125  /// padding should never be required.
126  uint8_t getBundlePadding() const { return BundlePadding; }
127 
128  /// \brief Set the padding size for this fragment. By default it's a no-op,
129  /// and only some fragments have a meaningful implementation.
130  void setBundlePadding(uint8_t N) { BundlePadding = N; }
131 
132  /// \brief Return true if given frgment has FT_Dummy type.
133  bool isDummy() const { return Kind == FT_Dummy; }
134 
135  void dump() const;
136 };
137 
138 class MCDummyFragment : public MCFragment {
139 public:
140  explicit MCDummyFragment(MCSection *Sec)
141  : MCFragment(FT_Dummy, false, 0, Sec) {}
142 
143  static bool classof(const MCFragment *F) { return F->getKind() == FT_Dummy; }
144 };
145 
146 /// Interface implemented by fragments that contain encoded instructions and/or
147 /// data.
148 ///
150 protected:
152  MCSection *Sec)
153  : MCFragment(FType, HasInstructions, 0, Sec) {}
154 
155 public:
156  static bool classof(const MCFragment *F) {
157  MCFragment::FragmentType Kind = F->getKind();
158  switch (Kind) {
159  default:
160  return false;
163  case MCFragment::FT_Data:
164  return true;
165  }
166  }
167 };
168 
169 /// Interface implemented by fragments that contain encoded instructions and/or
170 /// data.
171 ///
172 template<unsigned ContentsSize>
175 
176 protected:
178  bool HasInstructions,
179  MCSection *Sec)
180  : MCEncodedFragment(FType, HasInstructions, Sec) {}
181 
182 public:
183  SmallVectorImpl<char> &getContents() { return Contents; }
184  const SmallVectorImpl<char> &getContents() const { return Contents; }
185 };
186 
187 /// Interface implemented by fragments that contain encoded instructions and/or
188 /// data and also have fixups registered.
189 ///
190 template<unsigned ContentsSize, unsigned FixupsSize>
192  public MCEncodedFragmentWithContents<ContentsSize> {
193 
194  /// Fixups - The list of fixups in this fragment.
196 
197 protected:
199  bool HasInstructions,
200  MCSection *Sec)
201  : MCEncodedFragmentWithContents<ContentsSize>(FType, HasInstructions,
202  Sec) {}
203 
204 public:
207 
209  const SmallVectorImpl<MCFixup> &getFixups() const { return Fixups; }
210 
211  fixup_iterator fixup_begin() { return Fixups.begin(); }
212  const_fixup_iterator fixup_begin() const { return Fixups.begin(); }
213 
214  fixup_iterator fixup_end() { return Fixups.end(); }
215  const_fixup_iterator fixup_end() const { return Fixups.end(); }
216 
217  static bool classof(const MCFragment *F) {
218  MCFragment::FragmentType Kind = F->getKind();
219  return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data ||
221  }
222 };
223 
224 /// Fragment for data and encoded instructions.
225 ///
227 public:
228  MCDataFragment(MCSection *Sec = nullptr)
229  : MCEncodedFragmentWithFixups<32, 4>(FT_Data, false, Sec) {}
230 
231  void setHasInstructions(bool V) { HasInstructions = V; }
232 
233  static bool classof(const MCFragment *F) {
234  return F->getKind() == MCFragment::FT_Data;
235  }
236 };
237 
238 /// This is a compact (memory-size-wise) fragment for holding an encoded
239 /// instruction (non-relaxable) that has no fixups registered. When applicable,
240 /// it can be used instead of MCDataFragment and lead to lower memory
241 /// consumption.
242 ///
244 public:
247  }
248 
249  static bool classof(const MCFragment *F) {
251  }
252 };
253 
254 /// A relaxable fragment holds on to its MCInst, since it may need to be
255 /// relaxed during the assembler layout and relaxation stage.
256 ///
258 
259  /// Inst - The instruction this is a fragment for.
260  MCInst Inst;
261 
262  /// STI - The MCSubtargetInfo in effect when the instruction was encoded.
263  const MCSubtargetInfo &STI;
264 
265 public:
266  MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI,
267  MCSection *Sec = nullptr)
269  Inst(Inst), STI(STI) {}
270 
271  const MCInst &getInst() const { return Inst; }
272  void setInst(const MCInst &Value) { Inst = Value; }
273 
274  const MCSubtargetInfo &getSubtargetInfo() { return STI; }
275 
276  static bool classof(const MCFragment *F) {
277  return F->getKind() == MCFragment::FT_Relaxable;
278  }
279 };
280 
281 class MCAlignFragment : public MCFragment {
282  /// Alignment - The alignment to ensure, in bytes.
283  unsigned Alignment;
284 
285  /// EmitNops - Flag to indicate that (optimal) NOPs should be emitted instead
286  /// of using the provided value. The exact interpretation of this flag is
287  /// target dependent.
288  bool EmitNops : 1;
289 
290  /// Value - Value to use for filling padding bytes.
291  int64_t Value;
292 
293  /// ValueSize - The size of the integer (in bytes) of \p Value.
294  unsigned ValueSize;
295 
296  /// MaxBytesToEmit - The maximum number of bytes to emit; if the alignment
297  /// cannot be satisfied in this width then this fragment is ignored.
298  unsigned MaxBytesToEmit;
299 
300 public:
301  MCAlignFragment(unsigned Alignment, int64_t Value, unsigned ValueSize,
302  unsigned MaxBytesToEmit, MCSection *Sec = nullptr)
303  : MCFragment(FT_Align, false, 0, Sec), Alignment(Alignment),
304  EmitNops(false), Value(Value),
305  ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
306 
307  /// \name Accessors
308  /// @{
309 
310  unsigned getAlignment() const { return Alignment; }
311 
312  int64_t getValue() const { return Value; }
313 
314  unsigned getValueSize() const { return ValueSize; }
315 
316  unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
317 
318  bool hasEmitNops() const { return EmitNops; }
319  void setEmitNops(bool Value) { EmitNops = Value; }
320 
321  /// @}
322 
323  static bool classof(const MCFragment *F) {
324  return F->getKind() == MCFragment::FT_Align;
325  }
326 };
327 
328 /// Fragment for adding required padding.
329 /// This fragment is always inserted before an instruction, and holds that
330 /// instruction as context information (as well as a mask of kinds) for
331 /// determining the padding size.
332 ///
334  /// A mask containing all the kinds relevant to this fragment. i.e. the i'th
335  /// bit will be set iff kind i is relevant to this fragment.
336  uint64_t PaddingPoliciesMask;
337  /// A boolean indicating if this fragment will actually hold padding. If its
338  /// value is false, then this fragment serves only as a placeholder,
339  /// containing data to assist other insertion point in their decision making.
340  bool IsInsertionPoint;
341 
342  uint64_t Size;
343 
344  struct MCInstInfo {
345  bool IsInitialized;
346  MCInst Inst;
347  /// A boolean indicating whether the instruction pointed by this fragment is
348  /// a fixed size instruction or a relaxable instruction held by a
349  /// MCRelaxableFragment.
350  bool IsImmutableSizedInst;
351  union {
352  /// If the instruction is a fixed size instruction, hold its size.
353  size_t InstSize;
354  /// Otherwise, hold a pointer to the MCRelaxableFragment holding it.
355  MCRelaxableFragment *InstFragment;
356  };
357  };
358  MCInstInfo InstInfo;
359 
360 public:
361  static const uint64_t PFK_None = UINT64_C(0);
362 
364  // values 0-7 are reserved for future target independet values.
365 
366  FirstTargetPerfNopFragmentKind = 8,
367 
368  /// Limit range of target MCPerfNopFragment kinds to fit in uint64_t
369  MaxTargetPerfNopFragmentKind = 63
370  };
371 
372  MCPaddingFragment(MCSection *Sec = nullptr)
373  : MCFragment(FT_Padding, false, 0, Sec), PaddingPoliciesMask(PFK_None),
374  IsInsertionPoint(false), Size(UINT64_C(0)),
375  InstInfo({false, MCInst(), false, {0}}) {}
376 
377  bool isInsertionPoint() const { return IsInsertionPoint; }
378  void setAsInsertionPoint() { IsInsertionPoint = true; }
379  uint64_t getPaddingPoliciesMask() const { return PaddingPoliciesMask; }
380  void setPaddingPoliciesMask(uint64_t Value) { PaddingPoliciesMask = Value; }
381  bool hasPaddingPolicy(uint64_t PolicyMask) const {
382  assert(isPowerOf2_64(PolicyMask) &&
383  "Policy mask must contain exactly one policy");
384  return (getPaddingPoliciesMask() & PolicyMask) != PFK_None;
385  }
386  const MCInst &getInst() const {
387  assert(isInstructionInitialized() && "Fragment has no instruction!");
388  return InstInfo.Inst;
389  }
390  size_t getInstSize() const {
391  assert(isInstructionInitialized() && "Fragment has no instruction!");
392  if (InstInfo.IsImmutableSizedInst)
393  return InstInfo.InstSize;
394  assert(InstInfo.InstFragment != nullptr &&
395  "Must have a valid InstFragment to retrieve InstSize from");
396  return InstInfo.InstFragment->getContents().size();
397  }
398  void setInstAndInstSize(const MCInst &Inst, size_t InstSize) {
399  InstInfo.IsInitialized = true;
400  InstInfo.IsImmutableSizedInst = true;
401  InstInfo.Inst = Inst;
402  InstInfo.InstSize = InstSize;
403  }
404  void setInstAndInstFragment(const MCInst &Inst,
405  MCRelaxableFragment *InstFragment) {
406  InstInfo.IsInitialized = true;
407  InstInfo.IsImmutableSizedInst = false;
408  InstInfo.Inst = Inst;
409  InstInfo.InstFragment = InstFragment;
410  }
411  uint64_t getSize() const { return Size; }
412  void setSize(uint64_t Value) { Size = Value; }
413  bool isInstructionInitialized() const { return InstInfo.IsInitialized; }
414 
415  static bool classof(const MCFragment *F) {
416  return F->getKind() == MCFragment::FT_Padding;
417  }
418 };
419 
420 class MCFillFragment : public MCFragment {
421  /// Value to use for filling bytes.
422  uint8_t Value;
423 
424  /// The number of bytes to insert.
425  uint64_t Size;
426 
427 public:
428  MCFillFragment(uint8_t Value, uint64_t Size, MCSection *Sec = nullptr)
429  : MCFragment(FT_Fill, false, 0, Sec), Value(Value), Size(Size) {}
430 
431  uint8_t getValue() const { return Value; }
432  uint64_t getSize() const { return Size; }
433 
434  static bool classof(const MCFragment *F) {
435  return F->getKind() == MCFragment::FT_Fill;
436  }
437 };
438 
439 class MCOrgFragment : public MCFragment {
440  /// Offset - The offset this fragment should start at.
441  const MCExpr *Offset;
442 
443  /// Value - Value to use for filling bytes.
444  int8_t Value;
445 
446  /// Loc - Source location of the directive that this fragment was created for.
447  SMLoc Loc;
448 
449 public:
450  MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc,
451  MCSection *Sec = nullptr)
452  : MCFragment(FT_Org, false, 0, Sec), Offset(&Offset), Value(Value), Loc(Loc) {}
453 
454  /// \name Accessors
455  /// @{
456 
457  const MCExpr &getOffset() const { return *Offset; }
458 
459  uint8_t getValue() const { return Value; }
460 
461  SMLoc getLoc() const { return Loc; }
462 
463  /// @}
464 
465  static bool classof(const MCFragment *F) {
466  return F->getKind() == MCFragment::FT_Org;
467  }
468 };
469 
470 class MCLEBFragment : public MCFragment {
471  /// Value - The value this fragment should contain.
472  const MCExpr *Value;
473 
474  /// IsSigned - True if this is a sleb128, false if uleb128.
475  bool IsSigned;
476 
477  SmallString<8> Contents;
478 
479 public:
480  MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSection *Sec = nullptr)
481  : MCFragment(FT_LEB, false, 0, Sec), Value(&Value_), IsSigned(IsSigned_) {
482  Contents.push_back(0);
483  }
484 
485  /// \name Accessors
486  /// @{
487 
488  const MCExpr &getValue() const { return *Value; }
489 
490  bool isSigned() const { return IsSigned; }
491 
492  SmallString<8> &getContents() { return Contents; }
493  const SmallString<8> &getContents() const { return Contents; }
494 
495  /// @}
496 
497  static bool classof(const MCFragment *F) {
498  return F->getKind() == MCFragment::FT_LEB;
499  }
500 };
501 
503  /// LineDelta - the value of the difference between the two line numbers
504  /// between two .loc dwarf directives.
505  int64_t LineDelta;
506 
507  /// AddrDelta - The expression for the difference of the two symbols that
508  /// make up the address delta between two .loc dwarf directives.
509  const MCExpr *AddrDelta;
510 
511  SmallString<8> Contents;
512 
513 public:
514  MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta,
515  MCSection *Sec = nullptr)
516  : MCFragment(FT_Dwarf, false, 0, Sec), LineDelta(LineDelta),
517  AddrDelta(&AddrDelta) {
518  Contents.push_back(0);
519  }
520 
521  /// \name Accessors
522  /// @{
523 
524  int64_t getLineDelta() const { return LineDelta; }
525 
526  const MCExpr &getAddrDelta() const { return *AddrDelta; }
527 
528  SmallString<8> &getContents() { return Contents; }
529  const SmallString<8> &getContents() const { return Contents; }
530 
531  /// @}
532 
533  static bool classof(const MCFragment *F) {
534  return F->getKind() == MCFragment::FT_Dwarf;
535  }
536 };
537 
539  /// AddrDelta - The expression for the difference of the two symbols that
540  /// make up the address delta between two .cfi_* dwarf directives.
541  const MCExpr *AddrDelta;
542 
543  SmallString<8> Contents;
544 
545 public:
546  MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec = nullptr)
547  : MCFragment(FT_DwarfFrame, false, 0, Sec), AddrDelta(&AddrDelta) {
548  Contents.push_back(0);
549  }
550 
551  /// \name Accessors
552  /// @{
553 
554  const MCExpr &getAddrDelta() const { return *AddrDelta; }
555 
556  SmallString<8> &getContents() { return Contents; }
557  const SmallString<8> &getContents() const { return Contents; }
558 
559  /// @}
560 
561  static bool classof(const MCFragment *F) {
562  return F->getKind() == MCFragment::FT_DwarfFrame;
563  }
564 };
565 
566 /// Represents a symbol table index fragment.
568  const MCSymbol *Sym;
569 
570 public:
571  MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec = nullptr)
572  : MCFragment(FT_SymbolId, false, 0, Sec), Sym(Sym) {}
573 
574  /// \name Accessors
575  /// @{
576 
577  const MCSymbol *getSymbol() { return Sym; }
578  const MCSymbol *getSymbol() const { return Sym; }
579 
580  /// @}
581 
582  static bool classof(const MCFragment *F) {
583  return F->getKind() == MCFragment::FT_SymbolId;
584  }
585 };
586 
587 /// Fragment representing the binary annotations produced by the
588 /// .cv_inline_linetable directive.
590  unsigned SiteFuncId;
591  unsigned StartFileId;
592  unsigned StartLineNum;
593  const MCSymbol *FnStartSym;
594  const MCSymbol *FnEndSym;
595  SmallString<8> Contents;
596 
597  /// CodeViewContext has the real knowledge about this format, so let it access
598  /// our members.
599  friend class CodeViewContext;
600 
601 public:
602  MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
603  unsigned StartLineNum, const MCSymbol *FnStartSym,
604  const MCSymbol *FnEndSym,
605  MCSection *Sec = nullptr)
606  : MCFragment(FT_CVInlineLines, false, 0, Sec), SiteFuncId(SiteFuncId),
607  StartFileId(StartFileId), StartLineNum(StartLineNum),
608  FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
609 
610  /// \name Accessors
611  /// @{
612 
613  const MCSymbol *getFnStartSym() const { return FnStartSym; }
614  const MCSymbol *getFnEndSym() const { return FnEndSym; }
615 
616  SmallString<8> &getContents() { return Contents; }
617  const SmallString<8> &getContents() const { return Contents; }
618 
619  /// @}
620 
621  static bool classof(const MCFragment *F) {
622  return F->getKind() == MCFragment::FT_CVInlineLines;
623  }
624 };
625 
626 /// Fragment representing the .cv_def_range directive.
629  SmallString<32> FixedSizePortion;
630 
631  /// CodeViewContext has the real knowledge about this format, so let it access
632  /// our members.
633  friend class CodeViewContext;
634 
635 public:
637  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
638  StringRef FixedSizePortion, MCSection *Sec = nullptr)
640  Ranges(Ranges.begin(), Ranges.end()),
641  FixedSizePortion(FixedSizePortion) {}
642 
643  /// \name Accessors
644  /// @{
646  return Ranges;
647  }
648 
649  StringRef getFixedSizePortion() const { return FixedSizePortion; }
650  /// @}
651 
652  static bool classof(const MCFragment *F) {
653  return F->getKind() == MCFragment::FT_CVDefRange;
654  }
655 };
656 
657 } // end namespace llvm
658 
659 #endif // LLVM_MC_MCFRAGMENT_H
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
void push_back(const T &Elt)
Definition: SmallVector.h:212
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:245
MCAlignFragment(unsigned Alignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit, MCSection *Sec=nullptr)
Definition: MCFragment.h:301
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc, MCSection *Sec=nullptr)
Definition: MCFragment.h:450
static bool classof(const MCFragment *F)
Definition: MCFragment.h:497
Fragment for adding required padding.
Definition: MCFragment.h:333
bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
Definition: MCFragment.h:118
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:236
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:329
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta, MCSection *Sec=nullptr)
Definition: MCFragment.h:514
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
static bool classof(const MCFragment *F)
Definition: MCFragment.h:434
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
SmallString< 8 > & getContents()
Definition: MCFragment.h:616
static bool classof(const MCFragment *F)
Definition: MCFragment.h:143
const SmallString< 8 > & getContents() const
Definition: MCFragment.h:557
MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec=nullptr)
Definition: MCFragment.h:571
const MCSymbol * getSymbol() const
Definition: MCFragment.h:578
int64_t getValue() const
Definition: MCFragment.h:312
Interface implemented by fragments that contain encoded instructions and/or data. ...
Definition: MCFragment.h:173
uint64_t getSize() const
Definition: MCFragment.h:411
MCFragment & operator=(const MCFragment &)=delete
FragmentType getKind() const
Definition: MCFragment.h:102
This is a compact (memory-size-wise) fragment for holding an encoded instruction (non-relaxable) that...
Definition: MCFragment.h:243
F(f)
const MCSubtargetInfo & getSubtargetInfo()
Definition: MCFragment.h:274
const MCExpr & getOffset() const
Definition: MCFragment.h:457
static void EmitNops(MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSubtargetInfo &STI)
Emit the optimal amount of multi-byte nops on X86.
StringRef getFixedSizePortion() const
Definition: MCFragment.h:649
const_fixup_iterator fixup_begin() const
Definition: MCFragment.h:212
bool hasPaddingPolicy(uint64_t PolicyMask) const
Definition: MCFragment.h:381
MCFillFragment(uint8_t Value, uint64_t Size, MCSection *Sec=nullptr)
Definition: MCFragment.h:428
bool HasInstructions
Definition: MCFragment.h:56
Interface implemented by fragments that contain encoded instructions and/or data. ...
Definition: MCFragment.h:149
SmallVectorImpl< MCFixup >::const_iterator const_fixup_iterator
Definition: MCFragment.h:205
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
const_fixup_iterator fixup_end() const
Definition: MCFragment.h:215
void setEmitNops(bool Value)
Definition: MCFragment.h:319
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
bool isInstructionInitialized() const
Definition: MCFragment.h:413
void setAlignToBundleEnd(bool V)
Definition: MCFragment.h:119
const SmallString< 8 > & getContents() const
Definition: MCFragment.h:617
MCDummyFragment(MCSection *Sec)
Definition: MCFragment.h:140
SMLoc getLoc() const
Definition: MCFragment.h:461
void destroy()
Destroys the current fragment.
Definition: MCFragment.cpp:246
const MCExpr & getAddrDelta() const
Definition: MCFragment.h:526
void setPaddingPoliciesMask(uint64_t Value)
Definition: MCFragment.h:380
void setHasInstructions(bool V)
Definition: MCFragment.h:231
void setInstAndInstSize(const MCInst &Inst, size_t InstSize)
Definition: MCFragment.h:398
static bool classof(const MCFragment *F)
Definition: MCFragment.h:533
static bool classof(const MCFragment *F)
Definition: MCFragment.h:156
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
const MCExpr & getAddrDelta() const
Definition: MCFragment.h:554
MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSection *Sec=nullptr)
Definition: MCFragment.h:480
MCEncodedFragmentWithContents(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
Definition: MCFragment.h:177
bool isDummy() const
Return true if given frgment has FT_Dummy type.
Definition: MCFragment.h:133
MCPaddingFragment(MCSection *Sec=nullptr)
Definition: MCFragment.h:372
SmallVectorImpl< char > & getContents()
Definition: MCFragment.h:183
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI, MCSection *Sec=nullptr)
Definition: MCFragment.h:266
void dump() const
Definition: MCFragment.cpp:313
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:257
const MCInst & getInst() const
Definition: MCFragment.h:386
uint8_t getValue() const
Definition: MCFragment.h:431
An ilist node that can access its parent list.
Definition: ilist_node.h:257
static bool classof(const MCFragment *F)
Definition: MCFragment.h:465
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Definition: SmallVector.h:116
static bool classof(const MCFragment *F)
Definition: MCFragment.h:276
const SmallVectorImpl< char > & getContents() const
Definition: MCFragment.h:184
static bool classof(const MCFragment *F)
Definition: MCFragment.h:217
SmallVectorImpl< MCFixup > & getFixups()
Definition: MCFragment.h:208
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
Definition: MathExtras.h:426
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
Definition: MCFragment.h:151
const SmallString< 8 > & getContents() const
Definition: MCFragment.h:493
const MCSymbol * getAtom() const
Definition: MCFragment.h:107
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym, MCSection *Sec=nullptr)
Definition: MCFragment.h:602
static bool classof(const MCFragment *F)
Definition: MCFragment.h:323
Fragment representing the .cv_def_range directive.
Definition: MCFragment.h:627
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> Ranges, StringRef FixedSizePortion, MCSection *Sec=nullptr)
Definition: MCFragment.h:636
const MCExpr & getValue() const
Definition: MCFragment.h:488
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
Definition: MCFragment.h:198
unsigned getMaxBytesToEmit() const
Definition: MCFragment.h:316
const SmallString< 8 > & getContents() const
Definition: MCFragment.h:529
bool hasEmitNops() const
Definition: MCFragment.h:318
MCCompactEncodedInstFragment(MCSection *Sec=nullptr)
Definition: MCFragment.h:245
SmallVectorImpl< MCFixup >::iterator fixup_iterator
Definition: MCFragment.h:206
Represents a symbol table index fragment.
Definition: MCFragment.h:567
unsigned getLayoutOrder() const
Definition: MCFragment.h:110
uint64_t getPaddingPoliciesMask() const
Definition: MCFragment.h:379
static bool classof(const MCFragment *F)
Definition: MCFragment.h:415
const MCSymbol * getFnEndSym() const
Definition: MCFragment.h:614
MCSection * getParent() const
Definition: MCFragment.h:104
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
Definition: MCFragment.h:115
typename SuperClass::iterator iterator
Definition: SmallVector.h:328
SmallString< 8 > & getContents()
Definition: MCFragment.h:556
Fragment representing the binary annotations produced by the .cv_inline_linetable directive...
Definition: MCFragment.h:589
const MCSymbol * getFnStartSym() const
Definition: MCFragment.h:613
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
Definition: MCFragment.h:130
unsigned getValueSize() const
Definition: MCFragment.h:314
static bool classof(const MCFragment *F)
Definition: MCFragment.h:249
unsigned getAlignment() const
Definition: MCFragment.h:310
void setSize(uint64_t Value)
Definition: MCFragment.h:412
Basic Alias true
Interface implemented by fragments that contain encoded instructions and/or data and also have fixups...
Definition: MCFragment.h:191
uint64_t getSize() const
Definition: MCFragment.h:432
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Definition: SmallVector.h:120
static bool classof(const MCFragment *F)
Definition: MCFragment.h:582
int64_t getLineDelta() const
Definition: MCFragment.h:524
size_t getInstSize() const
Definition: MCFragment.h:390
const MCInst & getInst() const
Definition: MCFragment.h:271
static bool classof(const MCFragment *F)
Definition: MCFragment.h:561
#define N
static bool classof(const MCFragment *F)
Definition: MCFragment.h:652
MCSubtargetInfo - Generic base class for all target subtargets.
SmallString< 8 > & getContents()
Definition: MCFragment.h:492
const MCSymbol * getSymbol()
Definition: MCFragment.h:577
void setLayoutOrder(unsigned Value)
Definition: MCFragment.h:111
const unsigned Kind
Fragment for data and encoded instructions.
Definition: MCFragment.h:226
MCFragment()=delete
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isInsertionPoint() const
Definition: MCFragment.h:377
bool isSigned() const
Definition: MCFragment.h:490
LLVM Value Representation.
Definition: Value.h:73
void setInstAndInstFragment(const MCInst &Inst, MCRelaxableFragment *InstFragment)
Definition: MCFragment.h:404
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
Definition: MCFragment.h:645
static bool classof(const MCFragment *F)
Definition: MCFragment.h:233
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
uint8_t getValue() const
Definition: MCFragment.h:459
const SmallVectorImpl< MCFixup > & getFixups() const
Definition: MCFragment.h:209
SmallString< 8 > & getContents()
Definition: MCFragment.h:528
Represents a location in source code.
Definition: SMLoc.h:24
void setParent(MCSection *Value)
Definition: MCFragment.h:105
MCDataFragment(MCSection *Sec=nullptr)
Definition: MCFragment.h:228
MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec=nullptr)
Definition: MCFragment.h:546
void setInst(const MCInst &Value)
Definition: MCFragment.h:272
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
Definition: MCFragment.h:126
void setAtom(const MCSymbol *Value)
Definition: MCFragment.h:108
Holds state from .cv_file and .cv_loc directives for later emission.
Definition: MCCodeView.h:158
static bool classof(const MCFragment *F)
Definition: MCFragment.h:621