LLVM  8.0.1
MipsMCExpr.h
Go to the documentation of this file.
1 //===- MipsMCExpr.h - Mips 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 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
11 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
12 
13 #include "llvm/MC/MCAsmLayout.h"
14 #include "llvm/MC/MCExpr.h"
15 #include "llvm/MC/MCValue.h"
16 
17 namespace llvm {
18 
19 class MipsMCExpr : public MCTargetExpr {
20 public:
21  enum MipsExprKind {
49  };
50 
51 private:
52  const MipsExprKind Kind;
53  const MCExpr *Expr;
54 
55  explicit MipsMCExpr(MipsExprKind Kind, const MCExpr *Expr)
56  : Kind(Kind), Expr(Expr) {}
57 
58 public:
59  static const MipsMCExpr *create(MipsExprKind Kind, const MCExpr *Expr,
60  MCContext &Ctx);
61  static const MipsMCExpr *createGpOff(MipsExprKind Kind, const MCExpr *Expr,
62  MCContext &Ctx);
63 
64  /// Get the kind of this expression.
65  MipsExprKind getKind() const { return Kind; }
66 
67  /// Get the child of this expression.
68  const MCExpr *getSubExpr() const { return Expr; }
69 
70  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
71  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
72  const MCFixup *Fixup) const override;
73  void visitUsedExpr(MCStreamer &Streamer) const override;
74 
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  bool isGpOff(MipsExprKind &Kind) const;
86  bool isGpOff() const {
87  MipsExprKind Kind;
88  return isGpOff(Kind);
89  }
90 };
91 
92 } // end namespace llvm
93 
94 #endif // LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: MipsMCExpr.cpp:134
This class represents lattice values for constants.
Definition: AllocatorList.h:24
This represents an "assembler immediate".
Definition: MCValue.h:40
bool isGpOff() const
Definition: MipsMCExpr.h:86
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
static bool classof(const MCExpr *E)
Definition: MipsMCExpr.h:81
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
MipsExprKind getKind() const
Get the kind of this expression.
Definition: MipsMCExpr.h:65
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: MipsMCExpr.cpp:250
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: MipsMCExpr.cpp:220
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 const MipsMCExpr * createGpOff(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: MipsMCExpr.cpp:33
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: MipsMCExpr.cpp:38
PowerPC TLS Dynamic Call Fixup
MCFragment * findAssociatedFragment() const override
Definition: MipsMCExpr.h:75
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
const MCExpr * getSubExpr() const
Get the child of this expression.
Definition: MipsMCExpr.h:68
static const MipsMCExpr * create(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: MipsMCExpr.cpp:28
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
Target specific expression.
Definition: MCExpr.h:43