LLVM  9.0.0svn
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 {
60  };
61 
62 private:
63  const VariantKind Kind;
64  const MCExpr *Expr;
65 
66  explicit SparcMCExpr(VariantKind Kind, const MCExpr *Expr)
67  : Kind(Kind), Expr(Expr) {}
68 
69 public:
70  /// @name Construction
71  /// @{
72 
73  static const SparcMCExpr *create(VariantKind Kind, const MCExpr *Expr,
74  MCContext &Ctx);
75  /// @}
76  /// @name Accessors
77  /// @{
78 
79  /// getOpcode - Get the kind of this expression.
80  VariantKind getKind() const { return Kind; }
81 
82  /// getSubExpr - Get the child of this expression.
83  const MCExpr *getSubExpr() const { return Expr; }
84 
85  /// getFixupKind - Get the fixup kind of this expression.
86  Sparc::Fixups getFixupKind() const { return getFixupKind(Kind); }
87 
88  /// @}
89  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
91  const MCAsmLayout *Layout,
92  const MCFixup *Fixup) const override;
93  void visitUsedExpr(MCStreamer &Streamer) const override;
94  MCFragment *findAssociatedFragment() const override {
96  }
97 
98  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
99 
100  static bool classof(const MCExpr *E) {
101  return E->getKind() == MCExpr::Target;
102  }
103 
104  static bool classof(const SparcMCExpr *) { return true; }
105 
107  static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
109 };
110 
111 } // end namespace llvm.
112 
113 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
This represents an "assembler immediate".
Definition: MCValue.h:39
static bool printVariantKind(raw_ostream &OS, VariantKind Kind)
Definition: SparcMCExpr.cpp:42
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:579
Context object for machine code objects.
Definition: MCContext.h:62
Sparc::Fixups getFixupKind() const
getFixupKind - Get the fixup kind of this expression.
Definition: SparcMCExpr.h:86
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Streaming machine code generation interface.
Definition: MCStreamer.h:188
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
MCFragment * findAssociatedFragment() const override
Definition: SparcMCExpr.h:94
static VariantKind parseVariantKind(StringRef name)
Definition: SparcMCExpr.cpp:86
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: SparcMCExpr.h:83
PowerPC TLS Dynamic Call Fixup
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: SparcMCExpr.cpp:31
ExprKind getKind() const
Definition: MCExpr.h:72
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:864
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
static bool classof(const MCExpr *E)
Definition: SparcMCExpr.h:100
void visitUsedExpr(MCStreamer &Streamer) const override
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: SparcMCExpr.cpp:26
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: SparcMCExpr.h:80
static const char * name
static bool classof(const SparcMCExpr *)
Definition: SparcMCExpr.h:104
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
Target specific expression.
Definition: MCExpr.h:42