LLVM  13.0.0git
CSKYMCExpr.h
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
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 CSKYMCExpr : public MCTargetExpr {
18 public:
19  enum VariantKind {
30  };
31 
32 private:
33  const VariantKind Kind;
34  const MCExpr *Expr;
35 
36  explicit CSKYMCExpr(VariantKind Kind, const MCExpr *Expr)
37  : Kind(Kind), Expr(Expr) {}
38 
39 public:
40  static const CSKYMCExpr *create(const MCExpr *Expr, VariantKind Kind,
41  MCContext &Ctx);
42 
43  // Returns the kind of this expression.
44  VariantKind getKind() const { return Kind; }
45 
46  // Returns the child of this expression.
47  const MCExpr *getSubExpr() const { return Expr; }
48 
49  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
50 
51  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
52  const MCFixup *Fixup) const override;
53  void visitUsedExpr(MCStreamer &Streamer) const override;
54 
55  MCFragment *findAssociatedFragment() const override {
57  }
58 
59  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
60 
61  static bool classof(const MCExpr *E) {
62  return E->getKind() == MCExpr::Target;
63  }
64 
66 };
67 } // end namespace llvm
68 
69 #endif
llvm::CSKYMCExpr::VK_CSKY_GOTOFF
@ VK_CSKY_GOTOFF
Definition: CSKYMCExpr.h:25
llvm
Definition: AllocatorList.h:23
llvm::CSKYMCExpr::VK_CSKY_GOTPC
@ VK_CSKY_GOTPC
Definition: CSKYMCExpr.h:24
llvm::CSKYMCExpr::fixELFSymbolsInTLSFixups
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: CSKYMCExpr.cpp:86
llvm::CSKYMCExpr::VK_CSKY_Invalid
@ VK_CSKY_Invalid
Definition: CSKYMCExpr.h:29
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::CSKYMCExpr::getVariantKindName
static StringRef getVariantKindName(VariantKind Kind)
Definition: CSKYMCExpr.cpp:25
llvm::CSKYMCExpr::create
static const CSKYMCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)
Definition: CSKYMCExpr.cpp:20
llvm::CSKYMCExpr::VK_CSKY_GOT
@ VK_CSKY_GOT
Definition: CSKYMCExpr.h:23
llvm::CSKYMCExpr::evaluateAsRelocatableImpl
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: CSKYMCExpr.cpp:98
llvm::CSKYMCExpr::VK_CSKY_None
@ VK_CSKY_None
Definition: CSKYMCExpr.h:20
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::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
llvm::CSKYMCExpr::VK_CSKY_ADDR
@ VK_CSKY_ADDR
Definition: CSKYMCExpr.h:21
llvm::CSKYMCExpr::getKind
VariantKind getKind() const
Definition: CSKYMCExpr.h:44
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::CSKYMCExpr::VK_CSKY_PLT
@ VK_CSKY_PLT
Definition: CSKYMCExpr.h:26
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::MCExpr::MCExpr
MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
Definition: MCExpr.h:61
llvm::CSKYMCExpr
Definition: CSKYMCExpr.h:17
llvm::CSKYMCExpr::VariantKind
VariantKind
Definition: CSKYMCExpr.h:19
llvm::CSKYMCExpr::getSubExpr
const MCExpr * getSubExpr() const
Definition: CSKYMCExpr.h:47
llvm::CSKYMCExpr::VK_CSKY_TPOFF
@ VK_CSKY_TPOFF
Definition: CSKYMCExpr.h:27
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::CSKYMCExpr::VK_CSKY_TLSGD
@ VK_CSKY_TLSGD
Definition: CSKYMCExpr.h:28
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::CSKYMCExpr::VK_CSKY_PCREL
@ VK_CSKY_PCREL
Definition: CSKYMCExpr.h:22
llvm::CSKYMCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const override
Definition: CSKYMCExpr.h:55
MCValue.h
llvm::CSKYMCExpr::printImpl
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: CSKYMCExpr.cpp:52
llvm::CSKYMCExpr::classof
static bool classof(const MCExpr *E)
Definition: CSKYMCExpr.h:61
llvm::MCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:1004
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::CSKYMCExpr::visitUsedExpr
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: CSKYMCExpr.cpp:48
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:81
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35