1 //===- MipsMCExpr.h - Mips 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_MIPS_MCTARGETDESC_MIPSMCEXPR_H
10 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
12 #include "llvm/MC/MCAsmLayout.h"
13 #include "llvm/MC/MCExpr.h"
14 #include "llvm/MC/MCValue.h"
18 class MipsMCExpr
: public MCTargetExpr
{
51 const MipsExprKind Kind
;
54 explicit MipsMCExpr(MipsExprKind Kind
, const MCExpr
*Expr
)
55 : Kind(Kind
), Expr(Expr
) {}
58 static const MipsMCExpr
*create(MipsExprKind Kind
, const MCExpr
*Expr
,
60 static const MipsMCExpr
*createGpOff(MipsExprKind Kind
, const MCExpr
*Expr
,
63 /// Get the kind of this expression.
64 MipsExprKind
getKind() const { return Kind
; }
66 /// Get the child of this expression.
67 const MCExpr
*getSubExpr() const { return Expr
; }
69 void printImpl(raw_ostream
&OS
, const MCAsmInfo
*MAI
) const override
;
70 bool evaluateAsRelocatableImpl(MCValue
&Res
, const MCAsmLayout
*Layout
,
71 const MCFixup
*Fixup
) const override
;
72 void visitUsedExpr(MCStreamer
&Streamer
) const override
;
74 MCFragment
*findAssociatedFragment() const override
{
75 return getSubExpr()->findAssociatedFragment();
78 void fixELFSymbolsInTLSFixups(MCAssembler
&Asm
) const override
;
80 static bool classof(const MCExpr
*E
) {
81 return E
->getKind() == MCExpr::Target
;
84 bool isGpOff(MipsExprKind
&Kind
) const;
85 bool isGpOff() const {
91 } // end namespace llvm
93 #endif // LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H