1 | //===-- MipsMCAsmInfo.h - Mips 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 MipsMCAsmInfo class. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCASMINFO_H |
14 | #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCASMINFO_H |
15 | |
16 | #include "llvm/MC/MCAsmInfoCOFF.h" |
17 | #include "llvm/MC/MCAsmInfoELF.h" |
18 | #include "llvm/MC/MCFixup.h" |
19 | |
20 | namespace llvm { |
21 | class Triple; |
22 | |
23 | class MipsELFMCAsmInfo : public MCAsmInfoELF { |
24 | void anchor() override; |
25 | |
26 | public: |
27 | explicit MipsELFMCAsmInfo(const Triple &TheTriple, |
28 | const MCTargetOptions &Options); |
29 | void printSpecifierExpr(raw_ostream &OS, |
30 | const MCSpecifierExpr &Expr) const override; |
31 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &Expr, MCValue &Res, |
32 | const MCAssembler *Asm) const override; |
33 | }; |
34 | |
35 | class MipsCOFFMCAsmInfo : public MCAsmInfoGNUCOFF { |
36 | void anchor() override; |
37 | |
38 | public: |
39 | explicit MipsCOFFMCAsmInfo(); |
40 | void printSpecifierExpr(raw_ostream &OS, |
41 | const MCSpecifierExpr &Expr) const override; |
42 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &Expr, MCValue &Res, |
43 | const MCAssembler *Asm) const override; |
44 | }; |
45 | |
46 | namespace Mips { |
47 | using Specifier = uint16_t; |
48 | enum { |
49 | S_None, |
50 | S_CALL_HI16 = FirstTargetFixupKind, |
51 | S_CALL_LO16, |
52 | S_DTPREL, |
53 | S_DTPREL_HI, |
54 | S_DTPREL_LO, |
55 | S_GOT, |
56 | S_GOTTPREL, |
57 | S_GOT_CALL, |
58 | S_GOT_DISP, |
59 | S_GOT_HI16, |
60 | S_GOT_LO16, |
61 | S_GOT_OFST, |
62 | S_GOT_PAGE, |
63 | S_GPREL, |
64 | S_HI, |
65 | S_HIGHER, |
66 | S_HIGHEST, |
67 | S_LO, |
68 | S_NEG, |
69 | S_PCREL_HI16, |
70 | S_PCREL_LO16, |
71 | S_TLSGD, |
72 | S_TLSLDM, |
73 | S_TPREL_HI, |
74 | S_TPREL_LO, |
75 | S_Special, |
76 | }; |
77 | |
78 | bool isGpOff(const MCSpecifierExpr &E); |
79 | const MCSpecifierExpr *createGpOff(const MCExpr *Expr, Specifier S, |
80 | MCContext &Ctx); |
81 | } |
82 | |
83 | } // namespace llvm |
84 | |
85 | #endif |
86 | |