LLVM 19.0.0git
AMDGPUMCExpr.h
Go to the documentation of this file.
1//===- AMDGPUMCExpr.h - AMDGPU 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_AMDGPU_MCTARGETDESC_AMDGPUMCEXPR_H
10#define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCEXPR_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/MC/MCExpr.h"
14
15namespace llvm {
16
17/// AMDGPU target specific variadic MCExpr operations.
18///
19/// Takes in a minimum of 1 argument to be used with an operation. The supported
20/// operations are:
21/// - (bitwise) or
22/// - max
23///
24/// \note If the 'or'/'max' operations are provided only a single argument, the
25/// operation will act as a no-op and simply resolve as the provided argument.
26///
28public:
30
31private:
32 VariadicKind Kind;
33 MCContext &Ctx;
34 const MCExpr **RawArgs;
36
38 MCContext &Ctx);
40
41public:
42 static const AMDGPUVariadicMCExpr *
44
46 MCContext &Ctx) {
47 return create(VariadicKind::AGVK_Or, Args, Ctx);
48 }
49
51 MCContext &Ctx) {
52 return create(VariadicKind::AGVK_Max, Args, Ctx);
53 }
54
55 VariadicKind getKind() const { return Kind; }
56 const MCExpr *getSubExpr(size_t Index) const;
57
58 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
59 bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
60 const MCFixup *Fixup) const override;
61 void visitUsedExpr(MCStreamer &Streamer) const override;
62 MCFragment *findAssociatedFragment() const override;
63 void fixELFSymbolsInTLSFixups(MCAssembler &) const override{};
64
65 static bool classof(const MCExpr *E) {
66 return E->getKind() == MCExpr::Target;
67 }
68};
69
70} // end namespace llvm
71
72#endif // LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCEXPR_H
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
PowerPC TLS Dynamic Call Fixup
raw_pwrite_stream & OS
AMDGPU target specific variadic MCExpr operations.
Definition: AMDGPUMCExpr.h:27
static const AMDGPUVariadicMCExpr * create(VariadicKind Kind, ArrayRef< const MCExpr * > Args, MCContext &Ctx)
static const AMDGPUVariadicMCExpr * createMax(ArrayRef< const MCExpr * > Args, MCContext &Ctx)
Definition: AMDGPUMCExpr.h:50
static bool classof(const MCExpr *E)
Definition: AMDGPUMCExpr.h:65
VariadicKind getKind() const
Definition: AMDGPUMCExpr.h:55
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
static const AMDGPUVariadicMCExpr * createOr(ArrayRef< const MCExpr * > Args, MCContext &Ctx)
Definition: AMDGPUMCExpr.h:45
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
MCFragment * findAssociatedFragment() const override
const MCExpr * getSubExpr(size_t Index) const
void fixELFSymbolsInTLSFixups(MCAssembler &) const override
Definition: AMDGPUMCExpr.h:63
void visitUsedExpr(MCStreamer &Streamer) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
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:81
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
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
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