Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/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
// 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 {
19
    VK_ARM_None,
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
56.8k
      : 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
28.3k
  static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
39
28.3k
    return create(VK_ARM_HI16, Expr, Ctx);
40
28.3k
  }
41
42
28.3k
  static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
43
28.3k
    return create(VK_ARM_LO16, Expr, Ctx);
44
28.3k
  }
45
46
  /// @}
47
  /// @name Accessors
48
  /// @{
49
50
  /// getOpcode - Get the kind of this expression.
51
53.6k
  VariantKind getKind() const { return Kind; }
52
53
  /// getSubExpr - Get the child of this expression.
54
110k
  const MCExpr *getSubExpr() const { return Expr; }
55
56
  /// @}
57
58
  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
59
  bool evaluateAsRelocatableImpl(MCValue &Res,
60
                                 const MCAsmLayout *Layout,
61
0
                                 const MCFixup *Fixup) const override {
62
0
    return false;
63
0
  }
64
  void visitUsedExpr(MCStreamer &Streamer) const override;
65
0
  MCFragment *findAssociatedFragment() const override {
66
0
    return getSubExpr()->findAssociatedFragment();
67
0
  }
68
69
  // There are no TLS ARMMCExprs at the moment.
70
0
  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
71
72
244
  static bool classof(const MCExpr *E) {
73
244
    return E->getKind() == MCExpr::Target;
74
244
  }
75
};
76
} // end namespace llvm
77
78
#endif