1 //===-- ARMMCExpr.h - ARM specific MC expression classes --------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
10 #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
12 #include "llvm/MC/MCExpr.h"
16 class ARMMCExpr
: public MCTargetExpr
{
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)
25 const VariantKind Kind
;
28 explicit ARMMCExpr(VariantKind Kind
, const MCExpr
*Expr
)
29 : Kind(Kind
), Expr(Expr
) {}
32 /// @name Construction
35 static const ARMMCExpr
*create(VariantKind Kind
, const MCExpr
*Expr
,
38 static const ARMMCExpr
*createUpper16(const MCExpr
*Expr
, MCContext
&Ctx
) {
39 return create(VK_ARM_HI16
, Expr
, Ctx
);
42 static const ARMMCExpr
*createLower16(const MCExpr
*Expr
, MCContext
&Ctx
) {
43 return create(VK_ARM_LO16
, Expr
, Ctx
);
50 /// getOpcode - Get the kind of this expression.
51 VariantKind
getKind() const { return Kind
; }
53 /// getSubExpr - Get the child of this expression.
54 const MCExpr
*getSubExpr() const { return Expr
; }
58 void printImpl(raw_ostream
&OS
, const MCAsmInfo
*MAI
) const override
;
59 bool evaluateAsRelocatableImpl(MCValue
&Res
,
60 const MCAsmLayout
*Layout
,
61 const MCFixup
*Fixup
) const override
{
64 void visitUsedExpr(MCStreamer
&Streamer
) const override
;
65 MCFragment
*findAssociatedFragment() const override
{
66 return getSubExpr()->findAssociatedFragment();
69 // There are no TLS ARMMCExprs at the moment.
70 void fixELFSymbolsInTLSFixups(MCAssembler
&Asm
) const override
{}
72 static bool classof(const MCExpr
*E
) {
73 return E
->getKind() == MCExpr::Target
;
76 } // end namespace llvm