LLVM 20.0.0git
ARMMCExpr.h
Go to the documentation of this file.
1//===-- ARMMCExpr.h - ARM specific MC expression classes --------*- 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#ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
10#define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
11
12#include "llvm/MC/MCExpr.h"
13
14namespace llvm {
15
16class ARMMCExpr : public MCTargetExpr {
17public:
20 VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the .s file)
21 VK_ARM_LO16, // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file)
22
23 VK_ARM_HI_8_15, // The R_ARM_THM_ALU_ABS_G3 relocation (:upper8_15: in
24 // the .s file)
25 VK_ARM_HI_0_7, // The R_ARM_THM_ALU_ABS_G2_NC relocation (:upper0_8: in the
26 // .s file)
27 VK_ARM_LO_8_15, // The R_ARM_THM_ALU_ABS_G1_NC relocation (:lower8_15: in
28 // the .s file)
29 VK_ARM_LO_0_7, // The R_ARM_THM_ALU_ABS_G0_NC relocation (:lower0_7: in the
30 // .s file)
31 };
32
33private:
34 const VariantKind Kind;
35 const MCExpr *Expr;
36
37 explicit ARMMCExpr(VariantKind Kind, const MCExpr *Expr)
38 : Kind(Kind), Expr(Expr) {}
39
40public:
41 /// @name Construction
42 /// @{
43
44 static const ARMMCExpr *create(VariantKind Kind, const MCExpr *Expr,
45 MCContext &Ctx);
46
47 static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
48 return create(VK_ARM_HI16, Expr, Ctx);
49 }
50
51 static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
52 return create(VK_ARM_LO16, Expr, Ctx);
53 }
54
55 static const ARMMCExpr *createUpper8_15(const MCExpr *Expr, MCContext &Ctx) {
56 return create(VK_ARM_HI_8_15, Expr, Ctx);
57 }
58
59 static const ARMMCExpr *createUpper0_7(const MCExpr *Expr, MCContext &Ctx) {
60 return create(VK_ARM_HI_0_7, Expr, Ctx);
61 }
62
63 static const ARMMCExpr *createLower8_15(const MCExpr *Expr, MCContext &Ctx) {
64 return create(VK_ARM_LO_8_15, Expr, Ctx);
65 }
66
67 static const ARMMCExpr *createLower0_7(const MCExpr *Expr, MCContext &Ctx) {
68 return create(VK_ARM_LO_0_7, Expr, Ctx);
69 }
70
71 /// @}
72 /// @name Accessors
73 /// @{
74
75 /// getOpcode - Get the kind of this expression.
76 VariantKind getKind() const { return Kind; }
77
78 /// getSubExpr - Get the child of this expression.
79 const MCExpr *getSubExpr() const { return Expr; }
80
81 /// @}
82
83 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
85 const MCFixup *Fixup) const override {
86 return false;
87 }
88 void visitUsedExpr(MCStreamer &Streamer) const override;
91 }
92
93 // There are no TLS ARMMCExprs at the moment.
94 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
95
96 static bool classof(const MCExpr *E) {
97 return E->getKind() == MCExpr::Target;
98 }
99};
100} // end namespace llvm
101
102#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
PowerPC TLS Dynamic Call Fixup
raw_pwrite_stream & OS
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: ARMMCExpr.h:76
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override
Definition: ARMMCExpr.h:84
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: ARMMCExpr.cpp:22
static const ARMMCExpr * createUpper8_15(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:55
static bool classof(const MCExpr *E)
Definition: ARMMCExpr.h:96
static const ARMMCExpr * createLower0_7(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:67
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: ARMMCExpr.h:94
static const ARMMCExpr * createUpper0_7(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:59
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: ARMMCExpr.h:79
static const ARMMCExpr * createLower16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:51
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: ARMMCExpr.cpp:53
static const ARMMCExpr * createUpper16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:47
static const ARMMCExpr * createLower8_15(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:63
MCFragment * findAssociatedFragment() const override
Definition: ARMMCExpr.h:89
static const ARMMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.cpp:17
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
@ Target
Target specific expression.
Definition: MCExpr.h:41
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:1060
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
Streaming machine code generation interface.
Definition: MCStreamer.h:213
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:657
This represents an "assembler immediate".
Definition: MCValue.h:36
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18