File tree Expand file tree Collapse file tree 5 files changed +45
-4
lines changed
SwiftCompilerSources/Sources Expand file tree Collapse file tree 5 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -747,6 +747,14 @@ extension LoadInst {
747747 }
748748}
749749
750+ extension PointerToAddressInst {
751+ func set( alignment: Int ? , _ context: some MutatingContext ) {
752+ context. notifyInstructionsChanged ( )
753+ bridged. PointerToAddressInst_setAlignment ( UInt64 ( alignment ?? 0 ) )
754+ context. notifyInstructionChanged ( self )
755+ }
756+ }
757+
750758extension TermInst {
751759 func replaceBranchTarget( from fromBlock: BasicBlock , to toBlock: BasicBlock , _ context: some MutatingContext ) {
752760 context. notifyBranchesChanged ( )
Original file line number Diff line number Diff line change @@ -717,6 +717,15 @@ final public
717717class PointerToAddressInst : SingleValueInstruction , UnaryInstruction {
718718 public var pointer : Value { operand. value }
719719 public var isStrict : Bool { bridged. PointerToAddressInst_isStrict ( ) }
720+ public var isInvariant : Bool { bridged. PointerToAddressInst_isInvariant ( ) }
721+
722+ public var alignment : Int ? {
723+ let maybeAlign = bridged. PointerToAddressInst_getAlignment ( )
724+ if maybeAlign == 0 {
725+ return nil
726+ }
727+ return Int ( exactly: maybeAlign)
728+ }
720729}
721730
722731final public
Original file line number Diff line number Diff line change @@ -720,6 +720,9 @@ struct BridgedInstruction {
720720 BRIDGED_INLINE IntrinsicID BuiltinInst_getIntrinsicID () const ;
721721 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap BuiltinInst_getSubstitutionMap () const ;
722722 BRIDGED_INLINE bool PointerToAddressInst_isStrict () const ;
723+ BRIDGED_INLINE bool PointerToAddressInst_isInvariant () const ;
724+ BRIDGED_INLINE uint64_t PointerToAddressInst_getAlignment () const ;
725+ BRIDGED_INLINE void PointerToAddressInst_setAlignment (uint64_t alignment) const ;
723726 BRIDGED_INLINE bool AddressToPointerInst_needsStackProtection () const ;
724727 BRIDGED_INLINE bool IndexAddrInst_needsStackProtection () const ;
725728 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedConformanceArray InitExistentialRefInst_getConformances () const ;
Original file line number Diff line number Diff line change @@ -1140,6 +1140,23 @@ bool BridgedInstruction::PointerToAddressInst_isStrict() const {
11401140 return getAs<swift::PointerToAddressInst>()->isStrict ();
11411141}
11421142
1143+ bool BridgedInstruction::PointerToAddressInst_isInvariant () const {
1144+ return getAs<swift::PointerToAddressInst>()->isInvariant ();
1145+ }
1146+
1147+ uint64_t BridgedInstruction::PointerToAddressInst_getAlignment () const {
1148+ auto maybeAlign = getAs<swift::PointerToAddressInst>()->alignment ();
1149+ if (maybeAlign.has_value ()) {
1150+ assert (maybeAlign->value () != 0 );
1151+ return maybeAlign->value ();
1152+ }
1153+ return 0 ;
1154+ }
1155+
1156+ void BridgedInstruction::PointerToAddressInst_setAlignment (uint64_t alignment) const {
1157+ getAs<swift::PointerToAddressInst>()->setAlignment (llvm::MaybeAlign (alignment));
1158+ }
1159+
11431160bool BridgedInstruction::AddressToPointerInst_needsStackProtection () const {
11441161 return getAs<swift::AddressToPointerInst>()->needsStackProtection ();
11451162}
Original file line number Diff line number Diff line change @@ -6074,10 +6074,7 @@ class PointerToAddressInst
60746074 : UnaryInstructionBase(DebugLoc, Operand, Ty) {
60756075 sharedUInt8 ().PointerToAddressInst .isStrict = IsStrict;
60766076 sharedUInt8 ().PointerToAddressInst .isInvariant = IsInvariant;
6077- unsigned encodedAlignment = llvm::encode (Alignment);
6078- sharedUInt32 ().PointerToAddressInst .alignment = encodedAlignment;
6079- assert (sharedUInt32 ().PointerToAddressInst .alignment == encodedAlignment
6080- && " pointer_to_address alignment overflow" );
6077+ setAlignment (Alignment);
60816078 }
60826079
60836080public:
@@ -6100,6 +6097,13 @@ class PointerToAddressInst
61006097 llvm::MaybeAlign alignment () const {
61016098 return llvm::decodeMaybeAlign (sharedUInt32 ().PointerToAddressInst .alignment );
61026099 }
6100+
6101+ void setAlignment (llvm::MaybeAlign Alignment) {
6102+ unsigned encodedAlignment = llvm::encode (Alignment);
6103+ sharedUInt32 ().PointerToAddressInst .alignment = encodedAlignment;
6104+ assert (sharedUInt32 ().PointerToAddressInst .alignment == encodedAlignment
6105+ && " pointer_to_address alignment overflow" );
6106+ }
61036107};
61046108
61056109// / Convert a heap object reference to a different type without any runtime
You can’t perform that action at this time.
0 commit comments