summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LowLevelType.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-07-22 16:59:52 +0000
committerTim Northover <tnorthover@apple.com>2016-07-22 16:59:52 +0000
commit04e7d3ce197b9e545a1ea24e8842ff797bef5737 (patch)
treebde406dec087b7b810643f32cd29ce4bd0788928 /lib/CodeGen/LowLevelType.cpp
parent85f2423a3547578b262a9325c57870614712875a (diff)
GlobalISel: implement alloca instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LowLevelType.cpp')
-rw-r--r--lib/CodeGen/LowLevelType.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/CodeGen/LowLevelType.cpp b/lib/CodeGen/LowLevelType.cpp
index 0f696221e7c..c81535c3e10 100644
--- a/lib/CodeGen/LowLevelType.cpp
+++ b/lib/CodeGen/LowLevelType.cpp
@@ -19,26 +19,32 @@ using namespace llvm;
LLT::LLT(const Type &Ty) {
if (auto VTy = dyn_cast<VectorType>(&Ty)) {
- ScalarSize = VTy->getElementType()->getPrimitiveSizeInBits();
+ SizeOrAddrSpace = VTy->getElementType()->getPrimitiveSizeInBits();
NumElements = VTy->getNumElements();
Kind = NumElements == 1 ? Scalar : Vector;
+ } else if (auto PTy = dyn_cast<PointerType>(&Ty)) {
+ Kind = Pointer;
+ SizeOrAddrSpace = PTy->getAddressSpace();
+ NumElements = 1;
} else if (Ty.isSized()) {
// Aggregates are no different from real scalars as far as GlobalISel is
// concerned.
Kind = Scalar;
- ScalarSize = Ty.getPrimitiveSizeInBits();
+ SizeOrAddrSpace = Ty.getPrimitiveSizeInBits();
NumElements = 1;
} else {
Kind = Unsized;
- ScalarSize = NumElements = 0;
+ SizeOrAddrSpace = NumElements = 0;
}
}
void LLT::print(raw_ostream &OS) const {
if (isVector())
- OS << "<" << NumElements << " x s" << ScalarSize << ">";
+ OS << "<" << NumElements << " x s" << SizeOrAddrSpace << ">";
+ else if (isPointer())
+ OS << "p" << getAddressSpace();
else if (isSized())
- OS << "s" << ScalarSize;
+ OS << "s" << getScalarSizeInBits();
else if (isValid())
OS << "unsized";
else