LLVM 19.0.0git
LoongArchMCExpr.h
Go to the documentation of this file.
1//= LoongArchMCExpr.h - LoongArch specific MC expression classes -*- C++ -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file describes LoongArch-specific MCExprs, used for modifiers like
10// "%pc_hi20" or "%pc_lo12" etc.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHMCEXPR_H
15#define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHMCEXPR_H
16
17#include "llvm/MC/MCExpr.h"
18
19namespace llvm {
20
21class StringRef;
22
24public:
65 VK_LoongArch_Invalid // Must be the last item.
66 };
67
68private:
69 const MCExpr *Expr;
70 const VariantKind Kind;
71 const bool RelaxHint;
72
73 explicit LoongArchMCExpr(const MCExpr *Expr, VariantKind Kind, bool Hint)
74 : Expr(Expr), Kind(Kind), RelaxHint(Hint) {}
75
76public:
77 static const LoongArchMCExpr *create(const MCExpr *Expr, VariantKind Kind,
78 MCContext &Ctx, bool Hint = false);
79
80 VariantKind getKind() const { return Kind; }
81 const MCExpr *getSubExpr() const { return Expr; }
82 bool getRelaxHint() const { return RelaxHint; }
83
84 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
85 bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
86 const MCFixup *Fixup) const override;
87 void visitUsedExpr(MCStreamer &Streamer) const override;
90 }
91
92 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
93
94 static bool classof(const MCExpr *E) {
95 return E->getKind() == MCExpr::Target;
96 }
97
100};
101
102} // end namespace llvm
103
104#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
PowerPC TLS Dynamic Call Fixup
static const char * name
Definition: SMEABIPass.cpp:49
raw_pwrite_stream & OS
VariantKind getKind() const
const MCExpr * getSubExpr() const
static VariantKind getVariantKindForName(StringRef name)
void visitUsedExpr(MCStreamer &Streamer) const override
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
static const LoongArchMCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx, bool Hint=false)
static StringRef getVariantKindName(VariantKind Kind)
static bool classof(const MCExpr *E)
bool getRelaxHint() const
MCFragment * findAssociatedFragment() const override
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
@ Target
Target specific expression.
Definition: MCExpr.h:42
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:1062
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
Streaming machine code generation interface.
Definition: MCStreamer.h:212
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:656
This represents an "assembler immediate".
Definition: MCValue.h:36
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18