| 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/MCAsmInfoELF.h" |
| 17 | #include "llvm/MC/MCFixup.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | class Triple; |
| 21 | |
| 22 | class RISCVMCAsmInfo : public MCAsmInfoELF { |
| 23 | void anchor() override; |
| 24 | |
| 25 | public: |
| 26 | explicit RISCVMCAsmInfo(const Triple &TargetTriple); |
| 27 | |
| 28 | const MCExpr *getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, |
| 29 | MCStreamer &Streamer) const override; |
| 30 | void printSpecifierExpr(raw_ostream &OS, |
| 31 | const MCSpecifierExpr &Expr) const override; |
| 32 | }; |
| 33 | |
| 34 | namespace RISCV { |
| 35 | using Specifier = uint16_t; |
| 36 | // Specifiers mapping to relocation types below FirstTargetFixupKind are |
| 37 | // encoded literally, with these exceptions: |
| 38 | enum { |
| 39 | S_None, |
| 40 | // Specifiers mapping to distinct relocation types. |
| 41 | S_LO = FirstTargetFixupKind, |
| 42 | S_PCREL_LO, |
| 43 | S_TPREL_LO, |
| 44 | // Vendor-specific relocation types might conflict across vendors. |
| 45 | // Refer to them using Specifier constants. |
| 46 | S_QC_ABS20, |
| 47 | }; |
| 48 | |
| 49 | Specifier parseSpecifierName(StringRef name); |
| 50 | StringRef getSpecifierName(Specifier Kind); |
| 51 | } // namespace RISCV |
| 52 | |
| 53 | } // namespace llvm |
| 54 | |
| 55 | #endif |
| 56 | |