Coverage Report

Created: 2025-08-30 07:19

/src/keystone/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
Line
Count
Source (jump to first uncovered line)
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_ks {
16
17
class ARMMCExpr : public MCTargetExpr {
18
public:
19
  enum VariantKind {
20
    VK_ARM_None,
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
27
      : 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
0
  static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
40
0
    return create(VK_ARM_HI16, Expr, Ctx);
41
0
  }
42
43
0
  static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
44
0
    return create(VK_ARM_LO16, Expr, Ctx);
45
0
  }
46
47
  /// @}
48
  /// @name Accessors
49
  /// @{
50
51
  /// getOpcode - Get the kind of this expression.
52
0
  VariantKind getKind() const { return Kind; }
53
54
  /// getSubExpr - Get the child of this expression.
55
0
  const MCExpr *getSubExpr() const { return Expr; }
56
57
  /// @}
58
59
  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
60
  bool evaluateAsRelocatableImpl(MCValue &Res,
61
                                 const MCAsmLayout *Layout,
62
0
                                 const MCFixup *Fixup) const override {
63
0
    return false;
64
0
  }
65
  void visitUsedExpr(MCStreamer &Streamer) const override;
66
0
  MCFragment *findAssociatedFragment() const override {
67
0
    return getSubExpr()->findAssociatedFragment();
68
0
  }
69
70
  // There are no TLS ARMMCExprs at the moment.
71
0
  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
72
73
11
  static bool classof(const MCExpr *E) {
74
11
    return E->getKind() == MCExpr::Target;
75
11
  }
76
};
77
} // end namespace llvm_ks
78
79
#endif