LLVM  8.0.1
SparcMCExpr.h
Go to the documentation of this file.
1 //====- SparcMCExpr.h - Sparc specific MC expression classes --*- C++ -*-=====//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes Sparc-specific MCExprs, used for modifiers like
11 // "%hi" or "%lo" etc.,
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCEXPR_H
16 #define LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCEXPR_H
17 
18 #include "SparcFixupKinds.h"
19 #include "llvm/MC/MCExpr.h"
20 
21 namespace llvm {
22 
23 class StringRef;
24 class SparcMCExpr : public MCTargetExpr {
25 public:
26  enum VariantKind {
61  };
62 
63 private:
64  const VariantKind Kind;
65  const MCExpr *Expr;
66 
67  explicit SparcMCExpr(VariantKind Kind, const MCExpr *Expr)
68  : Kind(Kind), Expr(Expr) {}
69 
70 public:
71  /// @name Construction
72  /// @{
73 
74  static const SparcMCExpr *create(VariantKind Kind, const MCExpr *Expr,
75  MCContext &Ctx);
76  /// @}
77  /// @name Accessors
78  /// @{
79 
80  /// getOpcode - Get the kind of this expression.
81  VariantKind getKind() const { return Kind; }
82 
83  /// getSubExpr - Get the child of this expression.
84  const MCExpr *getSubExpr() const { return Expr; }
85 
86  /// getFixupKind - Get the fixup kind of this expression.
87  Sparc::Fixups getFixupKind() const { return getFixupKind(Kind); }
88 
89  /// @}
90  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
92  const MCAsmLayout *Layout,
93  const MCFixup *Fixup) const override;
94  void visitUsedExpr(MCStreamer &Streamer) const override;
95  MCFragment *findAssociatedFragment() const override {
97  }
98 
99  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
100 
101  static bool classof(const MCExpr *E) {
102  return E->getKind() == MCExpr::Target;
103  }
104 
105  static bool classof(const SparcMCExpr *) { return true; }
106 
108  static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
110 };
111 
112 } // end namespace llvm.
113 
114 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
This represents an "assembler immediate".
Definition: MCValue.h:40
static bool printVariantKind(raw_ostream &OS, VariantKind Kind)
Definition: SparcMCExpr.cpp:43
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:29
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:581
Context object for machine code objects.
Definition: MCContext.h:63
Sparc::Fixups getFixupKind() const
getFixupKind - Get the fixup kind of this expression.
Definition: SparcMCExpr.h:87
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:189
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
MCFragment * findAssociatedFragment() const override
Definition: SparcMCExpr.h:95
static VariantKind parseVariantKind(StringRef name)
Definition: SparcMCExpr.cpp:87
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: SparcMCExpr.h:84
PowerPC TLS Dynamic Call Fixup
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: SparcMCExpr.cpp:32
ExprKind getKind() const
Definition: MCExpr.h:73
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:867
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
static bool classof(const MCExpr *E)
Definition: SparcMCExpr.h:101
void visitUsedExpr(MCStreamer &Streamer) const override
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: SparcMCExpr.cpp:27
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: SparcMCExpr.h:81
static const char * name
static bool classof(const SparcMCExpr *)
Definition: SparcMCExpr.h:105
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Target specific expression.
Definition: MCExpr.h:43