10 #ifndef LLVM_MC_MCFRAGMENT_H 11 #define LLVM_MC_MCFRAGMENT_H 28 class MCSubtargetInfo;
130 bool AlignToBundleEnd =
false;
132 uint8_t BundlePadding = 0;
187 template<
unsigned ContentsSize>
205 template<
unsigned ContentsSize,
unsigned FixupsSize>
280 Inst(Inst) { this->STI = &STI; }
307 unsigned MaxBytesToEmit;
311 unsigned MaxBytesToEmit,
MCSection *Sec =
nullptr)
313 Value(Value), ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
344 uint64_t PaddingPoliciesMask;
348 bool IsInsertionPoint;
358 bool IsImmutableSizedInst;
369 static const uint64_t PFK_None = UINT64_C(0);
374 FirstTargetPerfNopFragmentKind = 8,
377 MaxTargetPerfNopFragmentKind = 63
382 IsInsertionPoint(
false), Size(UINT64_C(0)),
383 InstInfo({
false,
MCInst(),
false, {0}}) {}
391 "Policy mask must contain exactly one policy");
392 return (getPaddingPoliciesMask() & PolicyMask) != PFK_None;
395 assert(isInstructionInitialized() &&
"Fragment has no instruction!");
396 return InstInfo.Inst;
399 assert(isInstructionInitialized() &&
"Fragment has no instruction!");
400 if (InstInfo.IsImmutableSizedInst)
401 return InstInfo.InstSize;
402 assert(InstInfo.InstFragment !=
nullptr &&
403 "Must have a valid InstFragment to retrieve InstSize from");
404 return InstInfo.InstFragment->getContents().size();
407 InstInfo.IsInitialized =
true;
408 InstInfo.IsImmutableSizedInst =
true;
409 InstInfo.Inst = Inst;
410 InstInfo.InstSize = InstSize;
414 InstInfo.IsInitialized =
true;
415 InstInfo.IsImmutableSizedInst =
false;
416 InstInfo.Inst = Inst;
417 InstInfo.InstFragment = InstFragment;
442 NumValues(NumValues), Loc(Loc) {}
531 LineDelta(LineDelta), AddrDelta(&AddrDelta) {}
600 unsigned StartFileId;
601 unsigned StartLineNum;
612 unsigned StartLineNum,
const MCSymbol *FnStartSym,
616 StartFileId(StartFileId), StartLineNum(StartLineNum),
617 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
646 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
649 Ranges(Ranges.
begin(), Ranges.
end()),
650 FixedSizePortion(FixedSizePortion) {}
668 #endif // LLVM_MC_MCFRAGMENT_H Instances of this class represent a uniqued identifier for a section in the current translation unit...
bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
const_iterator end(StringRef path)
Get end iterator over path.
MCAlignFragment(unsigned Alignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit, MCSection *Sec=nullptr)
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc, MCSection *Sec=nullptr)
static bool classof(const MCFragment *F)
Fragment for adding required padding.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
typename SuperClass::const_iterator const_iterator
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta, MCSection *Sec=nullptr)
This class represents lattice values for constants.
static bool classof(const MCFragment *F)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
uint8_t getValueSize() const
SmallString< 8 > & getContents()
static bool classof(const MCFragment *F)
const SmallString< 8 > & getContents() const
void push_back(const T &Elt)
MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec=nullptr)
const MCSymbol * getSymbol() const
Interface implemented by fragments that contain encoded instructions and/or data. ...
MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues, SMLoc Loc, MCSection *Sec=nullptr)
MCFragment & operator=(const MCFragment &)=delete
FragmentType getKind() const
This is a compact (memory-size-wise) fragment for holding an encoded instruction (non-relaxable) that...
block Block Frequency true
const MCExpr & getOffset() const
static void EmitNops(MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSubtargetInfo &STI)
Emit the optimal amount of multi-byte nops on X86.
StringRef getFixedSizePortion() const
const_fixup_iterator fixup_begin() const
bool hasPaddingPolicy(uint64_t PolicyMask) const
Interface implemented by fragments that contain encoded instructions and/or data. ...
fixup_iterator fixup_end()
SmallVectorImpl< MCFixup >::const_iterator const_fixup_iterator
Encapsulates the layout of an assembly file at a particular point in time.
const_fixup_iterator fixup_end() const
void setEmitNops(bool Value)
Base class for the full range of assembler expressions which are needed for parsing.
bool isInstructionInitialized() const
const SmallString< 8 > & getContents() const
MCDummyFragment(MCSection *Sec)
void destroy()
Destroys the current fragment.
const MCExpr & getAddrDelta() const
void setPaddingPoliciesMask(uint64_t Value)
void setInstAndInstSize(const MCInst &Inst, size_t InstSize)
static bool classof(const MCFragment *F)
static bool classof(const MCFragment *F)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const MCExpr & getAddrDelta() const
MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSection *Sec=nullptr)
MCEncodedFragmentWithContents(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
bool isDummy() const
Return true if given frgment has FT_Dummy type.
MCPaddingFragment(MCSection *Sec=nullptr)
void setAsInsertionPoint()
SmallVectorImpl< char > & getContents()
Instances of this class represent a single low-level machine instruction.
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI, MCSection *Sec=nullptr)
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
const MCInst & getInst() const
An ilist node that can access its parent list.
static bool classof(const MCFragment *F)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
static bool classof(const MCFragment *F)
const SmallVectorImpl< char > & getContents() const
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
static bool classof(const MCFragment *F)
SmallVectorImpl< MCFixup > & getFixups()
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
const SmallString< 8 > & getContents() const
const MCSymbol * getAtom() const
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId, unsigned StartLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym, MCSection *Sec=nullptr)
static bool classof(const MCFragment *F)
Fragment representing the .cv_def_range directive.
MCCVDefRangeFragment(ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> Ranges, StringRef FixedSizePortion, MCSection *Sec=nullptr)
const MCExpr & getValue() const
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, bool HasInstructions, MCSection *Sec)
unsigned getMaxBytesToEmit() const
MCCompactEncodedInstFragment(MCSection *Sec=nullptr)
SmallVectorImpl< MCFixup >::iterator fixup_iterator
Represents a symbol table index fragment.
unsigned getLayoutOrder() const
uint64_t getPaddingPoliciesMask() const
static bool classof(const MCFragment *F)
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
const MCSymbol * getFnEndSym() const
MCSection * getParent() const
uint64_t getValue() const
const MCExpr & getNumValues() const
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
typename SuperClass::iterator iterator
SmallString< 8 > & getContents()
Fragment representing the binary annotations produced by the .cv_inline_linetable directive...
const MCSymbol * getFnStartSym() const
unsigned getValueSize() const
static bool classof(const MCFragment *F)
unsigned getAlignment() const
void setSize(uint64_t Value)
Interface implemented by fragments that contain encoded instructions and/or data and also have fixups...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
static bool classof(const MCFragment *F)
int64_t getLineDelta() const
size_t getInstSize() const
const MCInst & getInst() const
static bool classof(const MCFragment *F)
static bool classof(const MCFragment *F)
fixup_iterator fixup_begin()
Generic base class for all target subtargets.
SmallString< 8 > & getContents()
const MCSymbol * getSymbol()
void setLayoutOrder(unsigned Value)
void setAlignToBundleEnd(bool V)
Fragment for data and encoded instructions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isInsertionPoint() const
LLVM Value Representation.
void setInstAndInstFragment(const MCInst &Inst, MCRelaxableFragment *InstFragment)
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > getRanges() const
static bool classof(const MCFragment *F)
StringRef - Represent a constant reference to a string, i.e.
const SmallVectorImpl< MCFixup > & getFixups() const
Represents a location in source code.
void setParent(MCSection *Value)
MCDataFragment(MCSection *Sec=nullptr)
MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec=nullptr)
void setInst(const MCInst &Value)
void setAtom(const MCSymbol *Value)
Holds state from .cv_file and .cv_loc directives for later emission.
static bool classof(const MCFragment *F)