From c8a458ed1dbe456514f737a7cf4f885a2c1954ba Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Sat, 16 Dec 2017 18:28:11 -0500 Subject: [PATCH] [SIL] NFC: Repack misc CopyAddrInst bits --- include/swift/SIL/SILInstruction.h | 21 +++++++-------------- include/swift/SIL/SILNode.h | 11 +++++++++++ lib/SIL/SILInstructions.cpp | 8 +++++--- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/include/swift/SIL/SILInstruction.h b/include/swift/SIL/SILInstruction.h index a29d5232392..423272336bd 100644 --- a/include/swift/SIL/SILInstruction.h +++ b/include/swift/SIL/SILInstruction.h @@ -3747,16 +3747,6 @@ public: }; private: - // FIXME: compress storage - - /// IsTakeOfSrc - True if ownership will be taken from the value at the source - /// memory location. - unsigned IsTakeOfSrc : 1; - - /// IsInitializationOfDest - True if this is the initialization of the - /// uninitialized destination memory location. - unsigned IsInitializationOfDest : 1; - FixedOperandList<2> Operands; CopyAddrInst(SILDebugLocation DebugLoc, SILValue Src, SILValue Dest, @@ -3769,16 +3759,19 @@ public: void setSrc(SILValue V) { Operands[Src].set(V); } void setDest(SILValue V) { Operands[Dest].set(V); } - IsTake_t isTakeOfSrc() const { return IsTake_t(IsTakeOfSrc); } + IsTake_t isTakeOfSrc() const { + return IsTake_t(SILInstruction::Bits.CopyAddrInst.IsTakeOfSrc); + } IsInitialization_t isInitializationOfDest() const { - return IsInitialization_t(IsInitializationOfDest); + return IsInitialization_t( + SILInstruction::Bits.CopyAddrInst.IsInitializationOfDest); } void setIsTakeOfSrc(IsTake_t T) { - IsTakeOfSrc = (bool)T; + SILInstruction::Bits.CopyAddrInst.IsTakeOfSrc = (bool)T; } void setIsInitializationOfDest(IsInitialization_t I) { - IsInitializationOfDest = (bool)I; + SILInstruction::Bits.CopyAddrInst.IsInitializationOfDest = (bool)I; } ArrayRef getAllOperands() const { return Operands.asArray(); } diff --git a/include/swift/SIL/SILNode.h b/include/swift/SIL/SILNode.h index 3f4690fef6a..9fd46ed2d84 100644 --- a/include/swift/SIL/SILNode.h +++ b/include/swift/SIL/SILNode.h @@ -162,6 +162,16 @@ protected: atomicity : 1 ); + SWIFT_INLINE_BITFIELD(CopyAddrInst, NonValueInstruction, 1+1, + /// IsTakeOfSrc - True if ownership will be taken from the value at the + /// source memory location. + IsTakeOfSrc : 1, + + /// IsInitializationOfDest - True if this is the initialization of the + /// uninitialized destination memory location. + IsInitializationOfDest : 1 + ); + SWIFT_INLINE_BITFIELD(LoadReferenceInstBaseT, NonValueInstruction, 1, IsTake : 1; template @@ -240,6 +250,7 @@ protected: SWIFT_INLINE_BITS(StoreReferenceInstBaseT); SWIFT_INLINE_BITS(LoadReferenceInstBaseT); SWIFT_INLINE_BITS(StrongPinInst); + SWIFT_INLINE_BITS(CopyAddrInst); } Bits; private: diff --git a/lib/SIL/SILInstructions.cpp b/lib/SIL/SILInstructions.cpp index 9c6f3a93f16..fb344d6f55e 100644 --- a/lib/SIL/SILInstructions.cpp +++ b/lib/SIL/SILInstructions.cpp @@ -849,9 +849,11 @@ StrongPinInst::StrongPinInst(SILDebugLocation Loc, SILValue operand, CopyAddrInst::CopyAddrInst(SILDebugLocation Loc, SILValue SrcLValue, SILValue DestLValue, IsTake_t isTakeOfSrc, IsInitialization_t isInitializationOfDest) - : InstructionBase(Loc), IsTakeOfSrc(isTakeOfSrc), - IsInitializationOfDest(isInitializationOfDest), - Operands(this, SrcLValue, DestLValue) {} + : InstructionBase(Loc), Operands(this, SrcLValue, DestLValue) { + SILInstruction::Bits.CopyAddrInst.IsTakeOfSrc = bool(isTakeOfSrc); + SILInstruction::Bits.CopyAddrInst.IsInitializationOfDest = + bool(isInitializationOfDest); + } BindMemoryInst * BindMemoryInst::create(SILDebugLocation Loc, SILValue Base, SILValue Index,