LLVM  14.0.0git
ARMMCExpr.h
Go to the documentation of this file.
1 //===-- ARMMCExpr.h - ARM 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_ARM_MCTARGETDESC_ARMMCEXPR_H
10 #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
11 
12 #include "llvm/MC/MCExpr.h"
13 
14 namespace llvm {
15 
16 class ARMMCExpr : public MCTargetExpr {
17 public:
18  enum VariantKind {
20  VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the .s file)
21  VK_ARM_LO16 // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file)
22  };
23 
24 private:
25  const VariantKind Kind;
26  const MCExpr *Expr;
27 
28  explicit ARMMCExpr(VariantKind Kind, const MCExpr *Expr)
29  : Kind(Kind), Expr(Expr) {}
30 
31 public:
32  /// @name Construction
33  /// @{
34 
35  static const ARMMCExpr *create(VariantKind Kind, const MCExpr *Expr,
36  MCContext &Ctx);
37 
38  static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
39  return create(VK_ARM_HI16, Expr, Ctx);
40  }
41 
42  static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
43  return create(VK_ARM_LO16, Expr, Ctx);
44  }
45 
46  /// @}
47  /// @name Accessors
48  /// @{
49 
50  /// getOpcode - Get the kind of this expression.
51  VariantKind getKind() const { return Kind; }
52 
53  /// getSubExpr - Get the child of this expression.
54  const MCExpr *getSubExpr() const { return Expr; }
55 
56  /// @}
57 
58  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
60  const MCAsmLayout *Layout,
61  const MCFixup *Fixup) const override {
62  return false;
63  }
64  void visitUsedExpr(MCStreamer &Streamer) const override;
65  MCFragment *findAssociatedFragment() const override {
67  }
68 
69  // There are no TLS ARMMCExprs at the moment.
70  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
71 
72  static bool classof(const MCExpr *E) {
73  return E->getKind() == MCExpr::Target;
74  }
75 };
76 } // end namespace llvm
77 
78 #endif
llvm::ARMMCExpr::printImpl
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: ARMMCExpr.cpp:22
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::ARMMCExpr::visitUsedExpr
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: ARMMCExpr.cpp:37
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::ARMMCExpr::findAssociatedFragment
MCFragment * findAssociatedFragment() const override
Definition: ARMMCExpr.h:65
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::ARMMCExpr::getKind
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: ARMMCExpr.h:51
llvm::ARMMCExpr::VariantKind
VariantKind
Definition: ARMMCExpr.h:18
llvm::ARMMCExpr::createUpper16
static const ARMMCExpr * createUpper16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:38
llvm::MCFragment
Definition: MCFragment.h:31
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
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::ARMMCExpr::getSubExpr
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: ARMMCExpr.h:54
llvm::ARMMCExpr::evaluateAsRelocatableImpl
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: ARMMCExpr.h:59
llvm::ARMMCExpr::fixELFSymbolsInTLSFixups
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: ARMMCExpr.h:70
llvm::ARMMCExpr::VK_ARM_None
@ VK_ARM_None
Definition: ARMMCExpr.h:19
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::MCExpr::MCExpr
MCExpr(ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
Definition: MCExpr.h:61
llvm::ARMMCExpr
Definition: ARMMCExpr.h:16
llvm::ARMMCExpr::VK_ARM_LO16
@ VK_ARM_LO16
Definition: ARMMCExpr.h:21
llvm::ARMMCExpr::classof
static bool classof(const MCExpr *E)
Definition: ARMMCExpr.h:72
llvm::ARMMCExpr::create
static const ARMMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.cpp:17
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::ARMMCExpr::VK_ARM_HI16
@ VK_ARM_HI16
Definition: ARMMCExpr.h:20
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::ARMMCExpr::createLower16
static const ARMMCExpr * createLower16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:42
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