xref: /freebsd/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/riscv.cpp (revision 5e801ac66d24704442eba426ed13c3effb8a34e7)
1 //===------ riscv.cpp - Generic JITLink riscv 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 riscv objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/ExecutionEngine/JITLink/riscv.h"
14 
15 #define DEBUG_TYPE "jitlink"
16 
17 namespace llvm {
18 namespace jitlink {
19 namespace riscv {
20 
21 const char *getEdgeKindName(Edge::Kind K) {
22   switch (K) {
23   case R_RISCV_32:
24     return "R_RISCV_32";
25   case R_RISCV_64:
26     return "R_RISCV_64";
27   case R_RISCV_HI20:
28     return "R_RISCV_HI20";
29   case R_RISCV_LO12_I:
30     return "R_RISCV_LO12_I";
31   case R_RISCV_PCREL_HI20:
32     return "R_RISCV_PCREL_HI20";
33   case R_RISCV_PCREL_LO12_I:
34     return "R_RISCV_PCREL_LO12_I";
35   case R_RISCV_PCREL_LO12_S:
36     return "R_RISCV_PCREL_LO12_S";
37   case R_RISCV_CALL:
38     return "R_RISCV_CALL";
39   }
40   return getGenericEdgeKindName(K);
41 }
42 } // namespace riscv
43 } // namespace jitlink
44 } // namespace llvm
45