LLVM  14.0.0git
VEMCExpr.h
Go to the documentation of this file.
1 //====- VEMCExpr.h - VE 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 // This file describes VE-specific MCExprs, used for modifiers like
10 // "%hi" or "%lo" etc.,
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_VE_MCTARGETDESC_VEMCEXPR_H
15 #define LLVM_LIB_TARGET_VE_MCTARGETDESC_VEMCEXPR_H
16 
17 #include "VEFixupKinds.h"
18 #include "llvm/MC/MCExpr.h"
19 
20 namespace llvm {
21 
22 class StringRef;
23 class VEMCExpr : public MCTargetExpr {
24 public:
25  enum VariantKind {
42  };
43 
44 private:
45  const VariantKind Kind;
46  const MCExpr *Expr;
47 
48  explicit VEMCExpr(VariantKind Kind, const MCExpr *Expr)
49  : Kind(Kind), Expr(Expr) {}
50 
51 public:
52  /// @name Construction
53  /// @{
54 
55  static const VEMCExpr *create(VariantKind Kind, const MCExpr *Expr,
56  MCContext &Ctx);
57  /// @}
58  /// @name Accessors
59  /// @{
60 
61  /// getOpcode - Get the kind of this expression.
62  VariantKind getKind() const { return Kind; }
63 
64  /// getSubExpr - Get the child of this expression.
65  const MCExpr *getSubExpr() const { return Expr; }
66 
67  /// getFixupKind - Get the fixup kind of this expression.
68  VE::Fixups getFixupKind() const { return getFixupKind(Kind); }
69 
70  /// @}
71  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
72  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
73  const MCFixup *Fixup) const override;
74  void visitUsedExpr(MCStreamer &Streamer) const override;
75  MCFragment *findAssociatedFragment() const override {
77  }
78 
79  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
80 
81  static bool classof(const MCExpr *E) {
82  return E->getKind() == MCExpr::Target;
83  }
84 
85  static bool classof(const VEMCExpr *) { return true; }
86 
88  static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
89  static void printVariantKindSuffix(raw_ostream &OS, VariantKind Kind);
90  static VE::Fixups getFixupKind(VariantKind Kind);
91 };
92 
93 } // namespace llvm
94 
95 #endif
llvm::VEMCExpr::getSubExpr
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: VEMCExpr.h:65
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::VEMCExpr::VK_VE_PLT_HI32
@ VK_VE_PLT_HI32
Definition: VEMCExpr.h:36
llvm::VEMCExpr::VariantKind
VariantKind
Definition: VEMCExpr.h:25
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::VEMCExpr::VK_VE_REFLONG
@ VK_VE_REFLONG
Definition: VEMCExpr.h:27
llvm::VEMCExpr::VK_VE_None
@ VK_VE_None
Definition: VEMCExpr.h:26
llvm::VEMCExpr::evaluateAsRelocatableImpl
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: VEMCExpr.cpp:174
VEFixupKinds.h
llvm::VEMCExpr::VK_VE_PC_HI32
@ VK_VE_PC_HI32
Definition: VEMCExpr.h:30
llvm::VE::Fixups
Fixups
Definition: VEFixupKinds.h:16
llvm::VEMCExpr::printImpl
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: VEMCExpr.cpp:30
llvm::MCFragment
Definition: MCFragment.h:31
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
llvm::VEMCExpr::VK_VE_GOT_LO32
@ VK_VE_GOT_LO32
Definition: VEMCExpr.h:33
llvm::VEMCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const override
Definition: VEMCExpr.h:75
llvm::VEMCExpr::VK_VE_PLT_LO32
@ VK_VE_PLT_LO32
Definition: VEMCExpr.h:37
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
llvm::VEMCExpr::visitUsedExpr
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: VEMCExpr.cpp:210
llvm::VEMCExpr
Definition: VEMCExpr.h:23
llvm::VEMCExpr::create
static const VEMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: VEMCExpr.cpp:25
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::VEMCExpr::VK_VE_LO32
@ VK_VE_LO32
Definition: VEMCExpr.h:29
llvm::VEMCExpr::getKind
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: VEMCExpr.h:62
llvm::VEMCExpr::VK_VE_TLS_GD_LO32
@ VK_VE_TLS_GD_LO32
Definition: VEMCExpr.h:39
llvm::VEMCExpr::VK_VE_GOT_HI32
@ VK_VE_GOT_HI32
Definition: VEMCExpr.h:32
llvm::VEMCExpr::getFixupKind
VE::Fixups getFixupKind() const
getFixupKind - Get the fixup kind of this expression.
Definition: VEMCExpr.h:68
llvm::VEMCExpr::VK_VE_PC_LO32
@ VK_VE_PC_LO32
Definition: VEMCExpr.h:31
llvm::VEMCExpr::classof
static bool classof(const VEMCExpr *)
Definition: VEMCExpr.h:85
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::VEMCExpr::VK_VE_GOTOFF_LO32
@ VK_VE_GOTOFF_LO32
Definition: VEMCExpr.h:35
llvm::VEMCExpr::printVariantKindSuffix
static void printVariantKindSuffix(raw_ostream &OS, VariantKind Kind)
Definition: VEMCExpr.cpp:68
llvm::MCExpr::MCExpr
MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
Definition: MCExpr.h:61
llvm::VEMCExpr::VK_VE_TPOFF_HI32
@ VK_VE_TPOFF_HI32
Definition: VEMCExpr.h:40
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::VEMCExpr::VK_VE_TLS_GD_HI32
@ VK_VE_TLS_GD_HI32
Definition: VEMCExpr.h:38
llvm::VEMCExpr::fixELFSymbolsInTLSFixups
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: VEMCExpr.cpp:214
llvm::VEMCExpr::VK_VE_TPOFF_LO32
@ VK_VE_TPOFF_LO32
Definition: VEMCExpr.h:41
llvm::VEMCExpr::classof
static bool classof(const MCExpr *E)
Definition: VEMCExpr.h:81
llvm::VEMCExpr::parseVariantKind
static VariantKind parseVariantKind(StringRef name)
Definition: VEMCExpr.cpp:118
llvm::VEMCExpr::printVariantKind
static bool printVariantKind(raw_ostream &OS, VariantKind Kind)
Definition: VEMCExpr.cpp:42
llvm::MCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:985
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::VEMCExpr::VK_VE_HI32
@ VK_VE_HI32
Definition: VEMCExpr.h:28
llvm::MCTargetExpr
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:644
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::VEMCExpr::VK_VE_GOTOFF_HI32
@ VK_VE_GOTOFF_HI32
Definition: VEMCExpr.h:34
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35