Path: blob/main/contrib/llvm-project/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
35294 views
//===- MipsMCExpr.h - Mips specific MC expression classes -------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H9#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H1011#include "llvm/MC/MCExpr.h"12#include "llvm/MC/MCValue.h"1314namespace llvm {1516class MipsMCExpr : public MCTargetExpr {17public:18enum MipsExprKind {19MEK_None,20MEK_CALL_HI16,21MEK_CALL_LO16,22MEK_DTPREL,23MEK_DTPREL_HI,24MEK_DTPREL_LO,25MEK_GOT,26MEK_GOTTPREL,27MEK_GOT_CALL,28MEK_GOT_DISP,29MEK_GOT_HI16,30MEK_GOT_LO16,31MEK_GOT_OFST,32MEK_GOT_PAGE,33MEK_GPREL,34MEK_HI,35MEK_HIGHER,36MEK_HIGHEST,37MEK_LO,38MEK_NEG,39MEK_PCREL_HI16,40MEK_PCREL_LO16,41MEK_TLSGD,42MEK_TLSLDM,43MEK_TPREL_HI,44MEK_TPREL_LO,45MEK_Special,46};4748private:49const MipsExprKind Kind;50const MCExpr *Expr;5152explicit MipsMCExpr(MipsExprKind Kind, const MCExpr *Expr)53: Kind(Kind), Expr(Expr) {}5455public:56static const MipsMCExpr *create(MipsExprKind Kind, const MCExpr *Expr,57MCContext &Ctx);58static const MipsMCExpr *createGpOff(MipsExprKind Kind, const MCExpr *Expr,59MCContext &Ctx);6061/// Get the kind of this expression.62MipsExprKind getKind() const { return Kind; }6364/// Get the child of this expression.65const MCExpr *getSubExpr() const { return Expr; }6667void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;68bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,69const MCFixup *Fixup) const override;70void visitUsedExpr(MCStreamer &Streamer) const override;7172MCFragment *findAssociatedFragment() const override {73return getSubExpr()->findAssociatedFragment();74}7576void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;7778static bool classof(const MCExpr *E) {79return E->getKind() == MCExpr::Target;80}8182bool isGpOff(MipsExprKind &Kind) const;83bool isGpOff() const {84MipsExprKind Kind;85return isGpOff(Kind);86}87};8889} // end namespace llvm9091#endif // LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H929394