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