Path: blob/main/contrib/llvm-project/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
35294 views
//====- VEMCExpr.h - VE 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//===----------------------------------------------------------------------===//7//8// This file describes VE-specific MCExprs, used for modifiers like9// "%hi" or "%lo" etc.,10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_VE_MCTARGETDESC_VEMCEXPR_H14#define LLVM_LIB_TARGET_VE_MCTARGETDESC_VEMCEXPR_H1516#include "VEFixupKinds.h"17#include "llvm/MC/MCExpr.h"1819namespace llvm {2021class StringRef;22class VEMCExpr : public MCTargetExpr {23public:24enum VariantKind {25VK_VE_None,26VK_VE_REFLONG,27VK_VE_HI32,28VK_VE_LO32,29VK_VE_PC_HI32,30VK_VE_PC_LO32,31VK_VE_GOT_HI32,32VK_VE_GOT_LO32,33VK_VE_GOTOFF_HI32,34VK_VE_GOTOFF_LO32,35VK_VE_PLT_HI32,36VK_VE_PLT_LO32,37VK_VE_TLS_GD_HI32,38VK_VE_TLS_GD_LO32,39VK_VE_TPOFF_HI32,40VK_VE_TPOFF_LO32,41};4243private:44const VariantKind Kind;45const MCExpr *Expr;4647explicit VEMCExpr(VariantKind Kind, const MCExpr *Expr)48: Kind(Kind), Expr(Expr) {}4950public:51/// @name Construction52/// @{5354static const VEMCExpr *create(VariantKind Kind, const MCExpr *Expr,55MCContext &Ctx);56/// @}57/// @name Accessors58/// @{5960/// getOpcode - Get the kind of this expression.61VariantKind getKind() const { return Kind; }6263/// getSubExpr - Get the child of this expression.64const MCExpr *getSubExpr() const { return Expr; }6566/// getFixupKind - Get the fixup kind of this expression.67VE::Fixups getFixupKind() const { return getFixupKind(Kind); }6869/// @}70void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;71bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,72const MCFixup *Fixup) const override;73void visitUsedExpr(MCStreamer &Streamer) const override;74MCFragment *findAssociatedFragment() const override {75return getSubExpr()->findAssociatedFragment();76}7778void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;7980static bool classof(const MCExpr *E) {81return E->getKind() == MCExpr::Target;82}8384static VariantKind parseVariantKind(StringRef name);85static bool printVariantKind(raw_ostream &OS, VariantKind Kind);86static void printVariantKindSuffix(raw_ostream &OS, VariantKind Kind);87static VE::Fixups getFixupKind(VariantKind Kind);88};8990} // namespace llvm9192#endif939495