1 | //===-- LoongArchMCAsmInfo.h - LoongArch 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 LoongArchMCAsmInfo class. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHMCASMINFO_H |
14 | #define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHMCASMINFO_H |
15 | |
16 | #include "llvm/MC/MCAsmInfoELF.h" |
17 | #include "llvm/MC/MCExpr.h" |
18 | |
19 | namespace llvm { |
20 | class Triple; |
21 | class StringRef; |
22 | |
23 | class LoongArchMCExpr : public MCSpecifierExpr { |
24 | public: |
25 | using Specifier = uint16_t; |
26 | enum { VK_None }; |
27 | |
28 | private: |
29 | const bool RelaxHint; |
30 | |
31 | explicit LoongArchMCExpr(const MCExpr *Expr, Specifier S, bool Hint) |
32 | : MCSpecifierExpr(Expr, S), RelaxHint(Hint) {} |
33 | |
34 | public: |
35 | static const LoongArchMCExpr *create(const MCExpr *Expr, uint16_t S, |
36 | MCContext &Ctx, bool Hint = false); |
37 | |
38 | bool getRelaxHint() const { return RelaxHint; } |
39 | }; |
40 | |
41 | class LoongArchMCAsmInfo : public MCAsmInfoELF { |
42 | void anchor() override; |
43 | |
44 | public: |
45 | explicit LoongArchMCAsmInfo(const Triple &TargetTriple); |
46 | void printSpecifierExpr(raw_ostream &OS, |
47 | const MCSpecifierExpr &Expr) const override; |
48 | }; |
49 | |
50 | namespace LoongArch { |
51 | uint16_t parseSpecifier(StringRef name); |
52 | } // namespace LoongArch |
53 | |
54 | } // end namespace llvm |
55 | |
56 | #endif // LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHMCASMINFO_H |
57 | |