mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #81286 from eeckstein/temprvalue-opt
TempRValueElimination: re-implement the pass in swift
This commit is contained in:
@@ -732,6 +732,7 @@ struct BridgedInstruction {
|
||||
BRIDGED_INLINE bool IndexAddrInst_needsStackProtection() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedConformanceArray InitExistentialRefInst_getConformances() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType InitExistentialRefInst_getFormalConcreteType() const;
|
||||
BRIDGED_INLINE bool OpenExistentialAddr_isImmutable() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar GlobalAccessInst_getGlobal() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar AllocGlobalInst_getGlobal() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedFunction FunctionRefBaseInst_getReferencedFunction() const;
|
||||
@@ -791,6 +792,7 @@ struct BridgedInstruction {
|
||||
BRIDGED_INLINE SwiftInt BeginApplyInst_numArguments() const;
|
||||
BRIDGED_INLINE bool BeginApplyInst_isCalleeAllocated() const;
|
||||
BRIDGED_INLINE SwiftInt TryApplyInst_numArguments() const;
|
||||
BRIDGED_INLINE BridgedArgumentConvention YieldInst_getConvention(BridgedOperand forOperand) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedBasicBlock BranchInst_getTargetBlock() const;
|
||||
BRIDGED_INLINE SwiftInt SwitchEnumInst_getNumCases() const;
|
||||
BRIDGED_INLINE SwiftInt SwitchEnumInst_getCaseIndex(SwiftInt idx) const;
|
||||
@@ -807,6 +809,8 @@ struct BridgedInstruction {
|
||||
BRIDGED_INLINE bool BeginAccessInst_isUnsafe() const;
|
||||
BRIDGED_INLINE bool CopyAddrInst_isTakeOfSrc() const;
|
||||
BRIDGED_INLINE bool CopyAddrInst_isInitializationOfDest() const;
|
||||
BRIDGED_INLINE void CopyAddrInst_setIsTakeOfSrc(bool isTakeOfSrc) const;
|
||||
BRIDGED_INLINE void CopyAddrInst_setIsInitializationOfDest(bool isInitializationOfDest) const;
|
||||
BRIDGED_INLINE bool ExplicitCopyAddrInst_isTakeOfSrc() const;
|
||||
BRIDGED_INLINE bool ExplicitCopyAddrInst_isInitializationOfDest() const;
|
||||
BRIDGED_INLINE SwiftInt MarkUninitializedInst_getKind() const;
|
||||
|
||||
@@ -1144,6 +1144,13 @@ BridgedCanType BridgedInstruction::InitExistentialRefInst_getFormalConcreteType(
|
||||
return getAs<swift::InitExistentialRefInst>()->getFormalConcreteType();
|
||||
}
|
||||
|
||||
bool BridgedInstruction::OpenExistentialAddr_isImmutable() const {
|
||||
switch (getAs<swift::OpenExistentialAddrInst>()->getAccessKind()) {
|
||||
case swift::OpenedExistentialAccess::Immutable: return true;
|
||||
case swift::OpenedExistentialAccess::Mutable: return false;
|
||||
}
|
||||
}
|
||||
|
||||
BridgedGlobalVar BridgedInstruction::GlobalAccessInst_getGlobal() const {
|
||||
return {getAs<swift::GlobalAccessInst>()->getReferencedGlobal()};
|
||||
}
|
||||
@@ -1381,6 +1388,10 @@ SwiftInt BridgedInstruction::TryApplyInst_numArguments() const {
|
||||
return getAs<swift::TryApplyInst>()->getNumArguments();
|
||||
}
|
||||
|
||||
BridgedArgumentConvention BridgedInstruction::YieldInst_getConvention(BridgedOperand forOperand) const {
|
||||
return castToArgumentConvention(getAs<swift::YieldInst>()->getArgumentConventionForOperand(*forOperand.op));
|
||||
}
|
||||
|
||||
BridgedBasicBlock BridgedInstruction::BranchInst_getTargetBlock() const {
|
||||
return {getAs<swift::BranchInst>()->getDestBB()};
|
||||
}
|
||||
@@ -1446,6 +1457,15 @@ bool BridgedInstruction::CopyAddrInst_isInitializationOfDest() const {
|
||||
return getAs<swift::CopyAddrInst>()->isInitializationOfDest();
|
||||
}
|
||||
|
||||
void BridgedInstruction::CopyAddrInst_setIsTakeOfSrc(bool isTakeOfSrc) const {
|
||||
return getAs<swift::CopyAddrInst>()->setIsTakeOfSrc(isTakeOfSrc ? swift::IsTake : swift::IsNotTake);
|
||||
}
|
||||
|
||||
void BridgedInstruction::CopyAddrInst_setIsInitializationOfDest(bool isInitializationOfDest) const {
|
||||
return getAs<swift::CopyAddrInst>()->setIsInitializationOfDest(
|
||||
isInitializationOfDest ? swift::IsInitialization : swift::IsNotInitialization);
|
||||
}
|
||||
|
||||
bool BridgedInstruction::ExplicitCopyAddrInst_isTakeOfSrc() const {
|
||||
return getAs<swift::ExplicitCopyAddrInst>()->isTakeOfSrc();
|
||||
}
|
||||
|
||||
@@ -140,6 +140,9 @@ PASS(StackPromotion, "stack-promotion",
|
||||
"Stack Promotion of Class Objects")
|
||||
PASS(UpdateBorrowedFrom, "update-borrowed-from",
|
||||
"Test pass for update borrowed-from instructions")
|
||||
PASS(TempRValueElimination, "temp-rvalue-elimination",
|
||||
"Remove short-lived immutable temporary copies")
|
||||
|
||||
// NOTE - ExperimentalSwiftBasedClosureSpecialization and AutodiffClosureSpecialization are a WIP
|
||||
PASS(ExperimentalSwiftBasedClosureSpecialization, "experimental-swift-based-closure-specialization",
|
||||
"General closure-specialization pass written in Swift")
|
||||
@@ -403,8 +406,6 @@ LEGACY_PASS(RawSILInstLowering, "raw-sil-inst-lowering",
|
||||
"Lower all raw SIL instructions to canonical equivalents.")
|
||||
LEGACY_PASS(TempLValueOpt, "temp-lvalue-opt",
|
||||
"Remove short-lived immutable temporary l-values")
|
||||
LEGACY_PASS(TempRValueOpt, "temp-rvalue-opt",
|
||||
"Remove short-lived immutable temporary copies")
|
||||
LEGACY_PASS(IRGenPrepare, "irgen-prepare",
|
||||
"Cleanup SIL in preparation for IRGen")
|
||||
LEGACY_PASS(SendNonSendable, "send-non-sendable",
|
||||
|
||||
Reference in New Issue
Block a user