Path: blob/main/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp
35294 views
//===-- SystemZMCExpr.cpp - SystemZ specific MC expression classes --------===//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#include "SystemZMCExpr.h"9#include "llvm/MC/MCContext.h"10using namespace llvm;1112#define DEBUG_TYPE "systemzmcexpr"1314const SystemZMCExpr *SystemZMCExpr::create(VariantKind Kind, const MCExpr *Expr,15MCContext &Ctx) {16return new (Ctx) SystemZMCExpr(Kind, Expr);17}1819StringRef SystemZMCExpr::getVariantKindName() const {20switch (static_cast<uint32_t>(getKind())) {21case VK_SystemZ_None:22return "A";23case VK_SystemZ_RCon:24return "R";25case VK_SystemZ_VCon:26return "V";27default:28llvm_unreachable("Invalid kind");29}30}3132void SystemZMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {33OS << getVariantKindName() << '(';34Expr->print(OS, MAI);35OS << ')';36}3738bool SystemZMCExpr::evaluateAsRelocatableImpl(MCValue &Res,39const MCAssembler *Asm,40const MCFixup *Fixup) const {41if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))42return false;4344Res =45MCValue::get(Res.getSymA(), Res.getSymB(), Res.getConstant(), getKind());4647return true;48}495051