xref: /freebsd/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/riscv.cpp (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
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_BRANCH:
28     return "R_RISCV_BRANCH";
29   case R_RISCV_HI20:
30     return "R_RISCV_HI20";
31   case R_RISCV_LO12_I:
32     return "R_RISCV_LO12_I";
33   case R_RISCV_PCREL_HI20:
34     return "R_RISCV_PCREL_HI20";
35   case R_RISCV_PCREL_LO12_I:
36     return "R_RISCV_PCREL_LO12_I";
37   case R_RISCV_PCREL_LO12_S:
38     return "R_RISCV_PCREL_LO12_S";
39   case R_RISCV_CALL:
40     return "R_RISCV_CALL";
41   case R_RISCV_32_PCREL:
42     return "R_RISCV_32_PCREL";
43   case R_RISCV_ADD64:
44     return "R_RISCV_ADD64";
45   case R_RISCV_ADD32:
46     return "R_RISCV_ADD32";
47   case R_RISCV_ADD16:
48     return "R_RISCV_ADD16";
49   case R_RISCV_ADD8:
50     return "R_RISCV_ADD8";
51   case R_RISCV_SUB64:
52     return "R_RISCV_SUB64";
53   case R_RISCV_SUB32:
54     return "R_RISCV_SUB32";
55   case R_RISCV_SUB16:
56     return "R_RISCV_SUB16";
57   case R_RISCV_SUB8:
58     return "R_RISCV_SUB8";
59   case R_RISCV_SET6:
60     return "R_RISCV_SET6";
61   case R_RISCV_SET8:
62     return "R_RISCV_SET8";
63   case R_RISCV_SET16:
64     return "R_RISCV_SET16";
65   case R_RISCV_SET32:
66     return "R_RISCV_SET32";
67   }
68   return getGenericEdgeKindName(K);
69 }
70 } // namespace riscv
71 } // namespace jitlink
72 } // namespace llvm
73