Revert "New SIL instructions to support tail-allocated arrays in SIL."

This commit is contained in:
Dmitri Gribenko
2016-09-15 00:25:25 -07:00
committed by GitHub
parent cd07c2c125
commit fbb3cf35a5
68 changed files with 1145 additions and 1470 deletions

View File

@@ -91,9 +91,8 @@ enum class ProjectionKind : unsigned {
Upcast = 0,
RefCast = 1,
BitwiseCast = 2,
TailElems = 3,
FirstPointerKind = Upcast,
LastPointerKind = TailElems,
LastPointerKind = BitwiseCast,
// Index Projection Kinds
FirstIndexKind = 7,
@@ -125,7 +124,6 @@ static inline bool isCastProjectionKind(ProjectionKind Kind) {
case ProjectionKind::Class:
case ProjectionKind::Enum:
case ProjectionKind::Box:
case ProjectionKind::TailElems:
return false;
}
}
@@ -160,12 +158,6 @@ struct ProjectionIndex {
Aggregate = REA->getOperand();
break;
}
case ValueKind::RefTailAddrInst: {
RefTailAddrInst *REA = cast<RefTailAddrInst>(V);
Index = 0;
Aggregate = REA->getOperand();
break;
}
case ValueKind::ProjectBoxInst: {
ProjectBoxInst *PBI = cast<ProjectBoxInst>(V);
// A box has only a single payload.
@@ -301,7 +293,6 @@ public:
case ProjectionKind::Upcast:
case ProjectionKind::RefCast:
case ProjectionKind::BitwiseCast:
case ProjectionKind::TailElems:
return getCastType(BaseType);
case ProjectionKind::Index:
// Index types do not change the underlying type.
@@ -332,19 +323,13 @@ public:
SILType getCastType(SILType BaseType) const {
assert(isValid());
assert(getKind() == ProjectionKind::Upcast ||
getKind() == ProjectionKind::RefCast ||
getKind() == ProjectionKind::BitwiseCast);
auto *Ty = getPointer();
assert(Ty->isCanonical());
switch (getKind()) {
case ProjectionKind::Upcast:
case ProjectionKind::RefCast:
case ProjectionKind::BitwiseCast:
return SILType::getPrimitiveType(Ty->getCanonicalType(),
BaseType.getCategory());
case ProjectionKind::TailElems:
return SILType::getPrimitiveAddressType(Ty->getCanonicalType());
default:
llvm_unreachable("unknown cast projection type");
}
return SILType::getPrimitiveType(Ty->getCanonicalType(),
BaseType.getCategory());
}
bool operator<(const Projection &Other) const;
@@ -377,7 +362,6 @@ public:
}
case ValueKind::StructElementAddrInst:
case ValueKind::RefElementAddrInst:
case ValueKind::RefTailAddrInst:
case ValueKind::ProjectBoxInst:
case ValueKind::TupleElementAddrInst:
case ValueKind::UncheckedTakeEnumDataAddrInst:
@@ -401,8 +385,7 @@ public:
/// Returns true if this instruction projects from an object type into an
/// address subtype.
static bool isObjectToAddressProjection(SILValue V) {
return isa<RefElementAddrInst>(V) || isa<RefTailAddrInst>(V) ||
isa<ProjectBoxInst>(V);
return isa<RefElementAddrInst>(V) || isa<ProjectBoxInst>(V);
}
/// Given a specific SILType, return all first level projections if it is an
@@ -427,7 +410,6 @@ public:
case ProjectionKind::Tuple:
case ProjectionKind::Index:
case ProjectionKind::Class:
case ProjectionKind::TailElems:
case ProjectionKind::Enum:
case ProjectionKind::Box:
return false;
@@ -446,7 +428,6 @@ public:
case ProjectionKind::Tuple:
case ProjectionKind::Upcast:
case ProjectionKind::Box:
case ProjectionKind::TailElems:
return false;
}
}