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