LLVM  14.0.0git
LanaiMCExpr.h
Go to the documentation of this file.
1 //===-- LanaiMCExpr.h - Lanai 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 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIMCEXPR_H
10 #define LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIMCEXPR_H
11 
12 #include "llvm/MC/MCExpr.h"
13 #include "llvm/MC/MCValue.h"
14 
15 namespace llvm {
16 
17 class LanaiMCExpr : public MCTargetExpr {
18 public:
20 
21 private:
22  const VariantKind Kind;
23  const MCExpr *Expr;
24 
25  explicit LanaiMCExpr(VariantKind Kind, const MCExpr *Expr)
26  : Kind(Kind), Expr(Expr) {}
27 
28 public:
29  static const LanaiMCExpr *create(VariantKind Kind, const MCExpr *Expr,
30  MCContext &Ctx);
31 
32  // Returns the kind of this expression.
33  VariantKind getKind() const { return Kind; }
34 
35  // Returns the child of this expression.
36  const MCExpr *getSubExpr() const { return Expr; }
37 
38  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
39  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
40  const MCFixup *Fixup) const override;
41  void visitUsedExpr(MCStreamer &Streamer) const override;
42  MCFragment *findAssociatedFragment() const override {
44  }
45 
46  // There are no TLS LanaiMCExprs at the moment.
47  void fixELFSymbolsInTLSFixups(MCAssembler & /*Asm*/) const override {}
48 
49  static bool classof(const MCExpr *E) {
50  return E->getKind() == MCExpr::Target;
51  }
52 };
53 } // end namespace llvm
54 
55 #endif
llvm::LanaiMCExpr::printImpl
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: LanaiMCExpr.cpp:22
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::LanaiMCExpr::getSubExpr
const MCExpr * getSubExpr() const
Definition: LanaiMCExpr.h:36
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::LanaiMCExpr
Definition: LanaiMCExpr.h:17
llvm::MCFragment
Definition: MCFragment.h:31
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::LanaiMCExpr::evaluateAsRelocatableImpl
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: LanaiMCExpr.cpp:49
llvm::LanaiMCExpr::create
static const LanaiMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: LanaiMCExpr.cpp:17
llvm::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
llvm::LanaiMCExpr::VK_Lanai_ABS_HI
@ VK_Lanai_ABS_HI
Definition: LanaiMCExpr.h:19
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::LanaiMCExpr::getKind
VariantKind getKind() const
Definition: LanaiMCExpr.h:33
llvm::MCExpr::MCExpr
MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
Definition: MCExpr.h:61
llvm::LanaiMCExpr::fixELFSymbolsInTLSFixups
void fixELFSymbolsInTLSFixups(MCAssembler &) const override
Definition: LanaiMCExpr.h:47
llvm::LanaiMCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const override
Definition: LanaiMCExpr.h:42
llvm::LanaiMCExpr::classof
static bool classof(const MCExpr *E)
Definition: LanaiMCExpr.h:49
llvm::LanaiMCExpr::VariantKind
VariantKind
Definition: LanaiMCExpr.h:19
llvm::LanaiMCExpr::visitUsedExpr
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: LanaiMCExpr.cpp:45
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::LanaiMCExpr::VK_Lanai_None
@ VK_Lanai_None
Definition: LanaiMCExpr.h:19
MCValue.h
llvm::MCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:983
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::MCTargetExpr
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:643
MCExpr.h
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::LanaiMCExpr::VK_Lanai_ABS_LO
@ VK_Lanai_ABS_LO
Definition: LanaiMCExpr.h:19