49#define DEBUG_TYPE "assembler"
54STATISTIC(EmittedFragments,
"Number of emitted assembler fragments - total");
56 "Number of emitted assembler fragments - relaxable");
58 "Number of emitted assembler fragments - data");
59STATISTIC(EmittedCompactEncodedInstFragments,
60 "Number of emitted assembler fragments - compact encoded inst");
62 "Number of emitted assembler fragments - align");
64 "Number of emitted assembler fragments - fill");
65STATISTIC(EmittedNopsFragments,
"Number of emitted assembler fragments - nops");
66STATISTIC(EmittedOrgFragments,
"Number of emitted assembler fragments - org");
67STATISTIC(evaluateFixup,
"Number of evaluated fixups");
68STATISTIC(ObjectBytes,
"Number of emitted object file bytes");
69STATISTIC(RelaxationSteps,
"Number of assembler layout and relaxation steps");
70STATISTIC(RelaxedInstructions,
"Number of relaxed instructions");
83 std::unique_ptr<MCAsmBackend> Backend,
84 std::unique_ptr<MCCodeEmitter>
Emitter,
85 std::unique_ptr<MCObjectWriter> Writer)
86 : Context(Context), Backend(
std::
move(Backend)),
88 VersionInfo.Major = 0;
89 DarwinTargetVariantVersionInfo.Major = 0;
96 SubsectionsViaSymbols =
false;
97 IncrementalLinkerCompatible =
false;
100 LinkerOptions.clear();
105 LOHContainer.
reset();
106 VersionInfo.Major = 0;
108 DarwinTargetVariantVersionInfo.Major = 0;
109 DarwinTargetVariantVersionInfo.SDKVersion =
VersionTuple();
122 if (Section.isRegistered())
124 assert(Section.curFragList()->Head &&
"allocInitialFragment not called");
126 Section.setIsRegistered(
true);
131 if (ThumbFuncs.count(Symbol))
134 if (!Symbol->isVariable())
137 const MCExpr *Expr = Symbol->getVariableValue();
157 ThumbFuncs.insert(Symbol);
164 ++stats::evaluateFixup;
183 "unsupported subtraction of qualified symbol");
200 bool IsResolved =
false;
204 }
else if (!
Target.getSymA()) {
213 Writer->isSymbolRefDifferenceFullyResolvedImpl(
214 *
this, SA, *
DF,
false,
true);
218 IsResolved =
Target.isAbsolute();
236 assert((ShouldAlignPC ? IsPCRel :
true) &&
237 "FKF_IsAlignedDownTo32Bits is only allowed on PC-relative fixups!");
244 if (ShouldAlignPC)
Offset &= ~0x3;
257 if (!IsResolved &&
Target.getSymA() &&
Target.getSymB() &&
267 switch (
F.getKind()) {
269 return cast<MCDataFragment>(
F).getContents().size();
271 return cast<MCRelaxableFragment>(
F).getContents().size();
273 return cast<MCCompactEncodedInstFragment>(
F).getContents().size();
275 auto &FF = cast<MCFillFragment>(
F);
276 int64_t NumValues = 0;
277 if (!FF.getNumValues().evaluateKnownAbsolute(NumValues, *
this)) {
279 "expected assembly-time absolute expression");
282 int64_t
Size = NumValues * FF.getValueSize();
291 return cast<MCNopsFragment>(
F).getNumBytes();
294 return cast<MCLEBFragment>(
F).getContents().size();
297 return cast<MCBoundaryAlignFragment>(
F).getSize();
329 "expected assembly-time absolute expression");
334 int64_t TargetLocation =
Value.getConstant();
341 TargetLocation += Val;
343 int64_t
Size = TargetLocation - FragmentOffset;
344 if (Size < 0 || Size >= 0x40000000) {
346 OF.
getLoc(),
"invalid .org offset '" +
Twine(TargetLocation) +
347 "' (at offset '" +
Twine(FragmentOffset) +
"')");
354 return cast<MCDwarfLineAddrFragment>(
F).getContents().size();
356 return cast<MCDwarfCallFrameFragment>(
F).getContents().size();
358 return cast<MCCVInlineLineTableFragment>(
F).getContents().size();
360 return cast<MCCVDefRangeFragment>(
F).getContents().size();
362 return cast<MCPseudoProbeAddrFragment>(
F).getContents().size();
376 uint64_t OffsetInBundle = FOffset & (BundleSize - 1);
377 uint64_t EndOfFragment = OffsetInBundle + FSize;
386 if (
F->alignToBundleEnd()) {
397 if (EndOfFragment == BundleSize)
399 else if (EndOfFragment < BundleSize)
400 return BundleSize - EndOfFragment;
402 return 2 * BundleSize - EndOfFragment;
404 }
else if (OffsetInBundle > 0 && EndOfFragment > BundleSize)
405 return BundleSize - OffsetInBundle;
432 assert(isa<MCEncodedFragment>(
F) &&
433 "Only MCEncodedFragment implementations have instructions");
442 if (RequiredBundlePadding > UINT8_MAX)
445 EF->Offset += RequiredBundlePadding;
446 if (
auto *
DF = dyn_cast_or_null<MCDataFragment>(Prev))
447 if (
DF->getContents().empty())
448 DF->Offset = EF->Offset;
535 if (!Symbol.isVariable())
538 const MCExpr *Expr = Symbol.getVariableValue();
542 "expression could not be evaluated");
551 "' could not be evaluated in a subtraction expression");
562 "Common symbol '" + ASym.
getName() +
563 "' cannot be used in assignment expr");
585 bool Changed = !Symbol.isRegistered();
587 Symbol.setIsRegistered(
true);
588 Symbols.push_back(&Symbol);
599 if (BundlePadding > 0) {
601 "Writing bundle padding with disabled bundling");
603 "Writing bundle padding for a fragment without instructions");
605 unsigned TotalLength = BundlePadding +
static_cast<unsigned>(FSize);
617 if (!
getBackend().writeNopData(
OS, DistanceToBoundary, STI))
619 Twine(DistanceToBoundary) +
" bytes");
620 BundlePadding -= DistanceToBoundary;
624 Twine(BundlePadding) +
" bytes");
632 uint64_t FragmentSize = Asm.computeFragmentSize(
F);
637 Asm.writeFragmentPadding(
OS, *EF, FragmentSize);
644 ++stats::EmittedFragments;
646 switch (
F.getKind()) {
648 ++stats::EmittedAlignFragments;
660 "' is not a divisor of padding size '" +
661 Twine(FragmentSize) +
"'");
670 Twine(Count) +
" bytes");
675 for (
uint64_t i = 0; i != Count; ++i) {
694 ++stats::EmittedDataFragments;
695 OS << cast<MCDataFragment>(
F).getContents();
699 ++stats::EmittedRelaxableFragments;
700 OS << cast<MCRelaxableFragment>(
F).getContents();
704 ++stats::EmittedCompactEncodedInstFragments;
705 OS << cast<MCCompactEncodedInstFragment>(
F).getContents();
709 ++stats::EmittedFillFragments;
713 const unsigned MaxChunkSize = 16;
714 char Data[MaxChunkSize];
715 assert(0 < VSize && VSize <= MaxChunkSize &&
"Illegal fragment fill size");
718 for (
unsigned I = 0;
I != VSize; ++
I) {
720 Data[
I] = uint8_t(V >> (index * 8));
722 for (
unsigned I = VSize;
I < MaxChunkSize; ++
I)
726 const unsigned NumPerChunk = MaxChunkSize / VSize;
728 const unsigned ChunkSize = VSize * NumPerChunk;
732 for (
uint64_t I = 0, E = FragmentSize / ChunkSize;
I != E; ++
I)
736 unsigned TrailingCount = FragmentSize % ChunkSize;
743 ++stats::EmittedNopsFragments;
748 int64_t MaximumNopLength =
751 assert(NumBytes > 0 &&
"Expected positive NOPs fragment size");
752 assert(ControlledNopLength >= 0 &&
"Expected non-negative NOP size");
754 if (ControlledNopLength > MaximumNopLength) {
755 Asm.getContext().reportError(NF.
getLoc(),
756 "illegal NOP size " +
757 std::to_string(ControlledNopLength) +
758 ". (expected within [0, " +
759 std::to_string(MaximumNopLength) +
"])");
762 ControlledNopLength = MaximumNopLength;
766 if (!ControlledNopLength)
767 ControlledNopLength = MaximumNopLength;
771 (
uint64_t)std::min(NumBytes, ControlledNopLength);
772 assert(NumBytesToEmit &&
"try to emit empty NOP instruction");
773 if (!Asm.getBackend().writeNopData(
OS, NumBytesToEmit,
776 Twine(NumBytesToEmit) +
" bytes");
779 NumBytes -= NumBytesToEmit;
794 Twine(FragmentSize) +
" bytes");
805 ++stats::EmittedOrgFragments;
808 for (
uint64_t i = 0, e = FragmentSize; i != e; ++i)
825 const auto &OF = cast<MCCVInlineLineTableFragment>(
F);
826 OS << OF.getContents();
830 const auto &DRF = cast<MCCVDefRangeFragment>(
F);
831 OS << DRF.getContents();
844 "The stream should advance by fragment size");
857 switch (
F.getKind()) {
864 if (
DF.fixup_begin() !=
DF.fixup_end())
866 " section '" + Sec->getName() +
867 "' cannot have fixups");
868 for (
unsigned i = 0, e =
DF.getContents().size(); i != e; ++i)
869 if (
DF.getContents()[i]) {
871 Sec->getVirtualSectionKind() +
872 " section '" + Sec->getName() +
873 "' cannot have non-zero initializers");
881 assert((cast<MCAlignFragment>(
F).getValueSize() == 0 ||
882 cast<MCAlignFragment>(
F).getValue() == 0) &&
883 "Invalid align in virtual section!");
886 assert((cast<MCFillFragment>(
F).getValue() == 0) &&
887 "Invalid fill in virtual section!");
907std::tuple<MCValue, uint64_t, bool>
915 evaluateFixup(
Fixup, &
F,
Target, STI, FixedValue, WasForced);
922 return std::make_tuple(
Target, FixedValue, IsResolved);
928 errs() <<
"assembler backend - pre-layout\n--\n";
932 unsigned SectionIndex = 0;
937 if (Sec.Subsections.size() > 1) {
940 for (
auto &[
_,
List] : Sec.Subsections) {
945 Sec.Subsections.clear();
946 Sec.Subsections.push_back({0u, {Dummy.getNext(),
Tail}});
947 Sec.CurFragList = &Sec.Subsections[0].second;
949 unsigned FragmentIndex = 0;
951 Frag.setLayoutOrder(FragmentIndex++);
956 this->HasLayout =
true;
957 while (layoutOnce()) {
968 errs() <<
"assembler backend - post-relaxation\n--\n";
975 errs() <<
"assembler backend - final-layout\n--\n";
990 switch (Frag.getKind()) {
1003 Fixups =
DF.getFixups();
1004 Contents =
DF.getContents();
1005 STI =
DF.getSubtargetInfo();
1006 assert(!
DF.hasInstructions() || STI !=
nullptr);
1025 Fixups =
DF.getFixups();
1026 Contents =
DF.getContents();
1031 Fixups =
DF.getFixups();
1032 Contents =
DF.getContents();
1036 auto &LF = cast<MCLEBFragment>(Frag);
1037 Fixups = LF.getFixups();
1038 Contents = LF.getContents();
1052 std::tie(
Target, FixedValue, IsResolved) =
1053 handleFixup(Frag,
Fixup, STI);
1070bool MCAssembler::fixupNeedsRelaxation(
const MCFixup &
Fixup,
1076 bool Resolved = evaluateFixup(
Fixup,
DF,
Target,
DF->getSubtargetInfo(),
1091 if (!
getBackend().mayNeedRelaxation(
F->getInst(), *
F->getSubtargetInfo()))
1095 if (fixupNeedsRelaxation(
Fixup,
F))
1103 "Expected CodeEmitter defined for relaxInstruction");
1104 if (!fragmentNeedsRelaxation(&
F))
1107 ++stats::RelaxedInstructions;
1119 F.getFixups().clear();
1120 F.getContents().clear();
1122 *
F.getSubtargetInfo());
1127 const unsigned OldSize =
static_cast<unsigned>(LF.
getContents().
size());
1128 unsigned PadTo = OldSize;
1139 bool Relaxed, UseZeroPad;
1144 "leb128 expression is not absolute");
1172 Align BoundaryAlignment) {
1174 return (StartAddr >>
Log2(BoundaryAlignment)) !=
1175 ((EndAddr - 1) >>
Log2(BoundaryAlignment));
1185 Align BoundaryAlignment) {
1187 return (EndAddr & (BoundaryAlignment.
value() - 1)) == 0;
1197 Align BoundaryAlignment) {
1228 if (
getBackend().relaxDwarfLineAddr(*
this,
DF, WasRelaxed))
1234 bool Abs =
DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, *
this);
1235 assert(Abs &&
"We created a line delta with an invalid expression");
1238 LineDelta =
DF.getLineDelta();
1241 DF.getFixups().clear();
1245 return OldSize !=
Data.size();
1255 bool Abs =
DF.getAddrDelta().evaluateAsAbsolute(
Value, *
this);
1258 "invalid CFI advance_loc expression");
1266 DF.getFixups().clear();
1269 return OldSize !=
Data.size();
1273 unsigned OldSize =
F.getContents().size();
1275 return OldSize !=
F.getContents().size();
1279 unsigned OldSize =
F.getContents().size();
1281 return OldSize !=
F.getContents().size();
1288 assert(Abs &&
"We created a pseudo probe with an invalid expression");
1297 return OldSize !=
Data.size();
1301 switch(
F.getKind()) {
1306 "Did not expect a MCRelaxableFragment in RelaxAll mode");
1307 return relaxInstruction(cast<MCRelaxableFragment>(
F));
1309 return relaxDwarfLineAddr(cast<MCDwarfLineAddrFragment>(
F));
1311 return relaxDwarfCallFrameFragment(cast<MCDwarfCallFrameFragment>(
F));
1313 return relaxLEB(cast<MCLEBFragment>(
F));
1315 return relaxBoundaryAlign(cast<MCBoundaryAlignFragment>(
F));
1317 return relaxCVInlineLineTable(cast<MCCVInlineLineTableFragment>(
F));
1319 return relaxCVDefRange(cast<MCCVDefRangeFragment>(
F));
1321 return relaxPseudoProbeAddr(cast<MCPseudoProbeAddrFragment>(
F));
1325bool MCAssembler::layoutOnce() {
1326 ++stats::RelaxationSteps;
1328 bool Changed =
false;
1331 if (relaxFragment(Frag))
1336#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1340 OS <<
"<MCAssembler\n";
1341 OS <<
" Sections:[\n ";
1361 OS <<
", Index:" <<
Sym.getIndex() <<
", ";
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
dxil DXContainer Global Emitter
#define DEBUG_WITH_TYPE(TYPE, X)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
static uint64_t computeBundlePadding(unsigned BundleSize, const MCEncodedFragment *F, uint64_t FOffset, uint64_t FSize)
static bool getSymbolOffsetImpl(const MCAssembler &Asm, const MCSymbol &S, bool ReportError, uint64_t &Val)
static bool needPadding(uint64_t StartAddr, uint64_t Size, Align BoundaryAlignment)
Check if the branch needs padding.
static void writeFragment(raw_ostream &OS, const MCAssembler &Asm, const MCFragment &F)
Write the fragment F to the output file.
static bool mayCrossBoundary(uint64_t StartAddr, uint64_t Size, Align BoundaryAlignment)
Check if the branch crosses the boundary.
static bool isAgainstBoundary(uint64_t StartAddr, uint64_t Size, Align BoundaryAlignment)
Check if the branch is against the boundary.
static bool getLabelOffset(const MCAssembler &Asm, const MCSymbol &S, bool ReportError, uint64_t &Val)
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void encodeInlineLineTable(const MCAssembler &Asm, MCCVInlineLineTableFragment &F)
Encodes the binary annotations once we have a layout.
void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F)
Align getAlignment() const
unsigned getMaxBytesToEmit() const
unsigned getValueSize() const
const MCSubtargetInfo * getSubtargetInfo() const
virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const
Relax the instruction in the given fragment to the next wider instruction.
virtual bool shouldInsertFixupForCodeAlign(MCAssembler &Asm, MCAlignFragment &AF)
Hook which indicates if the target requires a fixup to be generated when handling an align directive ...
virtual bool fixupNeedsRelaxationAdvanced(const MCAssembler &Asm, const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const bool WasForced) const
Target specific predicate for whether a given fixup requires the associated instruction to be relaxed...
virtual void finishLayout(MCAssembler const &Asm) const
Give backend an opportunity to finish layout after relaxation.
virtual bool evaluateTargetFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCFragment *DF, const MCValue &Target, const MCSubtargetInfo *STI, uint64_t &Value, bool &WasForced)
virtual void reset()
lifetime management
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
virtual std::pair< bool, bool > relaxLEB128(const MCAssembler &Asm, MCLEBFragment &LF, int64_t &Value) const
virtual void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const =0
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
MCContext & getContext() const
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
void ensureValid(MCSection &Sec) const
uint64_t getSectionAddressSize(const MCSection &Sec) const
void Finish()
Finish - Do final processing and write the object to the output stream.
unsigned getBundleAlignSize() const
bool isBundlingEnabled() const
bool getSubsectionsViaSymbols() const
void writeSectionData(raw_ostream &OS, const MCSection *Section) const
Emit the section contents to OS.
MCObjectWriter * getWriterPtr() const
MCObjectWriter & getWriter() const
MCCodeEmitter * getEmitterPtr() const
uint64_t getFragmentOffset(const MCFragment &F) const
void layoutBundle(MCFragment *Prev, MCFragment *F) const
MCCodeEmitter & getEmitter() const
MCAssembler(MCContext &Context, std::unique_ptr< MCAsmBackend > Backend, std::unique_ptr< MCCodeEmitter > Emitter, std::unique_ptr< MCObjectWriter > Writer)
Construct a new assembler instance.
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
MCAsmBackend & getBackend() const
bool registerSection(MCSection &Section)
uint64_t computeFragmentSize(const MCFragment &F) const
Compute the effective fragment size.
const MCSymbol * getBaseSymbol(const MCSymbol &Symbol) const
MCAsmBackend * getBackendPtr() const
iterator_range< pointee_iterator< typename SmallVector< const MCSymbol *, 0 >::const_iterator > > symbols() const
MCLOHContainer & getLOHContainer()
uint64_t getSectionFileSize(const MCSection &Sec) const
void reset()
Reuse an assembler instance.
bool registerSymbol(const MCSymbol &Symbol)
MCDwarfLineTableParams getDWARFLinetableParams() const
void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F, uint64_t FSize) const
Write the necessary bundle padding to OS.
Represents required padding such that a particular other set of fragments does not cross a particular...
void setSize(uint64_t Value)
const MCFragment * getLastFragment() const
const MCSubtargetInfo * getSubtargetInfo() const
Align getAlignment() const
Fragment representing the .cv_def_range directive.
Fragment representing the binary annotations produced by the .cv_inline_linetable directive.
virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
Encode the given Inst to bytes and append to CB.
virtual void reset()
Lifetime management.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
CodeViewContext & getCVContext()
void reportError(SMLoc L, const Twine &Msg)
Fragment for data and encoded instructions.
static void encodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, SmallVectorImpl< char > &OS)
static void encode(MCContext &Context, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta, SmallVectorImpl< char > &OS)
Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
SmallVectorImpl< char > & getContents()
SmallVectorImpl< MCFixup > & getFixups()
Interface implemented by fragments that contain encoded instructions and/or data.
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
void setBundlePadding(uint8_t N)
Set the padding size for this fragment.
uint8_t getBundlePadding() const
Get the padding size that must be inserted before this fragment.
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.
bool evaluateAsValue(MCValue &Res, const MCAssembler &Asm) const
Try to evaluate the expression to the form (a - b + constant) where neither a nor b are variables.
bool evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const
Aggressive variant of evaluateAsRelocatable when relocations are unavailable (e.g.
bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
uint8_t getValueSize() const
uint64_t getValue() const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCSection * getParent() const
MCFragment * getNext() const
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.
const MCExpr & getValue() const
void setValue(const MCExpr *Expr)
int64_t getControlledNopLength() const
int64_t getNumBytes() const
const MCSubtargetInfo * getSubtargetInfo() const
virtual void executePostLayoutBinding(MCAssembler &Asm)
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
virtual void reset()
lifetime management
virtual uint64_t writeObject(MCAssembler &Asm)=0
Write the object file and returns the number of bytes written.
virtual void recordRelocation(MCAssembler &Asm, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)=0
Record a relocation entry.
const MCExpr & getOffset() const
const MCExpr & getAddrDelta() const
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Instances of this class represent a uniqued identifier for a section in the current translation unit.
void setOrdinal(unsigned Value)
bool isVirtualSection() const
Check whether this section is "virtual", that is has no actual object file contents.
virtual bool useCodeAlign() const =0
Return true if a .align directive should use "optimized nops" to fill instead of 0s.
FragList * curFragList() const
void setHasLayout(bool Value)
Generic base class for all target subtargets.
Represents a symbol table index fragment.
const MCSymbol * getSymbol()
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const MCExpr * getVariableValue(bool SetUsed=true) const
getVariableValue - Get the value for variable symbols.
bool isCommon() const
Is this a 'common' symbol.
StringRef getName() const
getName - Get the symbol name.
bool isVariable() const
isVariable - Check if this is a variable symbol.
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
uint32_t getIndex() const
Get the (implementation defined) index.
uint64_t getOffset() const
MCFragment * getFragment(bool SetUsed=true) const
This represents an "assembler immediate".
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Represents a location in source code.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
Represents a version number in the form major[.minor[.subminor[.build]]].
This class implements an extremely fast bulk output stream that can only output to a stream.
uint64_t tell() const
tell - Return the current offset with the file.
raw_ostream & write(unsigned char C)
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ FK_Data_1
A one-byte fixup.
uint64_t offsetToAlignment(uint64_t Value, Align Alignment)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Ref
The access may reference the value stored in memory.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
unsigned Log2(Align A)
Returns the log2 of the alignment.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t value() const
This is a hole in the type system and should not be abused.
@ FKF_IsTarget
Should this fixup be evaluated in a target dependent manner?
@ FKF_IsAlignedDownTo32Bits
Should this fixup kind force a 4-byte aligned effective PC value?
@ FKF_Constant
This fixup kind should be resolved if defined.
@ FKF_IsPCRel
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
unsigned Flags
Flags describing additional information on this fixup kind.