LLVM 23.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() const { return Sym; }
417
418 static bool classof(const MCFragment *F) {
419 return F->getKind() == MCFragment::FT_SymbolId;
420 }
421};
422
423/// Fragment representing the binary annotations produced by the
424/// .cv_inline_linetable directive.
426 unsigned SiteFuncId;
427 unsigned StartFileId;
428 unsigned StartLineNum;
429 const MCSymbol *FnStartSym;
430 const MCSymbol *FnEndSym;
431
432 /// CodeViewContext has the real knowledge about this format, so let it access
433 /// our members.
434 friend class CodeViewContext;
435
436public:
437 MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
438 unsigned StartLineNum, const MCSymbol *FnStartSym,
439 const MCSymbol *FnEndSym)
440 : MCFragment(FT_CVInlineLines), SiteFuncId(SiteFuncId),
441 StartFileId(StartFileId), StartLineNum(StartLineNum),
442 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
443
444 const MCSymbol *getFnStartSym() const { return FnStartSym; }
445 const MCSymbol *getFnEndSym() const { return FnEndSym; }
446
447 static bool classof(const MCFragment *F) {
448 return F->getKind() == MCFragment::FT_CVInlineLines;
449 }
450};
451
452/// Fragment representing the .cv_def_range directive.
455 StringRef FixedSizePortion;
456
457 /// CodeViewContext has the real knowledge about this format, so let it access
458 /// our members.
459 friend class CodeViewContext;
460
461public:
463 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
464 StringRef FixedSizePortion)
465 : MCFragment(FT_CVDefRange), Ranges(Ranges.begin(), Ranges.end()),
466 FixedSizePortion(FixedSizePortion) {}
467
471
472 StringRef getFixedSizePortion() const { return FixedSizePortion; }
473
474 static bool classof(const MCFragment *F) {
475 return F->getKind() == MCFragment::FT_CVDefRange;
476 }
477};
478
479/// Represents required padding such that a particular other set of fragments
480/// does not cross a particular power-of-two boundary. The other fragments must
481/// follow this one within the same section.
483 /// The alignment requirement of the branch to be aligned.
484 Align AlignBoundary;
485 /// The last fragment in the set of fragments to be aligned.
486 const MCFragment *LastFragment = nullptr;
487 /// The size of the fragment. The size is lazily set during relaxation, and
488 /// is not meaningful before that.
489 uint64_t Size = 0;
490
491public:
493 : MCFragment(FT_BoundaryAlign), AlignBoundary(AlignBoundary) {
494 this->STI = &STI;
495 }
496
497 uint64_t getSize() const { return Size; }
498 void setSize(uint64_t Value) { Size = Value; }
499
500 Align getAlignment() const { return AlignBoundary; }
501 void setAlignment(Align Value) { AlignBoundary = Value; }
502
503 const MCFragment *getLastFragment() const { return LastFragment; }
505 assert(!F || getParent() == F->getParent());
506 LastFragment = F;
507 }
508
509 static bool classof(const MCFragment *F) {
510 return F->getKind() == MCFragment::FT_BoundaryAlign;
511 }
512};
513
514/// Instances of this class represent a uniqued identifier for a section in the
515/// current translation unit. The MCContext class uniques and creates these.
517public:
520 friend class MCFragment;
521 static constexpr unsigned NonUniqueID = ~0U;
522
523 struct iterator {
524 MCFragment *F = nullptr;
525 iterator() = default;
526 explicit iterator(MCFragment *F) : F(F) {}
527 MCFragment &operator*() const { return *F; }
528 bool operator==(const iterator &O) const { return F == O.F; }
529 bool operator!=(const iterator &O) const { return F != O.F; }
530 iterator &operator++();
531 };
532
533 struct FragList {
534 MCFragment *Head = nullptr;
535 MCFragment *Tail = nullptr;
536 };
537
538private:
539 // At parse time, this holds the fragment list of the current subsection. At
540 // layout time, this holds the concatenated fragment lists of all subsections.
541 FragList *CurFragList;
542 // In many object file formats, this denotes the section symbol. In Mach-O,
543 // this denotes an optional temporary label at the section start.
544 MCSymbol *Begin;
545 MCSymbol *End = nullptr;
546 /// The alignment requirement of this section.
547 Align Alignment;
548 MaybeAlign PreferredAlignment;
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
610 if (!PreferredAlignment || Alignment > *PreferredAlignment)
611 return Alignment;
612 return *PreferredAlignment;
613 }
614
616 if (!PreferredAlignment || PrefAlign > *PreferredAlignment)
617 PreferredAlignment = PrefAlign;
618 }
619
620 Align getAlignmentForObjectFile(uint64_t Size) const;
621
622 unsigned getOrdinal() const { return Ordinal; }
623 void setOrdinal(unsigned Value) { Ordinal = Value; }
624
625 bool hasInstructions() const { return HasInstructions; }
626 void setHasInstructions(bool Value) { HasInstructions = Value; }
627
628 bool isRegistered() const { return IsRegistered; }
629 void setIsRegistered(bool Value) { IsRegistered = Value; }
630
631 unsigned firstLinkerRelaxable() const { return FirstLinkerRelaxable; }
632 bool isLinkerRelaxable() const { return FirstLinkerRelaxable != -1u; }
633 void setFirstLinkerRelaxable(unsigned Order) { FirstLinkerRelaxable = Order; }
634
635 MCFragment &getDummyFragment() { return DummyFragment; }
636
637 FragList *curFragList() const { return CurFragList; }
638 iterator begin() const { return iterator(CurFragList->Head); }
639 iterator end() const { return {}; }
640
642 *FragToSyms = nullptr) const;
643
644 /// Check whether this section is "virtual", that is has no actual object
645 /// file contents.
646 bool isBssSection() const { return IsBss; }
647};
648
650 return {reinterpret_cast<char *>(this + 1), FixedSize};
651}
653 return {reinterpret_cast<const char *>(this + 1), FixedSize};
654}
655
657 return MutableArrayRef(getParent()->ContentStorage)
658 .slice(VarContentStart, VarContentEnd - VarContentStart);
659}
661 return ArrayRef(getParent()->ContentStorage)
662 .slice(VarContentStart, VarContentEnd - VarContentStart);
663}
664
665//== Fixup-related functions manage parent's storage using FixupStart and
666// FixupSize.
668 return MutableArrayRef(getParent()->FixupStorage)
669 .slice(FixupStart, FixupEnd - FixupStart);
670}
672 return ArrayRef(getParent()->FixupStorage)
673 .slice(FixupStart, FixupEnd - FixupStart);
674}
675
677 return MutableArrayRef(getParent()->FixupStorage)
678 .slice(VarFixupStart, VarFixupSize);
679}
681 return ArrayRef(getParent()->FixupStorage).slice(VarFixupStart, VarFixupSize);
682}
683
684//== FT_Relaxable functions
686 assert(Kind == FT_Relaxable);
687 return MutableArrayRef(getParent()->MCOperandStorage)
688 .slice(u.relax.OperandStart, u.relax.OperandSize);
689}
691 assert(Kind == FT_Relaxable);
692 MCInst Inst;
693 Inst.setOpcode(u.relax.Opcode);
694 Inst.setFlags(u.relax.Flags);
695 Inst.setOperands(ArrayRef(getParent()->MCOperandStorage)
696 .slice(u.relax.OperandStart, u.relax.OperandSize));
697 return Inst;
698}
699inline void MCFragment::setInst(const MCInst &Inst) {
700 assert(Kind == FT_Relaxable);
701 u.relax.Opcode = Inst.getOpcode();
702 u.relax.Flags = Inst.getFlags();
703 auto &S = getParent()->MCOperandStorage;
704 if (Inst.getNumOperands() > u.relax.OperandSize) {
705 u.relax.OperandStart = S.size();
706 S.resize_for_overwrite(S.size() + Inst.getNumOperands());
707 }
708 u.relax.OperandSize = Inst.getNumOperands();
709 llvm::copy(Inst, S.begin() + u.relax.OperandStart);
710}
711
713 F = F->Next;
714 return *this;
715}
716
717} // end namespace llvm
718
719#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:492
void setAlignment(Align Value)
Definition MCSection.h:501
void setSize(uint64_t Value)
Definition MCSection.h:498
const MCFragment * getLastFragment() const
Definition MCSection.h:503
static bool classof(const MCFragment *F)
Definition MCSection.h:509
void setLastFragment(const MCFragment *F)
Definition MCSection.h:504
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
Definition MCSection.h:462
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
Definition MCSection.h:468
static bool classof(const MCFragment *F)
Definition MCSection.h:474
StringRef getFixedSizePortion() const
Definition MCSection.h:472
friend class CodeViewContext
CodeViewContext has the real knowledge about this format, so let it access our members.
Definition MCSection.h:459
static bool classof(const MCFragment *F)
Definition MCSection.h:447
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
Definition MCSection.h:437
const MCSymbol * getFnStartSym() const
Definition MCSection.h:444
friend class CodeViewContext
CodeViewContext has the real knowledge about this format, so let it access our members.
Definition MCSection.h:434
const MCSymbol * getFnEndSym() const
Definition MCSection.h:445
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:649
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:690
LLVM_ABI const MCSymbol * getAtom() const
LLVM_ABI void appendFixups(ArrayRef< MCFixup > Fixups)
Definition MCSection.cpp:83
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:667
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:97
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:685
LLVM_ABI void addFixup(MCFixup Fixup)
Definition MCSection.cpp:81
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:71
MutableArrayRef< char > getVarContents()
Definition MCSection.h:656
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:676
void setInst(const MCInst &Inst)
Definition MCSection.h:699
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:516
void setAlignment(Align Value)
Definition MCSection.h:601
unsigned getOrdinal() const
Definition MCSection.h:622
friend MCObjectStreamer
Definition MCSection.h:519
void ensureMinAlignment(Align MinAlignment)
Makes sure that Alignment is at least MinAlignment.
Definition MCSection.h:604
Align getPreferredAlignment() const
Definition MCSection.h:609
bool isBssSection() const
Check whether this section is "virtual", that is has no actual object file contents.
Definition MCSection.h:646
Align getAlign() const
Definition MCSection.h:600
bool isLinkerRelaxable() const
Definition MCSection.h:632
static constexpr unsigned NonUniqueID
Definition MCSection.h:521
const MCSymbol * getBeginSymbol() const
Definition MCSection.h:590
bool hasInstructions() const
Definition MCSection.h:625
bool isRegistered() const
Definition MCSection.h:628
void setHasInstructions(bool Value)
Definition MCSection.h:626
void setBeginSymbol(MCSymbol *Sym)
Definition MCSection.h:593
MCSection(const MCSection &)=delete
friend MCAssembler
Definition MCSection.h:518
void setOrdinal(unsigned Value)
Definition MCSection.h:623
bool isText() const
Definition MCSection.h:587
StringRef Name
Definition MCSection.h:578
iterator end() const
Definition MCSection.h:639
MCSection & operator=(const MCSection &)=delete
void ensurePreferredAlignment(Align PrefAlign)
Definition MCSection.h:615
StringRef getName() const
Definition MCSection.h:586
friend class MCFragment
Definition MCSection.h:520
MCFragment & getDummyFragment()
Definition MCSection.h:635
unsigned firstLinkerRelaxable() const
Definition MCSection.h:631
FragList * curFragList() const
Definition MCSection.h:637
MCSymbol * getBeginSymbol()
Definition MCSection.h:589
iterator begin() const
Definition MCSection.h:638
MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin)
Definition MCSection.cpp:21
void setIsRegistered(bool Value)
Definition MCSection.h:629
void setFirstLinkerRelaxable(unsigned Order)
Definition MCSection.h:633
Generic base class for all target subtargets.
const MCSymbol * getSymbol() const
Definition MCSection.h:416
MCSymbolIdFragment(const MCSymbol *Sym)
Definition MCSection.h:414
static bool classof(const MCFragment *F)
Definition MCSection.h:418
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.
Definition Types.h:26
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:1885
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:527
bool operator==(const iterator &O) const
Definition MCSection.h:528
bool operator!=(const iterator &O) const
Definition MCSection.h:529
iterator(MCFragment *F)
Definition MCSection.h:526
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition Alignment.h:106