Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/BPF/BPFSubtarget.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- BPFSubtarget.cpp - BPF Subtarget Information ----------------------===//
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 implements the BPF specific subclass of TargetSubtargetInfo.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "BPFSubtarget.h"
14
#include "BPF.h"
15
#include "llvm/Support/Host.h"
16
#include "llvm/Support/TargetRegistry.h"
17
18
using namespace llvm;
19
20
#define DEBUG_TYPE "bpf-subtarget"
21
22
#define GET_SUBTARGETINFO_TARGET_DESC
23
#define GET_SUBTARGETINFO_CTOR
24
#include "BPFGenSubtargetInfo.inc"
25
26
0
void BPFSubtarget::anchor() {}
27
28
BPFSubtarget &BPFSubtarget::initializeSubtargetDependencies(StringRef CPU,
29
212
                                                            StringRef FS) {
30
212
  initializeEnvironment();
31
212
  initSubtargetFeatures(CPU, FS);
32
212
  ParseSubtargetFeatures(CPU, FS);
33
212
  return *this;
34
212
}
35
36
212
void BPFSubtarget::initializeEnvironment() {
37
212
  HasJmpExt = false;
38
212
  HasJmp32 = false;
39
212
  HasAlu32 = false;
40
212
  UseDwarfRIS = false;
41
212
}
42
43
212
void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
44
212
  if (CPU == "probe")
45
0
    CPU = sys::detail::getHostCPUNameForBPF();
46
212
  if (CPU == "generic" || CPU == "v1")
47
0
    return;
48
212
  if (CPU == "v2") {
49
3
    HasJmpExt = true;
50
3
    return;
51
3
  }
52
209
  if (CPU == "v3") {
53
0
    HasJmpExt = true;
54
0
    HasJmp32 = true;
55
0
    return;
56
0
  }
57
209
}
58
59
BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
60
                           const std::string &FS, const TargetMachine &TM)
61
    : BPFGenSubtargetInfo(TT, CPU, FS), InstrInfo(),
62
      FrameLowering(initializeSubtargetDependencies(CPU, FS)),
63
212
      TLInfo(TM, *this) {}