1 //===-- llvm/Support/LowLevelType.cpp -------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// \file This file implements the more header-heavy bits of the LLT class to
11 /// avoid polluting users' namespaces.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Support/LowLevelTypeImpl.h"
16 #include "llvm/Support/raw_ostream.h"
21 init(/*isPointer=*/false, VT.getVectorNumElements() > 1,
22 VT.getVectorNumElements(), VT.getVectorElementType().getSizeInBits(),
24 } else if (VT.isValid()) {
25 // Aggregates are no different from real scalars as far as GlobalISel is
27 assert(VT.getSizeInBits() != 0 && "invalid zero-sized type");
28 init(/*isPointer=*/false, /*isVector=*/false, /*NumElements=*/0,
29 VT.getSizeInBits(), /*AddressSpace=*/0);
37 void LLT::print(raw_ostream &OS) const {
39 OS << "<" << getNumElements() << " x " << getElementType() << ">";
41 OS << "p" << getAddressSpace();
43 assert(isScalar() && "unexpected type");
44 OS << "s" << getScalarSizeInBits();
46 llvm_unreachable("trying to print an invalid type");
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;