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/MCAsmLayout.h"
13#include "llvm/MC/MCExpr.h"
14#include "llvm/MC/MCValue.h"
15
16namespace llvm {
17
18class PPCMCExpr : public MCTargetExpr {
19public:
31 };
32
33private:
34 const VariantKind Kind;
35 const MCExpr *Expr;
36
37 int64_t evaluateAsInt64(int64_t Value) const;
38
39 explicit PPCMCExpr(VariantKind Kind, const MCExpr *Expr)
40 : Kind(Kind), Expr(Expr) {}
41
42public:
43 /// @name Construction
44 /// @{
45
46 static const PPCMCExpr *create(VariantKind Kind, const MCExpr *Expr,
47 MCContext &Ctx);
48
49 static const PPCMCExpr *createLo(const MCExpr *Expr, MCContext &Ctx) {
50 return create(VK_PPC_LO, Expr, Ctx);
51 }
52
53 static const PPCMCExpr *createHi(const MCExpr *Expr, MCContext &Ctx) {
54 return create(VK_PPC_HI, Expr, Ctx);
55 }
56
57 static const PPCMCExpr *createHa(const MCExpr *Expr, MCContext &Ctx) {
58 return create(VK_PPC_HA, Expr, Ctx);
59 }
60
61 /// @}
62 /// @name Accessors
63 /// @{
64
65 /// getOpcode - Get the kind of this expression.
66 VariantKind getKind() const { return Kind; }
67
68 /// getSubExpr - Get the child of this expression.
69 const MCExpr *getSubExpr() const { return Expr; }
70
71 /// @}
72
73 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
75 const MCAsmLayout *Layout,
76 const MCFixup *Fixup) const override;
77 void visitUsedExpr(MCStreamer &Streamer) const override;
80 }
81
82 // There are no TLS PPCMCExprs at the moment.
83 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
84
85 bool evaluateAsConstant(int64_t &Res) const;
86
87 static bool classof(const MCExpr *E) {
88 return E->getKind() == MCExpr::Target;
89 }
90};
91} // end namespace llvm
92
93#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
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Context object for machine code objects.
Definition: MCContext.h:76
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
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:49
static const PPCMCExpr * createHa(const MCExpr *Expr, MCContext &Ctx)
Definition: PPCMCExpr.h:57
static bool classof(const MCExpr *E)
Definition: PPCMCExpr.h:87
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: PPCMCExpr.h:66
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:69
MCFragment * findAssociatedFragment() const override
Definition: PPCMCExpr.h:78
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: PPCMCExpr.cpp:103
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: PPCMCExpr.cpp:173
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: PPCMCExpr.h:83
bool evaluateAsConstant(int64_t &Res) const
Definition: PPCMCExpr.cpp:62
static const PPCMCExpr * createHi(const MCExpr *Expr, MCContext &Ctx)
Definition: PPCMCExpr.h:53
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