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 {
747
747
}
748
748
}
749
749
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
+
750
758
extension TermInst {
751
759
func replaceBranchTarget( from fromBlock: BasicBlock , to toBlock: BasicBlock , _ context: some MutatingContext ) {
752
760
context. notifyBranchesChanged ( )
Original file line number Diff line number Diff line change @@ -717,6 +717,15 @@ final public
717
717
class PointerToAddressInst : SingleValueInstruction , UnaryInstruction {
718
718
public var pointer : Value { operand. value }
719
719
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
+ }
720
729
}
721
730
722
731
final public
Original file line number Diff line number Diff line change @@ -720,6 +720,9 @@ struct BridgedInstruction {
720
720
BRIDGED_INLINE IntrinsicID BuiltinInst_getIntrinsicID () const ;
721
721
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap BuiltinInst_getSubstitutionMap () const ;
722
722
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 ;
723
726
BRIDGED_INLINE bool AddressToPointerInst_needsStackProtection () const ;
724
727
BRIDGED_INLINE bool IndexAddrInst_needsStackProtection () const ;
725
728
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 {
1140
1140
return getAs<swift::PointerToAddressInst>()->isStrict ();
1141
1141
}
1142
1142
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
+
1143
1160
bool BridgedInstruction::AddressToPointerInst_needsStackProtection () const {
1144
1161
return getAs<swift::AddressToPointerInst>()->needsStackProtection ();
1145
1162
}
Original file line number Diff line number Diff line change @@ -6074,10 +6074,7 @@ class PointerToAddressInst
6074
6074
: UnaryInstructionBase(DebugLoc, Operand, Ty) {
6075
6075
sharedUInt8 ().PointerToAddressInst .isStrict = IsStrict;
6076
6076
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);
6081
6078
}
6082
6079
6083
6080
public:
@@ -6100,6 +6097,13 @@ class PointerToAddressInst
6100
6097
llvm::MaybeAlign alignment () const {
6101
6098
return llvm::decodeMaybeAlign (sharedUInt32 ().PointerToAddressInst .alignment );
6102
6099
}
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
+ }
6103
6107
};
6104
6108
6105
6109
// / Convert a heap object reference to a different type without any runtime
You can’t perform that action at this time.
0 commit comments