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