1349cc55cSDimitry Andric //===---- aarch64.cpp - Generic JITLink aarch64 edge kinds, utilities -----===// 2349cc55cSDimitry Andric // 3349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6349cc55cSDimitry Andric // 7349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 8349cc55cSDimitry Andric // 9349cc55cSDimitry Andric // Generic utilities for graphs representing aarch64 objects. 10349cc55cSDimitry Andric // 11349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 12349cc55cSDimitry Andric 13349cc55cSDimitry Andric #include "llvm/ExecutionEngine/JITLink/aarch64.h" 14349cc55cSDimitry Andric 15349cc55cSDimitry Andric #define DEBUG_TYPE "jitlink" 16349cc55cSDimitry Andric 17349cc55cSDimitry Andric namespace llvm { 18349cc55cSDimitry Andric namespace jitlink { 19349cc55cSDimitry Andric namespace aarch64 { 20349cc55cSDimitry Andric 21*81ad6265SDimitry Andric const uint8_t NullGOTEntryContent[8] = {0x00, 0x00, 0x00, 0x00, 22*81ad6265SDimitry Andric 0x00, 0x00, 0x00, 0x00}; 23*81ad6265SDimitry Andric 24*81ad6265SDimitry Andric const uint8_t StubContent[8] = { 25*81ad6265SDimitry Andric 0x10, 0x00, 0x00, 0x58, // LDR x16, <literal> 26*81ad6265SDimitry Andric 0x00, 0x02, 0x1f, 0xd6 // BR x16 27*81ad6265SDimitry Andric }; 28*81ad6265SDimitry Andric 29*81ad6265SDimitry Andric const char *getEdgeKindName(Edge::Kind R) { 30*81ad6265SDimitry Andric switch (R) { 31*81ad6265SDimitry Andric case Branch26: 32*81ad6265SDimitry Andric return "Branch26"; 33*81ad6265SDimitry Andric case Pointer64: 34*81ad6265SDimitry Andric return "Pointer64"; 35*81ad6265SDimitry Andric case Pointer64Anon: 36*81ad6265SDimitry Andric return "Pointer64Anon"; 37*81ad6265SDimitry Andric case Page21: 38*81ad6265SDimitry Andric return "Page21"; 39*81ad6265SDimitry Andric case PageOffset12: 40*81ad6265SDimitry Andric return "PageOffset12"; 41*81ad6265SDimitry Andric case MoveWide16: 42*81ad6265SDimitry Andric return "MoveWide16"; 43*81ad6265SDimitry Andric case GOTPage21: 44*81ad6265SDimitry Andric return "GOTPage21"; 45*81ad6265SDimitry Andric case GOTPageOffset12: 46*81ad6265SDimitry Andric return "GOTPageOffset12"; 47*81ad6265SDimitry Andric case TLVPage21: 48*81ad6265SDimitry Andric return "TLVPage21"; 49*81ad6265SDimitry Andric case TLVPageOffset12: 50*81ad6265SDimitry Andric return "TLVPageOffset12"; 51*81ad6265SDimitry Andric case PointerToGOT: 52*81ad6265SDimitry Andric return "PointerToGOT"; 53*81ad6265SDimitry Andric case PairedAddend: 54*81ad6265SDimitry Andric return "PairedAddend"; 55*81ad6265SDimitry Andric case LDRLiteral19: 56*81ad6265SDimitry Andric return "LDRLiteral19"; 57*81ad6265SDimitry Andric case Delta32: 58*81ad6265SDimitry Andric return "Delta32"; 59*81ad6265SDimitry Andric case Delta64: 60*81ad6265SDimitry Andric return "Delta64"; 61*81ad6265SDimitry Andric case NegDelta32: 62*81ad6265SDimitry Andric return "NegDelta32"; 63*81ad6265SDimitry Andric case NegDelta64: 64*81ad6265SDimitry Andric return "NegDelta64"; 65*81ad6265SDimitry Andric default: 66*81ad6265SDimitry Andric return getGenericEdgeKindName(static_cast<Edge::Kind>(R)); 67349cc55cSDimitry Andric } 68349cc55cSDimitry Andric } 69*81ad6265SDimitry Andric 70349cc55cSDimitry Andric } // namespace aarch64 71349cc55cSDimitry Andric } // namespace jitlink 72349cc55cSDimitry Andric } // namespace llvm 73