Skip to content

Commit c7c70f2

Browse files
author
luxufan
committed
[JITLink] Add riscv.cpp
1 parent d9a6399 commit c7c70f2

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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

0 commit comments

Comments
 (0)