Skip to content

Commit 6a4786e

Browse files
committed
IRGen: Add IRGenFunction::getTypeLowering()
1 parent 5a35160 commit 6a4786e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/IRGen/GenOpaque.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "swift/AST/IRGenOptions.h"
2727
#include "swift/ABI/MetadataValues.h"
2828
#include "swift/IRGen/ValueWitness.h"
29+
#include "swift/SIL/TypeLowering.h"
2930

3031
#include "Callee.h"
3132
#include "Explosion.h"
@@ -719,7 +720,7 @@ void irgen::emitDestroyArrayCall(IRGenFunction &IGF,
719720
Address object,
720721
llvm::Value *count) {
721722
// If T is a trivial/POD type, nothing needs to be done.
722-
if (T.getObjectType().isTrivial(IGF.getSILModule()))
723+
if (IGF.IGM.getTypeLowering(T).isTrivial())
723724
return;
724725

725726
auto metadata = IGF.emitTypeMetadataRefForLayout(T);
@@ -994,7 +995,7 @@ void irgen::emitDestroyCall(IRGenFunction &IGF,
994995
SILType T,
995996
Address object) {
996997
// If T is a trivial/POD type, nothing needs to be done.
997-
if (T.getObjectType().isTrivial(IGF.getSILModule()))
998+
if (IGF.IGM.getTypeLowering(T).isTrivial())
998999
return;
9991000
llvm::Value *metadata;
10001001
auto fn = IGF.emitValueWitnessFunctionRef(T, metadata,

lib/IRGen/GenType.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,13 @@ SILType IRGenModule::getLoweredType(Type subst) const {
14461446
ResilienceExpansion::Minimal);
14471447
}
14481448

1449+
/// Return the SIL-lowering of the given type.
1450+
const Lowering::TypeLowering &IRGenModule::getTypeLowering(SILType type) const {
1451+
// FIXME: Expansion
1452+
return getSILTypes().getTypeLowering(type,
1453+
ResilienceExpansion::Minimal);
1454+
}
1455+
14491456
bool IRGenModule::isTypeABIAccessible(SILType type) const {
14501457
// FIXME: Expansion
14511458
return getSILModule().isTypeABIAccessible(type,

lib/IRGen/IRGenModule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ class IRGenModule {
749749

750750
SILType getLoweredType(AbstractionPattern orig, Type subst) const;
751751
SILType getLoweredType(Type subst) const;
752+
const Lowering::TypeLowering &getTypeLowering(SILType type) const;
752753
bool isTypeABIAccessible(SILType type) const;
753754

754755
const TypeInfo &getTypeInfoForUnlowered(AbstractionPattern orig,

0 commit comments

Comments
 (0)