From: Eugene Zelenko Date: Fri, 17 Feb 2017 22:23:34 +0000 (+0000) Subject: [CodeGen] Revert changes in LowLevelType to pre-r295499 to fix broken buildbots. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06332794af2b169ff1f104158a64d591546e9091;p=llvm [CodeGen] Revert changes in LowLevelType to pre-r295499 to fix broken buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295505 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/LowLevelType.h b/include/llvm/CodeGen/LowLevelType.h index 77c72efe9d2..b8885c3a95f 100644 --- a/include/llvm/CodeGen/LowLevelType.h +++ b/include/llvm/CodeGen/LowLevelType.h @@ -1,4 +1,4 @@ -//===- llvm/CodeGen/GlobalISel/LowLevelType.h -------------------*- C++ -*-===// +//== llvm/CodeGen/GlobalISel/LowLevelType.h -------------------- -*- C++ -*-==// // // The LLVM Compiler Infrastructure // @@ -27,21 +27,19 @@ #ifndef LLVM_CODEGEN_GLOBALISEL_LOWLEVELTYPE_H #define LLVM_CODEGEN_GLOBALISEL_LOWLEVELTYPE_H -#include "llvm/ADT/DenseMapInfo.h" -#include "llvm/CodeGen/MachineValueType.h" #include -#include +#include "llvm/ADT/DenseMapInfo.h" +#include "llvm/CodeGen/ValueTypes.h" namespace llvm { class DataLayout; -class raw_ostream; +class LLVMContext; class Type; +class raw_ostream; class LLT { public: - friend struct DenseMapInfo; - enum TypeKind : uint16_t { Invalid, Scalar, @@ -49,19 +47,6 @@ public: Vector, }; - explicit LLT(TypeKind Kind, uint16_t NumElements, unsigned SizeInBits) - : SizeInBits(SizeInBits), ElementsOrAddrSpace(NumElements), Kind(Kind) { - assert((Kind != Vector || ElementsOrAddrSpace > 1) && - "invalid number of vector elements"); - } - - LLT() = default; - - /// Construct a low-level type based on an LLVM type. - explicit LLT(Type &Ty, const DataLayout &DL); - - explicit LLT(MVT VT); - /// Get a low-level scalar or aggregate "bag of bits". static LLT scalar(unsigned SizeInBits) { assert(SizeInBits > 0 && "invalid scalar size"); @@ -87,6 +72,19 @@ public: return LLT{Vector, NumElements, ScalarTy.getSizeInBits()}; } + explicit LLT(TypeKind Kind, uint16_t NumElements, unsigned SizeInBits) + : SizeInBits(SizeInBits), ElementsOrAddrSpace(NumElements), Kind(Kind) { + assert((Kind != Vector || ElementsOrAddrSpace > 1) && + "invalid number of vector elements"); + } + + explicit LLT() : SizeInBits(0), ElementsOrAddrSpace(0), Kind(Invalid) {} + + /// Construct a low-level type based on an LLVM type. + explicit LLT(Type &Ty, const DataLayout &DL); + + explicit LLT(MVT VT); + bool isValid() const { return Kind != Invalid; } bool isScalar() const { return Kind == Scalar; } @@ -174,10 +172,11 @@ public: bool operator!=(const LLT &RHS) const { return !(*this == RHS); } + friend struct DenseMapInfo; private: - unsigned SizeInBits = 0; - uint16_t ElementsOrAddrSpace = 0; - TypeKind Kind = Invalid; + unsigned SizeInBits; + uint16_t ElementsOrAddrSpace; + TypeKind Kind; }; inline raw_ostream& operator<<(raw_ostream &OS, const LLT &Ty) { @@ -189,22 +188,19 @@ template<> struct DenseMapInfo { static inline LLT getEmptyKey() { return LLT{LLT::Invalid, 0, -1u}; } - static inline LLT getTombstoneKey() { return LLT{LLT::Invalid, 0, -2u}; } - static inline unsigned getHashValue(const LLT &Ty) { uint64_t Val = ((uint64_t)Ty.SizeInBits << 32) | ((uint64_t)Ty.ElementsOrAddrSpace << 16) | (uint64_t)Ty.Kind; return DenseMapInfo::getHashValue(Val); } - static bool isEqual(const LLT &LHS, const LLT &RHS) { return LHS == RHS; } }; -} // end namespace llvm +} -#endif // LLVM_CODEGEN_GLOBALISEL_LOWLEVELTYPE_H +#endif diff --git a/lib/CodeGen/LowLevelType.cpp b/lib/CodeGen/LowLevelType.cpp index cc1ce79a7ea..d74b7306e0f 100644 --- a/lib/CodeGen/LowLevelType.cpp +++ b/lib/CodeGen/LowLevelType.cpp @@ -1,4 +1,4 @@ -//===- llvm/CodeGen/GlobalISel/LowLevelType.cpp ---------------------------===// +//===-- llvm/CodeGen/GlobalISel/LowLevelType.cpp --------------------------===// // // The LLVM Compiler Infrastructure // @@ -13,15 +13,9 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LowLevelType.h" -#include "llvm/CodeGen/MachineValueType.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/Type.h" -#include "llvm/Support/Casting.h" -#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" -#include - using namespace llvm; LLT::LLT(Type &Ty, const DataLayout &DL) {