mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Shorten "TypeLoweringInfo" to "TypeLowering".
Swift SVN r6795
This commit is contained in:
@@ -660,7 +660,7 @@ public:
|
||||
/// Emit the instruction sequence needed to destroy (but not deallocate)
|
||||
/// a value in memory.
|
||||
void emitDestroyAddress(SILLocation Loc, SILValue addr) {
|
||||
auto &ti = F.getModule().getTypeLoweringInfo(addr.getType());
|
||||
auto &ti = F.getModule().getTypeLowering(addr.getType());
|
||||
if (ti.isTrivial())
|
||||
return;
|
||||
if (ti.isAddressOnly())
|
||||
@@ -672,10 +672,10 @@ public:
|
||||
/// Emit the instruction sequence needed to retain a value, which must not
|
||||
/// be an address.
|
||||
void emitRetainValue(SILLocation Loc, SILValue v) {
|
||||
emitRetainValueImpl(Loc, v, F.getModule().getTypeLoweringInfo(v.getType()));
|
||||
emitRetainValueImpl(Loc, v, F.getModule().getTypeLowering(v.getType()));
|
||||
}
|
||||
void emitReleaseValue(SILLocation Loc, SILValue v) {
|
||||
emitReleaseValueImpl(Loc, v, F.getModule().getTypeLoweringInfo(v.getType()));
|
||||
emitReleaseValueImpl(Loc, v, F.getModule().getTypeLowering(v.getType()));
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@@ -710,9 +710,9 @@ private:
|
||||
}
|
||||
|
||||
void emitRetainValueImpl(SILLocation Loc, SILValue v,
|
||||
const Lowering::TypeLoweringInfo &ti);
|
||||
const Lowering::TypeLowering &ti);
|
||||
void emitReleaseValueImpl(SILLocation Loc, SILValue v,
|
||||
const Lowering::TypeLoweringInfo &ti);
|
||||
const Lowering::TypeLowering &ti);
|
||||
};
|
||||
|
||||
} // end swift namespace
|
||||
|
||||
@@ -110,9 +110,9 @@ public:
|
||||
/// \brief This converts Swift types to SILTypes.
|
||||
Lowering::TypeConverter Types;
|
||||
|
||||
/// Look up the TypeLoweringInfo for a SILType.
|
||||
const Lowering::TypeLoweringInfo &getTypeLoweringInfo(SILType t) {
|
||||
return Types.getTypeLoweringInfo(t);
|
||||
/// Look up the TypeLowering for a SILType.
|
||||
const Lowering::TypeLowering &getTypeLowering(SILType t) {
|
||||
return Types.getTypeLowering(t);
|
||||
}
|
||||
|
||||
/// Construct a SIL module from a translation unit. The module will be
|
||||
|
||||
@@ -120,8 +120,8 @@ struct ReferenceTypePath {
|
||||
llvm::SmallVector<Component, 4> path;
|
||||
};
|
||||
|
||||
/// TypeLoweringInfo - Extended type information used by SILGen.
|
||||
class TypeLoweringInfo {
|
||||
/// TypeLowering - Extended type information used by SILGen.
|
||||
class TypeLowering {
|
||||
public:
|
||||
enum IsTrivial_t : bool { IsNotTrivial, IsTrivial };
|
||||
enum IsAddressOnly_t : bool { IsNotAddressOnly, IsAddressOnly };
|
||||
@@ -137,15 +137,15 @@ private:
|
||||
};
|
||||
|
||||
protected:
|
||||
TypeLoweringInfo(SILType type, IsTrivial_t isTrivial,
|
||||
IsAddressOnly_t isAddressOnly)
|
||||
TypeLowering(SILType type, IsTrivial_t isTrivial,
|
||||
IsAddressOnly_t isAddressOnly)
|
||||
: LoweredTypeAndFlags(type,
|
||||
(isTrivial ? IsTrivialFlag : 0U) |
|
||||
(isAddressOnly ? IsAddressOnlyFlag : 0U)) {}
|
||||
|
||||
public:
|
||||
TypeLoweringInfo(const TypeLoweringInfo &) = delete;
|
||||
TypeLoweringInfo &operator=(const TypeLoweringInfo &) = delete;
|
||||
TypeLowering(const TypeLowering &) = delete;
|
||||
TypeLowering &operator=(const TypeLowering &) = delete;
|
||||
|
||||
/// isAddressOnly - Returns true if the type is an address-only type. A type
|
||||
/// is address-only if it is a resilient value type, or if it is a fragile
|
||||
@@ -172,8 +172,8 @@ public:
|
||||
SILType getLoweredType() const {
|
||||
return LoweredTypeAndFlags.getPointer();
|
||||
}
|
||||
|
||||
/// Allocate a new TypeLoweringInfo using the TypeConverter's allocator.
|
||||
|
||||
/// Allocate a new TypeLowering using the TypeConverter's allocator.
|
||||
void *operator new(size_t size, TypeConverter &tc);
|
||||
|
||||
void *operator new(size_t) = delete;
|
||||
@@ -186,11 +186,11 @@ enum class UncurryDirection {
|
||||
RightToLeft
|
||||
};
|
||||
|
||||
/// TypeConverter - helper class for creating and managing TypeLoweringInfos.
|
||||
/// TypeConverter - helper class for creating and managing TypeLowerings.
|
||||
class TypeConverter {
|
||||
friend class TypeLoweringInfo;
|
||||
friend class TypeLowering;
|
||||
|
||||
llvm::BumpPtrAllocator TypeLoweringInfoBPA;
|
||||
llvm::BumpPtrAllocator TypeLoweringBPA;
|
||||
|
||||
enum : unsigned {
|
||||
/// There is a unique entry with this uncurry level in the
|
||||
@@ -204,7 +204,7 @@ class TypeConverter {
|
||||
return {t.getPointer(), uncurryLevel};
|
||||
}
|
||||
|
||||
llvm::DenseMap<TypeKey, const TypeLoweringInfo *> Types;
|
||||
llvm::DenseMap<TypeKey, const TypeLowering *> Types;
|
||||
llvm::DenseMap<SILDeclRef, SILType> constantTypes;
|
||||
|
||||
Type makeConstantType(SILDeclRef constant);
|
||||
@@ -215,8 +215,8 @@ class TypeConverter {
|
||||
Optional<CanType> NativeType##Ty;
|
||||
#include "swift/SIL/BridgedTypes.def"
|
||||
|
||||
const TypeLoweringInfo &getTypeLoweringInfoForLoweredType(CanType type);
|
||||
const TypeLoweringInfo &getTypeLoweringInfoForUncachedLoweredType(CanType type);
|
||||
const TypeLowering &getTypeLoweringForLoweredType(CanType type);
|
||||
const TypeLowering &getTypeLoweringForUncachedLoweredType(CanType type);
|
||||
|
||||
public:
|
||||
SILModule &M;
|
||||
@@ -227,18 +227,18 @@ public:
|
||||
TypeConverter(TypeConverter const &) = delete;
|
||||
TypeConverter &operator=(TypeConverter const &) = delete;
|
||||
|
||||
/// Lowers a Swift type to a SILType, and returns the SIL TypeLoweringInfo
|
||||
/// Lowers a Swift type to a SILType, and returns the SIL TypeLowering
|
||||
/// for that type.
|
||||
const TypeLoweringInfo &getTypeLoweringInfo(Type t,unsigned uncurryLevel = 0);
|
||||
const TypeLowering &getTypeLowering(Type t,unsigned uncurryLevel = 0);
|
||||
|
||||
/// Returns the SIL TypeLoweringInfo for an already lowered SILType. If the
|
||||
/// SILType is an address, returns the TypeLoweringInfo for the pointed-to
|
||||
/// Returns the SIL TypeLowering for an already lowered SILType. If the
|
||||
/// SILType is an address, returns the TypeLowering for the pointed-to
|
||||
/// type.
|
||||
const TypeLoweringInfo &getTypeLoweringInfo(SILType t);
|
||||
const TypeLowering &getTypeLowering(SILType t);
|
||||
|
||||
// Returns the lowered SIL type for a Swift type.
|
||||
SILType getLoweredType(Type t, unsigned uncurryLevel = 0) {
|
||||
return getTypeLoweringInfo(t, uncurryLevel).getLoweredType();
|
||||
return getTypeLowering(t, uncurryLevel).getLoweredType();
|
||||
}
|
||||
|
||||
/// Returns the SIL type of a constant reference.
|
||||
|
||||
@@ -204,7 +204,7 @@ static bool optimizeAllocBox(AllocBoxInst *ABI,
|
||||
ReleaseInst *LastRelease = getLastRelease(ABI, Users, Releases, PDI);
|
||||
|
||||
bool isTrivial = ABI->getModule()->Types.
|
||||
getTypeLoweringInfo(ABI->getElementType()).isTrivial();
|
||||
getTypeLowering(ABI->getElementType()).isTrivial();
|
||||
|
||||
if (LastRelease == nullptr && !isTrivial) {
|
||||
// If we can't tell where the last release is, we don't know where to insert
|
||||
|
||||
@@ -19,14 +19,14 @@ static void rrLoadableValue(SILBuilder &B, SILLocation loc, SILValue v,
|
||||
void (SILBuilder::*createRR)(SILLocation, SILValue)) {
|
||||
auto type = v.getType().getSwiftRValueType();
|
||||
|
||||
// TODO: abstract this into TypeLoweringInfo
|
||||
// TODO: abstract this into TypeLowering
|
||||
|
||||
if (auto tupleTy = dyn_cast<TupleType>(type)) {
|
||||
unsigned i = 0;
|
||||
for (auto eltTy : tupleTy.getElementTypes()) {
|
||||
auto curIndex = i++;
|
||||
auto &eltTI =
|
||||
B.getFunction().getParent()->Types.getTypeLoweringInfo(eltTy);
|
||||
B.getFunction().getParent()->Types.getTypeLowering(eltTy);
|
||||
if (eltTI.isTrivial()) continue;
|
||||
auto eltVal = B.createTupleExtract(loc, v, curIndex, eltTI.getLoweredType());
|
||||
rrLoadableValue(B, loc, eltVal, createRR);
|
||||
@@ -41,7 +41,7 @@ static void rrLoadableValue(SILBuilder &B, SILLocation loc, SILValue v,
|
||||
if (!field || field->isProperty()) continue;
|
||||
|
||||
auto &fieldTI = B.getFunction().getParent()->Types
|
||||
.getTypeLoweringInfo(field->getType());
|
||||
.getTypeLowering(field->getType());
|
||||
if (fieldTI.isTrivial()) continue;
|
||||
auto fieldVal = B.createStructExtract(loc, v, field,
|
||||
fieldTI.getLoweredType());
|
||||
@@ -55,7 +55,7 @@ static void rrLoadableValue(SILBuilder &B, SILLocation loc, SILValue v,
|
||||
}
|
||||
|
||||
void SILBuilder::emitRetainValueImpl(SILLocation loc, SILValue v,
|
||||
const TypeLoweringInfo &ti) {
|
||||
const TypeLowering &ti) {
|
||||
assert(!v.getType().isAddress() &&
|
||||
"emitRetainRValue cannot retain an address");
|
||||
if (ti.isTrivial()) return;
|
||||
@@ -64,7 +64,7 @@ void SILBuilder::emitRetainValueImpl(SILLocation loc, SILValue v,
|
||||
}
|
||||
|
||||
void SILBuilder::emitReleaseValueImpl(SILLocation loc, SILValue v,
|
||||
const TypeLoweringInfo &ti) {
|
||||
const TypeLowering &ti) {
|
||||
assert(!v.getType().isAddress() &&
|
||||
"emitReleaseRValue cannot release an address");
|
||||
if (ti.isTrivial()) return;
|
||||
|
||||
@@ -174,8 +174,8 @@ public:
|
||||
// the new.
|
||||
assert(!getType().isAddress() &&
|
||||
"can't assign loadable type from address");
|
||||
const TypeLoweringInfo &ti
|
||||
= gen.getTypeLoweringInfo(getType().getSwiftRValueType());
|
||||
const TypeLowering &ti
|
||||
= gen.getTypeLowering(getType().getSwiftRValueType());
|
||||
|
||||
SILValue old;
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
|
||||
/// Get the lowered type for a Swift type.
|
||||
SILType getLoweredType(Type t) {
|
||||
return Types.getTypeLoweringInfo(t).getLoweredType();
|
||||
return Types.getTypeLowering(t).getLoweredType();
|
||||
}
|
||||
|
||||
/// Generate the mangled symbol name for a SILDeclRef.
|
||||
@@ -356,15 +356,14 @@ public:
|
||||
SILFunction &getFunction() { return F; }
|
||||
SILBuilder &getBuilder() { return B; }
|
||||
|
||||
const TypeLoweringInfo &getTypeLoweringInfo(Type t,
|
||||
unsigned uncurryLevel = 0) {
|
||||
return SGM.Types.getTypeLoweringInfo(t, uncurryLevel);
|
||||
const TypeLowering &getTypeLowering(Type t, unsigned uncurryLevel = 0) {
|
||||
return SGM.Types.getTypeLowering(t, uncurryLevel);
|
||||
}
|
||||
SILType getLoweredType(Type t, unsigned uncurryLevel = 0) {
|
||||
return getTypeLoweringInfo(t, uncurryLevel).getLoweredType();
|
||||
return getTypeLowering(t, uncurryLevel).getLoweredType();
|
||||
}
|
||||
SILType getLoweredLoadableType(Type t, unsigned uncurryLevel = 0) {
|
||||
const TypeLoweringInfo &ti = getTypeLoweringInfo(t, uncurryLevel);
|
||||
const TypeLowering &ti = getTypeLowering(t, uncurryLevel);
|
||||
assert(ti.isLoadable() && "unexpected address-only type");
|
||||
return ti.getLoweredType();
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ ManagedValue SILGenFunction::emitApply(SILLocation Loc,
|
||||
|
||||
// Get the result type.
|
||||
Type resultTy = Fn.getType().getFunctionResultType();
|
||||
const TypeLoweringInfo &resultTI = getTypeLoweringInfo(resultTy);
|
||||
const TypeLowering &resultTI = getTypeLowering(resultTy);
|
||||
SILType instructionTy = resultTI.getLoweredType();
|
||||
|
||||
// Get the callee value.
|
||||
@@ -989,7 +989,7 @@ namespace {
|
||||
assert(substitutions.size() == 1 &&
|
||||
"destroy should have a single substitution");
|
||||
// The substitution determines the type of the thing we're destroying.
|
||||
auto &ti = gen.getTypeLoweringInfo(substitutions[0].Replacement);
|
||||
auto &ti = gen.getTypeLowering(substitutions[0].Replacement);
|
||||
|
||||
// Destroy is a no-op for trivial types.
|
||||
if (ti.isTrivial())
|
||||
|
||||
@@ -562,7 +562,7 @@ static void emitCaptureArguments(SILGenFunction &gen, ValueDecl *capture) {
|
||||
// Constants are captured by value.
|
||||
assert(!capture->getType()->is<LValueType>() &&
|
||||
"capturing byref by value?!");
|
||||
const TypeLoweringInfo &ti = gen.getTypeLoweringInfo(capture->getType());
|
||||
const TypeLowering &ti = gen.getTypeLowering(capture->getType());
|
||||
SILValue value = new (gen.SGM.M) SILArgument(ti.getLoweredType(),
|
||||
gen.F.begin());
|
||||
gen.LocalConstants[SILDeclRef(capture)] = value;
|
||||
@@ -609,7 +609,7 @@ void SILGenFunction::emitProlog(CapturingExpr *ce,
|
||||
void SILGenFunction::emitProlog(ArrayRef<Pattern *> paramPatterns,
|
||||
Type resultType) {
|
||||
// If the return type is address-only, emit the indirect return argument.
|
||||
const TypeLoweringInfo &returnTI = getTypeLoweringInfo(resultType);
|
||||
const TypeLowering &returnTI = getTypeLowering(resultType);
|
||||
if (returnTI.isAddressOnly()) {
|
||||
IndirectReturnAddress = new (SGM.M) SILArgument(returnTI.getLoweredType(),
|
||||
F.begin());
|
||||
@@ -689,7 +689,7 @@ void SILGenFunction::prepareEpilog(Type resultType) {
|
||||
// If we have a non-null, non-void, non-address-only return type, receive the
|
||||
// return value via a BB argument.
|
||||
if (resultType && !resultType->isVoid()) {
|
||||
auto &resultTI = getTypeLoweringInfo(resultType);
|
||||
auto &resultTI = getTypeLowering(resultType);
|
||||
if (!resultTI.isAddressOnly())
|
||||
new (F.getModule()) SILArgument(resultTI.getLoweredType(), epilogBB);
|
||||
}
|
||||
@@ -972,7 +972,7 @@ void SILGenFunction::destroyLocalVariable(VarDecl *vd) {
|
||||
// allocation, so load and destroy the value (or destroy it indirectly if
|
||||
// it's address-only) then deallocate the variable.
|
||||
assert(!loc.box && "fixed-lifetime var shouldn't have been given a box");
|
||||
const TypeLoweringInfo &ti = getTypeLoweringInfo(vd->getType());
|
||||
const TypeLowering &ti = getTypeLowering(vd->getType());
|
||||
if (!ti.isTrivial())
|
||||
B.createDestroyAddr(vd, loc.address);
|
||||
B.createDeallocStack(vd, loc.address);
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace {
|
||||
} // end anonymous namespace
|
||||
|
||||
ManagedValue SILGenFunction::emitManagedRValueWithCleanup(SILValue v) {
|
||||
if (getTypeLoweringInfo(v.getType().getSwiftRValueType()).isTrivial()) {
|
||||
if (getTypeLowering(v.getType().getSwiftRValueType()).isTrivial()) {
|
||||
return ManagedValue(v, ManagedValue::Unmanaged);
|
||||
} else if (v.getType().isAddressOnly(SGM.M)) {
|
||||
Cleanups.pushCleanup<CleanupMaterializedAddressOnlyValue>(v);
|
||||
@@ -414,7 +414,7 @@ Materialize SILGenFunction::emitMaterialize(SILLocation loc, ManagedValue v) {
|
||||
v.forwardInto(*this, loc, tmpMem);
|
||||
|
||||
CleanupsDepth valueCleanup = CleanupsDepth::invalid();
|
||||
if (!getTypeLoweringInfo(v.getType().getSwiftType()).isTrivial()) {
|
||||
if (!getTypeLowering(v.getType().getSwiftType()).isTrivial()) {
|
||||
Cleanups.pushCleanup<CleanupMaterializedValue>(tmpMem);
|
||||
valueCleanup = getCleanupsDepth();
|
||||
}
|
||||
@@ -1430,7 +1430,7 @@ void SILGenFunction::emitDestructor(ClassDecl *cd, DestructorDecl *dd) {
|
||||
if (VarDecl *vd = dyn_cast<VarDecl>(member)) {
|
||||
if (vd->isProperty())
|
||||
continue;
|
||||
const TypeLoweringInfo &ti = getTypeLoweringInfo(vd->getType());
|
||||
const TypeLowering &ti = getTypeLowering(vd->getType());
|
||||
if (!ti.isTrivial()) {
|
||||
SILValue addr = B.createRefElementAddr(dd, thisValue, vd,
|
||||
ti.getLoweredType().getAddressType());
|
||||
|
||||
@@ -462,46 +462,46 @@ bool SILType::isAddressOnly(CanType type, SILModule &M) {
|
||||
|
||||
namespace {
|
||||
/// A class for trivial, loadable types.
|
||||
class TrivialTypeLoweringInfo : public TypeLoweringInfo {
|
||||
class TrivialTypeLowering : public TypeLowering {
|
||||
public:
|
||||
TrivialTypeLoweringInfo(SILType type)
|
||||
: TypeLoweringInfo(type, IsTrivial, IsNotAddressOnly) {}
|
||||
TrivialTypeLowering(SILType type)
|
||||
: TypeLowering(type, IsTrivial, IsNotAddressOnly) {}
|
||||
};
|
||||
|
||||
/// A class for non-trivial but loadable types.
|
||||
class ScalarTypeLoweringInfo : public TypeLoweringInfo {
|
||||
class ScalarTypeLowering : public TypeLowering {
|
||||
public:
|
||||
ScalarTypeLoweringInfo(SILType type)
|
||||
: TypeLoweringInfo(type, IsNotTrivial, IsNotAddressOnly) {}
|
||||
ScalarTypeLowering(SILType type)
|
||||
: TypeLowering(type, IsNotTrivial, IsNotAddressOnly) {}
|
||||
};
|
||||
|
||||
/// A class for non-trivial, address-only types.
|
||||
class AddressOnlyTypeLoweringInfo : public TypeLoweringInfo {
|
||||
class AddressOnlyTypeLowering : public TypeLowering {
|
||||
public:
|
||||
AddressOnlyTypeLoweringInfo(SILType type)
|
||||
: TypeLoweringInfo(type, IsNotTrivial, IsAddressOnly) {}
|
||||
AddressOnlyTypeLowering(SILType type)
|
||||
: TypeLowering(type, IsNotTrivial, IsAddressOnly) {}
|
||||
};
|
||||
|
||||
/// Build the appropriate TypeLoweringInfo subclass for the given type.
|
||||
/// Build the appropriate TypeLowering subclass for the given type.
|
||||
class LowerType :
|
||||
public TypeClassifierBase<LowerType, const TypeLoweringInfo *> {
|
||||
public TypeClassifierBase<LowerType, const TypeLowering *> {
|
||||
TypeConverter &TC;
|
||||
public:
|
||||
LowerType(TypeConverter &TC) : TypeClassifierBase(TC.M), TC(TC) {}
|
||||
|
||||
const TypeLoweringInfo *handleTrivial(CanType type) {
|
||||
const TypeLowering *handleTrivial(CanType type) {
|
||||
auto silType = SILType::getPrimitiveType(type, false);
|
||||
return new (TC) TrivialTypeLoweringInfo(silType);
|
||||
return new (TC) TrivialTypeLowering(silType);
|
||||
}
|
||||
|
||||
const TypeLoweringInfo *handleScalar(CanType type) {
|
||||
const TypeLowering *handleScalar(CanType type) {
|
||||
auto silType = SILType::getPrimitiveType(type, false);
|
||||
return new (TC) ScalarTypeLoweringInfo(silType);
|
||||
return new (TC) ScalarTypeLowering(silType);
|
||||
}
|
||||
|
||||
const TypeLoweringInfo *handleAddressOnly(CanType type) {
|
||||
const TypeLowering *handleAddressOnly(CanType type) {
|
||||
auto silType = SILType::getPrimitiveType(type, true);
|
||||
return new (TC) AddressOnlyTypeLoweringInfo(silType);
|
||||
return new (TC) AddressOnlyTypeLowering(silType);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -512,27 +512,27 @@ TypeConverter::TypeConverter(SILModule &m)
|
||||
|
||||
TypeConverter::~TypeConverter() {
|
||||
// The bump pointer allocator destructor will deallocate but not destroy all
|
||||
// our TypeLoweringInfos.
|
||||
// our TypeLowerings.
|
||||
for (auto &ti : Types) {
|
||||
// Destroy only the unique entries.
|
||||
CanType srcType = CanType(ti.first.first);
|
||||
CanType mappedType = ti.second->getLoweredType().getSwiftRValueType();
|
||||
if (srcType == mappedType || isa<LValueType>(srcType))
|
||||
ti.second->~TypeLoweringInfo();
|
||||
ti.second->~TypeLowering();
|
||||
}
|
||||
}
|
||||
|
||||
void *TypeLoweringInfo::operator new(size_t size, TypeConverter &tc) {
|
||||
return tc.TypeLoweringInfoBPA.Allocate<TypeLoweringInfo>();
|
||||
void *TypeLowering::operator new(size_t size, TypeConverter &tc) {
|
||||
return tc.TypeLoweringBPA.Allocate<TypeLowering>();
|
||||
}
|
||||
|
||||
const TypeLoweringInfo &
|
||||
TypeConverter::getTypeLoweringInfo(Type origType, unsigned uncurryLevel) {
|
||||
const TypeLowering &
|
||||
TypeConverter::getTypeLowering(Type origType, unsigned uncurryLevel) {
|
||||
CanType type = origType->getCanonicalType();
|
||||
auto key = getTypeKey(type, uncurryLevel);
|
||||
auto existing = Types.find(key);
|
||||
if (existing != Types.end()) {
|
||||
assert(existing->second && "reentered getTypeLoweringInfo");
|
||||
assert(existing->second && "reentered getTypeLowering");
|
||||
return *existing->second;
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ TypeConverter::getTypeLoweringInfo(Type origType, unsigned uncurryLevel) {
|
||||
SILType loweredType =
|
||||
getLoweredType(objectType, uncurryLevel).getAddressType();
|
||||
|
||||
auto *theInfo = new (*this) TrivialTypeLoweringInfo(loweredType);
|
||||
auto *theInfo = new (*this) TrivialTypeLowering(loweredType);
|
||||
Types[key] = theInfo;
|
||||
return *theInfo;
|
||||
}
|
||||
@@ -558,7 +558,7 @@ TypeConverter::getTypeLoweringInfo(Type origType, unsigned uncurryLevel) {
|
||||
// If the lowering process changed the type, re-check the cache
|
||||
// and add a cache entry for the unlowered type.
|
||||
if (loweredType != type) {
|
||||
auto &typeInfo = getTypeLoweringInfoForLoweredType(loweredType);
|
||||
auto &typeInfo = getTypeLoweringForLoweredType(loweredType);
|
||||
Types[key] = &typeInfo;
|
||||
return typeInfo;
|
||||
}
|
||||
@@ -569,16 +569,16 @@ TypeConverter::getTypeLoweringInfo(Type origType, unsigned uncurryLevel) {
|
||||
// The Swift type directly corresponds to the lowered type; don't
|
||||
// re-check the cache.
|
||||
assert(uncurryLevel == 0);
|
||||
return getTypeLoweringInfoForUncachedLoweredType(type);
|
||||
return getTypeLoweringForUncachedLoweredType(type);
|
||||
}
|
||||
|
||||
const TypeLoweringInfo &
|
||||
TypeConverter::getTypeLoweringInfo(SILType type) {
|
||||
return getTypeLoweringInfoForLoweredType(type.getSwiftRValueType());
|
||||
const TypeLowering &
|
||||
TypeConverter::getTypeLowering(SILType type) {
|
||||
return getTypeLoweringForLoweredType(type.getSwiftRValueType());
|
||||
}
|
||||
|
||||
const TypeLoweringInfo &
|
||||
TypeConverter::getTypeLoweringInfoForLoweredType(CanType type) {
|
||||
const TypeLowering &
|
||||
TypeConverter::getTypeLoweringForLoweredType(CanType type) {
|
||||
assert(!isa<LValueType>(type) && "didn't lower out l-value type?");
|
||||
|
||||
// Re-using uncurry level 0 is reasonable because our uncurrying
|
||||
@@ -587,16 +587,16 @@ TypeConverter::getTypeLoweringInfoForLoweredType(CanType type) {
|
||||
auto key = getTypeKey(type, 0);
|
||||
auto existing = Types.find(key);
|
||||
if (existing != Types.end()) {
|
||||
assert(existing->second && "reentered getTypeLoweringInfoForLoweredType");
|
||||
assert(existing->second && "reentered getTypeLoweringForLoweredType");
|
||||
return *existing->second;
|
||||
}
|
||||
|
||||
return getTypeLoweringInfoForUncachedLoweredType(type);
|
||||
return getTypeLoweringForUncachedLoweredType(type);
|
||||
}
|
||||
|
||||
/// Do type-lowering for a lowered type which is not already in the cache.
|
||||
const TypeLoweringInfo &
|
||||
TypeConverter::getTypeLoweringInfoForUncachedLoweredType(CanType type) {
|
||||
const TypeLowering &
|
||||
TypeConverter::getTypeLoweringForUncachedLoweredType(CanType type) {
|
||||
auto key = getTypeKey(type, 0);
|
||||
assert(!Types.count(key) && "re-entrant or already cached");
|
||||
assert(!isa<LValueType>(type) && "didn't lower out l-value type?");
|
||||
@@ -654,7 +654,7 @@ SILType TypeConverter::getConstantType(SILDeclRef constant) {
|
||||
AbstractCC cc = getAbstractCC(constant);
|
||||
Type swiftTy = getThinFunctionType(makeConstantType(constant), cc);
|
||||
SILType loweredTy
|
||||
= getTypeLoweringInfo(swiftTy, constant.uncurryLevel).getLoweredType();
|
||||
= getTypeLowering(swiftTy, constant.uncurryLevel).getLoweredType();
|
||||
DEBUG(llvm::dbgs() << "constant ";
|
||||
constant.print(llvm::dbgs());
|
||||
llvm::dbgs() << " has type ";
|
||||
|
||||
Reference in New Issue
Block a user