9 #ifndef LLVM_MC_MCFRAGMENT_H 10 #define LLVM_MC_MCFRAGMENT_H 27 class MCSubtargetInfo;
129 bool AlignToBundleEnd =
false;
131 uint8_t BundlePadding = 0;
187 template<
unsigned ContentsSize>
205 template<
unsigned ContentsSize,
unsigned FixupsSize>
281 Inst(Inst) { this->STI = &STI; }
308 unsigned MaxBytesToEmit;
312 unsigned MaxBytesToEmit,
MCSection *Sec =
nullptr)
314 Value(Value), ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
345 uint64_t PaddingPoliciesMask;
349 bool IsInsertionPoint;
359 bool IsImmutableSizedInst;
370 static const uint64_t PFK_None = UINT64_C(0);
375 FirstTargetPerfNopFragmentKind = 8,
378 MaxTargetPerfNopFragmentKind = 63
383 IsInsertionPoint(
false), Size(UINT64_C(0)),
384 InstInfo({
false,
MCInst(),
false, {0}}) {}
392 "Policy mask must contain exactly one policy");
393 return (getPaddingPoliciesMask() & PolicyMask) != PFK_None;
396 assert(isInstructionInitialized() &&
"Fragment has no instruction!");
397 return InstInfo.Inst;
400 assert(isInstructionInitialized() &&
"Fragment has no instruction!");
401 if (InstInfo.IsImmutableSizedInst)
402 return InstInfo.InstSize;
403 assert(InstInfo.InstFragment !=
nullptr &&
404 "Must have a valid InstFragment to retrieve InstSize from");
405 return InstInfo.InstFragment->getContents().size();
408 InstInfo.IsInitialized =
true;
409 InstInfo.IsImmutableSizedInst =
true;
410 InstInfo.Inst = Inst;
411 InstInfo.InstSize = InstSize;
415 InstInfo.IsInitialized =
true;
416 InstInfo.IsImmutableSizedInst =
false;
417 InstInfo.Inst = Inst;
418 InstInfo.InstFragment = InstFragment;
443 NumValues(NumValues), Loc(Loc) {}
532 LineDelta(LineDelta), AddrDelta(&AddrDelta) {}
556 AddrDelta(&AddrDelta) {}
595 unsigned StartFileId;
596 unsigned StartLineNum;
607 unsigned StartLineNum,
const MCSymbol *FnStartSym,
611 StartFileId(StartFileId), StartLineNum(StartLineNum),
612 FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
641 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
644 Ranges(Ranges.
begin(), Ranges.
end()),
645 FixedSizePortion(FixedSizePortion) {}
663 #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)
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)
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
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...
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)