xref: /llvm-project/llvm/lib/ExecutionEngine/JITLink/riscv.cpp (revision dc18c5fa97e187475980f05acf12de5d9e3e941a)
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_ADD64:
42     return "R_RISCV_ADD64";
43   case R_RISCV_ADD32:
44     return "R_RISCV_ADD32";
45   case R_RISCV_ADD16:
46     return "R_RISCV_ADD16";
47   case R_RISCV_ADD8:
48     return "R_RISCV_ADD8";
49   case R_RISCV_SUB64:
50     return "R_RISCV_SUB64";
51   case R_RISCV_SUB32:
52     return "R_RISCV_SUB32";
53   case R_RISCV_SUB16:
54     return "R_RISCV_SUB16";
55   case R_RISCV_SUB8:
56     return "R_RISCV_SUB8";
57   }
58   return getGenericEdgeKindName(K);
59 }
60 } // namespace riscv
61 } // namespace jitlink
62 } // namespace llvm
63