riscv.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #include "llvm/ExecutionEngine/JITLink/riscv.h"
  13. #define DEBUG_TYPE "jitlink"
  14. namespace llvm {
  15. namespace jitlink {
  16. namespace riscv {
  17. const char *getEdgeKindName(Edge::Kind K) {
  18. switch (K) {
  19. case R_RISCV_32:
  20. return "R_RISCV_32";
  21. case R_RISCV_64:
  22. return "R_RISCV_64";
  23. case R_RISCV_BRANCH:
  24. return "R_RISCV_BRANCH";
  25. case R_RISCV_JAL:
  26. return "R_RISCV_JAL";
  27. case R_RISCV_CALL:
  28. return "R_RISCV_CALL";
  29. case R_RISCV_CALL_PLT:
  30. return "R_RISCV_CALL_PLT";
  31. case R_RISCV_GOT_HI20:
  32. return "R_RISCV_GOT_HI20";
  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_HI20:
  40. return "R_RISCV_HI20";
  41. case R_RISCV_LO12_I:
  42. return "R_RISCV_LO12_I";
  43. case R_RISCV_LO12_S:
  44. return "R_RISCV_LO12_S";
  45. case R_RISCV_ADD8:
  46. return "R_RISCV_ADD8";
  47. case R_RISCV_ADD16:
  48. return "R_RISCV_ADD16";
  49. case R_RISCV_ADD32:
  50. return "R_RISCV_ADD32";
  51. case R_RISCV_ADD64:
  52. return "R_RISCV_ADD64";
  53. case R_RISCV_SUB8:
  54. return "R_RISCV_SUB8";
  55. case R_RISCV_SUB16:
  56. return "R_RISCV_SUB16";
  57. case R_RISCV_SUB32:
  58. return "R_RISCV_SUB32";
  59. case R_RISCV_SUB64:
  60. return "R_RISCV_SUB64";
  61. case R_RISCV_RVC_BRANCH:
  62. return "R_RISCV_RVC_BRANCH";
  63. case R_RISCV_RVC_JUMP:
  64. return "R_RISCV_RVC_JUMP";
  65. case R_RISCV_SUB6:
  66. return "R_RISCV_SUB6";
  67. case R_RISCV_SET6:
  68. return "R_RISCV_SET6";
  69. case R_RISCV_SET8:
  70. return "R_RISCV_SET8";
  71. case R_RISCV_SET16:
  72. return "R_RISCV_SET16";
  73. case R_RISCV_SET32:
  74. return "R_RISCV_SET32";
  75. case R_RISCV_32_PCREL:
  76. return "R_RISCV_32_PCREL";
  77. }
  78. return getGenericEdgeKindName(K);
  79. }
  80. } // namespace riscv
  81. } // namespace jitlink
  82. } // namespace llvm