LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 ARMMCEXPR_H
11 #define 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;
61  const MCAsmLayout *Layout) const;
62  void AddValueSymbols(MCAssembler *) const;
65  }
66 
67  // There are no TLS ARMMCExprs at the moment.
69 
70  static bool classof(const MCExpr *E) {
71  return E->getKind() == MCExpr::Target;
72  }
73 };
74 } // end namespace llvm
75 
76 #endif
static bool classof(const MCExpr *E)
Definition: ARMMCExpr.h:70
ExprKind getKind() const
Definition: MCExpr.h:61
static const ARMMCExpr * CreateLower16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:43
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: ARMMCExpr.h:52
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const
Definition: ARMMCExpr.h:68
const MCSection * FindAssociatedSection() const
Definition: ARMMCExpr.h:63
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: ARMMCExpr.h:55
void PrintImpl(raw_ostream &OS) const
Definition: ARMMCExpr.cpp:22
bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout) const
Definition: ARMMCExpr.cpp:38
const MCSection * FindAssociatedSection() const
Definition: MCExpr.cpp:743
static const ARMMCExpr * Create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.cpp:17
static const ARMMCExpr * CreateUpper16(const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.h:39
void AddValueSymbols(MCAssembler *) const
Definition: ARMMCExpr.cpp:70
Target specific expression.
Definition: MCExpr.h:38