1 //===- MipsMCExpr.h - Mips specific MC expression classes -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
11 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
13 #include "llvm/MC/MCAsmLayout.h"
14 #include "llvm/MC/MCExpr.h"
15 #include "llvm/MC/MCValue.h"
19 class MipsMCExpr : public MCTargetExpr {
52 const MipsExprKind Kind;
55 explicit MipsMCExpr(MipsExprKind Kind, const MCExpr *Expr)
56 : Kind(Kind), Expr(Expr) {}
59 static const MipsMCExpr *create(MipsExprKind Kind, const MCExpr *Expr,
61 static const MipsMCExpr *createGpOff(MipsExprKind Kind, const MCExpr *Expr,
64 /// Get the kind of this expression.
65 MipsExprKind getKind() const { return Kind; }
67 /// Get the child of this expression.
68 const MCExpr *getSubExpr() const { return Expr; }
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;
75 MCFragment *findAssociatedFragment() const override {
76 return getSubExpr()->findAssociatedFragment();
79 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
81 static bool classof(const MCExpr *E) {
82 return E->getKind() == MCExpr::Target;
85 bool isGpOff(MipsExprKind &Kind) const;
86 bool isGpOff() const {
92 } // end namespace llvm
94 #endif // LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H