1 //===----- x86_64.cpp - Generic JITLink x86-64 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 x86-64 objects.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/ExecutionEngine/JITLink/x86_64.h"
14
15 #define DEBUG_TYPE "jitlink"
16
17 namespace llvm {
18 namespace jitlink {
19 namespace x86_64 {
20
getEdgeKindName(Edge::Kind K)21 const char *getEdgeKindName(Edge::Kind K) {
22 switch (K) {
23 case Pointer64:
24 return "Pointer64";
25 case Pointer32:
26 return "Pointer32";
27 case Delta64:
28 return "Delta64";
29 case Delta32:
30 return "Delta32";
31 case NegDelta64:
32 return "NegDelta64";
33 case NegDelta32:
34 return "NegDelta32";
35 case BranchPCRel32:
36 return "BranchPCRel32";
37 case BranchPCRel32ToPtrJumpStub:
38 return "BranchPCRel32ToPtrJumpStub";
39 case BranchPCRel32ToPtrJumpStubRelaxable:
40 return "BranchPCRel32ToPtrJumpStubRelaxable";
41 case RequestGOTAndTransformToDelta32:
42 return "RequestGOTAndTransformToDelta32";
43 case PCRel32GOTLoadRelaxable:
44 return "PCRel32GOTLoadRelaxable";
45 case RequestGOTAndTransformToPCRel32GOTLoadRelaxable:
46 return "RequestGOTAndTransformToPCRel32GOTLoadRelaxable";
47 case PCRel32TLVPLoadRelaxable:
48 return "PCRel32TLVPLoadRelaxable";
49 case RequestTLVPAndTransformToPCRel32TLVPLoadRelaxable:
50 return "RequestTLVPAndTransformToPCRel32TLVPLoadRelaxable";
51 default:
52 return getGenericEdgeKindName(static_cast<Edge::Kind>(K));
53 }
54 }
55
56 const char NullPointerContent[PointerSize] = {0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00};
58
59 const char PointerJumpStubContent[6] = {
60 static_cast<char>(0xFFu), 0x25, 0x00, 0x00, 0x00, 0x00};
61
62 } // end namespace x86_64
63 } // end namespace jitlink
64 } // end namespace llvm
65