Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- LanaiMCExpr.cpp - Lanai specific MC expression classes ------------===//
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
#include "LanaiMCExpr.h"
10
#include "llvm/MC/MCAssembler.h"
11
#include "llvm/MC/MCContext.h"
12
#include "llvm/MC/MCStreamer.h"
13
using namespace llvm;
14
15
#define DEBUG_TYPE "lanaimcexpr"
16
17
const LanaiMCExpr *LanaiMCExpr::create(VariantKind Kind, const MCExpr *Expr,
18
34
                                       MCContext &Ctx) {
19
34
  return new (Ctx) LanaiMCExpr(Kind, Expr);
20
34
}
21
22
43
void LanaiMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
23
43
  if (Kind == VK_Lanai_None) {
24
23
    Expr->print(OS, MAI);
25
23
    return;
26
23
  }
27
20
28
20
  switch (Kind) {
29
20
  default:
30
0
    llvm_unreachable("Invalid kind!");
31
20
  case VK_Lanai_ABS_HI:
32
13
    OS << "hi";
33
13
    break;
34
20
  case VK_Lanai_ABS_LO:
35
7
    OS << "lo";
36
7
    break;
37
20
  }
38
20
39
20
  OS << '(';
40
20
  const MCExpr *Expr = getSubExpr();
41
20
  Expr->print(OS, MAI);
42
20
  OS << ')';
43
20
}
44
45
0
void LanaiMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
46
0
  Streamer.visitUsedExpr(*getSubExpr());
47
0
}
48
49
bool LanaiMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
50
                                            const MCAsmLayout *Layout,
51
0
                                            const MCFixup *Fixup) const {
52
0
  if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
53
0
    return false;
54
0
55
0
  Res =
56
0
      MCValue::get(Res.getSymA(), Res.getSymB(), Res.getConstant(), getKind());
57
0
58
0
  return true;
59
0
}