[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / Target / CSKY / MCTargetDesc / CSKYMCExpr.h
blob06fccada53ce45de79b1014a52f0071013058803
1 //===-- CSKYMCExpr.h - CSKY 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 //===----------------------------------------------------------------------===//
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"
15 namespace llvm {
17 class CSKYMCExpr : public MCTargetExpr {
18 public:
19 enum VariantKind {
20 VK_CSKY_None,
21 VK_CSKY_ADDR,
22 VK_CSKY_PCREL,
23 VK_CSKY_GOT,
24 VK_CSKY_GOTPC,
25 VK_CSKY_GOTOFF,
26 VK_CSKY_PLT,
27 VK_CSKY_TPOFF,
28 VK_CSKY_TLSGD,
29 VK_CSKY_Invalid
32 private:
33 const VariantKind Kind;
34 const MCExpr *Expr;
36 explicit CSKYMCExpr(VariantKind Kind, const MCExpr *Expr)
37 : Kind(Kind), Expr(Expr) {}
39 public:
40 static const CSKYMCExpr *create(const MCExpr *Expr, VariantKind Kind,
41 MCContext &Ctx);
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
69 #endif