13#ifndef LLVM_EXECUTIONENGINE_JITLINK_AARCH32
14#define LLVM_EXECUTIONENGINE_JITLINK_AARCH32
167 assert(isUInt<16>(
Hi) &&
"Overflow in first half-word");
168 assert(isUInt<16>(
Lo) &&
"Overflow in second half-word");
217 static constexpr uint32_t Unconditional = 0xe0000000;
298 assert(Kind ==
None &&
"Not associated with a relocation class");
310 const ArmConfig &ArmCfg);
326 assert(Kind ==
None &&
"Not associated with a relocation class");
352 return "__llvm_jitlink_aarch32_STUBS_prev7";
361 struct StubMapEntry {
363 Symbol *ArmEntry =
nullptr;
364 Symbol *ThumbEntry =
nullptr;
367 std::pair<StubMapEntry *, bool> getStubMapSlot(
StringRef Name) {
368 auto &&[Stubs, NewStub] = StubMap.try_emplace(
Name);
369 return std::make_pair(&Stubs->second, NewStub);
372 Symbol *getOrCreateSlotEntrypoint(LinkGraph &
G, StubMapEntry &Slot,
376 Section *StubsSection =
nullptr;
386 return "__llvm_jitlink_aarch32_STUBS_v7";
394 using StubMapEntry = std::tuple<Symbol *, Symbol *>;
397 StubMapEntry &Stubs = StubMap.try_emplace(
Name).first->second;
399 return std::get<1>(Stubs);
400 return std::get<0>(Stubs);
404 Section *StubsSection =
nullptr;
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
static StringRef getSectionName()
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.
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.
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.
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.
Error applyFixupData(LinkGraph &G, Block &B, const Edge &E)
Helper function to apply the fixup for Data-class relocations.
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.
const char * getCPUArchName(ARMBuildAttrs::CPUArch K)
Human-readable name for a given CPU architecture kind.
Error applyFixupArm(LinkGraph &G, Block &B, const Edge &E)
Helper function to apply the fixup for Arm-class relocations.
const char * getEdgeKindName(Edge::Kind K)
Get a human-readable name for the given AArch32 edge kind.
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.
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.
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 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)