35 #define DEBUG_TYPE "assembler"
39 STATISTIC(EmittedFragments,
"Number of emitted assembler fragments - total");
41 "Number of emitted assembler fragments - relaxable");
43 "Number of emitted assembler fragments - data");
44 STATISTIC(EmittedCompactEncodedInstFragments,
45 "Number of emitted assembler fragments - compact encoded inst");
47 "Number of emitted assembler fragments - align");
49 "Number of emitted assembler fragments - fill");
51 "Number of emitted assembler fragments - org");
52 STATISTIC(evaluateFixup,
"Number of evaluated fixups");
53 STATISTIC(FragmentLayouts,
"Number of fragment layouts");
54 STATISTIC(ObjectBytes,
"Number of emitted object file bytes");
55 STATISTIC(RelaxationSteps,
"Number of assembler layout and relaxation steps");
56 STATISTIC(RelaxedInstructions,
"Number of relaxed instructions");
68 : Assembler(Asm), LastValidFragment()
72 if (!it->isVirtualSection())
73 SectionOrder.push_back(&*it);
75 if (it->isVirtualSection())
76 SectionOrder.push_back(&*it);
79 bool MCAsmLayout::isFragmentValid(
const MCFragment *
F)
const {
81 const MCFragment *LastValid = LastValidFragment.lookup(Sec);
90 if (!isFragmentValid(F))
98 void MCAsmLayout::ensureValid(
const MCFragment *F)
const {
107 while (!isFragmentValid(F)) {
108 assert(Cur &&
"Layout bookkeeping error");
116 assert(F->Offset != ~UINT64_C(0) &&
"Address not set!");
122 bool ReportError, uint64_t &Val) {
134 bool ReportError, uint64_t &Val) {
189 "' could not be evaluated in a subtraction expression");
200 "Common symbol " + ASym.
getName() +
201 " cannot be used in assignment expr");
224 uint64_t FOffset, uint64_t FSize) {
226 assert(BundleSize > 0 &&
227 "computeBundlePadding should only be called if bundling is enabled");
228 uint64_t BundleMask = BundleSize - 1;
229 uint64_t OffsetInBundle = FOffset & BundleMask;
230 uint64_t EndOfFragment = OffsetInBundle + FSize;
250 if (EndOfFragment == BundleSize)
252 else if (EndOfFragment < BundleSize)
253 return BundleSize - EndOfFragment;
255 return 2 * BundleSize - EndOfFragment;
257 }
else if (OffsetInBundle > 0 && EndOfFragment > BundleSize)
258 return BundleSize - OffsetInBundle;
269 MCFragment::MCFragment() :
Kind(FragmentType(~0)), HasInstructions(
false),
270 AlignToBundleEnd(
false), BundlePadding(0) {
273 MCFragment::~MCFragment() { }
276 uint8_t BundlePadding,
MCSection *Parent)
277 : Kind(Kind), HasInstructions(HasInstructions), AlignToBundleEnd(
false),
278 BundlePadding(BundlePadding), Parent(Parent), Atom(nullptr),
279 Offset(~UINT64_C(0)) {
293 delete cast<MCAlignFragment>(
this);
296 delete cast<MCDataFragment>(
this);
299 delete cast<MCCompactEncodedInstFragment>(
this);
302 delete cast<MCFillFragment>(
this);
305 delete cast<MCRelaxableFragment>(
this);
308 delete cast<MCOrgFragment>(
this);
311 delete cast<MCDwarfLineAddrFragment>(
this);
314 delete cast<MCDwarfCallFrameFragment>(
this);
317 delete cast<MCLEBFragment>(
this);
320 delete cast<MCSafeSEHFragment>(
this);
330 : Context(Context_), Backend(Backend_), Emitter(Emitter_), Writer(Writer_),
332 SubsectionsViaSymbols(
false), ELFHeaderEFlags(0) {
333 VersionMinInfo.
Major = 0;
342 IndirectSymbols.clear();
344 LinkerOptions.clear();
349 SubsectionsViaSymbols =
false;
351 LOHContainer.
reset();
352 VersionMinInfo.
Major = 0;
362 if (ThumbFuncs.count(Symbol))
382 ThumbFuncs.insert(Symbol);
420 bool MCAssembler::evaluateFixup(
const MCAsmLayout &Layout,
423 ++stats::evaluateFixup;
439 }
else if (!Target.
getSymA()) {
448 *
this, SA, *DF,
false,
true);
463 const MCSymbol &Sym = B->getSymbol();
471 assert((ShouldAlignPC ? IsPCRel :
true) &&
472 "FKF_IsAlignedDownTo32Bits is only allowed on PC-relative fixups!");
479 if (ShouldAlignPC) Offset &= ~0x3;
495 return cast<MCDataFragment>(
F).getContents().size();
497 return cast<MCRelaxableFragment>(
F).getContents().size();
499 return cast<MCCompactEncodedInstFragment>(
F).getContents().size();
501 return cast<MCFillFragment>(
F).getSize();
504 return cast<MCLEBFragment>(
F).getContents().size();
526 int64_t TargetLocation;
527 if (!OF.
getOffset().evaluateAsAbsolute(TargetLocation, Layout))
532 int64_t Size = TargetLocation - FragmentOffset;
533 if (Size < 0 || Size >= 0x40000000)
535 "' (at offset '" +
Twine(FragmentOffset) +
"')");
540 return cast<MCDwarfLineAddrFragment>(
F).getContents().size();
542 return cast<MCDwarfCallFrameFragment>(
F).getContents().size();
552 assert(!isFragmentValid(F) &&
"Attempt to recompute a valid fragment!");
555 assert((!Prev || isFragmentValid(Prev)) &&
556 "Attempt to compute fragment before its predecessor!");
558 ++stats::FragmentLayouts;
595 assert(isa<MCEncodedFragment>(F) &&
596 "Only MCEncodedFragment implementations have instructions");
604 if (RequiredBundlePadding > UINT8_MAX)
607 F->Offset += RequiredBundlePadding;
617 Symbols.push_back(&Symbol);
625 if (BundlePadding > 0) {
627 "Writing bundle padding with disabled bundling");
629 "Writing bundle padding for a fragment without instructions");
631 unsigned TotalLength = BundlePadding +
static_cast<unsigned>(FSize);
642 if (!
getBackend().writeNopData(DistanceToBoundary, OW))
644 Twine(DistanceToBoundary) +
" bytes");
645 BundlePadding -= DistanceToBoundary;
647 if (!
getBackend().writeNopData(BundlePadding, OW))
649 Twine(BundlePadding) +
" bytes");
668 ++stats::EmittedFragments;
672 ++stats::EmittedAlignFragments;
674 assert(AF.
getValueSize() &&
"Invalid virtual align in concrete fragment!");
684 "' is not a divisor of padding size '" +
685 Twine(FragmentSize) +
"'");
694 Twine(Count) +
" bytes");
699 for (uint64_t i = 0; i != Count; ++i) {
712 ++stats::EmittedDataFragments;
713 OW->
writeBytes(cast<MCDataFragment>(F).getContents());
717 ++stats::EmittedRelaxableFragments;
718 OW->
writeBytes(cast<MCRelaxableFragment>(F).getContents());
722 ++stats::EmittedCompactEncodedInstFragments;
723 OW->
writeBytes(cast<MCCompactEncodedInstFragment>(F).getContents());
727 ++stats::EmittedFillFragments;
730 assert(FF.
getValueSize() &&
"Invalid virtual align in concrete fragment!");
757 ++stats::EmittedOrgFragments;
760 for (uint64_t i = 0, e = FragmentSize; i != e; ++i)
779 "The stream should advance by fragment size");
791 switch (it->getKind()) {
799 "Cannot have fixups in virtual section!");
802 if (
auto *ELFSec = dyn_cast<const MCSectionELF>(Sec))
804 ELFSec->getSectionName() +
"'");
813 assert((cast<MCAlignFragment>(it)->getValueSize() == 0 ||
814 cast<MCAlignFragment>(it)->getValue() == 0) &&
815 "Invalid align in virtual section!");
818 assert((cast<MCFillFragment>(it)->getValueSize() == 0 ||
819 cast<MCFillFragment>(it)->getValue() == 0) &&
820 "Invalid fill in virtual section!");
835 assert(
getWriter().getStream().tell() - Start ==
839 std::pair<uint64_t, bool> MCAssembler::handleFixup(
const MCAsmLayout &Layout,
847 if (!evaluateFixup(Layout, Fixup, &F, Target, FixedValue)) {
854 return std::make_pair(FixedValue, IsPCRel);
859 llvm::errs() <<
"assembler backend - pre-layout\n--\n";
866 unsigned SectionIndex = 0;
870 if (it->getFragmentList().empty())
873 it->setOrdinal(SectionIndex++);
877 for (
unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i) {
878 MCSection *Sec = Layout.getSectionOrder()[i];
881 unsigned FragmentIndex = 0;
883 iFrag != iFragEnd; ++iFrag)
884 iFrag->setLayoutOrder(FragmentIndex++);
888 while (layoutOnce(Layout))
892 llvm::errs() <<
"assembler backend - post-relaxation\n--\n";
896 finishLayout(Layout);
899 llvm::errs() <<
"assembler backend - final-layout\n--\n";
902 uint64_t StartOffset = OS.
tell();
917 if (!F || isa<MCCompactEncodedInstFragment>(F))
921 if (
auto *FragWithFixups = dyn_cast<MCDataFragment>(F)) {
922 Fixups = FragWithFixups->getFixups();
923 Contents = FragWithFixups->getContents();
924 }
else if (
auto *FragWithFixups = dyn_cast<MCRelaxableFragment>(F)) {
925 Fixups = FragWithFixups->getFixups();
926 Contents = FragWithFixups->getContents();
929 for (
const MCFixup &Fixup : Fixups) {
932 std::tie(FixedValue, IsPCRel) = handleFixup(Layout, *F, Fixup);
934 Contents.
size(), FixedValue, IsPCRel);
942 stats::ObjectBytes += OS.
tell() - StartOffset;
945 bool MCAssembler::fixupNeedsRelaxation(
const MCFixup &Fixup,
950 bool Resolved = evaluateFixup(Layout, Fixup, DF, Target, Value);
965 if (fixupNeedsRelaxation(*it, F, Layout))
971 bool MCAssembler::relaxInstruction(
MCAsmLayout &Layout,
973 if (!fragmentNeedsRelaxation(&F, Layout))
976 ++stats::RelaxedInstructions;
1021 bool MCAssembler::relaxDwarfLineAddr(
MCAsmLayout &Layout,
1027 assert(Abs &&
"We created a line delta with an invalid expression");
1036 return OldSize != Data.
size();
1039 bool MCAssembler::relaxDwarfCallFrameFragment(
MCAsmLayout &Layout,
1045 assert(Abs &&
"We created call frame with an invalid expression");
1052 return OldSize != Data.
size();
1065 bool RelaxedFrag =
false;
1066 switch(
I->getKind()) {
1071 "Did not expect a MCRelaxableFragment in RelaxAll mode");
1072 RelaxedFrag = relaxInstruction(Layout, *cast<MCRelaxableFragment>(
I));
1075 RelaxedFrag = relaxDwarfLineAddr(Layout,
1076 *cast<MCDwarfLineAddrFragment>(
I));
1080 relaxDwarfCallFrameFragment(Layout,
1081 *cast<MCDwarfCallFrameFragment>(
I));
1084 RelaxedFrag = relaxLEB(Layout, *cast<MCLEBFragment>(
I));
1087 if (RelaxedFrag && !FirstRelaxedFragment)
1088 FirstRelaxedFragment =
I;
1090 if (FirstRelaxedFragment) {
1097 bool MCAssembler::layoutOnce(
MCAsmLayout &Layout) {
1098 ++stats::RelaxationSteps;
1100 bool WasRelaxed =
false;
1103 while (layoutSectionOnce(Layout, Sec))
1110 void MCAssembler::finishLayout(
MCAsmLayout &Layout) {
1112 for (
unsigned int i = 0, n = Layout.
getSectionOrder().size(); i != n; ++i) {
1122 OS <<
"<MCFixup" <<
" Offset:" << AF.
getOffset()
1124 <<
" Kind:" << AF.
getKind() <<
">";
1130 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1139 OS <<
"MCCompactEncodedInstFragment";
break;
1149 OS <<
"<MCFragment " << (
void*)
this <<
" LayoutOrder:" << LayoutOrder
1150 <<
" Offset:" << Offset
1158 OS <<
" (emit nops)";
1168 OS <<
" Contents:[";
1170 for (
unsigned i = 0, e = Contents.
size(); i != e; ++i) {
1172 OS << hexdigit((Contents[i] >> 4) & 0xF) <<
hexdigit(Contents[i] & 0xF);
1174 OS <<
"] (" << Contents.
size() <<
" bytes)";
1190 cast<MCCompactEncodedInstFragment>(
this);
1192 OS <<
" Contents:[";
1194 for (
unsigned i = 0, e = Contents.
size(); i != e; ++i) {
1196 OS << hexdigit((Contents[i] >> 4) & 0xF) <<
hexdigit(Contents[i] & 0xF);
1198 OS <<
"] (" << Contents.
size() <<
" bytes)";
1252 OS <<
"<MCAssembler\n";
1253 OS <<
" Sections:[\n ";
1255 if (it !=
begin()) OS <<
",\n ";
1265 OS <<
", Index:" << it->getIndex() <<
", ";
bool evaluateKnownAbsolute(int64_t &Res, const MCAsmLayout &Layout) const
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
const MCAsmInfo * getAsmInfo() const
unsigned getValueSize() const
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
raw_ostream & getStream()
const MCSymbol & getSymbol() const
STATISTIC(NumFunctions,"Total number of functions")
void write64(uint64_t Value)
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
unsigned getAlignment() const
const MCExpr & getAddrDelta() const
bool isRegistered() const
void setLayoutOrder(unsigned Value)
unsigned getBundleAlignSize() const
virtual bool fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const
Target specific predicate for whether a given fixup requires the associated instruction to be relaxed...
bool alignToBundleEnd() const
Should this fragment be placed at the end of an aligned bundle?
void writeFragmentPadding(const MCFragment &F, uint64_t FSize, MCObjectWriter *OW) const
Write the necessary bundle padding to the given object writer.
virtual void executePostLayoutBinding(MCAssembler &Asm, const MCAsmLayout &Layout)=0
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg) const
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
MCCodeEmitter & getEmitter() const
virtual void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout)=0
Write the object file.
A raw_ostream that writes to an SmallVector or SmallString.
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const
True if the section is atomized using the symbols in it.
This is a compact (memory-size-wise) fragment for holding an encoded instruction (non-relaxable) that...
const MCSubtargetInfo & getSubtargetInfo()
MCContext & getContext() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
void write8(uint8_t Value)
const MCExpr & getOffset() const
void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ") const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
symbol_iterator symbol_begin()
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
const MCInst & getInst() const
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
#define DEBUG_WITH_TYPE(TYPE, X)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
static void Encode(MCContext &Context, int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS)
Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
virtual unsigned getMinimumNopSize() const
Returns the minimum size of a nop in bytes on this target.
void push_back(NodeTy *val)
Interface implemented by fragments that contain encoded instructions and/or data. ...
fixup_iterator fixup_end()
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
NodeTy * getNextNode()
Get the next node, or 0 for the list tail.
Encapsulates the layout of an assembly file at a particular point in time.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCExpr * getVariableValue() const
getVariableValue() - Get the value for variable symbols.
virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.
Base class for the full range of assembler expressions which are needed for parsing.
NodeTy * getPrevNode()
Get the previous node, or 0 for the list head.
unsigned getMaxBytesToEmit() const
Represent a reference to a symbol from inside an expression.
int64_t getLineDelta() const
void destroy()
Destroys the current fragment.
uint64_t tell() const
tell - Return the current offset with the file.
Context object for machine code objects.
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
MCObjectWriter & getWriter() const
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
MCSection::iterator end()
virtual void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value, bool IsPCRel) const =0
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
const MCSymbol * getSymbol()
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
const MCSymbol * getAtom(const MCSymbol &S) const
Find the symbol which defines the atom containing the given symbol, or null if there is no such symbo...
void layoutFragment(MCFragment *Fragment)
Perform layout for a single fragment, assuming that the previous fragment has already been laid out c...
SmallVectorImpl< char > & getContents()
uint32_t getOffset() const
const MCExpr & getAddrDelta() const
size_t size() const
size - Get the array size.
Instances of this class represent a single low-level machine instruction.
virtual bool writeNopData(uint64_t Count, MCObjectWriter *OW) const =0
Write an (optimal) nop sequence of Count bytes to the given output.
static void deleteNode(NodeTy *V)
static bool getSymbolOffsetImpl(const MCAsmLayout &Layout, const MCSymbol &S, bool ReportError, uint64_t &Val)
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
void write32(uint32_t Value)
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
MCAsmLayout(MCAssembler &Assembler)
const MCSymbol * getBaseSymbol(const MCSymbol &Symbol) const
If this symbol is equivalent to A + Constant, return A.
const MCExpr * getValue() const
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
virtual void reset()
Lifetime management.
void writeSectionData(const MCSection *Section, const MCAsmLayout &Layout) const
Emit the section contents using the given object writer.
uint64_t computeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const
Compute the effective fragment size assuming it is laid out at the given SectionAddress and FragmentO...
uint32_t getIndex() const
Get the (implementation defined) index.
virtual void relaxInstruction(const MCInst &Inst, MCInst &Res) const =0
Relax the instruction in the given fragment to the next wider instruction.
virtual bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB, bool InSet, bool IsPCRel) const
FragmentType getKind() const
void invalidateFragmentsFrom(MCFragment *F)
Invalidate the fragments starting with F because it has been resized.
MCCodeEmitter - Generic instruction encoding interface.
virtual void reset()
lifetime management
bool evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const
Try to evaluate the expression to the form (a - b + constant) where neither a nor b are variables...
virtual void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFixup &Fixup, const MCFragment *DF, const MCValue &Target, uint64_t &Value, bool &IsResolved)
Target hook to adjust the literal value of a fixup if necessary.
SmallVectorImpl< MCFixup > & getFixups()
uint64_t getSectionAddressSize(const MCSection *Sec) const
Get the address space size of the given section, as it effects layout.
Should this fixup kind force a 4-byte aligned effective PC value?
MCFragment * getFragment() const
llvm::SmallVectorImpl< MCSection * > & getSectionOrder()
MCFixupKind getKind() const
const MCSymbolRefExpr * getSymB() const
MCSection::iterator begin()
void write16(uint16_t Value)
bool isSymbolLinkerVisible(const MCSymbol &SD) const
Check whether a particular symbol is visible to the linker and is required in the symbol table...
PowerPC TLS Dynamic Call Fixup
uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCFragment *F, uint64_t FOffset, uint64_t FSize)
Compute the amount of padding required before the fragment F to obey bundling restrictions, where FOffset is the fragment's offset in its section and FSize is the fragment's size.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
const MCSymbolRefExpr * getSymA() const
bool isUsedInReloc() const
virtual bool isVirtualSection() const =0
Check whether this section is "virtual", that is has no actual object file contents.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isBundlingEnabled() const
An iterator type that allows iterating over the pointees via some other iterator. ...
static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment &F)
Write the fragment F to the output file.
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, raw_ostream &OS)
MCLOHContainer & getLOHContainer()
MCSection * getParent() const
void encodeSLEB128(int64_t Value, raw_ostream &OS)
Utility function to encode a SLEB128 value to an output stream.
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Target - Wrapper for Target specific information.
void setIsRegistered(bool Value) const
SmallVectorImpl< MCFixup >::const_iterator const_fixup_iterator
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
SmallString< 8 > & getContents()
virtual void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue)=0
Record a relocation entry.
static char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16)...
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
const MCSymbol * getAtom() const
StringRef getName() const
getName - Get the symbol name.
uint64_t getOffset() const
MCAsmBackend & getBackend() const
bool isCommon() const
Is this a 'common' symbol.
fixup_iterator fixup_begin()
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
static bool getLabelOffset(const MCAsmLayout &Layout, const MCSymbol &S, bool ReportError, uint64_t &Val)
SmallString< 8 > & getContents()
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
unsigned getValueSize() const
void writeBytes(const SmallVectorImpl< char > &ByteVec, unsigned ZeroFillSize=0)
bool isVariable() const
isVariable - Check if this is a variable symbol.
void reset()
Reuse an assembler instance.
Fragment for data and encoded instructions.
VariantKind getKind() const
int64_t getConstant() const
const ARM::ArchExtKind Kind
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
LLVM Value Representation.
Generic interface to target specific assembler backends.
MCAssembler & getAssembler() const
Get the assembler object this is a layout for.
uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
This class implements an extremely fast bulk output stream that can only output to a stream...
const MCExpr & getValue() const
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output stream.
uint64_t getSectionFileSize(const MCSection *Sec) const
Get the data size of the given section, as emitted to the object file.
unsigned getLayoutOrder() const
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
SmallString< 8 > & getContents()
Represents a location in source code.
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
pointee_iterator< SectionListType::iterator > iterator
virtual void reset()
lifetime management
void Finish()
Finish - Do final processing and write the object to the output stream.
MCSection::FragmentListType & getFragmentList()
void setInst(const MCInst &Value)
symbol_iterator symbol_end()