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