LLVM  14.0.0git
MipsMCExpr.h
Go to the documentation of this file.
1 //===- MipsMCExpr.h - Mips 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_MIPS_MCTARGETDESC_MIPSMCEXPR_H
10 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
11 
12 #include "llvm/MC/MCAsmLayout.h"
13 #include "llvm/MC/MCExpr.h"
14 #include "llvm/MC/MCValue.h"
15 
16 namespace llvm {
17 
18 class MipsMCExpr : public MCTargetExpr {
19 public:
20  enum MipsExprKind {
48  };
49 
50 private:
51  const MipsExprKind Kind;
52  const MCExpr *Expr;
53 
54  explicit MipsMCExpr(MipsExprKind Kind, const MCExpr *Expr)
55  : Kind(Kind), Expr(Expr) {}
56 
57 public:
58  static const MipsMCExpr *create(MipsExprKind Kind, const MCExpr *Expr,
59  MCContext &Ctx);
60  static const MipsMCExpr *createGpOff(MipsExprKind Kind, const MCExpr *Expr,
61  MCContext &Ctx);
62 
63  /// Get the kind of this expression.
64  MipsExprKind getKind() const { return Kind; }
65 
66  /// Get the child of this expression.
67  const MCExpr *getSubExpr() const { return Expr; }
68 
69  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
70  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
71  const MCFixup *Fixup) const override;
72  void visitUsedExpr(MCStreamer &Streamer) const override;
73 
74  MCFragment *findAssociatedFragment() const override {
76  }
77 
78  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
79 
80  static bool classof(const MCExpr *E) {
81  return E->getKind() == MCExpr::Target;
82  }
83 
84  bool isGpOff(MipsExprKind &Kind) const;
85  bool isGpOff() const {
86  MipsExprKind Kind;
87  return isGpOff(Kind);
88  }
89 };
90 
91 } // end namespace llvm
92 
93 #endif // LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
llvm::MipsMCExpr::MEK_GOT_DISP
@ MEK_GOT_DISP
Definition: MipsMCExpr.h:30
llvm::MipsMCExpr::MEK_TLSLDM
@ MEK_TLSLDM
Definition: MipsMCExpr.h:44
llvm::MipsMCExpr::MEK_GOT_OFST
@ MEK_GOT_OFST
Definition: MipsMCExpr.h:33
llvm::MipsMCExpr::MEK_HIGHER
@ MEK_HIGHER
Definition: MipsMCExpr.h:37
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MipsMCExpr::MEK_PCREL_LO16
@ MEK_PCREL_LO16
Definition: MipsMCExpr.h:42
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::MipsMCExpr::MEK_GOT_PAGE
@ MEK_GOT_PAGE
Definition: MipsMCExpr.h:34
llvm::MipsMCExpr::classof
static bool classof(const MCExpr *E)
Definition: MipsMCExpr.h:80
llvm::MipsMCExpr::visitUsedExpr
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: MipsMCExpr.cpp:220
llvm::MipsMCExpr::printImpl
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: MipsMCExpr.cpp:37
llvm::MipsMCExpr::MEK_HIGHEST
@ MEK_HIGHEST
Definition: MipsMCExpr.h:38
llvm::MCFragment
Definition: MCFragment.h:31
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
llvm::MipsMCExpr::MEK_GOT_LO16
@ MEK_GOT_LO16
Definition: MipsMCExpr.h:32
llvm::MipsMCExpr::MEK_NEG
@ MEK_NEG
Definition: MipsMCExpr.h:40
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MipsMCExpr::MEK_PCREL_HI16
@ MEK_PCREL_HI16
Definition: MipsMCExpr.h:41
llvm::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
llvm::MipsMCExpr::isGpOff
bool isGpOff() const
Definition: MipsMCExpr.h:85
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::MipsMCExpr::MEK_DTPREL_HI
@ MEK_DTPREL_HI
Definition: MipsMCExpr.h:25
llvm::MCExpr::MCExpr
MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
Definition: MCExpr.h:61
llvm::MipsMCExpr::MEK_GOT
@ MEK_GOT
Definition: MipsMCExpr.h:27
llvm::MipsMCExpr::MEK_TLSGD
@ MEK_TLSGD
Definition: MipsMCExpr.h:43
llvm::MipsMCExpr::fixELFSymbolsInTLSFixups
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: MipsMCExpr.cpp:250
llvm::MipsMCExpr::MEK_CALL_HI16
@ MEK_CALL_HI16
Definition: MipsMCExpr.h:22
llvm::MipsMCExpr::MEK_None
@ MEK_None
Definition: MipsMCExpr.h:21
llvm::MipsMCExpr::MEK_Special
@ MEK_Special
Definition: MipsMCExpr.h:47
llvm::MipsMCExpr::MEK_GOT_CALL
@ MEK_GOT_CALL
Definition: MipsMCExpr.h:29
llvm::MipsMCExpr::MEK_TPREL_LO
@ MEK_TPREL_LO
Definition: MipsMCExpr.h:46
llvm::MipsMCExpr::MEK_GOT_HI16
@ MEK_GOT_HI16
Definition: MipsMCExpr.h:31
llvm::MipsMCExpr::getSubExpr
const MCExpr * getSubExpr() const
Get the child of this expression.
Definition: MipsMCExpr.h:67
llvm::MipsMCExpr::create
static const MipsMCExpr * create(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: MipsMCExpr.cpp:27
MCAsmLayout.h
llvm::MipsMCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const override
Definition: MipsMCExpr.h:74
llvm::MipsMCExpr::MEK_DTPREL
@ MEK_DTPREL
Definition: MipsMCExpr.h:24
llvm::MipsMCExpr::MipsExprKind
MipsExprKind
Definition: MipsMCExpr.h:20
llvm::MipsMCExpr::MEK_TPREL_HI
@ MEK_TPREL_HI
Definition: MipsMCExpr.h:45
llvm::MipsMCExpr::MEK_GOTTPREL
@ MEK_GOTTPREL
Definition: MipsMCExpr.h:28
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::MipsMCExpr::MEK_LO
@ MEK_LO
Definition: MipsMCExpr.h:39
llvm::MipsMCExpr::MEK_DTPREL_LO
@ MEK_DTPREL_LO
Definition: MipsMCExpr.h:26
llvm::MipsMCExpr
Definition: MipsMCExpr.h:18
llvm::MipsMCExpr::MEK_GPREL
@ MEK_GPREL
Definition: MipsMCExpr.h:35
MCValue.h
llvm::MipsMCExpr::MEK_HI
@ MEK_HI
Definition: MipsMCExpr.h:36
llvm::MipsMCExpr::createGpOff
static const MipsMCExpr * createGpOff(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: MipsMCExpr.cpp:32
llvm::MCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:983
llvm::MipsMCExpr::evaluateAsRelocatableImpl
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: MipsMCExpr.cpp:133
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::MCTargetExpr
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:643
MCExpr.h
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::MipsMCExpr::getKind
MipsExprKind getKind() const
Get the kind of this expression.
Definition: MipsMCExpr.h:64
llvm::MipsMCExpr::MEK_CALL_LO16
@ MEK_CALL_LO16
Definition: MipsMCExpr.h:23