Path: blob/main/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/loongarch.cpp
35271 views
//===--- loongarch.cpp - Generic JITLink loongarch edge kinds, utilities --===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Generic utilities for graphs representing loongarch objects.9//10//===----------------------------------------------------------------------===//1112#include "llvm/ExecutionEngine/JITLink/loongarch.h"1314#define DEBUG_TYPE "jitlink"1516namespace llvm {17namespace jitlink {18namespace loongarch {1920const char NullPointerContent[8] = {0x00, 0x00, 0x00, 0x00,210x00, 0x00, 0x00, 0x00};2223const uint8_t LA64StubContent[StubEntrySize] = {240x14, 0x00, 0x00, 0x1a, // pcalau12i $t8, %page20(imm)250x94, 0x02, 0xc0, 0x28, // ld.d $t8, $t8, %pageoff12(imm)260x80, 0x02, 0x00, 0x4c // jr $t827};2829const uint8_t LA32StubContent[StubEntrySize] = {300x14, 0x00, 0x00, 0x1a, // pcalau12i $t8, %page20(imm)310x94, 0x02, 0x80, 0x28, // ld.w $t8, $t8, %pageoff12(imm)320x80, 0x02, 0x00, 0x4c // jr $t833};3435const char *getEdgeKindName(Edge::Kind K) {36#define KIND_NAME_CASE(K) \37case K: \38return #K;3940switch (K) {41KIND_NAME_CASE(Pointer64)42KIND_NAME_CASE(Pointer32)43KIND_NAME_CASE(Delta32)44KIND_NAME_CASE(NegDelta32)45KIND_NAME_CASE(Delta64)46KIND_NAME_CASE(Branch26PCRel)47KIND_NAME_CASE(Page20)48KIND_NAME_CASE(PageOffset12)49KIND_NAME_CASE(RequestGOTAndTransformToPage20)50KIND_NAME_CASE(RequestGOTAndTransformToPageOffset12)51default:52return getGenericEdgeKindName(K);53}54#undef KIND_NAME_CASE55}5657} // namespace loongarch58} // namespace jitlink59} // namespace llvm606162