LLVM  4.0.0
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 {
48  };
49 
50 private:
51  const MipsExprKind Kind;
52  const MCExpr *Expr;
53 
54  explicit MipsMCExpr(MipsExprKind Kind, const MCExpr *Expr)
55  : Kind(Kind), Expr(Expr) {}
56 
57 public:
58  static const MipsMCExpr *create(MipsExprKind Kind, const MCExpr *Expr,
59  MCContext &Ctx);
60  static const MipsMCExpr *createGpOff(MipsExprKind Kind, const MCExpr *Expr,
61  MCContext &Ctx);
62 
63  /// Get the kind of this expression.
64  MipsExprKind getKind() const { return Kind; }
65 
66  /// Get the child of this expression.
67  const MCExpr *getSubExpr() const { return Expr; }
68 
69  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
70  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
71  const MCFixup *Fixup) const override;
72  void visitUsedExpr(MCStreamer &Streamer) const override;
73  MCFragment *findAssociatedFragment() const override {
75  }
76 
77  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
78 
79  static bool classof(const MCExpr *E) {
80  return E->getKind() == MCExpr::Target;
81  }
82 
83  bool isGpOff(MipsExprKind &Kind) const;
84  bool isGpOff() const {
85  MipsExprKind Kind;
86  return isGpOff(Kind);
87  }
88 };
89 } // end namespace llvm
90 
91 #endif
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: MipsMCExpr.cpp:123
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:765
const MCExpr * getSubExpr() const
Get the child of this expression.
Definition: MipsMCExpr.h:67
This represents an "assembler immediate".
Definition: MCValue.h:40
ExprKind getKind() const
Definition: MCExpr.h:70
bool isGpOff() const
Definition: MipsMCExpr.h:84
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:66
static bool classof(const MCExpr *E)
Definition: MipsMCExpr.h:79
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:34
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:531
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: MipsMCExpr.cpp:235
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: MipsMCExpr.cpp:205
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:57
Streaming machine code generation interface.
Definition: MCStreamer.h:161
static const MipsMCExpr * createGpOff(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: MipsMCExpr.cpp:27
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: MipsMCExpr.cpp:32
MCFragment * findAssociatedFragment() const override
Definition: MipsMCExpr.h:73
static const MipsMCExpr * create(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: MipsMCExpr.cpp:22
MipsExprKind getKind() const
Get the kind of this expression.
Definition: MipsMCExpr.h:64
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
Target specific expression.
Definition: MCExpr.h:41