LLVM  14.0.0git
SparcMCExpr.h
Go to the documentation of this file.
1 //====- SparcMCExpr.h - Sparc 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 Sparc-specific MCExprs, used for modifiers like
10 // "%hi" or "%lo" etc.,
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCEXPR_H
15 #define LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCEXPR_H
16 
17 #include "SparcFixupKinds.h"
18 #include "llvm/MC/MCExpr.h"
19 
20 namespace llvm {
21 
22 class StringRef;
23 class SparcMCExpr : public MCTargetExpr {
24 public:
25  enum VariantKind {
62  };
63 
64 private:
65  const VariantKind Kind;
66  const MCExpr *Expr;
67 
68  explicit SparcMCExpr(VariantKind Kind, const MCExpr *Expr)
69  : Kind(Kind), Expr(Expr) {}
70 
71 public:
72  /// @name Construction
73  /// @{
74 
75  static const SparcMCExpr *create(VariantKind Kind, const MCExpr *Expr,
76  MCContext &Ctx);
77  /// @}
78  /// @name Accessors
79  /// @{
80 
81  /// getOpcode - Get the kind of this expression.
82  VariantKind getKind() const { return Kind; }
83 
84  /// getSubExpr - Get the child of this expression.
85  const MCExpr *getSubExpr() const { return Expr; }
86 
87  /// getFixupKind - Get the fixup kind of this expression.
88  Sparc::Fixups getFixupKind() const { return getFixupKind(Kind); }
89 
90  /// @}
91  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
93  const MCAsmLayout *Layout,
94  const MCFixup *Fixup) const override;
95  void visitUsedExpr(MCStreamer &Streamer) const override;
96  MCFragment *findAssociatedFragment() const override {
98  }
99 
100  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
101 
102  static bool classof(const MCExpr *E) {
103  return E->getKind() == MCExpr::Target;
104  }
105 
106  static bool classof(const SparcMCExpr *) { return true; }
107 
109  static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
111 };
112 
113 } // end namespace llvm.
114 
115 #endif
llvm::SparcMCExpr::VK_Sparc_TLS_IE_LO10
@ VK_Sparc_TLS_IE_LO10
Definition: SparcMCExpr.h:56
llvm::SparcMCExpr::VK_Sparc_TLS_IE_ADD
@ VK_Sparc_TLS_IE_ADD
Definition: SparcMCExpr.h:59
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::SparcMCExpr::VK_Sparc_L44
@ VK_Sparc_L44
Definition: SparcMCExpr.h:31
llvm::SparcMCExpr::fixELFSymbolsInTLSFixups
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: SparcMCExpr.cpp:201
llvm::SparcMCExpr::VK_Sparc_HM
@ VK_Sparc_HM
Definition: SparcMCExpr.h:33
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::SparcMCExpr::VK_Sparc_None
@ VK_Sparc_None
Definition: SparcMCExpr.h:26
llvm::SparcMCExpr::VK_Sparc_TLS_LE_LOX10
@ VK_Sparc_TLS_LE_LOX10
Definition: SparcMCExpr.h:61
llvm::SparcMCExpr::VK_Sparc_TLS_LDO_ADD
@ VK_Sparc_TLS_LDO_ADD
Definition: SparcMCExpr.h:54
llvm::SparcMCExpr::classof
static bool classof(const SparcMCExpr *)
Definition: SparcMCExpr.h:106
llvm::SparcMCExpr::VK_Sparc_TLS_LDM_ADD
@ VK_Sparc_TLS_LDM_ADD
Definition: SparcMCExpr.h:50
llvm::SparcMCExpr
Definition: SparcMCExpr.h:23
llvm::SparcMCExpr::VK_Sparc_TLS_LDM_HI22
@ VK_Sparc_TLS_LDM_HI22
Definition: SparcMCExpr.h:48
llvm::SparcMCExpr::VK_Sparc_M44
@ VK_Sparc_M44
Definition: SparcMCExpr.h:30
llvm::SparcMCExpr::parseVariantKind
static VariantKind parseVariantKind(StringRef name)
Definition: SparcMCExpr.cpp:87
llvm::SparcMCExpr::VK_Sparc_TLS_GD_CALL
@ VK_Sparc_TLS_GD_CALL
Definition: SparcMCExpr.h:47
llvm::MCFragment
Definition: MCFragment.h:31
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
llvm::SparcMCExpr::VK_Sparc_TLS_LE_HIX22
@ VK_Sparc_TLS_LE_HIX22
Definition: SparcMCExpr.h:60
llvm::SparcMCExpr::classof
static bool classof(const MCExpr *E)
Definition: SparcMCExpr.h:102
llvm::SparcMCExpr::VK_Sparc_R_DISP32
@ VK_Sparc_R_DISP32
Definition: SparcMCExpr.h:43
llvm::SparcMCExpr::VK_Sparc_TLS_LDM_CALL
@ VK_Sparc_TLS_LDM_CALL
Definition: SparcMCExpr.h:51
SparcFixupKinds.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
llvm::SparcMCExpr::VK_Sparc_H44
@ VK_Sparc_H44
Definition: SparcMCExpr.h:29
llvm::SparcMCExpr::create
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: SparcMCExpr.cpp:26
llvm::SparcMCExpr::VK_Sparc_LM
@ VK_Sparc_LM
Definition: SparcMCExpr.h:34
llvm::SparcMCExpr::visitUsedExpr
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: SparcMCExpr.cpp:236
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::SparcMCExpr::VK_Sparc_TLS_LDM_LO10
@ VK_Sparc_TLS_LDM_LO10
Definition: SparcMCExpr.h:49
llvm::SparcMCExpr::VK_Sparc_TLS_LDO_HIX22
@ VK_Sparc_TLS_LDO_HIX22
Definition: SparcMCExpr.h:52
llvm::SparcMCExpr::VK_Sparc_GOT13
@ VK_Sparc_GOT13
Definition: SparcMCExpr.h:39
llvm::SparcMCExpr::VK_Sparc_TLS_IE_LDX
@ VK_Sparc_TLS_IE_LDX
Definition: SparcMCExpr.h:58
llvm::SparcMCExpr::VK_Sparc_PC22
@ VK_Sparc_PC22
Definition: SparcMCExpr.h:35
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::SparcMCExpr::printImpl
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: SparcMCExpr.cpp:31
llvm::SparcMCExpr::VK_Sparc_GOT22
@ VK_Sparc_GOT22
Definition: SparcMCExpr.h:37
llvm::SparcMCExpr::VK_Sparc_TLS_IE_LD
@ VK_Sparc_TLS_IE_LD
Definition: SparcMCExpr.h:57
llvm::SparcMCExpr::VK_Sparc_TLS_GD_LO10
@ VK_Sparc_TLS_GD_LO10
Definition: SparcMCExpr.h:45
llvm::MCExpr::MCExpr
MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
Definition: MCExpr.h:61
llvm::SparcMCExpr::VK_Sparc_TLS_IE_HI22
@ VK_Sparc_TLS_IE_HI22
Definition: SparcMCExpr.h:55
llvm::SparcMCExpr::VariantKind
VariantKind
Definition: SparcMCExpr.h:25
llvm::SparcMCExpr::VK_Sparc_PC10
@ VK_Sparc_PC10
Definition: SparcMCExpr.h:36
llvm::SparcMCExpr::VK_Sparc_13
@ VK_Sparc_13
Definition: SparcMCExpr.h:40
llvm::SparcMCExpr::VK_Sparc_WDISP30
@ VK_Sparc_WDISP30
Definition: SparcMCExpr.h:42
llvm::SparcMCExpr::VK_Sparc_GOT10
@ VK_Sparc_GOT10
Definition: SparcMCExpr.h:38
llvm::SparcMCExpr::VK_Sparc_HH
@ VK_Sparc_HH
Definition: SparcMCExpr.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::SparcMCExpr::printVariantKind
static bool printVariantKind(raw_ostream &OS, VariantKind Kind)
Definition: SparcMCExpr.cpp:42
llvm::SparcMCExpr::getSubExpr
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: SparcMCExpr.h:85
llvm::SparcMCExpr::VK_Sparc_WPLT30
@ VK_Sparc_WPLT30
Definition: SparcMCExpr.h:41
llvm::Sparc::Fixups
Fixups
Definition: SparcFixupKinds.h:16
llvm::SparcMCExpr::VK_Sparc_HI
@ VK_Sparc_HI
Definition: SparcMCExpr.h:28
llvm::SparcMCExpr::VK_Sparc_TLS_GD_HI22
@ VK_Sparc_TLS_GD_HI22
Definition: SparcMCExpr.h:44
llvm::SparcMCExpr::getFixupKind
Sparc::Fixups getFixupKind() const
getFixupKind - Get the fixup kind of this expression.
Definition: SparcMCExpr.h:88
llvm::SparcMCExpr::VK_Sparc_TLS_GD_ADD
@ VK_Sparc_TLS_GD_ADD
Definition: SparcMCExpr.h:46
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78
llvm::SparcMCExpr::VK_Sparc_TLS_LDO_LOX10
@ VK_Sparc_TLS_LDO_LOX10
Definition: SparcMCExpr.h:53
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
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::SparcMCExpr::evaluateAsRelocatableImpl
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: SparcMCExpr.cpp:166
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::SparcMCExpr::VK_Sparc_LO
@ VK_Sparc_LO
Definition: SparcMCExpr.h:27
llvm::SparcMCExpr::getKind
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: SparcMCExpr.h:82
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::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::SparcMCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const override
Definition: SparcMCExpr.h:96