annotate lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.h @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents 1172e4bd9c6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
1 //===-- LanaiMCExpr.h - Lanai specific MC expression classes ----*- C++ -*-===//
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
2 //
147
c2174574ed3a LLVM 10
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 120
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
c2174574ed3a LLVM 10
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 120
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
c2174574ed3a LLVM 10
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 120
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
6 //
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
8
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
9 #ifndef LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIMCEXPR_H
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
10 #define LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIMCEXPR_H
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
11
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
12 #include "llvm/MC/MCExpr.h"
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
13 #include "llvm/MC/MCValue.h"
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
14
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
15 namespace llvm {
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
16
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
17 class LanaiMCExpr : public MCTargetExpr {
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
18 public:
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
19 enum VariantKind { VK_Lanai_None, VK_Lanai_ABS_HI, VK_Lanai_ABS_LO };
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
20
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
21 private:
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
22 const VariantKind Kind;
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
23 const MCExpr *Expr;
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
24
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
25 explicit LanaiMCExpr(VariantKind Kind, const MCExpr *Expr)
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
26 : Kind(Kind), Expr(Expr) {}
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
27
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
28 public:
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
29 static const LanaiMCExpr *create(VariantKind Kind, const MCExpr *Expr,
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
30 MCContext &Ctx);
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
31
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
32 // Returns the kind of this expression.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
33 VariantKind getKind() const { return Kind; }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
34
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
35 // Returns the child of this expression.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
36 const MCExpr *getSubExpr() const { return Expr; }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
37
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
38 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
39 bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
40 const MCFixup *Fixup) const override;
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
41 void visitUsedExpr(MCStreamer &Streamer) const override;
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
42 MCFragment *findAssociatedFragment() const override {
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
43 return getSubExpr()->findAssociatedFragment();
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
44 }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
45
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
46 // There are no TLS LanaiMCExprs at the moment.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
47 void fixELFSymbolsInTLSFixups(MCAssembler & /*Asm*/) const override {}
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
48
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
49 static bool classof(const MCExpr *E) {
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
50 return E->getKind() == MCExpr::Target;
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
51 }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
52 };
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
53 } // end namespace llvm
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
54
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
55 #endif