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 //===----------------------------------------------------------------------===//
13 #include "llvm/MC/MCAsmLayout.h"
14 #include "llvm/MC/MCExpr.h"
15 #include "llvm/MC/MCValue.h"
19 class MipsMCExpr : public MCTargetExpr {
28 const VariantKind Kind;
31 explicit MipsMCExpr(VariantKind Kind, const MCExpr *Expr)
32 : Kind(Kind), Expr(Expr) {}
35 static const MipsMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
38 static const MipsMCExpr *CreateLo(const MCExpr *Expr, MCContext &Ctx) {
39 return Create(VK_Mips_ABS_LO, Expr, Ctx);
42 static const MipsMCExpr *CreateHi(const MCExpr *Expr, MCContext &Ctx) {
43 return Create(VK_Mips_ABS_HI, Expr, Ctx);
46 /// getOpcode - Get the kind of this expression.
47 VariantKind getKind() const { return Kind; }
49 /// getSubExpr - Get the child of this expression.
50 const MCExpr *getSubExpr() const { return Expr; }
52 void PrintImpl(raw_ostream &OS) const;
53 bool EvaluateAsRelocatableImpl(MCValue &Res,
54 const MCAsmLayout *Layout) const;
55 void AddValueSymbols(MCAssembler *) const;
56 const MCSection *FindAssociatedSection() const {
57 return getSubExpr()->FindAssociatedSection();
60 // There are no TLS MipsMCExprs at the moment.
61 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {}
63 static bool classof(const MCExpr *E) {
64 return E->getKind() == MCExpr::Target;
67 } // end namespace llvm