13#ifndef LLVM_EXECUTIONENGINE_JITLINK_HEXAGON_H
14#define LLVM_EXECUTIONENGINE_JITLINK_HEXAGON_H
141 for (
size_t Bit = 0; Bit != 32; ++Bit) {
143 uint32_t MaskBit = (Mask >> Bit) & 1;
145 Result |= (ValBit << Bit);
160 {0x38000000, 0x0000201f}, {0x39000000, 0x0000201f},
161 {0x3e000000, 0x00001f80}, {0x3f000000, 0x00001f80},
162 {0x40000000, 0x000020f8}, {0x41000000, 0x000007e0},
163 {0x42000000, 0x000020f8}, {0x43000000, 0x000007e0},
164 {0x44000000, 0x000020f8}, {0x45000000, 0x000007e0},
165 {0x46000000, 0x000020f8}, {0x47000000, 0x000007e0},
166 {0x6a000000, 0x00001f80}, {0x7c000000, 0x001f2000},
167 {0x9a000000, 0x00000f60}, {0x9b000000, 0x00000f60},
168 {0x9c000000, 0x00000f60}, {0x9d000000, 0x00000f60},
169 {0x9f000000, 0x001f0100}, {0xab000000, 0x0000003f},
170 {0xad000000, 0x0000003f}, {0xaf000000, 0x00030078},
171 {0xd7000000, 0x006020e0}, {0xd8000000, 0x006020e0},
172 {0xdb000000, 0x006020e0}, {0xdf000000, 0x006020e0}};
182 if ((0xff000000 & Insn) ==
I.CmpMask)
192 if ((0xff000000 & Insn) == 0xde000000)
194 if ((0xff000000 & Insn) == 0x3c000000)
202 if ((0xff000000 & Insn) == 0xa1000000)
211 if ((0xff000000 & Insn) == 0x48000000)
213 if ((0xff000000 & Insn) == 0x49000000)
215 if ((0xff000000 & Insn) == 0x78000000)
217 if ((0xff000000 & Insn) == 0xb0000000)
219 if ((0xff802000 & Insn) == 0x74000000)
221 if ((0xff802000 & Insn) == 0x74002000)
223 if ((0xff802000 & Insn) == 0x74800000)
225 if ((0xff802000 & Insn) == 0x74802000)
228 if ((0xff000000 & Insn) ==
I.CmpMask)
239 char *BlockWorkingMem =
B.getAlreadyMutableContent().data();
240 char *FixupPtr = BlockWorkingMem +
E.getOffset();
241 auto FixupAddress =
B.getAddress() +
E.getOffset();
243 int64_t TargetAddr =
E.getTarget().getAddress().getValue() +
E.getAddend();
244 int64_t PCRelVal =
E.getTarget().getAddress().getValue() -
245 FixupAddress.getValue() +
E.getAddend();
253 switch (
E.getKind()) {
331 return Mask.takeError();
339 return Mask.takeError();
347 return Mask.takeError();
363 return Mask.takeError();
375 return Mask.takeError();
382 "In graph " +
G.getName() +
", section " +
B.getSection().getName() +
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.
An Addressable with content and edges.
Represents fixups and constraints in the LinkGraph.
constexpr uint32_t applyMask(uint32_t Mask, uint32_t Data)
Spread data bits into instruction word according to mask.
LLVM_ABI const char * getEdgeKindName(Edge::Kind K)
Returns a string name for the given Hexagon edge kind.
Expected< uint32_t > findMaskR11(uint32_t Insn)
constexpr uint32_t PointerSize
Hexagon pointer size.
Expected< uint32_t > findMaskR16(uint32_t Insn)
Expected< uint32_t > findMaskR8(uint32_t Insn)
bool isDuplex(uint32_t Insn)
Error applyFixup(LinkGraph &G, Block &B, const Edge &E)
Apply fixup expression for edge to block content.
constexpr uint32_t InstParsePacketEnd
Expected< uint32_t > findMaskR6(uint32_t Insn)
EdgeKind_hexagon
Represents Hexagon fixup kinds.
@ Word6_PCREL_X
6-bit PC-relative extended.
@ B22_PCREL
22-bit PC-relative branch (shifted right by 2).
@ B15_PCREL_X
15-bit PC-relative branch, lower 6 bits via extender.
@ Word9_X
9-bit absolute extended (6 effective bits).
@ Word32_6_X
32-bit absolute, upper 26 bits via constant extender (shifted right by 6).
@ B13_PCREL_X
13-bit PC-relative branch, lower 6 bits via extender.
@ Word16_X
16-bit absolute extended (6 effective bits).
@ B7_PCREL_X
7-bit PC-relative branch, lower 6 bits via extender.
@ HI16
High 16 bits of absolute address.
@ B9_PCREL_X
9-bit PC-relative branch, lower 6 bits via extender.
@ PCRel32
32-bit PC-relative.
@ Word11_X
11-bit absolute extended (6 effective bits).
@ B7_PCREL
7-bit PC-relative branch (shifted right by 2).
@ B15_PCREL
15-bit PC-relative branch (shifted right by 2).
@ Word6_X
6-bit absolute extended.
@ B32_PCREL_X
32-bit PC-relative, upper 26 bits via constant extender (shifted by 6).
@ Pointer32
Full 32-bit absolute pointer.
@ Word10_X
10-bit absolute extended (6 effective bits).
@ B13_PCREL
13-bit PC-relative branch (shifted right by 2).
@ B9_PCREL
9-bit PC-relative branch (shifted right by 2).
@ Word12_X
12-bit absolute extended.
@ B22_PCREL_X
22-bit PC-relative branch, lower 6 bits via extender.
@ LO16
Low 16 bits of absolute address.
@ Word8_X
8-bit absolute extended.
constexpr InstructionMask R6Masks[]
Mask table for R_HEX_6_X relocations, indexed by instruction class.
LLVM_ABI Error makeTargetOutOfRangeError(const LinkGraph &G, const Block &B, const Edge &E)
Create an out of range error for the given edge in the given block.
void write32le(void *P, uint32_t V)
uint32_t read32le(const void *P)
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
static void or32le(void *P, int32_t V)
Instruction mask entry for R_HEX_6_X / R_HEX_16_X lookup.