Coverage Report

Created: 2017-10-03 07:32

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