13#ifndef LLVM_EXECUTIONENGINE_JITLINK_LOONGARCH_H
14#define LLVM_EXECUTIONENGINE_JITLINK_LOONGARCH_H
330 return Hi == 63 ? Val >>
Lo : (Val & ((((
uint64_t)1 << (
Hi + 1)) - 1))) >>
Lo;
353 return {
reinterpret_cast<const char *
>(StubContent),
StubEntrySize};
366 Symbol *InitialTarget =
nullptr,
372 *InitialTarget, InitialAddend);
373 return G.addAnonymousSymbol(
B, 0,
G.getPointerSize(),
false,
false);
381 Block &StubContentBlock =
G.createContentBlock(
385 return G.addAnonymousSymbol(StubContentBlock, 0,
StubEntrySize,
true,
false);
394 Edge::Kind KindToSet = Edge::Invalid;
395 switch (
E.getKind()) {
405 assert(KindToSet != Edge::Invalid &&
406 "Fell through switch, but no new kind to set");
408 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
409 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
410 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
412 E.setKind(KindToSet);
441 !
E.getTarget().isDefined()) {
443 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
444 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
445 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
An Addressable with content and edges.
void addEdge(Edge::Kind K, Edge::OffsetT Offset, Symbol &Target, Edge::AddendT Addend)
Add an edge to this block.
Represents fixups and constraints in the LinkGraph.
Represents an object file section.
A CRTP base for tables that are built on demand, e.g.
Symbol & getEntryForTarget(LinkGraph &G, Symbol &Target)
Global Offset Table Builder.
Symbol & createEntry(LinkGraph &G, Symbol &Target)
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
static StringRef getSectionName()
static StringRef getSectionName()
PLTTableManager(GOTTableManager &GOT)
Section & getStubsSection(LinkGraph &G)
Symbol & createEntry(LinkGraph &G, Symbol &Target)
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
Represents an address in the executor process.
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...
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.
ArrayRef< char > getStubBlockContent(LinkGraph &G)
LLVM_ABI const char * getEdgeKindName(Edge::Kind K)
Returns a string name for the given loongarch edge.
ArrayRef< char > getGOTEntryBlockContent(LinkGraph &G)
EdgeKind_loongarch
Represents loongarch fixups.
@ Branch16PCRel
A 16-bit PC-relative branch.
@ Add16
16 bits label addition
@ AddUleb128
ULEB128 bits label addition.
@ RequestGOTAndTransformToPage20
A GOT entry getter/constructor, transformed to Page20 pointing at the GOT entry for the original targ...
@ Sub16
16 bits label subtraction
@ NegDelta32
A 32-bit negative delta.
@ SubUleb128
ULEB128 bits label subtraction.
@ Sub8
8 bits label subtraction
@ PageOffset12
The 12-bit offset of the target within its page.
@ Sub32
32 bits label subtraction
@ Add64
64 bits label addition
@ Sub6
low 6 bits label subtraction
@ Add8
8 bits label addition
@ Page20
The signed 20-bit delta from the fixup page to the page containing the target.
@ Pointer64
A plain 64-bit pointer value relocation.
@ RequestGOTAndTransformToPageOffset12
A GOT entry getter/constructor, transformed to Pageoffset12 pointing at the GOT entry for the origina...
@ Call36PCRel
A 36-bit PC-relative call.
@ Add6
low 6 bits label addition
@ Branch21PCRel
A 21-bit PC-relative branch.
@ Branch26PCRel
A 26-bit PC-relative branch.
@ Add32
32 bits label addition
@ Pointer32
A plain 32-bit pointer value relocation.
@ AlignRelaxable
Alignment requirement used by linker relaxation.
@ Sub64
64 bits label subtraction
LLVM_ABI const uint8_t LA32StubContent[StubEntrySize]
LLVM_ABI const uint8_t LA64StubContent[StubEntrySize]
LLVM_ABI const char NullPointerContent[8]
loongarch null pointer content.
uint32_t extractBits(uint64_t Val, unsigned Hi, unsigned Lo)
constexpr size_t StubEntrySize
loongarch stub content.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.