LLVM 19.0.0git
MCFragment.h
Go to the documentation of this file.
1//===- MCFragment.h - Fragment type hierarchy -------------------*- 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_MCFRAGMENT_H
10#define LLVM_MC_MCFRAGMENT_H
11
12#include "llvm/ADT/ArrayRef.h"
15#include "llvm/ADT/StringRef.h"
16#include "llvm/ADT/ilist_node.h"
17#include "llvm/MC/MCFixup.h"
18#include "llvm/MC/MCInst.h"
20#include "llvm/Support/SMLoc.h"
21#include <cstdint>
22#include <utility>
23
24namespace llvm {
25
26class MCSection;
27class MCSubtargetInfo;
28class MCSymbol;
29
30class MCFragment : public ilist_node_with_parent<MCFragment, MCSection> {
31 friend class MCAsmLayout;
32
33public:
34 enum FragmentType : uint8_t {
51 };
52
53private:
54 /// The data for the section this fragment is in.
55 MCSection *Parent;
56
57 /// The atom this fragment is in, as represented by its defining symbol.
58 const MCSymbol *Atom;
59
60 /// The offset of this fragment in its section. This is ~0 until
61 /// initialized.
63
64 /// The layout order of this fragment.
65 unsigned LayoutOrder;
66
67 /// The subsection this fragment belongs to. This is 0 if the fragment is not
68 // in any subsection.
69 unsigned SubsectionNumber = 0;
70
71 FragmentType Kind;
72
73 /// Whether fragment is being laid out.
74 bool IsBeingLaidOut;
75
76protected:
78 bool LinkerRelaxable = false;
79
81 MCSection *Parent = nullptr);
82
83public:
84 MCFragment() = delete;
85 MCFragment(const MCFragment &) = delete;
86 MCFragment &operator=(const MCFragment &) = delete;
87
88 /// Destroys the current fragment.
89 ///
90 /// This must be used instead of delete as MCFragment is non-virtual.
91 /// This method will dispatch to the appropriate subclass.
92 void destroy();
93
94 FragmentType getKind() const { return Kind; }
95
96 MCSection *getParent() const { return Parent; }
97 void setParent(MCSection *Value) { Parent = Value; }
98
99 const MCSymbol *getAtom() const { return Atom; }
100 void setAtom(const MCSymbol *Value) { Atom = Value; }
101
102 unsigned getLayoutOrder() const { return LayoutOrder; }
103 void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
104
105 /// Does this fragment have instructions emitted into it? By default
106 /// this is false, but specific fragment types may set it to true.
107 bool hasInstructions() const { return HasInstructions; }
108
109 void dump() const;
110
111 void setSubsectionNumber(unsigned Value) { SubsectionNumber = Value; }
112 unsigned getSubsectionNumber() const { return SubsectionNumber; }
113};
114
116public:
118
119 static bool classof(const MCFragment *F) { return F->getKind() == FT_Dummy; }
120};
121
122/// Interface implemented by fragments that contain encoded instructions and/or
123/// data.
124///
126 /// Should this fragment be aligned to the end of a bundle?
127 bool AlignToBundleEnd = false;
128
129 uint8_t BundlePadding = 0;
130
131protected:
133 MCSection *Sec)
134 : MCFragment(FType, HasInstructions, Sec) {}
135
136 /// The MCSubtargetInfo in effect when the instruction was encoded.
137 /// It must be non-null for instructions.
138 const MCSubtargetInfo *STI = nullptr;
139
140public:
141 static bool classof(const MCFragment *F) {
142 MCFragment::FragmentType Kind = F->getKind();
143 switch (Kind) {
144 default:
145 return false;
152 return true;
153 }
154 }
155
156 /// Should this fragment be placed at the end of an aligned bundle?
157 bool alignToBundleEnd() const { return AlignToBundleEnd; }
158 void setAlignToBundleEnd(bool V) { AlignToBundleEnd = V; }
159
160 /// Get the padding size that must be inserted before this fragment.
161 /// Used for bundling. By default, no padding is inserted.
162 /// Note that padding size is restricted to 8 bits. This is an optimization
163 /// to reduce the amount of space used for each fragment. In practice, larger
164 /// padding should never be required.
165 uint8_t getBundlePadding() const { return BundlePadding; }
166
167 /// Set the padding size for this fragment. By default it's a no-op,
168 /// and only some fragments have a meaningful implementation.
169 void setBundlePadding(uint8_t N) { BundlePadding = N; }
170
171 /// Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
172 /// Guaranteed to be non-null if hasInstructions() == true
173 const MCSubtargetInfo *getSubtargetInfo() const { return STI; }
174
175 /// Record that the fragment contains instructions with the MCSubtargetInfo in
176 /// effect when the instruction was encoded.
178 HasInstructions = true;
179 this->STI = &STI;
180 }
181};
182
183/// Interface implemented by fragments that contain encoded instructions and/or
184/// data.
185///
186template<unsigned ContentsSize>
189
190protected:
192 bool HasInstructions,
193 MCSection *Sec)
194 : MCEncodedFragment(FType, HasInstructions, Sec) {}
195
196public:
197 SmallVectorImpl<char> &getContents() { return Contents; }
198 const SmallVectorImpl<char> &getContents() const { return Contents; }
199};
200
201/// Interface implemented by fragments that contain encoded instructions and/or
202/// data and also have fixups registered.
203///
204template<unsigned ContentsSize, unsigned FixupsSize>
206 public MCEncodedFragmentWithContents<ContentsSize> {
207
208 /// The list of fixups in this fragment.
210
211protected:
213 bool HasInstructions,
214 MCSection *Sec)
215 : MCEncodedFragmentWithContents<ContentsSize>(FType, HasInstructions,
216 Sec) {}
217
218public:
219
222
224 const SmallVectorImpl<MCFixup> &getFixups() const { return Fixups; }
225
226 fixup_iterator fixup_begin() { return Fixups.begin(); }
227 const_fixup_iterator fixup_begin() const { return Fixups.begin(); }
228
229 fixup_iterator fixup_end() { return Fixups.end(); }
230 const_fixup_iterator fixup_end() const { return Fixups.end(); }
231
232 static bool classof(const MCFragment *F) {
233 MCFragment::FragmentType Kind = F->getKind();
234 return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data ||
237 }
238};
239
240/// Fragment for data and encoded instructions.
241///
243public:
244 MCDataFragment(MCSection *Sec = nullptr)
245 : MCEncodedFragmentWithFixups<32, 4>(FT_Data, false, Sec) {}
246
247 static bool classof(const MCFragment *F) {
248 return F->getKind() == MCFragment::FT_Data;
249 }
250
251 bool isLinkerRelaxable() const { return LinkerRelaxable; }
253};
254
255/// This is a compact (memory-size-wise) fragment for holding an encoded
256/// instruction (non-relaxable) that has no fixups registered. When applicable,
257/// it can be used instead of MCDataFragment and lead to lower memory
258/// consumption.
259///
261public:
264 }
265
266 static bool classof(const MCFragment *F) {
267 return F->getKind() == MCFragment::FT_CompactEncodedInst;
268 }
269};
270
271/// A relaxable fragment holds on to its MCInst, since it may need to be
272/// relaxed during the assembler layout and relaxation stage.
273///
275
276 /// The instruction this is a fragment for.
277 MCInst Inst;
278 /// Can we auto pad the instruction?
279 bool AllowAutoPadding = false;
280
281public:
283 MCSection *Sec = nullptr)
285 Inst(Inst) { this->STI = &STI; }
286
287 const MCInst &getInst() const { return Inst; }
288 void setInst(const MCInst &Value) { Inst = Value; }
289
290 bool getAllowAutoPadding() const { return AllowAutoPadding; }
291 void setAllowAutoPadding(bool V) { AllowAutoPadding = V; }
292
293 static bool classof(const MCFragment *F) {
294 return F->getKind() == MCFragment::FT_Relaxable;
295 }
296};
297
299 /// The alignment to ensure, in bytes.
300 Align Alignment;
301
302 /// Flag to indicate that (optimal) NOPs should be emitted instead
303 /// of using the provided value. The exact interpretation of this flag is
304 /// target dependent.
305 bool EmitNops : 1;
306
307 /// Value to use for filling padding bytes.
308 int64_t Value;
309
310 /// The size of the integer (in bytes) of \p Value.
311 unsigned ValueSize;
312
313 /// The maximum number of bytes to emit; if the alignment
314 /// cannot be satisfied in this width then this fragment is ignored.
315 unsigned MaxBytesToEmit;
316
317 /// When emitting Nops some subtargets have specific nop encodings.
318 const MCSubtargetInfo *STI = nullptr;
319
320public:
321 MCAlignFragment(Align Alignment, int64_t Value, unsigned ValueSize,
322 unsigned MaxBytesToEmit, MCSection *Sec = nullptr)
323 : MCFragment(FT_Align, false, Sec), Alignment(Alignment), EmitNops(false),
324 Value(Value), ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
325
326 Align getAlignment() const { return Alignment; }
327
328 int64_t getValue() const { return Value; }
329
330 unsigned getValueSize() const { return ValueSize; }
331
332 unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
333
334 bool hasEmitNops() const { return EmitNops; }
335 void setEmitNops(bool Value, const MCSubtargetInfo *STI) {
336 EmitNops = Value;
337 this->STI = STI;
338 }
339
340 const MCSubtargetInfo *getSubtargetInfo() const { return STI; }
341
342 static bool classof(const MCFragment *F) {
343 return F->getKind() == MCFragment::FT_Align;
344 }
345};
346
348 uint8_t ValueSize;
349 /// Value to use for filling bytes.
351 /// The number of bytes to insert.
352 const MCExpr &NumValues;
353
354 /// Source location of the directive that this fragment was created for.
355 SMLoc Loc;
356
357public:
358 MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues,
359 SMLoc Loc, MCSection *Sec = nullptr)
360 : MCFragment(FT_Fill, false, Sec), ValueSize(VSize), Value(Value),
361 NumValues(NumValues), Loc(Loc) {}
362
363 uint64_t getValue() const { return Value; }
364 uint8_t getValueSize() const { return ValueSize; }
365 const MCExpr &getNumValues() const { return NumValues; }
366
367 SMLoc getLoc() const { return Loc; }
368
369 static bool classof(const MCFragment *F) {
370 return F->getKind() == MCFragment::FT_Fill;
371 }
372};
373
375 /// The number of bytes to insert.
376 int64_t Size;
377 /// Maximum number of bytes allowed in each NOP instruction.
378 int64_t ControlledNopLength;
379
380 /// Source location of the directive that this fragment was created for.
381 SMLoc Loc;
382
383 /// When emitting Nops some subtargets have specific nop encodings.
384 const MCSubtargetInfo &STI;
385
386public:
387 MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L,
388 const MCSubtargetInfo &STI, MCSection *Sec = nullptr)
389 : MCFragment(FT_Nops, false, Sec), Size(NumBytes),
390 ControlledNopLength(ControlledNopLength), Loc(L), STI(STI) {}
391
392 int64_t getNumBytes() const { return Size; }
393 int64_t getControlledNopLength() const { return ControlledNopLength; }
394
395 SMLoc getLoc() const { return Loc; }
396
397 const MCSubtargetInfo *getSubtargetInfo() const { return &STI; }
398
399 static bool classof(const MCFragment *F) {
400 return F->getKind() == MCFragment::FT_Nops;
401 }
402};
403
404class MCOrgFragment : public MCFragment {
405 /// Value to use for filling bytes.
406 int8_t Value;
407
408 /// The offset this fragment should start at.
409 const MCExpr *Offset;
410
411 /// Source location of the directive that this fragment was created for.
412 SMLoc Loc;
413
414public:
415 MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc,
416 MCSection *Sec = nullptr)
417 : MCFragment(FT_Org, false, Sec), Value(Value), Offset(&Offset),
418 Loc(Loc) {}
419
420 const MCExpr &getOffset() const { return *Offset; }
421
422 uint8_t getValue() const { return Value; }
423
424 SMLoc getLoc() const { return Loc; }
425
426 static bool classof(const MCFragment *F) {
427 return F->getKind() == MCFragment::FT_Org;
428 }
429};
430
431class MCLEBFragment final : public MCEncodedFragmentWithFixups<8, 0> {
432 /// True if this is a sleb128, false if uleb128.
433 bool IsSigned;
434
435 /// The value this fragment should contain.
436 const MCExpr *Value;
437
438public:
439 MCLEBFragment(const MCExpr &Value, bool IsSigned, MCSection *Sec = nullptr)
441 IsSigned(IsSigned), Value(&Value) {
443 }
444
445 const MCExpr &getValue() const { return *Value; }
446 void setValue(const MCExpr *Expr) { Value = Expr; }
447
448 bool isSigned() const { return IsSigned; }
449
450 /// @}
451
452 static bool classof(const MCFragment *F) {
453 return F->getKind() == MCFragment::FT_LEB;
454 }
455};
456
458 /// The value of the difference between the two line numbers
459 /// between two .loc dwarf directives.
460 int64_t LineDelta;
461
462 /// The expression for the difference of the two symbols that
463 /// make up the address delta between two .loc dwarf directives.
464 const MCExpr *AddrDelta;
465
466public:
467 MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta,
468 MCSection *Sec = nullptr)
470 LineDelta(LineDelta), AddrDelta(&AddrDelta) {}
471
472 int64_t getLineDelta() const { return LineDelta; }
473
474 const MCExpr &getAddrDelta() const { return *AddrDelta; }
475
476 static bool classof(const MCFragment *F) {
477 return F->getKind() == MCFragment::FT_Dwarf;
478 }
479};
480
482 /// The expression for the difference of the two symbols that
483 /// make up the address delta between two .cfi_* dwarf directives.
484 const MCExpr *AddrDelta;
485
486public:
487 MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec = nullptr)
489 AddrDelta(&AddrDelta) {}
490
491 const MCExpr &getAddrDelta() const { return *AddrDelta; }
492 void setAddrDelta(const MCExpr *E) { AddrDelta = E; }
493
494 static bool classof(const MCFragment *F) {
495 return F->getKind() == MCFragment::FT_DwarfFrame;
496 }
497};
498
499/// Represents a symbol table index fragment.
501 const MCSymbol *Sym;
502
503public:
504 MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec = nullptr)
505 : MCFragment(FT_SymbolId, false, Sec), Sym(Sym) {}
506
507 const MCSymbol *getSymbol() { return Sym; }
508 const MCSymbol *getSymbol() const { return Sym; }
509
510 static bool classof(const MCFragment *F) {
511 return F->getKind() == MCFragment::FT_SymbolId;
512 }
513};
514
515/// Fragment representing the binary annotations produced by the
516/// .cv_inline_linetable directive.
518 unsigned SiteFuncId;
519 unsigned StartFileId;
520 unsigned StartLineNum;
521 const MCSymbol *FnStartSym;
522 const MCSymbol *FnEndSym;
523 SmallString<8> Contents;
524
525 /// CodeViewContext has the real knowledge about this format, so let it access
526 /// our members.
527 friend class CodeViewContext;
528
529public:
530 MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
531 unsigned StartLineNum, const MCSymbol *FnStartSym,
532 const MCSymbol *FnEndSym,
533 MCSection *Sec = nullptr)
534 : MCFragment(FT_CVInlineLines, false, Sec), SiteFuncId(SiteFuncId),
535 StartFileId(StartFileId), StartLineNum(StartLineNum),
536 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
537
538 const MCSymbol *getFnStartSym() const { return FnStartSym; }
539 const MCSymbol *getFnEndSym() const { return FnEndSym; }
540
541 SmallString<8> &getContents() { return Contents; }
542 const SmallString<8> &getContents() const { return Contents; }
543
544 static bool classof(const MCFragment *F) {
545 return F->getKind() == MCFragment::FT_CVInlineLines;
546 }
547};
548
549/// Fragment representing the .cv_def_range directive.
552 SmallString<32> FixedSizePortion;
553
554 /// CodeViewContext has the real knowledge about this format, so let it access
555 /// our members.
556 friend class CodeViewContext;
557
558public:
560 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
561 StringRef FixedSizePortion, MCSection *Sec = nullptr)
563 Ranges(Ranges.begin(), Ranges.end()),
564 FixedSizePortion(FixedSizePortion) {}
565
567 return Ranges;
568 }
569
570 StringRef getFixedSizePortion() const { return FixedSizePortion.str(); }
571
572 static bool classof(const MCFragment *F) {
573 return F->getKind() == MCFragment::FT_CVDefRange;
574 }
575};
576
577/// Represents required padding such that a particular other set of fragments
578/// does not cross a particular power-of-two boundary. The other fragments must
579/// follow this one within the same section.
581 /// The alignment requirement of the branch to be aligned.
582 Align AlignBoundary;
583 /// The last fragment in the set of fragments to be aligned.
584 const MCFragment *LastFragment = nullptr;
585 /// The size of the fragment. The size is lazily set during relaxation, and
586 /// is not meaningful before that.
587 uint64_t Size = 0;
588
589 /// When emitting Nops some subtargets have specific nop encodings.
590 const MCSubtargetInfo &STI;
591
592public:
594 MCSection *Sec = nullptr)
595 : MCFragment(FT_BoundaryAlign, false, Sec), AlignBoundary(AlignBoundary),
596 STI(STI) {}
597
598 uint64_t getSize() const { return Size; }
599 void setSize(uint64_t Value) { Size = Value; }
600
601 Align getAlignment() const { return AlignBoundary; }
602 void setAlignment(Align Value) { AlignBoundary = Value; }
603
604 const MCFragment *getLastFragment() const { return LastFragment; }
606 assert(!F || getParent() == F->getParent());
607 LastFragment = F;
608 }
609
610 const MCSubtargetInfo *getSubtargetInfo() const { return &STI; }
611
612 static bool classof(const MCFragment *F) {
613 return F->getKind() == MCFragment::FT_BoundaryAlign;
614 }
615};
616
618 /// The expression for the difference of the two symbols that
619 /// make up the address delta between two .pseudoprobe directives.
620 const MCExpr *AddrDelta;
621
622public:
623 MCPseudoProbeAddrFragment(const MCExpr *AddrDelta, MCSection *Sec = nullptr)
625 AddrDelta(AddrDelta) {}
626
627 const MCExpr &getAddrDelta() const { return *AddrDelta; }
628
629 static bool classof(const MCFragment *F) {
630 return F->getKind() == MCFragment::FT_PseudoProbe;
631 }
632};
633} // end namespace llvm
634
635#endif // LLVM_MC_MCFRAGMENT_H
basic Basic Alias true
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
uint64_t Offset
Definition: ELF_riscv.cpp:478
Symbol * Sym
Definition: ELF_riscv.cpp:479
#define F(x, y, z)
Definition: MD5.cpp:55
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Holds state from .cv_file and .cv_loc directives for later emission.
Definition: MCCodeView.h:144
void setEmitNops(bool Value, const MCSubtargetInfo *STI)
Definition: MCFragment.h:335
int64_t getValue() const
Definition: MCFragment.h:328
Align getAlignment() const
Definition: MCFragment.h:326
unsigned getMaxBytesToEmit() const
Definition: MCFragment.h:332
bool hasEmitNops() const
Definition: MCFragment.h:334
unsigned getValueSize() const
Definition: MCFragment.h:330
const MCSubtargetInfo * getSubtargetInfo() const
Definition: MCFragment.h:340
static bool classof(const MCFragment *F)
Definition: MCFragment.h:342
MCAlignFragment(Align Alignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit, MCSection *Sec=nullptr)
Definition: MCFragment.h:321
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Represents required padding such that a particular other set of fragments does not cross a particular...
Definition: MCFragment.h:580
uint64_t getSize() const
Definition: MCFragment.h:598
void setAlignment(Align Value)
Definition: MCFragment.h:602
void setSize(uint64_t Value)
Definition: MCFragment.h:599
MCBoundaryAlignFragment(Align AlignBoundary, const MCSubtargetInfo &STI, MCSection *Sec=nullptr)
Definition: MCFragment.h:593
const MCFragment * getLastFragment() const
Definition: MCFragment.h:604
const MCSubtargetInfo * getSubtargetInfo() const
Definition: MCFragment.h:610
static bool classof(const MCFragment *F)
Definition: MCFragment.h:612
void setLastFragment(const MCFragment *F)
Definition: MCFragment.h:605
Fragment representing the .cv_def_range directive.
Definition: MCFragment.h:550
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
Definition: MCFragment.h:566
static bool classof(const MCFragment *F)
Definition: MCFragment.h:572
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion, MCSection *Sec=nullptr)
Definition: MCFragment.h:559
StringRef getFixedSizePortion() const
Definition: MCFragment.h:570
Fragment representing the binary annotations produced by the .cv_inline_linetable directive.
Definition: MCFragment.h:517
static bool classof(const MCFragment *F)
Definition: MCFragment.h:544
const SmallString< 8 > & getContents() const
Definition: MCFragment.h:542
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym, MCSection *Sec=nullptr)
Definition: MCFragment.h:530
const MCSymbol * getFnStartSym() const
Definition: MCFragment.h:538
const MCSymbol * getFnEndSym() const
Definition: MCFragment.h:539
SmallString< 8 > & getContents()
Definition: MCFragment.h:541
This is a compact (memory-size-wise) fragment for holding an encoded instruction (non-relaxable) that...
Definition: MCFragment.h:260
MCCompactEncodedInstFragment(MCSection *Sec=nullptr)
Definition: MCFragment.h:262
static bool classof(const MCFragment *F)
Definition: MCFragment.h:266
Fragment for data and encoded instructions.
Definition: MCFragment.h:242
static bool classof(const MCFragment *F)
Definition: MCFragment.h:247
MCDataFragment(MCSection *Sec=nullptr)
Definition: MCFragment.h:244
bool isLinkerRelaxable() const
Definition: MCFragment.h:251
static bool classof(const MCFragment *F)
Definition: MCFragment.h:119
MCDummyFragment(MCSection *Sec)
Definition: MCFragment.h:117
void setAddrDelta(const MCExpr *E)
Definition: MCFragment.h:492
MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec=nullptr)
Definition: MCFragment.h:487
static bool classof(const MCFragment *F)
Definition: MCFragment.h:494
const MCExpr & getAddrDelta() const
Definition: MCFragment.h:491
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta, MCSection *Sec=nullptr)
Definition: MCFragment.h:467
int64_t getLineDelta() const
Definition: MCFragment.h:472
static bool classof(const MCFragment *F)
Definition: MCFragment.h:476
const MCExpr & getAddrDelta() const
Definition: MCFragment.h:474
Interface implemented by fragments that contain encoded instructions and/or data.
Definition: MCFragment.h:187
const SmallVectorImpl< char > & getContents() const
Definition: MCFragment.h:198
SmallVectorImpl< char > & getContents()
Definition: MCFragment.h:197
MCEncodedFragmentWithContents(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
Definition: MCFragment.h:191
Interface implemented by fragments that contain encoded instructions and/or data and also have fixups...
Definition: MCFragment.h:206
static bool classof(const MCFragment *F)
Definition: MCFragment.h:232
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
Definition: MCFragment.h:212
const SmallVectorImpl< MCFixup > & getFixups() const
Definition: MCFragment.h:224
SmallVectorImpl< MCFixup > & getFixups()
Definition: MCFragment.h:223
SmallVectorImpl< MCFixup >::iterator fixup_iterator
Definition: MCFragment.h:221
const_fixup_iterator fixup_end() const
Definition: MCFragment.h:230
SmallVectorImpl< MCFixup >::const_iterator const_fixup_iterator
Definition: MCFragment.h:220
const_fixup_iterator fixup_begin() const
Definition: MCFragment.h:227
Interface implemented by fragments that contain encoded instructions and/or data.
Definition: MCFragment.h:125
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
Definition: MCFragment.h:173
const MCSubtargetInfo * STI
The MCSubtargetInfo in effect when the instruction was encoded.
Definition: MCFragment.h:138
static bool classof(const MCFragment *F)
Definition: MCFragment.h:141
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
Definition: MCFragment.h:169
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
Definition: MCFragment.h:177
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
Definition: MCFragment.h:165
void setAlignToBundleEnd(bool V)
Definition: MCFragment.h:158
bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
Definition: MCFragment.h:157
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
Definition: MCFragment.h:132
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues, SMLoc Loc, MCSection *Sec=nullptr)
Definition: MCFragment.h:358
SMLoc getLoc() const
Definition: MCFragment.h:367
uint8_t getValueSize() const
Definition: MCFragment.h:364
uint64_t getValue() const
Definition: MCFragment.h:363
static bool classof(const MCFragment *F)
Definition: MCFragment.h:369
const MCExpr & getNumValues() const
Definition: MCFragment.h:365
bool LinkerRelaxable
Definition: MCFragment.h:78
FragmentType getKind() const
Definition: MCFragment.h:94
MCFragment()=delete
unsigned getLayoutOrder() const
Definition: MCFragment.h:102
bool HasInstructions
Definition: MCFragment.h:77
void setParent(MCSection *Value)
Definition: MCFragment.h:97
void setSubsectionNumber(unsigned Value)
Definition: MCFragment.h:111
void destroy()
Destroys the current fragment.
Definition: MCFragment.cpp:266
const MCSymbol * getAtom() const
Definition: MCFragment.h:99
void setLayoutOrder(unsigned Value)
Definition: MCFragment.h:103
void dump() const
Definition: MCFragment.cpp:339
MCSection * getParent() const
Definition: MCFragment.h:96
MCFragment(const MCFragment &)=delete
void setAtom(const MCSymbol *Value)
Definition: MCFragment.h:100
MCFragment & operator=(const MCFragment &)=delete
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
Definition: MCFragment.h:107
unsigned getSubsectionNumber() const
Definition: MCFragment.h:112
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
bool isSigned() const
Definition: MCFragment.h:448
const MCExpr & getValue() const
Definition: MCFragment.h:445
void setValue(const MCExpr *Expr)
Definition: MCFragment.h:446
MCLEBFragment(const MCExpr &Value, bool IsSigned, MCSection *Sec=nullptr)
Definition: MCFragment.h:439
static bool classof(const MCFragment *F)
Definition: MCFragment.h:452
int64_t getControlledNopLength() const
Definition: MCFragment.h:393
int64_t getNumBytes() const
Definition: MCFragment.h:392
MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L, const MCSubtargetInfo &STI, MCSection *Sec=nullptr)
Definition: MCFragment.h:387
static bool classof(const MCFragment *F)
Definition: MCFragment.h:399
const MCSubtargetInfo * getSubtargetInfo() const
Definition: MCFragment.h:397
SMLoc getLoc() const
Definition: MCFragment.h:395
SMLoc getLoc() const
Definition: MCFragment.h:424
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc, MCSection *Sec=nullptr)
Definition: MCFragment.h:415
static bool classof(const MCFragment *F)
Definition: MCFragment.h:426
uint8_t getValue() const
Definition: MCFragment.h:422
const MCExpr & getOffset() const
Definition: MCFragment.h:420
MCPseudoProbeAddrFragment(const MCExpr *AddrDelta, MCSection *Sec=nullptr)
Definition: MCFragment.h:623
const MCExpr & getAddrDelta() const
Definition: MCFragment.h:627
static bool classof(const MCFragment *F)
Definition: MCFragment.h:629
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:274
void setAllowAutoPadding(bool V)
Definition: MCFragment.h:291
static bool classof(const MCFragment *F)
Definition: MCFragment.h:293
bool getAllowAutoPadding() const
Definition: MCFragment.h:290
const MCInst & getInst() const
Definition: MCFragment.h:287
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI, MCSection *Sec=nullptr)
Definition: MCFragment.h:282
void setInst(const MCInst &Value)
Definition: MCFragment.h:288
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
Generic base class for all target subtargets.
Represents a symbol table index fragment.
Definition: MCFragment.h:500
const MCSymbol * getSymbol() const
Definition: MCFragment.h:508
MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec=nullptr)
Definition: MCFragment.h:504
static bool classof(const MCFragment *F)
Definition: MCFragment.h:510
const MCSymbol * getSymbol()
Definition: MCFragment.h:507
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:40
Represents a location in source code.
Definition: SMLoc.h:23
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
StringRef str() const
Explicit conversion to StringRef.
Definition: SmallString.h:254
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:586
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:591
typename SuperClass::iterator iterator
Definition: SmallVector.h:590
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
An ilist node that can access its parent list.
Definition: ilist_node.h:284
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39