13#ifndef LLVM_EXECUTIONENGINE_JITLINK_AARCH32
14#define LLVM_EXECUTIONENGINE_JITLINK_AARCH32
168 assert(isUInt<16>(
Hi) &&
"Overflow in first half-word");
169 assert(isUInt<16>(
Lo) &&
"Overflow in second half-word");
218 static constexpr uint32_t Unconditional = 0xe0000000;
279 Edge::OffsetT
Offset, Edge::Kind Kind);
285 const ArmConfig &ArmCfg);
290 Edge::OffsetT
Offset, Edge::Kind Kind,
301 assert(Kind ==
None &&
"Not associated with a relocation class");
313 const ArmConfig &ArmCfg);
318 Edge::Kind Kind =
E.getKind();
329 assert(Kind ==
None &&
"Not associated with a relocation class");
355 return "__llvm_jitlink_aarch32_STUBS_prev7";
364 struct StubMapEntry {
366 Symbol *ArmEntry =
nullptr;
367 Symbol *ThumbEntry =
nullptr;
370 std::pair<StubMapEntry *, bool> getStubMapSlot(
StringRef Name) {
371 auto &&[Stubs, NewStub] = StubMap.try_emplace(
Name);
372 return std::make_pair(&Stubs->second, NewStub);
375 Symbol *getOrCreateSlotEntrypoint(LinkGraph &
G, StubMapEntry &Slot,
379 Section *StubsSection =
nullptr;
389 return "__llvm_jitlink_aarch32_STUBS_v7";
397 using StubMapEntry = std::tuple<Symbol *, Symbol *>;
400 StubMapEntry &Stubs = StubMap[
Name];
402 return std::get<1>(Stubs);
403 return std::get<0>(Stubs);
407 Section *StubsSection =
nullptr;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
support::ulittle32_t & Wd
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
An Addressable with content and edges.
Represents fixups and constraints in the LinkGraph.
Represents an object file section.
A CRTP base for tables that are built on demand, e.g.
Populate a Global Offset Table from edges that request it.
LLVM_ABI bool visitEdge(LinkGraph &G, Block *B, Edge &E)
static StringRef getSectionName()
LLVM_ABI Symbol & createEntry(LinkGraph &G, Symbol &Target)
Stubs builder emits non-position-independent Arm stubs for pre-v7 CPUs.
static StringRef getSectionName()
Name of the object file section that will contain all our stubs.
LLVM_ABI bool visitEdge(LinkGraph &G, Block *B, Edge &E)
Implements link-graph traversal via visitExistingEdges()
StubsManager_prev7()=default
Stubs builder for v7 emits non-position-independent Arm and Thumb stubs.
static StringRef getSectionName()
Name of the object file section that will contain all our stubs.
LLVM_ABI bool visitEdge(LinkGraph &G, Block *B, Edge &E)
Implements link-graph traversal via visitExistingEdges().
StubsManager_v7()=default
EdgeKind_aarch32
JITLink-internal AArch32 fixup kinds.
@ Data_RequestGOTAndTransformToDelta32
Create GOT entry and store offset.
@ Arm_MovtAbs
Write immediate value to the top halfword of the destination register.
@ Data_PRel31
Relative 31-bit value relocation that preserves the most-significant bit.
@ Data_Pointer32
Absolute 32-bit value relocation.
@ FirstThumbRelocation
Relocations of class Thumb16 and Thumb32 (covers Thumb instruction subset)
@ Arm_MovwAbsNC
Write immediate value to the lower halfword of the destination register.
@ Arm_Call
Write immediate value for unconditional PC-relative branch with link.
@ Thumb_MovtPrel
Write PC-relative immediate value to the top halfword of the destination register.
@ FirstDataRelocation
Relocations of class Data respect target endianness (unless otherwise specified)
@ Thumb_Jump24
Write immediate value for PC-relative branch without link.
@ Arm_Jump24
Write immediate value for conditional PC-relative branch without link.
@ Thumb_MovwAbsNC
Write immediate value to the lower halfword of the destination register.
@ FirstArmRelocation
Relocations of class Arm (covers fixed-width 4-byte instruction subset)
@ Data_Delta32
Relative 32-bit value relocation.
@ Thumb_Call
Write immediate value for unconditional PC-relative branch with link.
@ Thumb_MovtAbs
Write immediate value to the top halfword of the destination register.
@ Thumb_MovwPrelNC
Write PC-relative immediate value to the lower halfword of the destination register.
LLVM_ABI Error applyFixupThumb(LinkGraph &G, Block &B, const Edge &E, const ArmConfig &ArmCfg)
Helper function to apply the fixup for Thumb-class relocations.
Error applyFixup(LinkGraph &G, Block &B, const Edge &E, const ArmConfig &ArmCfg)
Apply fixup expression for edge to block content.
LLVM_ABI Error applyFixupData(LinkGraph &G, Block &B, const Edge &E)
Helper function to apply the fixup for Data-class relocations.
LLVM_ABI Expected< int64_t > readAddendData(LinkGraph &G, Block &B, Edge::OffsetT Offset, Edge::Kind Kind)
Helper function to read the initial addend for Data-class relocations.
ArmConfig getArmConfigForCPUArch(ARMBuildAttrs::CPUArch CPUArch)
Obtain the sub-arch configuration for a given Arm CPU model.
LLVM_ABI const char * getCPUArchName(ARMBuildAttrs::CPUArch K)
Human-readable name for a given CPU architecture kind.
LLVM_ABI Error applyFixupArm(LinkGraph &G, Block &B, const Edge &E)
Helper function to apply the fixup for Arm-class relocations.
LLVM_ABI const char * getEdgeKindName(Edge::Kind K)
Get a human-readable name for the given AArch32 edge kind.
LLVM_ABI bool hasTargetFlags(Symbol &Sym, TargetFlagsType Flags)
Check whether the given target flags are set for this Symbol.
StubsFlavor
AArch32 uses stubs for a number of purposes, like branch range extension or interworking between Arm ...
Expected< int64_t > readAddend(LinkGraph &G, Block &B, Edge::OffsetT Offset, Edge::Kind Kind, const ArmConfig &ArmCfg)
Read the initial addend for a REL-type relocation.
TargetFlags_aarch32
Flags enum for AArch32-specific symbol properties.
LLVM_ABI Expected< int64_t > readAddendThumb(LinkGraph &G, Block &B, Edge::OffsetT Offset, Edge::Kind Kind, const ArmConfig &ArmCfg)
Helper function to read the initial addend for Thumb-class relocations.
LLVM_ABI Expected< int64_t > readAddendArm(LinkGraph &G, Block &B, Edge::OffsetT Offset, Edge::Kind Kind)
Helper function to read the initial addend for Arm-class relocations.
uint8_t TargetFlagsType
Holds target-specific properties for a symbol.
This is an optimization pass for GlobalISel generic memory operations.
JITLink sub-arch configuration for Arm CPU models.
static constexpr uint32_t Opcode
static constexpr uint32_t ImmMask
static constexpr uint32_t OpcodeMask
static constexpr uint32_t RegMask
static constexpr uint32_t ImmMask
FixupInfo checks for Arm edge kinds work on 32-bit words.
bool(* checkOpcode)(uint32_t Wd)
FixupInfo base class is required for dynamic lookups.
static LLVM_ABI const FixupInfoBase * getDynFixupInfo(Edge::Kind K)
static constexpr HalfWords OpcodeMask
static constexpr HalfWords RegMask
static constexpr HalfWords ImmMask
FixupInfo check for Thumb32 edge kinds work on a pair of 16-bit halfwords.
bool(* checkOpcode)(uint16_t Hi, uint16_t Lo)
Collection of named constants per fixup kind.
Immutable pair of halfwords, Hi and Lo, with overflow check.
constexpr HalfWords(uint32_t Hi, uint32_t Lo)