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