LLVM  3.7.0
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 {
59  };
60 
61 private:
62  const VariantKind Kind;
63  const MCExpr *Expr;
64 
65  explicit SparcMCExpr(VariantKind Kind, const MCExpr *Expr)
66  : Kind(Kind), Expr(Expr) {}
67 
68 public:
69  /// @name Construction
70  /// @{
71 
72  static const SparcMCExpr *create(VariantKind Kind, const MCExpr *Expr,
73  MCContext &Ctx);
74  /// @}
75  /// @name Accessors
76  /// @{
77 
78  /// getOpcode - Get the kind of this expression.
79  VariantKind getKind() const { return Kind; }
80 
81  /// getSubExpr - Get the child of this expression.
82  const MCExpr *getSubExpr() const { return Expr; }
83 
84  /// getFixupKind - Get the fixup kind of this expression.
85  Sparc::Fixups getFixupKind() const { return getFixupKind(Kind); }
86 
87  /// @}
88  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
90  const MCAsmLayout *Layout,
91  const MCFixup *Fixup) const override;
92  void visitUsedExpr(MCStreamer &Streamer) const override;
93  MCSection *findAssociatedSection() const override {
95  }
96 
97  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
98 
99  static bool classof(const MCExpr *E) {
100  return E->getKind() == MCExpr::Target;
101  }
102 
103  static bool classof(const SparcMCExpr *) { return true; }
104 
106  static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
108 };
109 
110 } // end namespace llvm.
111 
112 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:48
This represents an "assembler immediate".
Definition: MCValue.h:44
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: SparcMCExpr.h:82
static bool printVariantKind(raw_ostream &OS, VariantKind Kind)
Definition: SparcMCExpr.cpp:44
ExprKind getKind() const
Definition: MCExpr.h:69
MCSection * findAssociatedSection() const override
Definition: SparcMCExpr.h:93
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:62
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:33
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:548
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:58
Sparc::Fixups getFixupKind() const
getFixupKind - Get the fixup kind of this expression.
Definition: SparcMCExpr.h:85
Streaming machine code generation interface.
Definition: MCStreamer.h:157
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: SparcMCExpr.h:79
MCSection * findAssociatedSection() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:768
static VariantKind parseVariantKind(StringRef name)
Definition: SparcMCExpr.cpp:86
PowerPC TLS Dynamic Call Fixup
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: SparcMCExpr.cpp:33
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
static bool classof(const MCExpr *E)
Definition: SparcMCExpr.h:99
void visitUsedExpr(MCStreamer &Streamer) const override
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: SparcMCExpr.cpp:28
static const char * name
static bool classof(const SparcMCExpr *)
Definition: SparcMCExpr.h:103
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
Target specific expression.
Definition: MCExpr.h:40