1 | //===-- ARMMCAsmInfo.h - ARM asm properties --------------------*- 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 ARMMCAsmInfo class. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCASMINFO_H |
14 | #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCASMINFO_H |
15 | |
16 | #include "llvm/MC/MCAsmInfoCOFF.h" |
17 | #include "llvm/MC/MCAsmInfoDarwin.h" |
18 | #include "llvm/MC/MCAsmInfoELF.h" |
19 | #include "llvm/MC/MCExpr.h" |
20 | |
21 | namespace llvm { |
22 | class Triple; |
23 | |
24 | namespace ARM { |
25 | void printSpecifierExpr(const MCAsmInfo &MAI, raw_ostream &OS, |
26 | const MCSpecifierExpr &Expr); |
27 | } |
28 | |
29 | class ARMMCAsmInfoDarwin : public MCAsmInfoDarwin { |
30 | virtual void anchor(); |
31 | |
32 | public: |
33 | explicit ARMMCAsmInfoDarwin(const Triple &TheTriple); |
34 | void printSpecifierExpr(raw_ostream &OS, |
35 | const MCSpecifierExpr &Expr) const override { |
36 | ARM::printSpecifierExpr(MAI: *this, OS, Expr); |
37 | } |
38 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &, |
39 | const MCAssembler *) const override { |
40 | return false; |
41 | } |
42 | }; |
43 | |
44 | class ARMELFMCAsmInfo : public MCAsmInfoELF { |
45 | void anchor() override; |
46 | |
47 | public: |
48 | explicit ARMELFMCAsmInfo(const Triple &TT); |
49 | |
50 | void setUseIntegratedAssembler(bool Value) override; |
51 | void printSpecifierExpr(raw_ostream &OS, |
52 | const MCSpecifierExpr &Expr) const override { |
53 | ARM::printSpecifierExpr(MAI: *this, OS, Expr); |
54 | } |
55 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &, |
56 | const MCAssembler *) const override { |
57 | return false; |
58 | } |
59 | }; |
60 | |
61 | class ARMCOFFMCAsmInfoMicrosoft : public MCAsmInfoMicrosoft { |
62 | void anchor() override; |
63 | |
64 | public: |
65 | explicit ARMCOFFMCAsmInfoMicrosoft(); |
66 | void printSpecifierExpr(raw_ostream &OS, |
67 | const MCSpecifierExpr &Expr) const override { |
68 | ARM::printSpecifierExpr(MAI: *this, OS, Expr); |
69 | } |
70 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &, |
71 | const MCAssembler *) const override { |
72 | return false; |
73 | } |
74 | }; |
75 | |
76 | class ARMCOFFMCAsmInfoGNU : public MCAsmInfoGNUCOFF { |
77 | void anchor() override; |
78 | |
79 | public: |
80 | explicit ARMCOFFMCAsmInfoGNU(); |
81 | void printSpecifierExpr(raw_ostream &OS, |
82 | const MCSpecifierExpr &Expr) const override { |
83 | ARM::printSpecifierExpr(MAI: *this, OS, Expr); |
84 | } |
85 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &, |
86 | const MCAssembler *) const override { |
87 | return false; |
88 | } |
89 | }; |
90 | |
91 | namespace ARM { |
92 | using Specifier = uint16_t; |
93 | enum { |
94 | S_None, |
95 | S_COFF_SECREL, |
96 | |
97 | S_HI16 = |
98 | MCSymbolRefExpr::FirstTargetSpecifier, // The R_ARM_MOVT_ABS relocation |
99 | // (:upper16: in the .s file) |
100 | S_LO16, // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file) |
101 | |
102 | S_HI_8_15, // The R_ARM_THM_ALU_ABS_G3 relocation (:upper8_15: in |
103 | // the .s file) |
104 | S_HI_0_7, // The R_ARM_THM_ALU_ABS_G2_NC relocation (:upper0_8: in the |
105 | // .s file) |
106 | S_LO_8_15, // The R_ARM_THM_ALU_ABS_G1_NC relocation (:lower8_15: in |
107 | // the .s file) |
108 | S_LO_0_7, // The R_ARM_THM_ALU_ABS_G0_NC relocation (:lower0_7: in the |
109 | // .s file) |
110 | |
111 | S_ARM_NONE, |
112 | S_FUNCDESC, |
113 | S_GOT, |
114 | S_GOTFUNCDESC, |
115 | S_GOTOFF, |
116 | S_GOTOFFFUNCDESC, |
117 | S_GOTTPOFF, |
118 | S_GOTTPOFF_FDPIC, |
119 | S_GOT_PREL, |
120 | S_PLT, |
121 | S_PREL31, |
122 | S_SBREL, |
123 | S_TARGET1, |
124 | S_TARGET2, |
125 | S_TLSCALL, |
126 | S_TLSDESC, |
127 | S_TLSDESCSEQ, |
128 | S_TLSGD, |
129 | S_TLSGD_FDPIC, |
130 | S_TLSLDM, |
131 | S_TLSLDM_FDPIC, |
132 | S_TLSLDO, |
133 | S_TPOFF, |
134 | }; |
135 | |
136 | const MCSpecifierExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx); |
137 | const MCSpecifierExpr *createLower16(const MCExpr *Expr, MCContext &Ctx); |
138 | const MCSpecifierExpr *createUpper8_15(const MCExpr *Expr, MCContext &Ctx); |
139 | const MCSpecifierExpr *createUpper0_7(const MCExpr *Expr, MCContext &Ctx); |
140 | const MCSpecifierExpr *createLower8_15(const MCExpr *Expr, MCContext &Ctx); |
141 | const MCSpecifierExpr *createLower0_7(const MCExpr *Expr, MCContext &Ctx); |
142 | } |
143 | |
144 | } // namespace llvm |
145 | |
146 | #endif |
147 | |