[flang][cuda] Adding atomicadd as a cudadevice intrinsic and converting it LLVM diale...
[llvm-project.git] / llvm / lib / Target / VE / MCTargetDesc / VEMCExpr.h
blobec71f9d852475c4f73227c06a04b2b942ab9f9ec
1 //====- VEMCExpr.h - VE 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 VE-specific MCExprs, used for modifiers like
10 // "%hi" or "%lo" etc.,
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_VE_MCTARGETDESC_VEMCEXPR_H
15 #define LLVM_LIB_TARGET_VE_MCTARGETDESC_VEMCEXPR_H
17 #include "VEFixupKinds.h"
18 #include "llvm/MC/MCExpr.h"
20 namespace llvm {
22 class StringRef;
23 class VEMCExpr : public MCTargetExpr {
24 public:
25 enum VariantKind {
26 VK_VE_None,
27 VK_VE_REFLONG,
28 VK_VE_HI32,
29 VK_VE_LO32,
30 VK_VE_PC_HI32,
31 VK_VE_PC_LO32,
32 VK_VE_GOT_HI32,
33 VK_VE_GOT_LO32,
34 VK_VE_GOTOFF_HI32,
35 VK_VE_GOTOFF_LO32,
36 VK_VE_PLT_HI32,
37 VK_VE_PLT_LO32,
38 VK_VE_TLS_GD_HI32,
39 VK_VE_TLS_GD_LO32,
40 VK_VE_TPOFF_HI32,
41 VK_VE_TPOFF_LO32,
44 private:
45 const VariantKind Kind;
46 const MCExpr *Expr;
48 explicit VEMCExpr(VariantKind Kind, const MCExpr *Expr)
49 : Kind(Kind), Expr(Expr) {}
51 public:
52 /// @name Construction
53 /// @{
55 static const VEMCExpr *create(VariantKind Kind, const MCExpr *Expr,
56 MCContext &Ctx);
57 /// @}
58 /// @name Accessors
59 /// @{
61 /// getOpcode - Get the kind of this expression.
62 VariantKind getKind() const { return Kind; }
64 /// getSubExpr - Get the child of this expression.
65 const MCExpr *getSubExpr() const { return Expr; }
67 /// getFixupKind - Get the fixup kind of this expression.
68 VE::Fixups getFixupKind() const { return getFixupKind(Kind); }
70 /// @}
71 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
72 bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
73 const MCFixup *Fixup) const override;
74 void visitUsedExpr(MCStreamer &Streamer) const override;
75 MCFragment *findAssociatedFragment() const override {
76 return getSubExpr()->findAssociatedFragment();
79 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
81 static bool classof(const MCExpr *E) {
82 return E->getKind() == MCExpr::Target;
85 static VariantKind parseVariantKind(StringRef name);
86 static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
87 static void printVariantKindSuffix(raw_ostream &OS, VariantKind Kind);
88 static VE::Fixups getFixupKind(VariantKind Kind);
91 } // namespace llvm
93 #endif