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 {
30 const VariantKind Kind;
33 explicit MipsMCExpr(VariantKind Kind, const MCExpr *Expr)
34 : Kind(Kind), Expr(Expr) {}
37 static bool isSupportedBinaryExpr(MCSymbolRefExpr::VariantKind VK,
38 const MCBinaryExpr *BE);
40 static const MipsMCExpr *create(MCSymbolRefExpr::VariantKind VK,
41 const MCExpr *Expr, MCContext &Ctx);
43 /// getOpcode - Get the kind of this expression.
44 VariantKind getKind() const { return Kind; }
46 /// getSubExpr - Get the child of this expression.
47 const MCExpr *getSubExpr() const { return Expr; }
49 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
50 bool evaluateAsRelocatableImpl(MCValue &Res,
51 const MCAsmLayout *Layout,
52 const MCFixup *Fixup) const override;
53 void visitUsedExpr(MCStreamer &Streamer) const override;
54 MCSection *findAssociatedSection() const override {
55 return getSubExpr()->findAssociatedSection();
58 // There are no TLS MipsMCExprs at the moment.
59 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
61 static bool classof(const MCExpr *E) {
62 return E->getKind() == MCExpr::Target;
65 } // end namespace llvm