xref: /freebsd/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1 //===---- aarch64.cpp - Generic JITLink aarch64 edge kinds, utilities -----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Generic utilities for graphs representing aarch64 objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/ExecutionEngine/JITLink/aarch64.h"
14 
15 #define DEBUG_TYPE "jitlink"
16 
17 namespace llvm {
18 namespace jitlink {
19 namespace aarch64 {
20 
21 const uint8_t NullGOTEntryContent[8] = {0x00, 0x00, 0x00, 0x00,
22                                         0x00, 0x00, 0x00, 0x00};
23 
24 const uint8_t StubContent[8] = {
25     0x10, 0x00, 0x00, 0x58, // LDR x16, <literal>
26     0x00, 0x02, 0x1f, 0xd6  // BR  x16
27 };
28 
29 const char *getEdgeKindName(Edge::Kind R) {
30   switch (R) {
31   case Branch26:
32     return "Branch26";
33   case Pointer64:
34     return "Pointer64";
35   case Pointer64Anon:
36     return "Pointer64Anon";
37   case Page21:
38     return "Page21";
39   case PageOffset12:
40     return "PageOffset12";
41   case MoveWide16:
42     return "MoveWide16";
43   case GOTPage21:
44     return "GOTPage21";
45   case GOTPageOffset12:
46     return "GOTPageOffset12";
47   case TLVPage21:
48     return "TLVPage21";
49   case TLVPageOffset12:
50     return "TLVPageOffset12";
51   case TLSDescPage21:
52     return "TLSDescPage21";
53   case TLSDescPageOffset12:
54     return "TLSDescPageOffset12";
55   case Delta32ToGOT:
56     return "Delta32ToGOT";
57   case PairedAddend:
58     return "PairedAddend";
59   case LDRLiteral19:
60     return "LDRLiteral19";
61   case Delta32:
62     return "Delta32";
63   case Delta64:
64     return "Delta64";
65   case NegDelta32:
66     return "NegDelta32";
67   case NegDelta64:
68     return "NegDelta64";
69   default:
70     return getGenericEdgeKindName(static_cast<Edge::Kind>(R));
71   }
72 }
73 
74 } // namespace aarch64
75 } // namespace jitlink
76 } // namespace llvm
77