LLVM 24.0.0git
llvm::jitlink::mips Namespace Reference

Classes

struct  PCRelEncoding

Enumerations

enum  EdgeKind_mips : Edge::Kind {
  Pointer32 = Edge::FirstRelocation , Pointer64 , PagePointer32 , PagePointer64 ,
  Delta32 , Delta64 , NegDelta32 , Abs16 ,
  Hi16 , Lo16 , Higher16 , Highest16 ,
  Jump26 , PC16 , PC32 , PC18S3 ,
  PC19S2 , PC21S2 , PC26S2 , PCHi16 ,
  PCLo16 , GPDispHi16 , GPDispLo16 , GPRel16 ,
  GPRel32 , GPRel64 , GOTOffset16 , GOTOffsetHi16 ,
  GOTOffsetLo16 , GOTPageOffset16 , DTPRelHi16 , DTPRelLo16 ,
  DTPRel32 , DTPRel64 , NegGPRelHi16 , NegGPRelLo16 ,
  RequestGOTAndTransformToOffset16 , RequestGOTPageAndTransformToOffset16 , RequestGOTAndTransformToOffsetHi16 , RequestGOTAndTransformToOffsetLo16 ,
  RequestTLSGDAndTransformToOffset16 , RequestTLSLDMAndTransformToOffset16
}
 MIPS fixup and table-request edge kinds. More...

Functions

LLVM_ABI const char * getEdgeKindName (Edge::Kind K)
LLVM_ABI bool isR6 (const LinkGraph &G)
 Returns true if G uses the MIPS release-6 ISA.
LLVM_ABI Edge::Kind getPointerEdgeKind (const LinkGraph &G)
 Returns Pointer32 or Pointer64, according to G's pointer ABI.
uint16_t getLo16 (uint64_t Value)
uint16_t getHi16 (uint64_t Value)
uint16_t getHigher16 (uint64_t Value)
uint16_t getHighest16 (uint64_t Value)
uint64_t getGOTPage (uint64_t Value)
PCRelEncoding getPCRelEncoding (Edge::Kind Kind)
bool needsGP (Edge::Kind K)
void writeMaskedInstruction32 (char *Fixup, uint32_t Mask, uint32_t Value, endianness Endianness)
void writeImmediate16 (char *Fixup, uint16_t Value, endianness Endianness)
void writeImmediate26 (char *Fixup, uint32_t Value, endianness Endianness)
Error applyFixup (LinkGraph &G, Block &B, const Edge &E, const Symbol *GPSymbol, const Symbol *TLSBaseSymbol)
 Apply fixup expression for edge to block content.
LLVM_ABI ArrayRef< char > getPointerBlockContent (const LinkGraph &G)
 Returns zero-filled pointer contents in the graph's pointer width.
LLVM_ABI Symbol & createAnonymousPointer (LinkGraph &G, Section &PointerSection, Symbol *InitialTarget=nullptr, Edge::AddendT InitialAddend=0)
 Creates an anonymous pointer, optionally initialized to InitialTarget.
LLVM_ABI Symbol & createAnonymousPointerJumpStub (LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
 Creates a stub that materializes PointerSymbol, loads its value into $t9, and jumps to $t9.

Variables

constexpr unsigned InstructionSize = sizeof(uint32_t)
constexpr unsigned GOTPageBits = 16
constexpr uint64_t GOTPageSize = UINT64_C(1) << GOTPageBits
constexpr uint64_t GOTPageMask = GOTPageSize - 1
constexpr uint64_t GOTPageBias = GOTPageSize / 2
constexpr unsigned JumpRegionBits = 28
constexpr uint64_t JumpRegionMask = ~maskTrailingOnes<uint64_t>(JumpRegionBits)
constexpr uint32_t InstructionImm16Mask = 0x0000ffffU
constexpr uint32_t InstructionImm26Mask = 0x03ffffffU
static const char NullPointerContent [sizeof(uint64_t)] = {}

Enumeration Type Documentation

◆ EdgeKind_mips

MIPS fixup and table-request edge kinds.

Enumerator
Pointer32 

Fixup <- Target + Addend, checked as an unsigned 32-bit pointer.

Pointer64 

Fixup <- Target + Addend : uint64.

PagePointer32 

Pointer containing the rounded 64-KiB page of Target + Addend.

PagePointer64 
Delta32 

Fixup <- Target - Fixup + Addend : int32.

Delta64 

Fixup <- Target - Fixup + Addend : int64.

NegDelta32 

Fixup <- Fixup - Target + Addend : int32 (used by .eh_frame).

Abs16 

Fixup[15:0] <- Target + Addend : int16.

Hi16 

Fixup[15:0] <- (Target + Addend + 0x8000) >> 16.

Lo16 

Fixup[15:0] <- Target + Addend.

Higher16 

Fixup[15:0] <- (Target + Addend + 0x80008000) >> 32.

Highest16 

Fixup[15:0] <- (Target + Addend + 0x800080008000) >> 48.

Jump26 

J/JAL target. The target must be aligned and in the same 256-MiB region.

PC16 

Fixup[15:0] <- (Target - Fixup + Addend) >> 2 : int16.

PC32 

Fixup <- Target - Fixup + Addend : int32.

PC18S3 

Release-6 compact branch immediate fields.

PC19S2 
PC21S2 
PC26S2 
PCHi16 

Paired PC-relative high and low halves.

PCLo16 
GPDispHi16 

_gp_disp high/low expressions. The O32 low half uses Fixup - 4 as P.

GPDispLo16 
GPRel16 

Fixup <- Target + Addend - _gp.

GPRel32 
GPRel64 
GOTOffset16 

Fixup <- address of GOT entry - _gp.

GOTOffsetHi16 
GOTOffsetLo16 
GOTPageOffset16 

Low offset complementary to a rounded 64-KiB GOT page entry.

DTPRelHi16 

Fixup <- Target + Addend - start-of-ORC-TLS-template.

DTPRelLo16 
DTPRel32 
DTPRel64 
NegGPRelHi16 

Compound N32/N64 neg(gp_rel(Target + Addend)) fixups.

NegGPRelLo16 
RequestGOTAndTransformToOffset16 

Create an exact-address GOT entry and rewrite to GOTOffset16.

RequestGOTPageAndTransformToOffset16 

Create a rounded 64-KiB page GOT entry and rewrite to GOTOffset16.

RequestGOTAndTransformToOffsetHi16 

Create an exact-address GOT entry and rewrite to its high/low GP offset.

RequestGOTAndTransformToOffsetLo16 
RequestTLSGDAndTransformToOffset16 

Create a two-word general/local-dynamic TLS descriptor.

RequestTLSLDMAndTransformToOffset16 

Definition at line 26 of file mips.h.

Function Documentation

◆ applyFixup()

Error llvm::jitlink::mips::applyFixup ( LinkGraph & G,
Block & B,
const Edge & E,
const Symbol * GPSymbol,
const Symbol * TLSBaseSymbol )
inline

◆ createAnonymousPointer()

Symbol & llvm::jitlink::mips::createAnonymousPointer ( LinkGraph & G,
Section & PointerSection,
Symbol * InitialTarget = nullptr,
Edge::AddendT InitialAddend = 0 )

Creates an anonymous pointer, optionally initialized to InitialTarget.

Definition at line 173 of file mips.cpp.

References B(), G, getPointerBlockContent(), and getPointerEdgeKind().

Referenced by llvm::jitlink::getAnonymousPointerCreator().

◆ createAnonymousPointerJumpStub()

Symbol & llvm::jitlink::mips::createAnonymousPointerJumpStub ( LinkGraph & G,
Section & StubSection,
Symbol & PointerSymbol )

Creates a stub that materializes PointerSymbol, loads its value into $t9, and jumps to $t9.

Release-6 graphs use the release-6 indirect-jump encoding.

Definition at line 183 of file mips.cpp.

References B(), llvm::enumerate(), F, G, InstructionSize, isR6(), and llvm::support::endian::write32().

Referenced by llvm::jitlink::getPointerJumpStubCreator().

◆ getEdgeKindName()

◆ getGOTPage()

uint64_t llvm::jitlink::mips::getGOTPage ( uint64_t Value)
inline

Definition at line 136 of file mips.h.

References GOTPageBias, GOTPageMask, and uint64_t.

Referenced by applyFixup().

◆ getHi16()

uint16_t llvm::jitlink::mips::getHi16 ( uint64_t Value)
inline

Definition at line 121 of file mips.h.

References GOTPageBias, and uint64_t.

Referenced by applyFixup().

◆ getHigher16()

uint16_t llvm::jitlink::mips::getHigher16 ( uint64_t Value)
inline

Definition at line 125 of file mips.h.

References GOTPageBias, and uint64_t.

Referenced by applyFixup().

◆ getHighest16()

uint16_t llvm::jitlink::mips::getHighest16 ( uint64_t Value)
inline

Definition at line 130 of file mips.h.

References GOTPageBias, and uint64_t.

Referenced by applyFixup().

◆ getLo16()

uint16_t llvm::jitlink::mips::getLo16 ( uint64_t Value)
inline

Definition at line 119 of file mips.h.

References uint64_t.

Referenced by applyFixup().

◆ getPCRelEncoding()

PCRelEncoding llvm::jitlink::mips::getPCRelEncoding ( Edge::Kind Kind)
inline

Definition at line 146 of file mips.h.

References llvm_unreachable, PC16, PC18S3, PC19S2, PC21S2, and PC26S2.

Referenced by applyFixup().

◆ getPointerBlockContent()

ArrayRef< char > llvm::jitlink::mips::getPointerBlockContent ( const LinkGraph & G)

Returns zero-filled pointer contents in the graph's pointer width.

Definition at line 169 of file mips.cpp.

References G, and NullPointerContent.

Referenced by createAnonymousPointer().

◆ getPointerEdgeKind()

Edge::Kind llvm::jitlink::mips::getPointerEdgeKind ( const LinkGraph & G)

Returns Pointer32 or Pointer64, according to G's pointer ABI.

Definition at line 165 of file mips.cpp.

References G, Pointer32, and Pointer64.

Referenced by createAnonymousPointer().

◆ isR6()

bool llvm::jitlink::mips::isR6 ( const LinkGraph & G)

Returns true if G uses the MIPS release-6 ISA.

Definition at line 159 of file mips.cpp.

References G, and llvm::is_contained().

Referenced by createAnonymousPointerJumpStub().

◆ needsGP()

bool llvm::jitlink::mips::needsGP ( Edge::Kind K)
inline

Definition at line 163 of file mips.h.

References GOTOffset16, GOTOffsetHi16, GOTOffsetLo16, GPDispHi16, GPDispLo16, GPRel16, GPRel32, GPRel64, NegGPRelHi16, and NegGPRelLo16.

Referenced by applyFixup().

◆ writeImmediate16()

void llvm::jitlink::mips::writeImmediate16 ( char * Fixup,
uint16_t Value,
endianness Endianness )
inline

Definition at line 191 of file mips.h.

References Fixup, InstructionImm16Mask, and writeMaskedInstruction32().

Referenced by applyFixup().

◆ writeImmediate26()

void llvm::jitlink::mips::writeImmediate26 ( char * Fixup,
uint32_t Value,
endianness Endianness )
inline

Definition at line 196 of file mips.h.

References Fixup, InstructionImm26Mask, and writeMaskedInstruction32().

Referenced by applyFixup().

◆ writeMaskedInstruction32()

void llvm::jitlink::mips::writeMaskedInstruction32 ( char * Fixup,
uint32_t Mask,
uint32_t Value,
endianness Endianness )
inline

Variable Documentation

◆ GOTPageBias

uint64_t llvm::jitlink::mips::GOTPageBias = GOTPageSize / 2
constexpr

Definition at line 115 of file mips.h.

Referenced by getGOTPage(), getHi16(), getHigher16(), and getHighest16().

◆ GOTPageBits

unsigned llvm::jitlink::mips::GOTPageBits = 16
constexpr

Definition at line 112 of file mips.h.

◆ GOTPageMask

uint64_t llvm::jitlink::mips::GOTPageMask = GOTPageSize - 1
constexpr

Definition at line 114 of file mips.h.

Referenced by getGOTPage().

◆ GOTPageSize

uint64_t llvm::jitlink::mips::GOTPageSize = UINT64_C(1) << GOTPageBits
constexpr

Definition at line 113 of file mips.h.

◆ InstructionImm16Mask

uint32_t llvm::jitlink::mips::InstructionImm16Mask = 0x0000ffffU
constexpr

Definition at line 181 of file mips.h.

Referenced by writeImmediate16().

◆ InstructionImm26Mask

uint32_t llvm::jitlink::mips::InstructionImm26Mask = 0x03ffffffU
constexpr

Definition at line 182 of file mips.h.

Referenced by writeImmediate26().

◆ InstructionSize

unsigned llvm::jitlink::mips::InstructionSize = sizeof(uint32_t)
constexpr

Definition at line 111 of file mips.h.

Referenced by applyFixup(), and createAnonymousPointerJumpStub().

◆ JumpRegionBits

unsigned llvm::jitlink::mips::JumpRegionBits = 28
constexpr

Definition at line 116 of file mips.h.

◆ JumpRegionMask

uint64_t llvm::jitlink::mips::JumpRegionMask = ~maskTrailingOnes<uint64_t>(JumpRegionBits)
constexpr

Definition at line 117 of file mips.h.

Referenced by applyFixup().

◆ NullPointerContent

const char llvm::jitlink::mips::NullPointerContent[sizeof(uint64_t)] = {}
static

Definition at line 157 of file mips.cpp.

Referenced by getPointerBlockContent().