LLVM 22.0.0git
MCSection.h
Go to the documentation of this file.
1//===- MCSection.h - Machine Code Sections ----------------------*- 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// This file declares the MCSection class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_MC_MCSECTION_H
14#define LLVM_MC_MCSECTION_H
15
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/DenseMap.h"
20#include "llvm/MC/MCFixup.h"
21#include "llvm/MC/MCInst.h"
22#include "llvm/MC/SectionKind.h"
25#include <cassert>
26#include <utility>
27
28namespace llvm {
29
30class MCAsmInfo;
31class MCAssembler;
32class MCContext;
33class MCExpr;
34class MCFragment;
36class MCSymbol;
37class MCSection;
38class MCSubtargetInfo;
39class raw_ostream;
40class Triple;
41
42// Represents a contiguous piece of code or data within a section. Its size is
43// determined by MCAssembler::layout. All subclasses must have trivial
44// destructors.
46 friend class MCAssembler;
47 friend class MCStreamer;
48 friend class MCObjectStreamer;
49 friend class MCSection;
50
51public:
68
69private:
70 // The next fragment within the section.
71 MCFragment *Next = nullptr;
72
73 /// The data for the section this fragment is in.
74 MCSection *Parent = nullptr;
75
76 /// The offset of this fragment in its section.
77 uint64_t Offset = 0;
78
79 /// The layout order of this fragment.
80 unsigned LayoutOrder = 0;
81
82 FragmentType Kind;
83
84 //== Used by certain fragment types for better packing.
85
86 // The number of fixups for the optional variable-size tail must be small.
87 uint8_t VarFixupSize = 0;
88
89 bool LinkerRelaxable : 1;
90
91 /// FT_Data, FT_Relaxable
92 bool HasInstructions : 1;
93 /// FT_Relaxable, x86-specific
94 bool AllowAutoPadding : 1;
95
96 // Track content and fixups for the fixed-size part as fragments are
97 // appended to the section. The content is stored as trailing data of the
98 // MCFragment. The content remains immutable, except when modified by
99 // applyFixup.
100 uint32_t FixedSize = 0;
101 uint32_t FixupStart = 0;
102 uint32_t FixupEnd = 0;
103
104 // Track content and fixups for the optional variable-size tail part,
105 // typically modified during relaxation.
106 uint32_t VarContentStart = 0;
107 uint32_t VarContentEnd = 0;
108 uint32_t VarFixupStart = 0;
109
110protected:
111 const MCSubtargetInfo *STI = nullptr;
112
113private:
114 // Optional variable-size tail used by various fragment types.
115 union Tail {
116 struct {
117 uint32_t Opcode;
118 uint32_t Flags;
119 uint32_t OperandStart;
120 uint32_t OperandSize;
121 } relax;
122 struct {
123 // The alignment to ensure, in bytes.
124 Align Alignment;
125 // The size of the integer (in bytes) of \p Value.
126 uint8_t FillLen;
127 // If true, fill with target-specific nop instructions.
128 bool EmitNops;
129 // The maximum number of bytes to emit; if the alignment
130 // cannot be satisfied in this width then this fragment is ignored.
131 unsigned MaxBytesToEmit;
132 // Value to use for filling padding bytes.
133 int64_t Fill;
134 } align;
135 struct {
136 // True if this is a sleb128, false if uleb128.
137 bool IsSigned;
138 // The value this fragment should contain.
139 const MCExpr *Value;
140 } leb;
141 // Used by .debug_frame and .debug_line to encode an address difference.
142 struct {
143 // The address difference between two labels.
144 const MCExpr *AddrDelta;
145 // The value of the difference between the two line numbers between two
146 // .loc dwarf directives.
147 int64_t LineDelta;
148 } dwarf;
149 struct {
150 // This FRE describes unwind info at AddrDelta from function start.
151 const MCExpr *AddrDelta;
152 // Fragment that records how many bytes of AddrDelta to emit.
153 MCFragment *FDEFragment;
154 } sframe;
155 } u{};
156
157public:
158 LLVM_ABI MCFragment(FragmentType Kind = MCFragment::FT_Data,
159 bool HasInstructions = false);
160 MCFragment(const MCFragment &) = delete;
161 MCFragment &operator=(const MCFragment &) = delete;
162
163 MCFragment *getNext() const { return Next; }
164
165 FragmentType getKind() const { return Kind; }
166
167 MCSection *getParent() const { return Parent; }
168 void setParent(MCSection *Value) { Parent = Value; }
169
170 LLVM_ABI const MCSymbol *getAtom() const;
171
172 unsigned getLayoutOrder() const { return LayoutOrder; }
173 void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
174
175 /// Does this fragment have instructions emitted into it? By default
176 /// this is false, but specific fragment types may set it to true.
177 bool hasInstructions() const { return HasInstructions; }
178
179 LLVM_ABI void dump() const;
180
181 /// Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
182 /// Guaranteed to be non-null if hasInstructions() == true
183 const MCSubtargetInfo *getSubtargetInfo() const { return STI; }
184
185 /// Record that the fragment contains instructions with the MCSubtargetInfo in
186 /// effect when the instruction was encoded.
188 HasInstructions = true;
189 this->STI = &STI;
190 }
191
192 bool isLinkerRelaxable() const { return LinkerRelaxable; }
193 void setLinkerRelaxable() { LinkerRelaxable = true; }
194
195 bool getAllowAutoPadding() const { return AllowAutoPadding; }
196 void setAllowAutoPadding(bool V) { AllowAutoPadding = V; }
197
198 //== Content-related functions manage parent's storage using ContentStart and
199 // ContentSize.
200
203
208
209 size_t getFixedSize() const { return FixedSize; }
210 size_t getVarSize() const { return VarContentEnd - VarContentStart; }
211 size_t getSize() const {
212 return FixedSize + (VarContentEnd - VarContentStart);
213 }
214
215 //== Fixup-related functions manage parent's storage using FixupStart and
216 // FixupSize.
217 void clearFixups() { FixupEnd = FixupStart; }
222
223 // Source fixup offsets are relative to the variable part's start.
224 // Stored fixup offsets are relative to the fixed part's start.
229
230 //== FT_Relaxable functions
231 unsigned getOpcode() const {
232 assert(Kind == FT_Relaxable);
233 return u.relax.Opcode;
234 }
236 MCInst getInst() const;
237 void setInst(const MCInst &Inst);
238
239 //== FT_Align functions
240 void makeAlign(Align Alignment, int64_t Fill, uint8_t FillLen,
241 unsigned MaxBytesToEmit) {
242 Kind = FT_Align;
243 u.align.EmitNops = false;
244 u.align.Alignment = Alignment;
245 u.align.Fill = Fill;
246 u.align.FillLen = FillLen;
247 u.align.MaxBytesToEmit = MaxBytesToEmit;
248 }
249
251 assert(Kind == FT_Align);
252 return u.align.Alignment;
253 }
254 int64_t getAlignFill() const {
255 assert(Kind == FT_Align);
256 return u.align.Fill;
257 }
259 assert(Kind == FT_Align);
260 return u.align.FillLen;
261 }
262 unsigned getAlignMaxBytesToEmit() const {
263 assert(Kind == FT_Align);
264 return u.align.MaxBytesToEmit;
265 }
266 bool hasAlignEmitNops() const {
267 assert(Kind == FT_Align);
268 return u.align.EmitNops;
269 }
270
271 //== FT_LEB functions
272 void makeLEB(bool IsSigned, const MCExpr *Value) {
273 assert(Kind == FT_Data);
274 Kind = MCFragment::FT_LEB;
275 u.leb.IsSigned = IsSigned;
276 u.leb.Value = Value;
277 }
278 const MCExpr &getLEBValue() const {
279 assert(Kind == FT_LEB);
280 return *u.leb.Value;
281 }
282 void setLEBValue(const MCExpr *Expr) {
283 assert(Kind == FT_LEB);
284 u.leb.Value = Expr;
285 }
286 bool isLEBSigned() const {
287 assert(Kind == FT_LEB);
288 return u.leb.IsSigned;
289 }
290
291 //== FT_DwarfFrame functions
292 const MCExpr &getDwarfAddrDelta() const {
293 assert(Kind == FT_Dwarf || Kind == FT_DwarfFrame);
294 return *u.dwarf.AddrDelta;
295 }
297 assert(Kind == FT_Dwarf || Kind == FT_DwarfFrame);
298 u.dwarf.AddrDelta = E;
299 }
300 int64_t getDwarfLineDelta() const {
301 assert(Kind == FT_Dwarf);
302 return u.dwarf.LineDelta;
303 }
304 void setDwarfLineDelta(int64_t LineDelta) {
305 assert(Kind == FT_Dwarf);
306 u.dwarf.LineDelta = LineDelta;
307 }
308
309 //== FT_SFrame functions
310 const MCExpr &getSFrameAddrDelta() const {
311 assert(Kind == FT_SFrame);
312 return *u.sframe.AddrDelta;
313 }
315 assert(Kind == FT_SFrame);
316 u.sframe.AddrDelta = E;
317 }
319 assert(Kind == FT_SFrame);
320 return u.sframe.FDEFragment;
321 }
323 assert(Kind == FT_SFrame);
324 u.sframe.FDEFragment = F;
325 }
326};
327
328// MCFragment subclasses do not use the fixed-size part or variable-size tail of
329// MCFragment. Instead, they encode content in a specialized way.
330
332 uint8_t ValueSize;
333 /// Value to use for filling bytes.
334 uint64_t Value;
335 /// The number of bytes to insert.
336 const MCExpr &NumValues;
337
338 /// Source location of the directive that this fragment was created for.
339 SMLoc Loc;
340
341public:
342 MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues,
343 SMLoc Loc)
344 : MCFragment(FT_Fill), ValueSize(VSize), Value(Value),
345 NumValues(NumValues), Loc(Loc) {}
346
347 uint64_t getValue() const { return Value; }
348 uint8_t getValueSize() const { return ValueSize; }
349 const MCExpr &getNumValues() const { return NumValues; }
350
351 SMLoc getLoc() const { return Loc; }
352
353 static bool classof(const MCFragment *F) {
354 return F->getKind() == MCFragment::FT_Fill;
355 }
356};
357
359 /// The number of bytes to insert.
360 int64_t Size;
361 /// Maximum number of bytes allowed in each NOP instruction.
362 int64_t ControlledNopLength;
363
364 /// Source location of the directive that this fragment was created for.
365 SMLoc Loc;
366
367public:
368 MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L,
369 const MCSubtargetInfo &STI)
370 : MCFragment(FT_Nops), Size(NumBytes),
371 ControlledNopLength(ControlledNopLength), Loc(L) {
372 this->STI = &STI;
373 }
374
375 int64_t getNumBytes() const { return Size; }
376 int64_t getControlledNopLength() const { return ControlledNopLength; }
377
378 SMLoc getLoc() const { return Loc; }
379
380 static bool classof(const MCFragment *F) {
381 return F->getKind() == MCFragment::FT_Nops;
382 }
383};
384
385class MCOrgFragment : public MCFragment {
386 /// Value to use for filling bytes.
387 int8_t Value;
388
389 /// The offset this fragment should start at.
390 const MCExpr *Offset;
391
392 /// Source location of the directive that this fragment was created for.
393 SMLoc Loc;
394
395public:
396 MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
397 : MCFragment(FT_Org), Value(Value), Offset(&Offset), Loc(Loc) {}
398
399 const MCExpr &getOffset() const { return *Offset; }
400 uint8_t getValue() const { return Value; }
401
402 SMLoc getLoc() const { return Loc; }
403
404 static bool classof(const MCFragment *F) {
405 return F->getKind() == MCFragment::FT_Org;
406 }
407};
408
409/// Represents a symbol table index fragment.
411 const MCSymbol *Sym;
412
413public:
415
416 const MCSymbol *getSymbol() { return Sym; }
417 const MCSymbol *getSymbol() const { return Sym; }
418
419 static bool classof(const MCFragment *F) {
420 return F->getKind() == MCFragment::FT_SymbolId;
421 }
422};
423
424/// Fragment representing the binary annotations produced by the
425/// .cv_inline_linetable directive.
427 unsigned SiteFuncId;
428 unsigned StartFileId;
429 unsigned StartLineNum;
430 const MCSymbol *FnStartSym;
431 const MCSymbol *FnEndSym;
432
433 /// CodeViewContext has the real knowledge about this format, so let it access
434 /// our members.
435 friend class CodeViewContext;
436
437public:
438 MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
439 unsigned StartLineNum, const MCSymbol *FnStartSym,
440 const MCSymbol *FnEndSym)
441 : MCFragment(FT_CVInlineLines), SiteFuncId(SiteFuncId),
442 StartFileId(StartFileId), StartLineNum(StartLineNum),
443 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
444
445 const MCSymbol *getFnStartSym() const { return FnStartSym; }
446 const MCSymbol *getFnEndSym() const { return FnEndSym; }
447
448 static bool classof(const MCFragment *F) {
449 return F->getKind() == MCFragment::FT_CVInlineLines;
450 }
451};
452
453/// Fragment representing the .cv_def_range directive.
456 StringRef FixedSizePortion;
457
458 /// CodeViewContext has the real knowledge about this format, so let it access
459 /// our members.
460 friend class CodeViewContext;
461
462public:
464 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
465 StringRef FixedSizePortion)
466 : MCFragment(FT_CVDefRange), Ranges(Ranges.begin(), Ranges.end()),
467 FixedSizePortion(FixedSizePortion) {}
468
472
473 StringRef getFixedSizePortion() const { return FixedSizePortion; }
474
475 static bool classof(const MCFragment *F) {
476 return F->getKind() == MCFragment::FT_CVDefRange;
477 }
478};
479
480/// Represents required padding such that a particular other set of fragments
481/// does not cross a particular power-of-two boundary. The other fragments must
482/// follow this one within the same section.
484 /// The alignment requirement of the branch to be aligned.
485 Align AlignBoundary;
486 /// The last fragment in the set of fragments to be aligned.
487 const MCFragment *LastFragment = nullptr;
488 /// The size of the fragment. The size is lazily set during relaxation, and
489 /// is not meaningful before that.
490 uint64_t Size = 0;
491
492public:
494 : MCFragment(FT_BoundaryAlign), AlignBoundary(AlignBoundary) {
495 this->STI = &STI;
496 }
497
498 uint64_t getSize() const { return Size; }
499 void setSize(uint64_t Value) { Size = Value; }
500
501 Align getAlignment() const { return AlignBoundary; }
502 void setAlignment(Align Value) { AlignBoundary = Value; }
503
504 const MCFragment *getLastFragment() const { return LastFragment; }
506 assert(!F || getParent() == F->getParent());
507 LastFragment = F;
508 }
509
510 static bool classof(const MCFragment *F) {
511 return F->getKind() == MCFragment::FT_BoundaryAlign;
512 }
513};
514
515/// Instances of this class represent a uniqued identifier for a section in the
516/// current translation unit. The MCContext class uniques and creates these.
518public:
521 friend class MCFragment;
522 static constexpr unsigned NonUniqueID = ~0U;
523
524 struct iterator {
525 MCFragment *F = nullptr;
526 iterator() = default;
527 explicit iterator(MCFragment *F) : F(F) {}
528 MCFragment &operator*() const { return *F; }
529 bool operator==(const iterator &O) const { return F == O.F; }
530 bool operator!=(const iterator &O) const { return F != O.F; }
531 iterator &operator++();
532 };
533
534 struct FragList {
535 MCFragment *Head = nullptr;
536 MCFragment *Tail = nullptr;
537 };
538
539private:
540 // At parse time, this holds the fragment list of the current subsection. At
541 // layout time, this holds the concatenated fragment lists of all subsections.
542 FragList *CurFragList;
543 // In many object file formats, this denotes the section symbol. In Mach-O,
544 // this denotes an optional temporary label at the section start.
545 MCSymbol *Begin;
546 MCSymbol *End = nullptr;
547 /// The alignment requirement of this section.
548 Align Alignment;
549 /// The section index in the assemblers section list.
550 unsigned Ordinal = 0;
551 // If not -1u, the first linker-relaxable fragment's order within the
552 // subsection. When present, the offset between two locations crossing this
553 // fragment may not be fully resolved.
554 unsigned FirstLinkerRelaxable = -1u;
555
556 /// Whether this section has had instructions emitted into it.
557 bool HasInstructions : 1;
558
559 bool IsRegistered : 1;
560
561 bool IsText : 1;
562 bool IsBss : 1;
563
564 MCFragment DummyFragment;
565
566 // Mapping from subsection number to fragment list. At layout time, the
567 // subsection 0 list is replaced with concatenated fragments from all
568 // subsections.
570
571 // Content and fixup storage for fragments
572 SmallVector<char, 0> ContentStorage;
573 SmallVector<MCFixup, 0> FixupStorage;
574 SmallVector<MCOperand, 0> MCOperandStorage;
575
576protected:
577 // TODO Make Name private when possible.
579
580 MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin);
581
582public:
583 MCSection(const MCSection &) = delete;
584 MCSection &operator=(const MCSection &) = delete;
585
586 StringRef getName() const { return Name; }
587 bool isText() const { return IsText; }
588
589 MCSymbol *getBeginSymbol() { return Begin; }
590 const MCSymbol *getBeginSymbol() const {
591 return const_cast<MCSection *>(this)->getBeginSymbol();
592 }
594 assert(!Begin);
595 Begin = Sym;
596 }
597 MCSymbol *getEndSymbol(MCContext &Ctx);
598 bool hasEnded() const;
599
600 Align getAlign() const { return Alignment; }
601 void setAlignment(Align Value) { Alignment = Value; }
602
603 /// Makes sure that Alignment is at least MinAlignment.
604 void ensureMinAlignment(Align MinAlignment) {
605 if (Alignment < MinAlignment)
606 Alignment = MinAlignment;
607 }
608
609 unsigned getOrdinal() const { return Ordinal; }
610 void setOrdinal(unsigned Value) { Ordinal = Value; }
611
612 bool hasInstructions() const { return HasInstructions; }
613 void setHasInstructions(bool Value) { HasInstructions = Value; }
614
615 bool isRegistered() const { return IsRegistered; }
616 void setIsRegistered(bool Value) { IsRegistered = Value; }
617
618 unsigned firstLinkerRelaxable() const { return FirstLinkerRelaxable; }
619 bool isLinkerRelaxable() const { return FirstLinkerRelaxable != -1u; }
620 void setFirstLinkerRelaxable(unsigned Order) { FirstLinkerRelaxable = Order; }
621
622 MCFragment &getDummyFragment() { return DummyFragment; }
623
624 FragList *curFragList() const { return CurFragList; }
625 iterator begin() const { return iterator(CurFragList->Head); }
626 iterator end() const { return {}; }
627
629 *FragToSyms = nullptr) const;
630
631 /// Check whether this section is "virtual", that is has no actual object
632 /// file contents.
633 bool isBssSection() const { return IsBss; }
634};
635
637 return {reinterpret_cast<char *>(this + 1), FixedSize};
638}
640 return {reinterpret_cast<const char *>(this + 1), FixedSize};
641}
642
644 return MutableArrayRef(getParent()->ContentStorage)
645 .slice(VarContentStart, VarContentEnd - VarContentStart);
646}
648 return ArrayRef(getParent()->ContentStorage)
649 .slice(VarContentStart, VarContentEnd - VarContentStart);
650}
651
652//== Fixup-related functions manage parent's storage using FixupStart and
653// FixupSize.
655 return MutableArrayRef(getParent()->FixupStorage)
656 .slice(FixupStart, FixupEnd - FixupStart);
657}
659 return ArrayRef(getParent()->FixupStorage)
660 .slice(FixupStart, FixupEnd - FixupStart);
661}
662
664 return MutableArrayRef(getParent()->FixupStorage)
665 .slice(VarFixupStart, VarFixupSize);
666}
668 return ArrayRef(getParent()->FixupStorage).slice(VarFixupStart, VarFixupSize);
669}
670
671//== FT_Relaxable functions
673 assert(Kind == FT_Relaxable);
674 return MutableArrayRef(getParent()->MCOperandStorage)
675 .slice(u.relax.OperandStart, u.relax.OperandSize);
676}
678 assert(Kind == FT_Relaxable);
679 MCInst Inst;
680 Inst.setOpcode(u.relax.Opcode);
681 Inst.setFlags(u.relax.Flags);
682 Inst.setOperands(ArrayRef(getParent()->MCOperandStorage)
683 .slice(u.relax.OperandStart, u.relax.OperandSize));
684 return Inst;
685}
686inline void MCFragment::setInst(const MCInst &Inst) {
687 assert(Kind == FT_Relaxable);
688 u.relax.Opcode = Inst.getOpcode();
689 u.relax.Flags = Inst.getFlags();
690 auto &S = getParent()->MCOperandStorage;
691 if (Inst.getNumOperands() > u.relax.OperandSize) {
692 u.relax.OperandStart = S.size();
693 S.resize_for_overwrite(S.size() + Inst.getNumOperands());
694 }
695 u.relax.OperandSize = Inst.getNumOperands();
696 llvm::copy(Inst, S.begin() + u.relax.OperandStart);
697}
698
700 F = F->Next;
701 return *this;
702}
703
704} // end namespace llvm
705
706#endif // LLVM_MC_MCSECTION_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
This file defines the DenseMap class.
#define F(x, y, z)
Definition MD5.cpp:54
PowerPC TLS Dynamic Call Fixup
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:40
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Definition ArrayRef.h:186
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:64
MCBoundaryAlignFragment(Align AlignBoundary, const MCSubtargetInfo &STI)
Definition MCSection.h:493
void setAlignment(Align Value)
Definition MCSection.h:502
void setSize(uint64_t Value)
Definition MCSection.h:499
const MCFragment * getLastFragment() const
Definition MCSection.h:504
static bool classof(const MCFragment *F)
Definition MCSection.h:510
void setLastFragment(const MCFragment *F)
Definition MCSection.h:505
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
Definition MCSection.h:463
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
Definition MCSection.h:469
static bool classof(const MCFragment *F)
Definition MCSection.h:475
StringRef getFixedSizePortion() const
Definition MCSection.h:473
friend class CodeViewContext
CodeViewContext has the real knowledge about this format, so let it access our members.
Definition MCSection.h:460
static bool classof(const MCFragment *F)
Definition MCSection.h:448
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
Definition MCSection.h:438
const MCSymbol * getFnStartSym() const
Definition MCSection.h:445
friend class CodeViewContext
CodeViewContext has the real knowledge about this format, so let it access our members.
Definition MCSection.h:435
const MCSymbol * getFnEndSym() const
Definition MCSection.h:446
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues, SMLoc Loc)
Definition MCSection.h:342
SMLoc getLoc() const
Definition MCSection.h:351
uint8_t getValueSize() const
Definition MCSection.h:348
uint64_t getValue() const
Definition MCSection.h:347
static bool classof(const MCFragment *F)
Definition MCSection.h:353
const MCExpr & getNumValues() const
Definition MCSection.h:349
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition MCFixup.h:61
const MCExpr & getDwarfAddrDelta() const
Definition MCSection.h:292
MutableArrayRef< char > getContents()
Definition MCSection.h:636
MCFragment * getSFrameFDE() const
Definition MCSection.h:318
bool getAllowAutoPadding() const
Definition MCSection.h:195
FragmentType getKind() const
Definition MCSection.h:165
bool isLinkerRelaxable() const
Definition MCSection.h:192
void setAllowAutoPadding(bool V)
Definition MCSection.h:196
unsigned getLayoutOrder() const
Definition MCSection.h:172
LLVM_ABI MCFragment(FragmentType Kind=MCFragment::FT_Data, bool HasInstructions=false)
bool hasAlignEmitNops() const
Definition MCSection.h:266
friend class MCObjectStreamer
Definition MCSection.h:48
void setSFrameAddrDelta(const MCExpr *E)
Definition MCSection.h:314
void setParent(MCSection *Value)
Definition MCSection.h:168
MCInst getInst() const
Definition MCSection.h:677
LLVM_ABI const MCSymbol * getAtom() const
LLVM_ABI void appendFixups(ArrayRef< MCFixup > Fixups)
Definition MCSection.cpp:73
void setDwarfLineDelta(int64_t LineDelta)
Definition MCSection.h:304
unsigned getAlignMaxBytesToEmit() const
Definition MCSection.h:262
int64_t getDwarfLineDelta() const
Definition MCSection.h:300
bool isLEBSigned() const
Definition MCSection.h:286
unsigned getOpcode() const
Definition MCSection.h:231
MutableArrayRef< MCFixup > getFixups()
Definition MCSection.h:654
friend class MCSection
Definition MCSection.h:49
void setLayoutOrder(unsigned Value)
Definition MCSection.h:173
void setSFrameFDE(MCFragment *F)
Definition MCSection.h:322
const MCExpr & getLEBValue() const
Definition MCSection.h:278
LLVM_ABI void dump() const
friend class MCAssembler
Definition MCSection.h:46
size_t getSize() const
Definition MCSection.h:211
MCSection * getParent() const
Definition MCSection.h:167
void makeAlign(Align Alignment, int64_t Fill, uint8_t FillLen, unsigned MaxBytesToEmit)
Definition MCSection.h:240
LLVM_ABI void setVarFixups(ArrayRef< MCFixup > Fixups)
Definition MCSection.cpp:87
MCFragment * getNext() const
Definition MCSection.h:163
const MCSubtargetInfo * STI
Definition MCSection.h:111
MCFragment(const MCFragment &)=delete
void clearVarFixups()
Definition MCSection.h:226
ArrayRef< MCOperand > getOperands() const
Definition MCSection.h:672
LLVM_ABI void addFixup(MCFixup Fixup)
Definition MCSection.cpp:71
void setLinkerRelaxable()
Definition MCSection.h:193
Align getAlignment() const
Definition MCSection.h:250
size_t getFixedSize() const
Definition MCSection.h:209
friend class MCStreamer
Definition MCSection.h:47
int64_t getAlignFill() const
Definition MCSection.h:254
MCFragment & operator=(const MCFragment &)=delete
void makeLEB(bool IsSigned, const MCExpr *Value)
Definition MCSection.h:272
bool hasInstructions() const
Does this fragment have instructions emitted into it?
Definition MCSection.h:177
uint8_t getAlignFillLen() const
Definition MCSection.h:258
void setDwarfAddrDelta(const MCExpr *E)
Definition MCSection.h:296
void setLEBValue(const MCExpr *Expr)
Definition MCSection.h:282
size_t getVarSize() const
Definition MCSection.h:210
LLVM_ABI void setVarContents(ArrayRef< char > Contents)
Definition MCSection.cpp:61
MutableArrayRef< char > getVarContents()
Definition MCSection.h:643
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
Definition MCSection.h:183
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
Definition MCSection.h:187
const MCExpr & getSFrameAddrDelta() const
Definition MCSection.h:310
MutableArrayRef< MCFixup > getVarFixups()
Definition MCSection.h:663
void setInst(const MCInst &Inst)
Definition MCSection.h:686
void clearVarContents()
Definition MCSection.h:205
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
unsigned getNumOperands() const
Definition MCInst.h:212
unsigned getFlags() const
Definition MCInst.h:205
unsigned getOpcode() const
Definition MCInst.h:202
void setFlags(unsigned F)
Definition MCInst.h:204
void setOperands(ArrayRef< MCOperand > Ops)
Definition MCInst.h:216
iterator begin()
Definition MCInst.h:227
void setOpcode(unsigned Op)
Definition MCInst.h:201
int64_t getControlledNopLength() const
Definition MCSection.h:376
int64_t getNumBytes() const
Definition MCSection.h:375
MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L, const MCSubtargetInfo &STI)
Definition MCSection.h:368
static bool classof(const MCFragment *F)
Definition MCSection.h:380
SMLoc getLoc() const
Definition MCSection.h:378
Streaming object file generation interface.
SMLoc getLoc() const
Definition MCSection.h:402
static bool classof(const MCFragment *F)
Definition MCSection.h:404
uint8_t getValue() const
Definition MCSection.h:400
const MCExpr & getOffset() const
Definition MCSection.h:399
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
Definition MCSection.h:396
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:517
void setAlignment(Align Value)
Definition MCSection.h:601
unsigned getOrdinal() const
Definition MCSection.h:609
friend MCObjectStreamer
Definition MCSection.h:520
void ensureMinAlignment(Align MinAlignment)
Makes sure that Alignment is at least MinAlignment.
Definition MCSection.h:604
bool isBssSection() const
Check whether this section is "virtual", that is has no actual object file contents.
Definition MCSection.h:633
Align getAlign() const
Definition MCSection.h:600
bool isLinkerRelaxable() const
Definition MCSection.h:619
static constexpr unsigned NonUniqueID
Definition MCSection.h:522
const MCSymbol * getBeginSymbol() const
Definition MCSection.h:590
bool hasInstructions() const
Definition MCSection.h:612
bool isRegistered() const
Definition MCSection.h:615
void setHasInstructions(bool Value)
Definition MCSection.h:613
void setBeginSymbol(MCSymbol *Sym)
Definition MCSection.h:593
MCSection(const MCSection &)=delete
friend MCAssembler
Definition MCSection.h:519
void setOrdinal(unsigned Value)
Definition MCSection.h:610
bool isText() const
Definition MCSection.h:587
StringRef Name
Definition MCSection.h:578
iterator end() const
Definition MCSection.h:626
MCSection & operator=(const MCSection &)=delete
StringRef getName() const
Definition MCSection.h:586
friend class MCFragment
Definition MCSection.h:521
MCFragment & getDummyFragment()
Definition MCSection.h:622
unsigned firstLinkerRelaxable() const
Definition MCSection.h:618
FragList * curFragList() const
Definition MCSection.h:624
MCSymbol * getBeginSymbol()
Definition MCSection.h:589
iterator begin() const
Definition MCSection.h:625
MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin)
Definition MCSection.cpp:21
void setIsRegistered(bool Value)
Definition MCSection.h:616
void setFirstLinkerRelaxable(unsigned Order)
Definition MCSection.h:620
Generic base class for all target subtargets.
const MCSymbol * getSymbol() const
Definition MCSection.h:417
MCSymbolIdFragment(const MCSymbol *Sym)
Definition MCSection.h:414
static bool classof(const MCFragment *F)
Definition MCSection.h:419
const MCSymbol * getSymbol()
Definition MCSection.h:416
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition ArrayRef.h:298
MutableArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Definition ArrayRef.h:376
Represents a location in source code.
Definition SMLoc.h:22
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
Calculates the starting offsets for various sections within the .debug_names section.
Definition Dwarf.h:35
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
@ Offset
Definition DWP.cpp:532
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
FunctionAddr VTableAddr Next
Definition InstrProf.h:141
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt copy(R &&Range, OutputIt Out)
Definition STLExtras.h:1835
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
MCFragment & operator*() const
Definition MCSection.h:528
bool operator==(const iterator &O) const
Definition MCSection.h:529
bool operator!=(const iterator &O) const
Definition MCSection.h:530
iterator(MCFragment *F)
Definition MCSection.h:527