LLVM: include/llvm/ExecutionEngine/JITLink/aarch32.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_EXECUTIONENGINE_JITLINK_AARCH32

14#define LLVM_EXECUTIONENGINE_JITLINK_AARCH32

15

22

23namespace llvm {

26

27

29

30

32

33

34

35

36

38

39

41

42

44

45

47

48

50

52

53

54

55

57

58

59

60

61

63

64

65

66

68

69

71

72

74

76

77

78

79

81

82

83

84

85

87

88

89

90

92

93

95

96

98

99

100

102

103

104

106

108

109

111

113};

114

115

119

120

122

123

125

126

127

128

129

130

131

132

133

134

135

136

142

143

150

151

157 } else {

160 }

161 return ArmCfg;

162}

163

164

174

175

180

181

185

186

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204template <EdgeKind_aarch32 Kind> struct FixupInfo {};

205

210

214

222

228

232

236

242

250

256

260

264

268

272

273

276

277

279 Edge::OffsetT Offset, Edge::Kind Kind);

280

281

283 Edge::OffsetT Offset,

284 Edge::Kind Kind,

285 const ArmConfig &ArmCfg);

286

287

288

290 Edge::OffsetT Offset, Edge::Kind Kind,

294

297

300

301 assert(Kind == None && "Not associated with a relocation class");

302 return 0;

303}

304

305

307

308

310

311

313 const ArmConfig &ArmCfg);

314

315

318 Edge::Kind Kind = E.getKind();

319

322

325

328

329 assert(Kind == None && "Not associated with a relocation class");

331}

332

333

335public:

337

340

341private:

342 Section *GOTSection = nullptr;

343};

344

345

346

347

348

350public:

352

353

355 return "__llvm_jitlink_aarch32_STUBS_prev7";

356 }

357

358

360

361private:

362

363

364 struct StubMapEntry {

366 Symbol *ArmEntry = nullptr;

367 Symbol *ThumbEntry = nullptr;

368 };

369

370 std::pair<StubMapEntry *, bool> getStubMapSlot(StringRef Name) {

371 auto &&[Stubs, NewStub] = StubMap.try_emplace(Name);

372 return std::make_pair(&Stubs->second, NewStub);

373 }

374

375 Symbol *getOrCreateSlotEntrypoint(LinkGraph &G, StubMapEntry &Slot,

376 bool Thumb);

377

379 Section *StubsSection = nullptr;

380};

381

382

384public:

386

387

389 return "__llvm_jitlink_aarch32_STUBS_v7";

390 }

391

392

394

395private:

396

397 using StubMapEntry = std::tuple<Symbol *, Symbol *>;

398

400 StubMapEntry &Stubs = StubMap[Name];

401 if (Thumb)

402 return std::get<1>(Stubs);

403 return std::get<0>(Stubs);

404 }

405

407 Section *StubsSection = nullptr;

408};

409

410}

411}

412}

413

414#endif

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")

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.

Definition aarch32.h:334

LLVM_ABI bool visitEdge(LinkGraph &G, Block *B, Edge &E)

static StringRef getSectionName()

Definition aarch32.h:336

LLVM_ABI Symbol & createEntry(LinkGraph &G, Symbol &Target)

static StringRef getSectionName()

Name of the object file section that will contain all our stubs.

Definition aarch32.h:354

LLVM_ABI bool visitEdge(LinkGraph &G, Block *B, Edge &E)

Implements link-graph traversal via visitExistingEdges()

StubsManager_prev7()=default

static StringRef getSectionName()

Name of the object file section that will contain all our stubs.

Definition aarch32.h:388

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.

Definition aarch32.h:31

@ LastRelocation

Definition aarch32.h:112

@ Data_RequestGOTAndTransformToDelta32

Create GOT entry and store offset.

Definition aarch32.h:49

@ Arm_MovtAbs

Write immediate value to the top halfword of the destination register.

Definition aarch32.h:73

@ LastDataRelocation

Definition aarch32.h:51

@ Data_PRel31

Relative 31-bit value relocation that preserves the most-significant bit.

Definition aarch32.h:46

@ Data_Pointer32

Absolute 32-bit value relocation.

Definition aarch32.h:43

@ FirstThumbRelocation

Relocations of class Thumb16 and Thumb32 (covers Thumb instruction subset)

Definition aarch32.h:80

@ LastThumbRelocation

Definition aarch32.h:107

@ LastArmRelocation

Definition aarch32.h:75

@ Arm_MovwAbsNC

Write immediate value to the lower halfword of the destination register.

Definition aarch32.h:70

@ Arm_Call

Write immediate value for unconditional PC-relative branch with link.

Definition aarch32.h:62

@ Thumb_MovtPrel

Write PC-relative immediate value to the top halfword of the destination register.

Definition aarch32.h:105

@ FirstDataRelocation

Relocations of class Data respect target endianness (unless otherwise specified)

Definition aarch32.h:37

@ Thumb_Jump24

Write immediate value for PC-relative branch without link.

Definition aarch32.h:91

@ Arm_Jump24

Write immediate value for conditional PC-relative branch without link.

Definition aarch32.h:67

@ Thumb_MovwAbsNC

Write immediate value to the lower halfword of the destination register.

Definition aarch32.h:94

@ FirstArmRelocation

Relocations of class Arm (covers fixed-width 4-byte instruction subset)

Definition aarch32.h:56

@ Data_Delta32

Relative 32-bit value relocation.

Definition aarch32.h:40

@ Thumb_Call

Write immediate value for unconditional PC-relative branch with link.

Definition aarch32.h:86

@ None

No-op relocation.

Definition aarch32.h:110

@ Thumb_MovtAbs

Write immediate value to the top halfword of the destination register.

Definition aarch32.h:97

@ Thumb_MovwPrelNC

Write PC-relative immediate value to the lower halfword of the destination register.

Definition aarch32.h:101

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.

Definition aarch32.h:316

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.

Definition aarch32.h:152

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 ...

Definition aarch32.h:137

@ pre_v7

Definition aarch32.h:139

@ v7

Definition aarch32.h:140

@ Undefined

Definition aarch32.h:138

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.

Definition aarch32.h:289

TargetFlags_aarch32

Flags enum for AArch32-specific symbol properties.

Definition aarch32.h:116

@ ThumbSymbol

Definition aarch32.h:117

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.

constexpr bool isUInt(uint64_t x)

Checks if an unsigned integer fits into the given bit width.

JITLink sub-arch configuration for Arm CPU models.

Definition aarch32.h:144

bool Target1Rel

Definition aarch32.h:148

bool J1J2BranchEncoding

Definition aarch32.h:145

StubsFlavor Stubs

Definition aarch32.h:146

static constexpr uint32_t Opcode

Definition aarch32.h:207

static constexpr uint32_t ImmMask

Definition aarch32.h:208

static constexpr uint32_t OpcodeMask

Definition aarch32.h:224

static constexpr uint32_t RegMask

Definition aarch32.h:226

static constexpr uint32_t ImmMask

Definition aarch32.h:225

FixupInfo checks for Arm edge kinds work on 32-bit words.

Definition aarch32.h:182

bool(* checkOpcode)(uint32_t Wd)

Definition aarch32.h:183

FixupInfo base class is required for dynamic lookups.

Definition aarch32.h:176

virtual ~FixupInfoBase()=default

static LLVM_ABI const FixupInfoBase * getDynFixupInfo(Edge::Kind K)

static constexpr HalfWords OpcodeMask

Definition aarch32.h:252

static constexpr HalfWords RegMask

Definition aarch32.h:254

static constexpr HalfWords ImmMask

Definition aarch32.h:253

FixupInfo check for Thumb32 edge kinds work on a pair of 16-bit halfwords.

Definition aarch32.h:187

bool(* checkOpcode)(uint16_t Hi, uint16_t Lo)

Definition aarch32.h:188

static constexpr uint32_t Unconditional

Definition aarch32.h:218

static constexpr uint32_t BitBlx

Definition aarch32.h:220

static constexpr uint32_t CondMask

Definition aarch32.h:217

static constexpr uint32_t OpcodeMask

Definition aarch32.h:216

static constexpr uint32_t BitH

Definition aarch32.h:219

static constexpr uint32_t OpcodeMask

Definition aarch32.h:212

static constexpr uint32_t Opcode

Definition aarch32.h:230

static constexpr uint32_t Opcode

Definition aarch32.h:234

static constexpr HalfWords Opcode

Definition aarch32.h:244

static constexpr uint16_t LoBitNoBlx

Definition aarch32.h:248

static constexpr HalfWords ImmMask

Definition aarch32.h:246

static constexpr uint16_t LoBitH

Definition aarch32.h:247

static constexpr HalfWords OpcodeMask

Definition aarch32.h:245

static constexpr HalfWords OpcodeMask

Definition aarch32.h:239

static constexpr HalfWords Opcode

Definition aarch32.h:238

static constexpr HalfWords ImmMask

Definition aarch32.h:240

static constexpr HalfWords Opcode

Definition aarch32.h:258

static constexpr HalfWords Opcode

Definition aarch32.h:262

static constexpr HalfWords Opcode

Definition aarch32.h:266

static constexpr HalfWords Opcode

Definition aarch32.h:270

Collection of named constants per fixup kind.

Definition aarch32.h:204

Immutable pair of halfwords, Hi and Lo, with overflow check.

Definition aarch32.h:165

const uint16_t Hi

Definition aarch32.h:171

constexpr HalfWords()

Definition aarch32.h:166

constexpr HalfWords(uint32_t Hi, uint32_t Lo)

Definition aarch32.h:167

const uint16_t Lo

Definition aarch32.h:172