LLVM 22.0.0git
|
Classes | |
class | GOTTableManager |
Global Offset Table Builder. More... | |
class | PLTTableManager |
Procedure Linkage Table Builder. More... |
Enumerations | |
enum | EdgeKind_loongarch : Edge::Kind { Pointer64 = Edge::FirstRelocation , Pointer32 , Branch16PCRel , Branch21PCRel , Branch26PCRel , Delta32 , NegDelta32 , Delta64 , Page20 , PageOffset12 , RequestGOTAndTransformToPage20 , RequestGOTAndTransformToPageOffset12 , Call36PCRel , Add6 , Add8 , Add16 , Add32 , Add64 , AddUleb128 , Sub6 , Sub8 , Sub16 , Sub32 , Sub64 , SubUleb128 , AlignRelaxable } |
Represents loongarch fixups. More... |
Functions | |
LLVM_ABI const char * | getEdgeKindName (Edge::Kind K) |
Returns a string name for the given loongarch edge. | |
uint32_t | extractBits (uint64_t Val, unsigned Hi, unsigned Lo) |
Error | applyFixup (LinkGraph &G, Block &B, const Edge &E) |
Apply fixup expression for edge to block content. | |
ArrayRef< char > | getGOTEntryBlockContent (LinkGraph &G) |
ArrayRef< char > | getStubBlockContent (LinkGraph &G) |
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. | |
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 it. |
Variables | |
LLVM_ABI const char | NullPointerContent [8] |
loongarch null pointer content. | |
constexpr size_t | StubEntrySize = 12 |
loongarch stub content. | |
LLVM_ABI const uint8_t | LA64StubContent [StubEntrySize] |
LLVM_ABI const uint8_t | LA32StubContent [StubEntrySize] |
enum llvm::jitlink::loongarch::EdgeKind_loongarch : Edge::Kind |
Represents loongarch fixups.
Enumerator | |
---|---|
Pointer64 | A plain 64-bit pointer value relocation. Fixup expression: Fixup <- Target + Addend : uint64 |
Pointer32 | A plain 32-bit pointer value relocation. Fixup expression: Fixup <- Target + Addend : uint32 Errors:
|
Branch16PCRel | A 16-bit PC-relative branch. Represents a PC-relative branch to a target within +/-128Kb. The target must be 4-byte aligned. Fixup expression: Fixup <- (Target - Fixup + Addend) >> 2 : int16 Notes: The '16' in the name refers to the number operand bits and follows the naming convention used by the corresponding ELF relocations. Since the low two bits must be zero (because of the 4-byte alignment of the target) the operand is effectively a signed 18-bit number. Errors:
|
Branch21PCRel | A 21-bit PC-relative branch. Represents a PC-relative branch to a target within +/-4Mb. The Target must be 4-byte aligned. Fixup expression: Fixup <- (Target - Fixup + Addend) >> 2 : int21 Notes: The '21' in the name refers to the number operand bits and follows the naming convention used by the corresponding ELF relocations. Since the low two bits must be zero (because of the 4-byte alignment of the target) the operand is effectively a signed 23-bit number. Errors:
|
Branch26PCRel | A 26-bit PC-relative branch. Represents a PC-relative call or branch to a target within +/-128Mb. The target must be 4-byte aligned. Fixup expression: Fixup <- (Target - Fixup + Addend) >> 2 : int26 Notes: The '26' in the name refers to the number operand bits and follows the naming convention used by the corresponding ELF relocations. Since the low two bits must be zero (because of the 4-byte alignment of the target) the operand is effectively a signed 28-bit number. Errors:
|
Delta32 | A 32-bit delta. Delta from the fixup to the target. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
NegDelta32 | A 32-bit negative delta. Delta from the target back to the fixup. Fixup expression: Fixup <- Fixup - Target + Addend : int32 Errors:
|
Delta64 | A 64-bit delta. Delta from the fixup to the target. Fixup expression: Fixup <- Target - Fixup + Addend : int64 |
Page20 | The signed 20-bit delta from the fixup page to the page containing the target. Fixup expression: Fixup <- (((Target + Addend + ((Target + Addend) & 0x800)) & ~0xfff) Notes: For PCALAU12I fixups. Errors:
|
PageOffset12 | The 12-bit offset of the target within its page. Typically used to fix up ADDI/LD_W/LD_D immediates. Fixup expression: Fixup <- ((Target + Addend) >> Shift) & 0xfff : int12 |
RequestGOTAndTransformToPage20 | A GOT entry getter/constructor, transformed to Page20 pointing at the GOT entry for the original target. Indicates that this edge should be transformed into a Page20 targeting the GOT entry for the edge's current target, maintaining the same addend. A GOT entry for the target should be created if one does not already exist. Edges of this kind are usually handled by a GOT/PLT builder pass inserted by default. Fixup expression: NONE Errors:
|
RequestGOTAndTransformToPageOffset12 | A GOT entry getter/constructor, transformed to Pageoffset12 pointing at the GOT entry for the original target. Indicates that this edge should be transformed into a PageOffset12 targeting the GOT entry for the edge's current target, maintaining the same addend. A GOT entry for the target should be created if one does not already exist. Edges of this kind are usually handled by a GOT/PLT builder pass inserted by default. Fixup expression: NONE |
Call36PCRel | A 36-bit PC-relative call. Represents a PC-relative call to a target within [-128G - 0x20000, +128G
Fixup expression: Fixup <- (Target - Fixup + Addend) >> 2 : int36 Notes: The '36' in the name refers to the number operand bits and follows the naming convention used by the corresponding ELF relocations. Since the low two bits must be zero (because of the 4-byte alignment of the target) the operand is effectively a signed 38-bit number. Errors:
|
Add6 | low 6 bits label addition Fixup expression: Fixup <- (*{1}Fixup + (Target + Addend) & 0x3f) : int8 |
Add8 | 8 bits label addition Fixup expression: Fixup <- (*{1}Fixup + Target + Addend) : int8 |
Add16 | 16 bits label addition Fixup expression: Fixup <- (*{2}Fixup + Target + Addend) : int16 |
Add32 | 32 bits label addition Fixup expression: Fixup <- (*{4}Fixup + Target + Addend) : int32 |
Add64 | 64 bits label addition Fixup expression: Fixup <- (*{8}Fixup + Target + Addend) : int64 |
AddUleb128 | ULEB128 bits label addition. Fixup expression: Fixup <- (Fixup + Target + Addend) : uleb128 |
Sub6 | low 6 bits label subtraction Fixup expression: Fixup <- (*{1}Fixup - (Target + Addend) & 0x3f) : int8 |
Sub8 | 8 bits label subtraction Fixup expression: Fixup <- (*{1}Fixup - Target - Addend) : int8 |
Sub16 | 16 bits label subtraction Fixup expression: Fixup <- (*{2}Fixup - Target - Addend) : int16 |
Sub32 | 32 bits label subtraction Fixup expression: Fixup <- (*{4}Fixup - Target - Addend) : int32 |
Sub64 | 64 bits label subtraction Fixup expression: Fixup <- (*{8}Fixup - Target - Addend) : int64 |
SubUleb128 | ULEB128 bits label subtraction. Fixup expression: Fixup <- (Fixup - Target - Addend) : uleb128 |
AlignRelaxable | Alignment requirement used by linker relaxation. Linker relaxation will use this to ensure all code sequences are properly aligned and then remove these edges from the graph. |
Definition at line 28 of file loongarch.h.
Apply fixup expression for edge to block content.
Definition at line 334 of file loongarch.h.
References Add16, Add32, Add6, Add64, Add8, AddUleb128, AlignRelaxable, B(), Branch16PCRel, Branch21PCRel, Branch26PCRel, Call36PCRel, llvm::Count, llvm::decodeULEB128(), Delta32, Delta64, E(), llvm::encodeULEB128(), extractBits(), G, getEdgeKindName(), llvm::isInt(), llvm::isShiftedInt(), llvm::make_error(), llvm::jitlink::makeAlignmentError(), llvm::jitlink::makeTargetOutOfRangeError(), NegDelta32, Page20, PageOffset12, Pointer32, Pointer64, llvm::support::endian::read16le(), llvm::support::endian::read32le(), llvm::support::endian::read64le(), llvm::SignExtend64(), Sub16, Sub32, Sub6, Sub64, Sub8, SubUleb128, llvm::Error::success(), and llvm::utohexstr().
|
inline |
Creates a new pointer block in the given section and returns an Anonymous symbol pointing to it.
If InitialTarget is given then an Pointer64 relocation will be added to the block pointing at InitialTarget.
The pointer block will have the following default values: alignment: PointerSize alignment-offset: 0
Definition at line 597 of file loongarch.h.
References B(), G, getGOTEntryBlockContent(), Pointer32, and Pointer64.
Referenced by llvm::jitlink::loongarch::GOTTableManager::createEntry(), and llvm::jitlink::getAnonymousPointerCreator().
|
inline |
Create a jump stub that jumps via the pointer at the given symbol and an anonymous symbol pointing to it.
Return the anonymous symbol.
Definition at line 610 of file loongarch.h.
References llvm::jitlink::Block::addEdge(), G, getStubBlockContent(), Page20, PageOffset12, and StubEntrySize.
Referenced by llvm::jitlink::loongarch::PLTTableManager::createEntry(), and llvm::jitlink::getPointerJumpStubCreator().
Definition at line 329 of file loongarch.h.
References llvm::Hi, and llvm::Lo.
Referenced by applyFixup().
Returns a string name for the given loongarch edge.
For debugging purposes only.
Definition at line 36 of file loongarch.cpp.
References Add16, Add32, Add6, Add64, Add8, AddUleb128, AlignRelaxable, Branch16PCRel, Branch21PCRel, Branch26PCRel, Call36PCRel, Delta32, Delta64, llvm::jitlink::getGenericEdgeKindName(), KIND_NAME_CASE, NegDelta32, Page20, PageOffset12, Pointer32, Pointer64, RequestGOTAndTransformToPage20, RequestGOTAndTransformToPageOffset12, Sub16, Sub32, Sub6, Sub64, Sub8, and SubUleb128.
Referenced by applyFixup().
Definition at line 567 of file loongarch.h.
References G, and NullPointerContent.
Referenced by createAnonymousPointer().
Definition at line 582 of file loongarch.h.
References G, LA32StubContent, LA64StubContent, and StubEntrySize.
Referenced by createAnonymousPointerJumpStub().
Definition at line 30 of file loongarch.cpp.
Referenced by getStubBlockContent().
Definition at line 24 of file loongarch.cpp.
Referenced by getStubBlockContent().
loongarch null pointer content.
Definition at line 21 of file loongarch.cpp.
Referenced by getGOTEntryBlockContent().
|
constexpr |
loongarch stub content.
Contains the instruction sequence for an indirect jump via an in-memory pointer: pcalau12i $t8, page20(ptr) ld.[w/d] $t8, pageoff12(ptr) jr $t8
Definition at line 579 of file loongarch.h.
Referenced by createAnonymousPointerJumpStub(), and getStubBlockContent().