Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h
Line
Count
Source (jump to first uncovered line)
1
//=--- X86MCExpr.h - X86 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
// This file describes X86-specific MCExprs, i.e, registers used for
10
// extended variable assignments.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCEXPR_H
15
#define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCEXPR_H
16
17
#include "X86ATTInstPrinter.h"
18
#include "llvm/MC/MCAsmInfo.h"
19
#include "llvm/MC/MCContext.h"
20
#include "llvm/MC/MCExpr.h"
21
#include "llvm/Support/ErrorHandling.h"
22
23
namespace llvm {
24
25
class X86MCExpr : public MCTargetExpr {
26
27
private:
28
  const int64_t RegNo; // All
29
30
299k
  explicit X86MCExpr(int64_t R) : RegNo(R) {}
31
32
public:
33
  /// @name Construction
34
  /// @{
35
36
299k
  static const X86MCExpr *create(int64_t RegNo, MCContext &Ctx) {
37
299k
    return new (Ctx) X86MCExpr(RegNo);
38
299k
  }
39
40
  /// @}
41
  /// @name Accessors
42
  /// @{
43
44
  /// getSubExpr - Get the child of this expression.
45
300k
  int64_t getRegNo() const { return RegNo; }
46
47
  /// @}
48
49
0
  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override {
50
0
    if (!MAI || MAI->getAssemblerDialect() == 0)
51
0
      OS << '%';
52
0
    OS << X86ATTInstPrinter::getRegisterName(RegNo);
53
0
  }
54
55
  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
56
300k
                                 const MCFixup *Fixup) const override {
57
300k
    return false;
58
300k
  }
59
  // Register values should be inlined as they are not valid .set expressions.
60
256
  bool inlineAssignedExpr() const override { return true; }
61
2
  bool isEqualTo(const MCExpr *X) const override {
62
2
    if (auto *E = dyn_cast<X86MCExpr>(X))
63
2
      return getRegNo() == E->getRegNo();
64
0
    return false;
65
0
  }
66
13
  void visitUsedExpr(MCStreamer &Streamer) const override{};
67
0
  MCFragment *findAssociatedFragment() const override { return nullptr; }
68
69
  // There are no TLS X86MCExprs at the moment.
70
0
  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
71
72
373k
  static bool classof(const MCExpr *E) {
73
373k
    return E->getKind() == MCExpr::Target;
74
373k
  }
75
};
76
77
} // end namespace llvm
78
79
#endif