Thanks to visit codestin.com
Credit goes to llvm.org

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
110 const MCSubtargetInfo *STI = nullptr;
111
112 // Optional variable-size tail used by various fragment types.
113 union Tail {
114 struct {
115 uint32_t Opcode;
116 uint32_t Flags;
117 uint32_t OperandStart;
118 uint32_t OperandSize;
119 } relax;
120 struct {
121 // The alignment to ensure, in bytes.
122 Align Alignment;
123 // The size of the integer (in bytes) of \p Value.
124 uint8_t FillLen;
125 // If true, fill with target-specific nop instructions.
126 bool EmitNops;
127 // The maximum number of bytes to emit; if the alignment
128 // cannot be satisfied in this width then this fragment is ignored.
129 unsigned MaxBytesToEmit;
130 // Value to use for filling padding bytes.
131 int64_t Fill;
132 } align;
133 struct {
134 // True if this is a sleb128, false if uleb128.
135 bool IsSigned;
136 // The value this fragment should contain.
137 const MCExpr *Value;
138 } leb;
139 // Used by .debug_frame and .debug_line to encode an address difference.
140 struct {
141 // The address difference between two labels.
142 const MCExpr *AddrDelta;
143 // The value of the difference between the two line numbers between two
144 // .loc dwarf directives.
145 int64_t LineDelta;
146 } dwarf;
147 struct {
148 // This FRE describes unwind info at AddrDelta from function start.
149 const MCExpr *AddrDelta;
150 // Fragment that records how many bytes of AddrDelta to emit.
151 MCFragment *FDEFragment;
152 } sframe;
153 } u{};
154
155public:
157 bool HasInstructions = false);
158 MCFragment(const MCFragment &) = delete;
159 MCFragment &operator=(const MCFragment &) = delete;
160
161 MCFragment *getNext() const { return Next; }
162
163 FragmentType getKind() const { return Kind; }
164
165 MCSection *getParent() const { return Parent; }
166 void setParent(MCSection *Value) { Parent = Value; }
167
168 LLVM_ABI const MCSymbol *getAtom() const;
169
170 unsigned getLayoutOrder() const { return LayoutOrder; }
171 void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
172
173 /// Does this fragment have instructions emitted into it? By default
174 /// this is false, but specific fragment types may set it to true.
175 bool hasInstructions() const { return HasInstructions; }
176
177 LLVM_ABI void dump() const;
178
179 /// Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
180 /// Guaranteed to be non-null if hasInstructions() == true
181 const MCSubtargetInfo *getSubtargetInfo() const { return STI; }
182
183 /// Record that the fragment contains instructions with the MCSubtargetInfo in
184 /// effect when the instruction was encoded.
186 HasInstructions = true;
187 this->STI = &STI;
188 }
189
190 bool isLinkerRelaxable() const { return LinkerRelaxable; }
191 void setLinkerRelaxable() { LinkerRelaxable = true; }
192
193 bool getAllowAutoPadding() const { return AllowAutoPadding; }
194 void setAllowAutoPadding(bool V) { AllowAutoPadding = V; }
195
196 //== Content-related functions manage parent's storage using ContentStart and
197 // ContentSize.
198
201
206
207 size_t getFixedSize() const { return FixedSize; }
208 size_t getVarSize() const { return VarContentEnd - VarContentStart; }
209 size_t getSize() const {
210 return FixedSize + (VarContentEnd - VarContentStart);
211 }
212
213 //== Fixup-related functions manage parent's storage using FixupStart and
214 // FixupSize.
215 void clearFixups() { FixupEnd = FixupStart; }
220
221 // Source fixup offsets are relative to the variable part's start.
222 // Stored fixup offsets are relative to the fixed part's start.
227
228 //== FT_Relaxable functions
229 unsigned getOpcode() const {
230 assert(Kind == FT_Relaxable);
231 return u.relax.Opcode;
232 }
234 MCInst getInst() const;
235 void setInst(const MCInst &Inst);
236
237 //== FT_Align functions
238 void makeAlign(Align Alignment, int64_t Fill, uint8_t FillLen,
239 unsigned MaxBytesToEmit) {
240 Kind = FT_Align;
241 u.align.EmitNops = false;
242 u.align.Alignment = Alignment;
243 u.align.Fill = Fill;
244 u.align.FillLen = FillLen;
245 u.align.MaxBytesToEmit = MaxBytesToEmit;
246 }
247
249 assert(Kind == FT_Align);
250 return u.align.Alignment;
251 }
252 int64_t getAlignFill() const {
253 assert(Kind == FT_Align);
254 return u.align.Fill;
255 }
257 assert(Kind == FT_Align);
258 return u.align.FillLen;
259 }
260 unsigned getAlignMaxBytesToEmit() const {
261 assert(Kind == FT_Align);
262 return u.align.MaxBytesToEmit;
263 }
264 bool hasAlignEmitNops() const {
265 assert(Kind == FT_Align);
266 return u.align.EmitNops;
267 }
268
269 //== FT_LEB functions
270 void makeLEB(bool IsSigned, const MCExpr *Value) {
271 assert(Kind == FT_Data);
272 Kind = MCFragment::FT_LEB;
273 u.leb.IsSigned = IsSigned;
274 u.leb.Value = Value;
275 }
276 const MCExpr &getLEBValue() const {
277 assert(Kind == FT_LEB);
278 return *u.leb.Value;
279 }
280 void setLEBValue(const MCExpr *Expr) {
281 assert(Kind == FT_LEB);
282 u.leb.Value = Expr;
283 }
284 bool isLEBSigned() const {
285 assert(Kind == FT_LEB);
286 return u.leb.IsSigned;
287 }
288
289 //== FT_DwarfFrame functions
290 const MCExpr &getDwarfAddrDelta() const {
291 assert(Kind == FT_Dwarf || Kind == FT_DwarfFrame);
292 return *u.dwarf.AddrDelta;
293 }
295 assert(Kind == FT_Dwarf || Kind == FT_DwarfFrame);
296 u.dwarf.AddrDelta = E;
297 }
298 int64_t getDwarfLineDelta() const {
299 assert(Kind == FT_Dwarf);
300 return u.dwarf.LineDelta;
301 }
302 void setDwarfLineDelta(int64_t LineDelta) {
303 assert(Kind == FT_Dwarf);
304 u.dwarf.LineDelta = LineDelta;
305 }
306
307 //== FT_SFrame functions
308 const MCExpr &getSFrameAddrDelta() const {
309 assert(Kind == FT_SFrame);
310 return *u.sframe.AddrDelta;
311 }
313 assert(Kind == FT_SFrame);
314 u.sframe.AddrDelta = E;
315 }
317 assert(Kind == FT_SFrame);
318 return u.sframe.FDEFragment;
319 }
321 assert(Kind == FT_SFrame);
322 u.sframe.FDEFragment = F;
323 }
324};
325
326// MCFragment subclasses do not use the fixed-size part or variable-size tail of
327// MCFragment. Instead, they encode content in a specialized way.
328
330 uint8_t ValueSize;
331 /// Value to use for filling bytes.
332 uint64_t Value;
333 /// The number of bytes to insert.
334 const MCExpr &NumValues;
335
336 /// Source location of the directive that this fragment was created for.
337 SMLoc Loc;
338
339public:
340 MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues,
341 SMLoc Loc)
342 : MCFragment(FT_Fill), ValueSize(VSize), Value(Value),
343 NumValues(NumValues), Loc(Loc) {}
344
345 uint64_t getValue() const { return Value; }
346 uint8_t getValueSize() const { return ValueSize; }
347 const MCExpr &getNumValues() const { return NumValues; }
348
349 SMLoc getLoc() const { return Loc; }
350
351 static bool classof(const MCFragment *F) {
352 return F->getKind() == MCFragment::FT_Fill;
353 }
354};
355
357 /// The number of bytes to insert.
358 int64_t Size;
359 /// Maximum number of bytes allowed in each NOP instruction.
360 int64_t ControlledNopLength;
361
362 /// Source location of the directive that this fragment was created for.
363 SMLoc Loc;
364
365 /// When emitting Nops some subtargets have specific nop encodings.
366 const MCSubtargetInfo &STI;
367
368public:
369 MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L,
370 const MCSubtargetInfo &STI)
371 : MCFragment(FT_Nops), Size(NumBytes),
372 ControlledNopLength(ControlledNopLength), Loc(L), STI(STI) {}
373
374 int64_t getNumBytes() const { return Size; }
375 int64_t getControlledNopLength() const { return ControlledNopLength; }
376
377 SMLoc getLoc() const { return Loc; }
378
379 const MCSubtargetInfo *getSubtargetInfo() const { return &STI; }
380
381 static bool classof(const MCFragment *F) {
382 return F->getKind() == MCFragment::FT_Nops;
383 }
384};
385
386class MCOrgFragment : public MCFragment {
387 /// Value to use for filling bytes.
388 int8_t Value;
389
390 /// The offset this fragment should start at.
391 const MCExpr *Offset;
392
393 /// Source location of the directive that this fragment was created for.
394 SMLoc Loc;
395
396public:
397 MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
398 : MCFragment(FT_Org), Value(Value), Offset(&Offset), Loc(Loc) {}
399
400 const MCExpr &getOffset() const { return *Offset; }
401 uint8_t getValue() const { return Value; }
402
403 SMLoc getLoc() const { return Loc; }
404
405 static bool classof(const MCFragment *F) {
406 return F->getKind() == MCFragment::FT_Org;
407 }
408};
409
410/// Represents a symbol table index fragment.
412 const MCSymbol *Sym;
413
414public:
416
417 const MCSymbol *getSymbol() { return Sym; }
418 const MCSymbol *getSymbol() const { return Sym; }
419
420 static bool classof(const MCFragment *F) {
421 return F->getKind() == MCFragment::FT_SymbolId;
422 }
423};
424
425/// Fragment representing the binary annotations produced by the
426/// .cv_inline_linetable directive.
428 unsigned SiteFuncId;
429 unsigned StartFileId;
430 unsigned StartLineNum;
431 const MCSymbol *FnStartSym;
432 const MCSymbol *FnEndSym;
433
434 /// CodeViewContext has the real knowledge about this format, so let it access
435 /// our members.
436 friend class CodeViewContext;
437
438public:
439 MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
440 unsigned StartLineNum, const MCSymbol *FnStartSym,
441 const MCSymbol *FnEndSym)
442 : MCFragment(FT_CVInlineLines), SiteFuncId(SiteFuncId),
443 StartFileId(StartFileId), StartLineNum(StartLineNum),
444 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
445
446 const MCSymbol *getFnStartSym() const { return FnStartSym; }
447 const MCSymbol *getFnEndSym() const { return FnEndSym; }
448
449 static bool classof(const MCFragment *F) {
450 return F->getKind() == MCFragment::FT_CVInlineLines;
451 }
452};
453
454/// Fragment representing the .cv_def_range directive.
457 StringRef FixedSizePortion;
458
459 /// CodeViewContext has the real knowledge about this format, so let it access
460 /// our members.
461 friend class CodeViewContext;
462
463public:
465 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
466 StringRef FixedSizePortion)
467 : MCFragment(FT_CVDefRange), Ranges(Ranges.begin(), Ranges.end()),
468 FixedSizePortion(FixedSizePortion) {}
469
473
474 StringRef getFixedSizePortion() const { return FixedSizePortion; }
475
476 static bool classof(const MCFragment *F) {
477 return F->getKind() == MCFragment::FT_CVDefRange;
478 }
479};
480
481/// Represents required padding such that a particular other set of fragments
482/// does not cross a particular power-of-two boundary. The other fragments must
483/// follow this one within the same section.
485 /// The alignment requirement of the branch to be aligned.
486 Align AlignBoundary;
487 /// The last fragment in the set of fragments to be aligned.
488 const MCFragment *LastFragment = nullptr;
489 /// The size of the fragment. The size is lazily set during relaxation, and
490 /// is not meaningful before that.
491 uint64_t Size = 0;
492
493 /// When emitting Nops some subtargets have specific nop encodings.
494 const MCSubtargetInfo &STI;
495
496public:
498 : MCFragment(FT_BoundaryAlign), AlignBoundary(AlignBoundary), STI(STI) {}
499
500 uint64_t getSize() const { return Size; }
501 void setSize(uint64_t Value) { Size = Value; }
502
503 Align getAlignment() const { return AlignBoundary; }
504 void setAlignment(Align Value) { AlignBoundary = Value; }
505
506 const MCFragment *getLastFragment() const { return LastFragment; }
508 assert(!F || getParent() == F->getParent());
509 LastFragment = F;
510 }
511
512 const MCSubtargetInfo *getSubtargetInfo() const { return &STI; }
513
514 static bool classof(const MCFragment *F) {
515 return F->getKind() == MCFragment::FT_BoundaryAlign;
516 }
517};
518
519/// Instances of this class represent a uniqued identifier for a section in the
520/// current translation unit. The MCContext class uniques and creates these.
522public:
525 friend class MCFragment;
526 static constexpr unsigned NonUniqueID = ~0U;
527
528 struct iterator {
529 MCFragment *F = nullptr;
530 iterator() = default;
531 explicit iterator(MCFragment *F) : F(F) {}
532 MCFragment &operator*() const { return *F; }
533 bool operator==(const iterator &O) const { return F == O.F; }
534 bool operator!=(const iterator &O) const { return F != O.F; }
535 iterator &operator++();
536 };
537
538 struct FragList {
539 MCFragment *Head = nullptr;
540 MCFragment *Tail = nullptr;
541 };
542
543private:
544 // At parse time, this holds the fragment list of the current subsection. At
545 // layout time, this holds the concatenated fragment lists of all subsections.
546 FragList *CurFragList;
547 // In many object file formats, this denotes the section symbol. In Mach-O,
548 // this denotes an optional temporary label at the section start.
549 MCSymbol *Begin;
550 MCSymbol *End = nullptr;
551 /// The alignment requirement of this section.
552 Align Alignment;
553 /// The section index in the assemblers section list.
554 unsigned Ordinal = 0;
555 // If not -1u, the first linker-relaxable fragment's order within the
556 // subsection. When present, the offset between two locations crossing this
557 // fragment may not be fully resolved.
558 unsigned FirstLinkerRelaxable = -1u;
559
560 /// Whether this section has had instructions emitted into it.
561 bool HasInstructions : 1;
562
563 bool IsRegistered : 1;
564
565 bool IsText : 1;
566 bool IsBss : 1;
567
568 MCFragment DummyFragment;
569
570 // Mapping from subsection number to fragment list. At layout time, the
571 // subsection 0 list is replaced with concatenated fragments from all
572 // subsections.
574
575 // Content and fixup storage for fragments
576 SmallVector<char, 0> ContentStorage;
577 SmallVector<MCFixup, 0> FixupStorage;
578 SmallVector<MCOperand, 0> MCOperandStorage;
579
580protected:
581 // TODO Make Name private when possible.
583
584 MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin);
585
586public:
587 MCSection(const MCSection &) = delete;
588 MCSection &operator=(const MCSection &) = delete;
589
590 StringRef getName() const { return Name; }
591 bool isText() const { return IsText; }
592
593 MCSymbol *getBeginSymbol() { return Begin; }
594 const MCSymbol *getBeginSymbol() const {
595 return const_cast<MCSection *>(this)->getBeginSymbol();
596 }
598 assert(!Begin);
599 Begin = Sym;
600 }
601 MCSymbol *getEndSymbol(MCContext &Ctx);
602 bool hasEnded() const;
603
604 Align getAlign() const { return Alignment; }
605 void setAlignment(Align Value) { Alignment = Value; }
606
607 /// Makes sure that Alignment is at least MinAlignment.
608 void ensureMinAlignment(Align MinAlignment) {
609 if (Alignment < MinAlignment)
610 Alignment = MinAlignment;
611 }
612
613 unsigned getOrdinal() const { return Ordinal; }
614 void setOrdinal(unsigned Value) { Ordinal = Value; }
615
616 bool hasInstructions() const { return HasInstructions; }
617 void setHasInstructions(bool Value) { HasInstructions = Value; }
618
619 bool isRegistered() const { return IsRegistered; }
620 void setIsRegistered(bool Value) { IsRegistered = Value; }
621
622 unsigned firstLinkerRelaxable() const { return FirstLinkerRelaxable; }
623 bool isLinkerRelaxable() const { return FirstLinkerRelaxable != -1u; }
624 void setFirstLinkerRelaxable(unsigned Order) { FirstLinkerRelaxable = Order; }
625
626 MCFragment &getDummyFragment() { return DummyFragment; }
627
628 FragList *curFragList() const { return CurFragList; }
629 iterator begin() const { return iterator(CurFragList->Head); }
630 iterator end() const { return {}; }
631
633 *FragToSyms = nullptr) const;
634
635 /// Check whether this section is "virtual", that is has no actual object
636 /// file contents.
637 bool isBssSection() const { return IsBss; }
638};
639
641 return {reinterpret_cast<char *>(this + 1), FixedSize};
642}
644 return {reinterpret_cast<const char *>(this + 1), FixedSize};
645}
646
648 return MutableArrayRef(getParent()->ContentStorage)
649 .slice(VarContentStart, VarContentEnd - VarContentStart);
650}
652 return ArrayRef(getParent()->ContentStorage)
653 .slice(VarContentStart, VarContentEnd - VarContentStart);
654}
655
656//== Fixup-related functions manage parent's storage using FixupStart and
657// FixupSize.
659 return MutableArrayRef(getParent()->FixupStorage)
660 .slice(FixupStart, FixupEnd - FixupStart);
661}
663 return ArrayRef(getParent()->FixupStorage)
664 .slice(FixupStart, FixupEnd - FixupStart);
665}
666
668 return MutableArrayRef(getParent()->FixupStorage)
669 .slice(VarFixupStart, VarFixupSize);
670}
672 return ArrayRef(getParent()->FixupStorage).slice(VarFixupStart, VarFixupSize);
673}
674
675//== FT_Relaxable functions
677 assert(Kind == FT_Relaxable);
678 return MutableArrayRef(getParent()->MCOperandStorage)
679 .slice(u.relax.OperandStart, u.relax.OperandSize);
680}
682 assert(Kind == FT_Relaxable);
683 MCInst Inst;
684 Inst.setOpcode(u.relax.Opcode);
685 Inst.setFlags(u.relax.Flags);
686 Inst.setOperands(ArrayRef(getParent()->MCOperandStorage)
687 .slice(u.relax.OperandStart, u.relax.OperandSize));
688 return Inst;
689}
690inline void MCFragment::setInst(const MCInst &Inst) {
691 assert(Kind == FT_Relaxable);
692 u.relax.Opcode = Inst.getOpcode();
693 u.relax.Flags = Inst.getFlags();
694 auto &S = getParent()->MCOperandStorage;
695 if (Inst.getNumOperands() > u.relax.OperandSize) {
696 u.relax.OperandStart = S.size();
697 S.resize_for_overwrite(S.size() + Inst.getNumOperands());
698 }
699 u.relax.OperandSize = Inst.getNumOperands();
700 llvm::copy(Inst, S.begin() + u.relax.OperandStart);
701}
702
704 F = F->Next;
705 return *this;
706}
707
708} // end namespace llvm
709
710#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:55
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:41
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:191
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:497
void setAlignment(Align Value)
Definition MCSection.h:504
void setSize(uint64_t Value)
Definition MCSection.h:501
const MCFragment * getLastFragment() const
Definition MCSection.h:506
const MCSubtargetInfo * getSubtargetInfo() const
Definition MCSection.h:512
static bool classof(const MCFragment *F)
Definition MCSection.h:514
void setLastFragment(const MCFragment *F)
Definition MCSection.h:507
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
Definition MCSection.h:464
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
Definition MCSection.h:470
static bool classof(const MCFragment *F)
Definition MCSection.h:476
StringRef getFixedSizePortion() const
Definition MCSection.h:474
friend class CodeViewContext
CodeViewContext has the real knowledge about this format, so let it access our members.
Definition MCSection.h:461
static bool classof(const MCFragment *F)
Definition MCSection.h:449
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
Definition MCSection.h:439
const MCSymbol * getFnStartSym() const
Definition MCSection.h:446
friend class CodeViewContext
CodeViewContext has the real knowledge about this format, so let it access our members.
Definition MCSection.h:436
const MCSymbol * getFnEndSym() const
Definition MCSection.h:447
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:340
SMLoc getLoc() const
Definition MCSection.h:349
uint8_t getValueSize() const
Definition MCSection.h:346
uint64_t getValue() const
Definition MCSection.h:345
static bool classof(const MCFragment *F)
Definition MCSection.h:351
const MCExpr & getNumValues() const
Definition MCSection.h:347
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:290
MutableArrayRef< char > getContents()
Definition MCSection.h:640
MCFragment * getSFrameFDE() const
Definition MCSection.h:316
bool getAllowAutoPadding() const
Definition MCSection.h:193
FragmentType getKind() const
Definition MCSection.h:163
bool isLinkerRelaxable() const
Definition MCSection.h:190
void setAllowAutoPadding(bool V)
Definition MCSection.h:194
unsigned getLayoutOrder() const
Definition MCSection.h:170
LLVM_ABI MCFragment(FragmentType Kind=MCFragment::FT_Data, bool HasInstructions=false)
bool hasAlignEmitNops() const
Definition MCSection.h:264
friend class MCObjectStreamer
Definition MCSection.h:48
void setSFrameAddrDelta(const MCExpr *E)
Definition MCSection.h:312
void setParent(MCSection *Value)
Definition MCSection.h:166
MCInst getInst() const
Definition MCSection.h:681
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:302
unsigned getAlignMaxBytesToEmit() const
Definition MCSection.h:260
int64_t getDwarfLineDelta() const
Definition MCSection.h:298
bool isLEBSigned() const
Definition MCSection.h:284
unsigned getOpcode() const
Definition MCSection.h:229
MutableArrayRef< MCFixup > getFixups()
Definition MCSection.h:658
friend class MCSection
Definition MCSection.h:49
void setLayoutOrder(unsigned Value)
Definition MCSection.h:171
void setSFrameFDE(MCFragment *F)
Definition MCSection.h:320
const MCExpr & getLEBValue() const
Definition MCSection.h:276
LLVM_ABI void dump() const
friend class MCAssembler
Definition MCSection.h:46
size_t getSize() const
Definition MCSection.h:209
MCSection * getParent() const
Definition MCSection.h:165
void makeAlign(Align Alignment, int64_t Fill, uint8_t FillLen, unsigned MaxBytesToEmit)
Definition MCSection.h:238
LLVM_ABI void setVarFixups(ArrayRef< MCFixup > Fixups)
Definition MCSection.cpp:87
MCFragment * getNext() const
Definition MCSection.h:161
MCFragment(const MCFragment &)=delete
void clearVarFixups()
Definition MCSection.h:224
ArrayRef< MCOperand > getOperands() const
Definition MCSection.h:676
LLVM_ABI void addFixup(MCFixup Fixup)
Definition MCSection.cpp:71
void setLinkerRelaxable()
Definition MCSection.h:191
Align getAlignment() const
Definition MCSection.h:248
size_t getFixedSize() const
Definition MCSection.h:207
friend class MCStreamer
Definition MCSection.h:47
int64_t getAlignFill() const
Definition MCSection.h:252
MCFragment & operator=(const MCFragment &)=delete
void makeLEB(bool IsSigned, const MCExpr *Value)
Definition MCSection.h:270
bool hasInstructions() const
Does this fragment have instructions emitted into it?
Definition MCSection.h:175
uint8_t getAlignFillLen() const
Definition MCSection.h:256
void setDwarfAddrDelta(const MCExpr *E)
Definition MCSection.h:294
void setLEBValue(const MCExpr *Expr)
Definition MCSection.h:280
size_t getVarSize() const
Definition MCSection.h:208
LLVM_ABI void setVarContents(ArrayRef< char > Contents)
Definition MCSection.cpp:61
MutableArrayRef< char > getVarContents()
Definition MCSection.h:647
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
Definition MCSection.h:181
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
Definition MCSection.h:185
const MCExpr & getSFrameAddrDelta() const
Definition MCSection.h:308
MutableArrayRef< MCFixup > getVarFixups()
Definition MCSection.h:667
void setInst(const MCInst &Inst)
Definition MCSection.h:690
void clearVarContents()
Definition MCSection.h:203
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:375
int64_t getNumBytes() const
Definition MCSection.h:374
MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L, const MCSubtargetInfo &STI)
Definition MCSection.h:369
static bool classof(const MCFragment *F)
Definition MCSection.h:381
const MCSubtargetInfo * getSubtargetInfo() const
Definition MCSection.h:379
SMLoc getLoc() const
Definition MCSection.h:377
Streaming object file generation interface.
SMLoc getLoc() const
Definition MCSection.h:403
static bool classof(const MCFragment *F)
Definition MCSection.h:405
uint8_t getValue() const
Definition MCSection.h:401
const MCExpr & getOffset() const
Definition MCSection.h:400
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
Definition MCSection.h:397
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:521
void setAlignment(Align Value)
Definition MCSection.h:605
unsigned getOrdinal() const
Definition MCSection.h:613
friend MCObjectStreamer
Definition MCSection.h:524
void ensureMinAlignment(Align MinAlignment)
Makes sure that Alignment is at least MinAlignment.
Definition MCSection.h:608
bool isBssSection() const
Check whether this section is "virtual", that is has no actual object file contents.
Definition MCSection.h:637
Align getAlign() const
Definition MCSection.h:604
bool isLinkerRelaxable() const
Definition MCSection.h:623
static constexpr unsigned NonUniqueID
Definition MCSection.h:526
const MCSymbol * getBeginSymbol() const
Definition MCSection.h:594
bool hasInstructions() const
Definition MCSection.h:616
bool isRegistered() const
Definition MCSection.h:619
void setHasInstructions(bool Value)
Definition MCSection.h:617
void setBeginSymbol(MCSymbol *Sym)
Definition MCSection.h:597
MCSection(const MCSection &)=delete
friend MCAssembler
Definition MCSection.h:523
void setOrdinal(unsigned Value)
Definition MCSection.h:614
bool isText() const
Definition MCSection.h:591
StringRef Name
Definition MCSection.h:582
iterator end() const
Definition MCSection.h:630
MCSection & operator=(const MCSection &)=delete
StringRef getName() const
Definition MCSection.h:590
friend class MCFragment
Definition MCSection.h:525
MCFragment & getDummyFragment()
Definition MCSection.h:626
unsigned firstLinkerRelaxable() const
Definition MCSection.h:622
FragList * curFragList() const
Definition MCSection.h:628
MCSymbol * getBeginSymbol()
Definition MCSection.h:593
iterator begin() const
Definition MCSection.h:629
MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin)
Definition MCSection.cpp:21
void setIsRegistered(bool Value)
Definition MCSection.h:620
void setFirstLinkerRelaxable(unsigned Order)
Definition MCSection.h:624
Generic base class for all target subtargets.
const MCSymbol * getSymbol() const
Definition MCSection.h:418
MCSymbolIdFragment(const MCSymbol *Sym)
Definition MCSection.h:415
static bool classof(const MCFragment *F)
Definition MCSection.h:420
const MCSymbol * getSymbol()
Definition MCSection.h:417
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:303
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:381
Represents a location in source code.
Definition SMLoc.h:23
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
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
Definition CallingConv.h:76
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
@ Offset
Definition DWP.cpp:477
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:1815
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:532
bool operator==(const iterator &O) const
Definition MCSection.h:533
bool operator!=(const iterator &O) const
Definition MCSection.h:534
iterator(MCFragment *F)
Definition MCSection.h:531