LLVM 19.0.0git
PPCMCExpr.h
Go to the documentation of this file.
1//===-- PPCMCExpr.h - PPC 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#ifndef LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCMCEXPR_H
10#define LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCMCEXPR_H
11
12#include "llvm/MC/MCExpr.h"
13#include "llvm/MC/MCValue.h"
14
15namespace llvm {
16
17class PPCMCExpr : public MCTargetExpr {
18public:
30 };
31
32private:
33 const VariantKind Kind;
34 const MCExpr *Expr;
35
36 int64_t evaluateAsInt64(int64_t Value) const;
37
38 explicit PPCMCExpr(VariantKind Kind, const MCExpr *Expr)
39 : Kind(Kind), Expr(Expr) {}
40
41public:
42 /// @name Construction
43 /// @{
44
45 static const PPCMCExpr *create(VariantKind Kind, const MCExpr *Expr,
46 MCContext &Ctx);
47
48 static const PPCMCExpr *createLo(const MCExpr *Expr, MCContext &Ctx) {
49 return create(VK_PPC_LO, Expr, Ctx);
50 }
51
52 static const PPCMCExpr *createHi(const MCExpr *Expr, MCContext &Ctx) {
53 return create(VK_PPC_HI, Expr, Ctx);
54 }
55
56 static const PPCMCExpr *createHa(const MCExpr *Expr, MCContext &Ctx) {
57 return create(VK_PPC_HA, Expr, Ctx);
58 }
59
60 /// @}
61 /// @name Accessors
62 /// @{
63
64 /// getOpcode - Get the kind of this expression.
65 VariantKind getKind() const { return Kind; }
66
67 /// getSubExpr - Get the child of this expression.
68 const MCExpr *getSubExpr() const { return Expr; }
69
70 /// @}
71
72 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
73 bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
74 const MCFixup *Fixup) const override;
75 void visitUsedExpr(MCStreamer &Streamer) const override;
78 }
79
80 // There are no TLS PPCMCExprs at the moment.
81 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
82
83 bool evaluateAsConstant(int64_t &Res) const;
84
85 static bool classof(const MCExpr *E) {
86 return E->getKind() == MCExpr::Target;
87 }
88};
89} // end namespace llvm
90
91#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
PowerPC TLS Dynamic Call Fixup
raw_pwrite_stream & OS
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
@ Target
Target specific expression.
Definition: MCExpr.h:41
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:1030
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:213
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:652
This represents an "assembler immediate".
Definition: MCValue.h:36
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override
Definition: PPCMCExpr.cpp:102
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: PPCMCExpr.cpp:25
static const PPCMCExpr * createLo(const MCExpr *Expr, MCContext &Ctx)
Definition: PPCMCExpr.h:48
static const PPCMCExpr * createHa(const MCExpr *Expr, MCContext &Ctx)
Definition: PPCMCExpr.h:56
static bool classof(const MCExpr *E)
Definition: PPCMCExpr.h:85
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: PPCMCExpr.h:65
static const PPCMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: PPCMCExpr.cpp:20
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: PPCMCExpr.h:68
MCFragment * findAssociatedFragment() const override
Definition: PPCMCExpr.h:76
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: PPCMCExpr.cpp:171
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: PPCMCExpr.h:81
bool evaluateAsConstant(int64_t &Res) const
Definition: PPCMCExpr.cpp:62
static const PPCMCExpr * createHi(const MCExpr *Expr, MCContext &Ctx)
Definition: PPCMCExpr.h:52
LLVM Value Representation.
Definition: Value.h:74
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