1 //===-- CSKYMCExpr.h - CSKY 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_LANAI_MCTARGETDESC_LANAIMCEXPR_H
10 #define LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIMCEXPR_H
12 #include "llvm/MC/MCExpr.h"
13 #include "llvm/MC/MCValue.h"
17 class CSKYMCExpr
: public MCTargetExpr
{
33 const VariantKind Kind
;
36 explicit CSKYMCExpr(VariantKind Kind
, const MCExpr
*Expr
)
37 : Kind(Kind
), Expr(Expr
) {}
40 static const CSKYMCExpr
*create(const MCExpr
*Expr
, VariantKind Kind
,
43 // Returns the kind of this expression.
44 VariantKind
getKind() const { return Kind
; }
46 // Returns the child of this expression.
47 const MCExpr
*getSubExpr() const { return Expr
; }
49 void printImpl(raw_ostream
&OS
, const MCAsmInfo
*MAI
) const override
;
51 bool evaluateAsRelocatableImpl(MCValue
&Res
, const MCAsmLayout
*Layout
,
52 const MCFixup
*Fixup
) const override
;
53 void visitUsedExpr(MCStreamer
&Streamer
) const override
;
55 MCFragment
*findAssociatedFragment() const override
{
56 return getSubExpr()->findAssociatedFragment();
59 void fixELFSymbolsInTLSFixups(MCAssembler
&Asm
) const override
;
61 static bool classof(const MCExpr
*E
) {
62 return E
->getKind() == MCExpr::Target
;
65 static StringRef
getVariantKindName(VariantKind Kind
);
67 } // end namespace llvm