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 char NullPointerContent[8] = {0x00, 0x00, 0x00, 0x00, 22 0x00, 0x00, 0x00, 0x00}; 23 24 const char PointerJumpStubContent[12] = { 25 0x10, 0x00, 0x00, (char)0x90u, // ADRP x16, <imm>@page21 26 0x10, 0x02, 0x40, (char)0xf9u, // LDR x16, [x16, <imm>@pageoff12] 27 0x00, 0x02, 0x1f, (char)0xd6u // BR x16 28 }; 29 30 const char *getEdgeKindName(Edge::Kind R) { 31 switch (R) { 32 case Pointer64: 33 return "Pointer64"; 34 case Pointer32: 35 return "Pointer32"; 36 case Delta64: 37 return "Delta64"; 38 case Delta32: 39 return "Delta32"; 40 case NegDelta64: 41 return "NegDelta64"; 42 case NegDelta32: 43 return "NegDelta32"; 44 case Branch26PCRel: 45 return "Branch26PCRel"; 46 case MoveWide16: 47 return "MoveWide16"; 48 case LDRLiteral19: 49 return "LDRLiteral19"; 50 case TestAndBranch14PCRel: 51 return "TestAndBranch14PCRel"; 52 case CondBranch19PCRel: 53 return "CondBranch19PCRel"; 54 case ADRLiteral21: 55 return "ADRLiteral21"; 56 case Page21: 57 return "Page21"; 58 case PageOffset12: 59 return "PageOffset12"; 60 case RequestGOTAndTransformToPage21: 61 return "RequestGOTAndTransformToPage21"; 62 case RequestGOTAndTransformToPageOffset12: 63 return "RequestGOTAndTransformToPageOffset12"; 64 case RequestGOTAndTransformToDelta32: 65 return "RequestGOTAndTransformToDelta32"; 66 case RequestTLVPAndTransformToPage21: 67 return "RequestTLVPAndTransformToPage21"; 68 case RequestTLVPAndTransformToPageOffset12: 69 return "RequestTLVPAndTransformToPageOffset12"; 70 case RequestTLSDescEntryAndTransformToPage21: 71 return "RequestTLSDescEntryAndTransformToPage21"; 72 case RequestTLSDescEntryAndTransformToPageOffset12: 73 return "RequestTLSDescEntryAndTransformToPageOffset12"; 74 default: 75 return getGenericEdgeKindName(static_cast<Edge::Kind>(R)); 76 } 77 } 78 79 } // namespace aarch64 80 } // namespace jitlink 81 } // namespace llvm 82