LLVM  8.0.1
ARMMCExpr.h
Go to the documentation of this file.
1 //===-- ARMMCExpr.h - ARM specific MC expression classes --------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
11 #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
12 
13 #include "llvm/MC/MCExpr.h"
14 
15 namespace llvm {
16 
17 class ARMMCExpr : public MCTargetExpr {
18 public:
19  enum VariantKind {
21  VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the .s file)
22  VK_ARM_LO16 // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file)
23  };
24 
25 private:
26  const VariantKind Kind;
27  const MCExpr *Expr;
28 
29  explicit ARMMCExpr(VariantKind Kind, const MCExpr *Expr)
30  : Kind(Kind), Expr(Expr) {}
31 
32 public:
33  /// @name Construction
34  /// @{
35 
36  static const ARMMCExpr *create(VariantKind Kind, const MCExpr *Expr,
37  MCContext &Ctx);
38 
39  static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
40  return create(VK_ARM_HI16, Expr, Ctx);
41  }
42 
43  static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
44  return create(VK_ARM_LO16, Expr, Ctx);
45  }
46 
47  /// @}
48  /// @name Accessors
49  /// @{
50 
51  /// getOpcode - Get the kind of this expression.
52  VariantKind getKind() const { return Kind; }
53 
54  /// getSubExpr - Get the child of this expression.
55  const MCExpr *getSubExpr() const { return Expr; }
56 
57  /// @}
58 
59  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
61  const MCAsmLayout *Layout,
62  const MCFixup *Fixup) const override {
63  return false;
64  }
65  void visitUsedExpr(MCStreamer &Streamer) const override;
66  MCFragment *findAssociatedFragment() const override {
68  }
69 
70  // There are no TLS ARMMCExprs at the moment.
71  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
72 
73  static bool classof(const MCExpr *E) {
74  return E->getKind() == MCExpr::Target;
75  }
76 };
77 } // end namespace llvm
78 
79 #endif
static bool classof(const MCExpr *E)
Definition: ARMMCExpr.h:73
This class represents lattice values for constants.
Definition: AllocatorList.h:24
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: ARMMCExpr.h:52
This represents an "assembler immediate".
Definition: MCValue.h:40
static const ARMMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.cpp:18
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: ARMMCExpr.h:60
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: ARMMCExpr.h:71
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:581
Context object for machine code objects.
Definition: MCContext.h:63
static const ARMMCExpr * createLower16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:43
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: ARMMCExpr.cpp:38
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Streaming machine code generation interface.
Definition: MCStreamer.h:189
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
MCFragment * findAssociatedFragment() const override
Definition: ARMMCExpr.h:66
ExprKind getKind() const
Definition: MCExpr.h:73
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:867
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: ARMMCExpr.cpp:23
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: ARMMCExpr.h:55
static const ARMMCExpr * createUpper16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:39
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
Target specific expression.
Definition: MCExpr.h:43