1//===-- RISCVMCAsmInfo.h - RISC-V Asm Info ---------------------*- C++ -*--===//
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// This file contains the declaration of the RISCVMCAsmInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVMCASMINFO_H
14#define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVMCASMINFO_H
15
16#include "llvm/MC/MCAsmInfoDarwin.h"
17#include "llvm/MC/MCAsmInfoELF.h"
18#include "llvm/MC/MCFixup.h"
19
20namespace llvm {
21class Triple;
22
23class RISCVMCAsmInfo : public MCAsmInfoELF {
24 void anchor() override;
25
26public:
27 explicit RISCVMCAsmInfo(const Triple &TargetTriple,
28 const MCTargetOptions &Options);
29
30 void printSpecifierExpr(raw_ostream &OS,
31 const MCSpecifierExpr &Expr) const override;
32};
33
34namespace RISCV {
35using Specifier = uint16_t;
36// Specifiers mapping to relocation types below FirstTargetFixupKind are
37// encoded literally, with these exceptions:
38enum {
39 S_None,
40 // Specifiers mapping to distinct relocation types.
41 S_LO = FirstTargetFixupKind,
42 S_PCREL_LO,
43 S_PCREL_HI,
44 S_TPREL_LO,
45 S_CALL_PLT,
46 S_GOT_HI,
47 // Vendor-specific relocation types might conflict across vendors.
48 // Refer to them using Specifier constants.
49 S_QC_ABS20,
50 S_QC_ACCESS,
51};
52
53Specifier parseSpecifierName(StringRef name);
54StringRef getSpecifierName(Specifier Kind);
55} // namespace RISCV
56
57class RISCVMCAsmInfoDarwin : public MCAsmInfoDarwin {
58public:
59 explicit RISCVMCAsmInfoDarwin(const MCTargetOptions &Options);
60 void printSpecifierExpr(raw_ostream &OS,
61 const MCSpecifierExpr &Expr) const override;
62};
63
64} // namespace llvm
65
66#endif
67