Path: blob/main/contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h
35294 views
//=--- X86MCExpr.h - X86 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 X86-specific MCExprs, i.e, registers used for9// extended variable assignments.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCEXPR_H14#define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCEXPR_H1516#include "X86ATTInstPrinter.h"17#include "llvm/MC/MCAsmInfo.h"18#include "llvm/MC/MCContext.h"19#include "llvm/MC/MCExpr.h"20#include "llvm/Support/Casting.h"21#include "llvm/Support/ErrorHandling.h"2223namespace llvm {2425class X86MCExpr : public MCTargetExpr {2627private:28const int64_t RegNo; // All2930explicit X86MCExpr(int64_t R) : RegNo(R) {}3132public:33/// @name Construction34/// @{3536static const X86MCExpr *create(int64_t RegNo, MCContext &Ctx) {37return new (Ctx) X86MCExpr(RegNo);38}3940/// @}41/// @name Accessors42/// @{4344/// getSubExpr - Get the child of this expression.45int64_t getRegNo() const { return RegNo; }4647/// @}4849void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override {50if (!MAI || MAI->getAssemblerDialect() == 0)51OS << '%';52OS << X86ATTInstPrinter::getRegisterName(RegNo);53}5455bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,56const MCFixup *Fixup) const override {57return false;58}59// Register values should be inlined as they are not valid .set expressions.60bool inlineAssignedExpr() const override { return true; }61bool isEqualTo(const MCExpr *X) const override {62if (auto *E = dyn_cast<X86MCExpr>(X))63return getRegNo() == E->getRegNo();64return false;65}66void visitUsedExpr(MCStreamer &Streamer) const override {}67MCFragment *findAssociatedFragment() const override { return nullptr; }6869// There are no TLS X86MCExprs at the moment.70void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}7172static bool classof(const MCExpr *E) {73return E->getKind() == MCExpr::Target;74}75};7677} // end namespace llvm7879#endif808182