Go to the documentation of this file.
13 #ifndef LLVM_EXECUTIONENGINE_JITLINK_X86_64_H
14 #define LLVM_EXECUTIONENGINE_JITLINK_X86_64_H
366 const Symbol *GOTSymbol) {
369 char *BlockWorkingMem =
B.getAlreadyMutableContent().data();
370 char *FixupPtr = BlockWorkingMem +
E.getOffset();
371 auto FixupAddress =
B.getAddress() +
E.getOffset();
373 switch (
E.getKind()) {
376 uint64_t Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
382 uint64_t Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
390 int64_t
Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
405 E.getTarget().getAddress() - (FixupAddress + 4) +
E.getAddend();
414 int64_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
420 int64_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
429 int64_t
Value = FixupAddress -
E.getTarget().getAddress() +
E.getAddend();
435 int64_t
Value = FixupAddress -
E.getTarget().getAddress() +
E.getAddend();
443 assert(GOTSymbol &&
"No GOT section symbol");
445 E.getTarget().getAddress() - GOTSymbol->
getAddress() +
E.getAddend();
451 return make_error<JITLinkError>(
452 "In graph " +
G.getName() +
", section " +
B.getSection().getName() +
483 Symbol *InitialTarget =
nullptr,
488 B.addEdge(
Pointer64, 0, *InitialTarget, InitialAddend);
489 return G.addAnonymousSymbol(
B, 0, 8,
false,
false);
502 B.addEdge(
Delta32, 2, PointerSymbol, -4);
513 return G.addAnonymousSymbol(
525 switch (
E.getKind()) {
551 "Fell through switch, but no new kind to set");
553 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
554 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
555 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
557 E.setKind(KindToSet);
586 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
587 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
588 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
628 #endif // LLVM_EXECUTIONENGINE_JITLINK_X86_64_H
Symbol & createEntry(LinkGraph &G, Symbol &Target)
Represents an address in the executor process.
@ PCRel32TLVPLoadREXRelaxable
A PC-relative REX load of a Thread Local Variable Pointer (TLVP) entry, relaxable if the TLVP entry t...
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
This is an optimization pass for GlobalISel generic memory operations.
@ NegDelta32
A 32-bit negative delta.
@ RequestGOTAndTransformToDelta64
A GOT entry getter/constructor, transformed to Delta64 pointing at the GOT entry for the original tar...
Target - Wrapper for Target specific information.
static ErrorSuccess success()
Create a success value.
@ RequestGOTAndTransformToDelta32
A GOT entry getter/constructor, transformed to Delta32 pointing at the GOT entry for the original tar...
An Addressable with content and edges.
@ Pointer64
A plain 64-bit pointer value relocation.
@ BranchPCRel32ToPtrJumpStub
A 32-bit PC-relative branch to a pointer jump stub.
static StringRef getSectionName()
@ PCRel32GOTLoadREXRelaxable
A PC-relative REX load of a GOT entry, relaxable if GOT entry target is in-range of the fixup.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
@ PCRel32GOTLoadRelaxable
A PC-relative load of a GOT entry, relaxable if GOT entry target is in-range of the fixup.
Procedure Linkage Table Builder.
Block & createPointerJumpStubBlock(LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
Create a jump stub block that jumps via the pointer at the given symbol.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
detail::packed_endian_specific_integral< int64_t, little, unaligned > little64_t
#define DEBUG_WITH_TYPE(TYPE, X)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
Symbol & getEntryForTarget(LinkGraph &G, Symbol &Target)
Return the constructed entry.
@ Delta64FromGOT
A 64-bit GOT delta.
Error optimizeGOTAndStubAccesses(LinkGraph &G)
Optimize the GOT and Stub relocations if the edge target address is in range.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
PLTTableManager(GOTTableManager &GOT)
Symbol & createAnonymousPointer(LinkGraph &G, Section &PointerSection, Symbol *InitialTarget=nullptr, uint64_t InitialAddend=0)
Creates a new pointer block in the given section and returns an anonymous symbol pointing to it.
@ RequestGOTAndTransformToPCRel32GOTLoadRelaxable
A GOT entry getter/constructor, transformed to PCRel32ToGOTLoadRelaxable pointing at the GOT entry fo...
const char * getEdgeKindName(Edge::Kind K)
Returns a string name for the given x86-64 edge.
@ RequestGOTAndTransformToDelta64FromGOT
A GOT entry offset within GOT getter/constructor, transformed to Delta64FromGOT pointing at the GOT e...
@ BranchPCRel32
A 32-bit PC-relative branch.
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
EdgeKind_x86_64
Represents x86-64 fixups and other x86-64-specific edge kinds.
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
orc::ExecutorAddr getAddress() const
Returns the address of this symbol.
constexpr uint64_t PointerSize
x86_64 pointer size.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
@ RequestTLSDescInGOTAndTransformToDelta32
TODO: Explain the generic edge kind.
Symbol & createEntry(LinkGraph &G, Symbol &Target)
static StringRef getSectionName()
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
StringRef - Represent a constant reference to a string, i.e.
Represents fixups and constraints in the LinkGraph.
Error makeTargetOutOfRangeError(const LinkGraph &G, const Block &B, const Edge &E)
Create an out of range error for the given edge in the given block.
@ RequestTLVPAndTransformToPCRel32TLVPLoadREXRelaxable
A TLVP entry getter/constructor, transformed to Delta32ToTLVPLoadREXRelaxable.
Error applyFixup(LinkGraph &G, Block &B, const Edge &E, const Symbol *GOTSymbol)
Apply fixup expression for edge to block content.
bool isInRangeForImmU32(uint64_t Value)
Returns true if the given uint64_t value is in range for a uint32_t.
Global Offset Table Builder.
@ RequestGOTAndTransformToPCRel32GOTLoadREXRelaxable
A GOT entry getter/constructor, transformed to PCRel32ToGOTLoadREXRelaxable pointing at the GOT entry...
Represents an object file section.
const char NullPointerContent[PointerSize]
x86-64 null pointer content.
Lightweight error class with error context and mandatory checking.
detail::packed_endian_specific_integral< int32_t, little, unaligned > little32_t
const char PointerJumpStubContent[6]
x86-64 pointer jump stub content.
detail::packed_endian_specific_integral< uint64_t, little, unaligned > ulittle64_t
A CRTP base for tables that are built on demand, e.g.
bool isInRangeForImmS32(int64_t Value)
Returns true if the given int64_t value is in range for an int32_t.
Section & getStubsSection(LinkGraph &G)
@ NegDelta64
A 64-bit negative delta.
@ BranchPCRel32ToPtrJumpStubBypassable
A relaxable version of BranchPCRel32ToPtrJumpStub.
Align max(MaybeAlign Lhs, Align Rhs)
Reimplement select in terms of SEL *We would really like to support but we need to prove that the add doesn t need to overflow between the two bit chunks *Implement pre post increment support(e.g. PR935) *Implement smarter const ant generation for binops with large immediates. A few ARMv6T2 ops should be pattern matched
#define LLVM_LIKELY(EXPR)
@ Pointer32
A plain 32-bit pointer value relocation.
Symbol & createAnonymousPointerJumpStub(LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
Create a jump stub that jumps via the pointer at the given symbol and an anonymous symbol pointing to...
LLVM Value Representation.
@ Pointer32Signed
A signed 32-bit pointer value relocation.