Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- RISCVELFStreamer.cpp - RISCV ELF Target Streamer Methods ----------===//
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 provides RISCV specific target streamer methods.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "RISCVELFStreamer.h"
14
#include "MCTargetDesc/RISCVAsmBackend.h"
15
#include "RISCVMCTargetDesc.h"
16
#include "Utils/RISCVBaseInfo.h"
17
#include "llvm/BinaryFormat/ELF.h"
18
#include "llvm/MC/MCSubtargetInfo.h"
19
20
using namespace llvm;
21
22
// This part is for ELF object output.
23
RISCVTargetELFStreamer::RISCVTargetELFStreamer(MCStreamer &S,
24
                                               const MCSubtargetInfo &STI)
25
245
    : RISCVTargetStreamer(S) {
26
245
  MCAssembler &MCA = getStreamer().getAssembler();
27
245
  const FeatureBitset &Features = STI.getFeatureBits();
28
245
  auto &MAB = static_cast<RISCVAsmBackend &>(MCA.getBackend());
29
245
  RISCVABI::ABI ABI = MAB.getTargetABI();
30
245
  assert(ABI != RISCVABI::ABI_Unknown && "Improperly initialised target ABI");
31
245
32
245
  unsigned EFlags = MCA.getELFHeaderEFlags();
33
245
34
245
  if (Features[RISCV::FeatureStdExtC])
35
49
    EFlags |= ELF::EF_RISCV_RVC;
36
245
37
245
  switch (ABI) {
38
245
  case RISCVABI::ABI_ILP32:
39
236
  case RISCVABI::ABI_LP64:
40
236
    break;
41
236
  case RISCVABI::ABI_ILP32F:
42
4
  case RISCVABI::ABI_LP64F:
43
4
    EFlags |= ELF::EF_RISCV_FLOAT_ABI_SINGLE;
44
4
    break;
45
4
  case RISCVABI::ABI_ILP32D:
46
2
  case RISCVABI::ABI_LP64D:
47
2
    EFlags |= ELF::EF_RISCV_FLOAT_ABI_DOUBLE;
48
2
    break;
49
3
  case RISCVABI::ABI_ILP32E:
50
3
    EFlags |= ELF::EF_RISCV_RVE;
51
3
    break;
52
2
  case RISCVABI::ABI_Unknown:
53
0
    llvm_unreachable("Improperly initialised target ABI");
54
245
  }
55
245
56
245
  MCA.setELFHeaderEFlags(EFlags);
57
245
}
58
59
245
MCELFStreamer &RISCVTargetELFStreamer::getStreamer() {
60
245
  return static_cast<MCELFStreamer &>(Streamer);
61
245
}
62
63
12
void RISCVTargetELFStreamer::emitDirectiveOptionPush() {}
64
12
void RISCVTargetELFStreamer::emitDirectiveOptionPop() {}
65
13
void RISCVTargetELFStreamer::emitDirectiveOptionRVC() {}
66
9
void RISCVTargetELFStreamer::emitDirectiveOptionNoRVC() {}
67
7
void RISCVTargetELFStreamer::emitDirectiveOptionRelax() {}
68
9
void RISCVTargetELFStreamer::emitDirectiveOptionNoRelax() {}