2014-02-04 18:41:57 +00:00
|
|
|
//===-- MipsMCExpr.h - Mips specific MC expression classes ------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
|
|
|
|
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
|
2014-02-04 18:41:57 +00:00
|
|
|
|
2014-03-04 10:07:28 +00:00
|
|
|
#include "llvm/MC/MCAsmLayout.h"
|
2014-02-04 18:41:57 +00:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
|
|
|
#include "llvm/MC/MCValue.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MipsMCExpr : public MCTargetExpr {
|
|
|
|
public:
|
|
|
|
enum VariantKind {
|
|
|
|
VK_Mips_None,
|
2014-04-03 10:37:45 +00:00
|
|
|
VK_Mips_LO,
|
|
|
|
VK_Mips_HI,
|
|
|
|
VK_Mips_HIGHER,
|
|
|
|
VK_Mips_HIGHEST
|
2014-02-04 18:41:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
const VariantKind Kind;
|
|
|
|
const MCExpr *Expr;
|
|
|
|
|
|
|
|
explicit MipsMCExpr(VariantKind Kind, const MCExpr *Expr)
|
|
|
|
: Kind(Kind), Expr(Expr) {}
|
|
|
|
|
|
|
|
public:
|
2014-04-03 10:37:45 +00:00
|
|
|
static bool isSupportedBinaryExpr(MCSymbolRefExpr::VariantKind VK,
|
|
|
|
const MCBinaryExpr *BE);
|
2014-02-04 18:41:57 +00:00
|
|
|
|
2015-05-30 01:25:56 +00:00
|
|
|
static const MipsMCExpr *create(MCSymbolRefExpr::VariantKind VK,
|
2014-04-03 10:37:45 +00:00
|
|
|
const MCExpr *Expr, MCContext &Ctx);
|
2014-02-04 18:41:57 +00:00
|
|
|
|
|
|
|
/// getOpcode - Get the kind of this expression.
|
|
|
|
VariantKind getKind() const { return Kind; }
|
|
|
|
|
|
|
|
/// getSubExpr - Get the child of this expression.
|
|
|
|
const MCExpr *getSubExpr() const { return Expr; }
|
|
|
|
|
2015-06-09 00:31:39 +00:00
|
|
|
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
|
2015-05-30 01:25:56 +00:00
|
|
|
bool evaluateAsRelocatableImpl(MCValue &Res,
|
2014-08-10 11:35:12 +00:00
|
|
|
const MCAsmLayout *Layout,
|
|
|
|
const MCFixup *Fixup) const override;
|
2014-06-25 15:45:33 +00:00
|
|
|
void visitUsedExpr(MCStreamer &Streamer) const override;
|
2015-05-30 01:25:56 +00:00
|
|
|
MCSection *findAssociatedSection() const override {
|
|
|
|
return getSubExpr()->findAssociatedSection();
|
2014-02-04 18:41:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// There are no TLS MipsMCExprs at the moment.
|
2014-04-29 07:58:02 +00:00
|
|
|
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
2014-02-04 18:41:57 +00:00
|
|
|
|
|
|
|
static bool classof(const MCExpr *E) {
|
|
|
|
return E->getKind() == MCExpr::Target;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|