Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Support/LowLevelType.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- llvm/Support/LowLevelType.cpp -------------------------------------===//
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
/// \file This file implements the more header-heavy bits of the LLT class to
10
/// avoid polluting users' namespaces.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "llvm/Support/LowLevelTypeImpl.h"
15
#include "llvm/Support/raw_ostream.h"
16
using namespace llvm;
17
18
3.05M
LLT::LLT(MVT VT) {
19
3.05M
  if (VT.isVector()) {
20
591
    init(/*IsPointer=*/false, VT.getVectorNumElements() > 1,
21
591
         VT.getVectorNumElements(), VT.getVectorElementType().getSizeInBits(),
22
591
         /*AddressSpace=*/0);
23
3.05M
  } else if (VT.isValid()) {
24
3.05M
    // Aggregates are no different from real scalars as far as GlobalISel is
25
3.05M
    // concerned.
26
3.05M
    assert(VT.getSizeInBits() != 0 && "invalid zero-sized type");
27
3.05M
    init(/*IsPointer=*/false, /*IsVector=*/false, /*NumElements=*/0,
28
3.05M
         VT.getSizeInBits(), /*AddressSpace=*/0);
29
3.05M
  } else {
30
0
    IsPointer = false;
31
0
    IsVector = false;
32
0
    RawData = 0;
33
0
  }
34
3.05M
}
35
36
84.4k
void LLT::print(raw_ostream &OS) const {
37
84.4k
  if (isVector())
38
9.95k
    OS << "<" << getNumElements() << " x " << getElementType() << ">";
39
74.4k
  else if (isPointer())
40
7.11k
    OS << "p" << getAddressSpace();
41
67.3k
  else if (isValid()) {
42
67.3k
    assert(isScalar() && "unexpected type");
43
67.3k
    OS << "s" << getScalarSizeInBits();
44
67.3k
  } else
45
0
    OS << "LLT_invalid";
46
84.4k
}
47
48
const constexpr LLT::BitFieldInfo LLT::ScalarSizeFieldInfo;
49
const constexpr LLT::BitFieldInfo LLT::PointerSizeFieldInfo;
50
const constexpr LLT::BitFieldInfo LLT::PointerAddressSpaceFieldInfo;
51
const constexpr LLT::BitFieldInfo LLT::VectorElementsFieldInfo;
52
const constexpr LLT::BitFieldInfo LLT::VectorSizeFieldInfo;
53
const constexpr LLT::BitFieldInfo LLT::PointerVectorElementsFieldInfo;
54
const constexpr LLT::BitFieldInfo LLT::PointerVectorSizeFieldInfo;
55
const constexpr LLT::BitFieldInfo LLT::PointerVectorAddressSpaceFieldInfo;