LLVM: include/llvm/MC/MCFragment.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_MC_MCFRAGMENT_H
10#define LLVM_MC_MCFRAGMENT_H
11
21#include
22#include
23
24namespace llvm {
25
26class MCAssembler;
27class MCObjectStreamer;
28class MCSection;
29class MCSubtargetInfo;
31
36
37public:
55
56private:
57
59
60
62
63
65
66
67 unsigned LayoutOrder = 0;
68
70
71protected:
72
73
74
77
79
81
83
84public:
88
89
90
91
92
94
96
98
101
103
106
107
108
110
111 void dump() const;
112};
113
115public:
117
119};
120
121
122
123
125 uint8_t BundlePadding = 0;
126
127protected:
130
131
132
134
135public:
138 switch (Kind) {
139 default:
140 return false;
146 return true;
147 }
148 }
149
150
153
154
155
156
157
158
160
161
162
164
165
166
168
169
170
173 this->STI = &STI;
174 }
175};
176
177
178
179
180template <unsigned ContentsSize, unsigned FixupsSize>
183
184
186
187protected:
191
192public:
195
199
202
208 }
209};
210
211
212
214public:
216
219 }
220
223};
224
225
226
227
229
231
232public:
235 this->STI = &STI;
236 }
237
240
243
246 }
247};
248
250
252
253
254
255
256 bool EmitNops : 1;
257
258
260
261
262 unsigned ValueSize;
263
264
265
266 unsigned MaxBytesToEmit;
267
268
270
271public:
273 unsigned MaxBytesToEmit)
275 Value(Value), ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
276
278
280
282
284
287 EmitNops = Value;
288 this->STI = STI;
289 }
290
292
295 }
296};
297
300
302
303 const MCExpr &NumValues;
304
305
307
308public:
312 NumValues(NumValues), Loc(Loc) {}
313
317
319
322 }
323};
324
326
327 int64_t Size;
328
329 int64_t ControlledNopLength;
330
331
333
334
336
337public:
341 ControlledNopLength(ControlledNopLength), Loc(L), STI(STI) {}
342
345
347
349
352 }
353};
354
356
358
359
360 const MCExpr *Offset;
361
362
364
365public:
368
370
372
374
377 }
378};
379
381
382 bool IsSigned;
383
384
386
387public:
392 }
393
396
397 bool isSigned() const { return IsSigned; }
398
399
400
403 }
404};
405
407
408
409 int64_t LineDelta;
410
411
412
413 const MCExpr *AddrDelta;
414
415public:
418 LineDelta(LineDelta), AddrDelta(&AddrDelta) {}
419
421
423
426 }
427};
428
430
431
432 const MCExpr *AddrDelta;
433
434public:
437 AddrDelta(&AddrDelta) {}
438
441
444 }
445};
446
447
450
451public:
454
457
460 }
461};
462
463
464
466 unsigned SiteFuncId;
467 unsigned StartFileId;
468 unsigned StartLineNum;
472
473
474
476
477public:
479 unsigned StartLineNum, const MCSymbol *FnStartSym,
482 StartFileId(StartFileId), StartLineNum(StartLineNum),
483 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
484
487
490
493 }
494};
495
496
500
501
502
504
505public:
507 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
510 Ranges(Ranges), FixedSizePortion(FixedSizePortion) {}
511
513 return Ranges;
514 }
515
517
520 }
521};
522
523
524
525
527
528 Align AlignBoundary;
529
530 const MCFragment *LastFragment = nullptr;
531
532
534
535
537
538public:
541 STI(STI) {}
542
545
548
552 LastFragment = F;
553 }
554
556
559 }
560};
561
563
564
565 const MCExpr *AddrDelta;
566
567public:
570 AddrDelta(AddrDelta) {}
571
573
576 }
577};
578}
579
580#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Holds state from .cv_file and .cv_loc directives for later emission.
void setEmitNops(bool Value, const MCSubtargetInfo *STI)
MCAlignFragment(Align Alignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit)
Align getAlignment() const
unsigned getMaxBytesToEmit() const
unsigned getValueSize() const
const MCSubtargetInfo * getSubtargetInfo() const
static bool classof(const MCFragment *F)
Represents required padding such that a particular other set of fragments does not cross a particular...
MCBoundaryAlignFragment(Align AlignBoundary, const MCSubtargetInfo &STI)
void setAlignment(Align Value)
void setSize(uint64_t Value)
const MCFragment * getLastFragment() const
const MCSubtargetInfo * getSubtargetInfo() const
static bool classof(const MCFragment *F)
Align getAlignment() const
void setLastFragment(const MCFragment *F)
Fragment representing the .cv_def_range directive.
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
static bool classof(const MCFragment *F)
StringRef getFixedSizePortion() const
Fragment representing the binary annotations produced by the .cv_inline_linetable directive.
static bool classof(const MCFragment *F)
const SmallString< 8 > & getContents() const
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
const MCSymbol * getFnStartSym() const
const MCSymbol * getFnEndSym() const
SmallString< 8 > & getContents()
Fragment for data and encoded instructions.
void setLinkerRelaxable()
static bool classof(const MCFragment *F)
bool isLinkerRelaxable() const
static bool classof(const MCFragment *F)
void setAddrDelta(const MCExpr *E)
static bool classof(const MCFragment *F)
const MCExpr & getAddrDelta() const
MCDwarfCallFrameFragment(const MCExpr &AddrDelta)
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta)
int64_t getLineDelta() const
static bool classof(const MCFragment *F)
const MCExpr & getAddrDelta() const
Interface implemented by fragments that contain encoded instructions and/or data and also have fixups...
static bool classof(const MCFragment *F)
void setContents(ArrayRef< char > C)
const SmallVectorImpl< MCFixup > & getFixups() const
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, bool HasInstructions)
SmallVectorImpl< MCFixup > & getFixups()
const SmallVectorImpl< char > & getContents() const
void appendContents(ArrayRef< char > C)
void appendContents(size_t Num, char Elt)
SmallVectorImpl< char > & getContents()
Interface implemented by fragments that contain encoded instructions and/or data.
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions)
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
const MCSubtargetInfo * STI
The MCSubtargetInfo in effect when the instruction was encoded.
static bool classof(const MCFragment *F)
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
void setAlignToBundleEnd(bool V)
bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
Base class for the full range of assembler expressions which are needed for parsing.
MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues, SMLoc Loc)
uint8_t getValueSize() const
uint64_t getValue() const
static bool classof(const MCFragment *F)
const MCExpr & getNumValues() const
bool LinkerRelaxable
MCDataFragment.
FragmentType getKind() const
unsigned getLayoutOrder() const
bool HasInstructions
Used by subclasses for better packing.
void setParent(MCSection *Value)
const MCSymbol * getAtom() const
void destroy()
Destroys the current fragment.
void setLayoutOrder(unsigned Value)
MCSection * getParent() const
MCFragment * getNext() const
MCFragment(const MCFragment &)=delete
bool AllowAutoPadding
MCRelaxableFragment: x86-specific.
MCFragment & operator=(const MCFragment &)=delete
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
Instances of this class represent a single low-level machine instruction.
MCLEBFragment(const MCExpr &Value, bool IsSigned)
const MCExpr & getValue() const
void setValue(const MCExpr *Expr)
static bool classof(const MCFragment *F)
int64_t getControlledNopLength() const
int64_t getNumBytes() const
MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L, const MCSubtargetInfo &STI)
static bool classof(const MCFragment *F)
const MCSubtargetInfo * getSubtargetInfo() const
Streaming object file generation interface.
static bool classof(const MCFragment *F)
const MCExpr & getOffset() const
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
MCPseudoProbeAddrFragment(const MCExpr *AddrDelta)
const MCExpr & getAddrDelta() const
static bool classof(const MCFragment *F)
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
void setAllowAutoPadding(bool V)
static bool classof(const MCFragment *F)
bool getAllowAutoPadding() const
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI)
const MCInst & getInst() const
void setInst(const MCInst &Value)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Generic base class for all target subtargets.
Represents a symbol table index fragment.
const MCSymbol * getSymbol() const
MCSymbolIdFragment(const MCSymbol *Sym)
static bool classof(const MCFragment *F)
const MCSymbol * getSymbol()
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Represents a location in source code.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef str() const
Explicit conversion to StringRef.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void assign(size_type NumElts, ValueParamT Elt)
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
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.
LLVM Value Representation.
This file defines the ilist_node class template, which is a convenient base class for creating classe...
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
This struct is a compact representation of a valid (non-zero power of two) alignment.