Skip to content

Commit 969a788

Browse files
committed
SIL: add the Builtin.name getter and Builtin.arguments
1 parent 1856d4e commit 969a788

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,21 @@ final public class BuiltinInst : SingleValueInstruction {
658658
return bridged.BuiltinInst_getID()
659659
}
660660

661+
public var name: StringRef {
662+
return StringRef(bridged: bridged.BuiltinInst_getName())
663+
}
664+
661665
public var intrinsicID: BridgedInstruction.IntrinsicID {
662666
return bridged.BuiltinInst_getIntrinsicID()
663667
}
664668

665669
public var substitutionMap: SubstitutionMap {
666670
SubstitutionMap(bridged: bridged.BuiltinInst_getSubstitutionMap())
667671
}
672+
673+
public var arguments: LazyMapSequence<OperandArray, Value> {
674+
operands.values
675+
}
668676
}
669677

670678
final public class UpcastInst : SingleValueInstruction, UnaryInstruction {

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ struct BridgedInstruction {
718718
BRIDGED_INLINE bool LoadBorrowInst_isUnchecked() const ;
719719
BRIDGED_INLINE BuiltinValueKind BuiltinInst_getID() const;
720720
BRIDGED_INLINE IntrinsicID BuiltinInst_getIntrinsicID() const;
721+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef BuiltinInst_getName() const;
721722
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap BuiltinInst_getSubstitutionMap() const;
722723
BRIDGED_INLINE bool PointerToAddressInst_isStrict() const;
723724
BRIDGED_INLINE bool PointerToAddressInst_isInvariant() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,10 @@ BridgedInstruction::IntrinsicID BridgedInstruction::BuiltinInst_getIntrinsicID()
11321132
}
11331133
}
11341134

1135+
BridgedStringRef BridgedInstruction::BuiltinInst_getName() const {
1136+
return getAs<swift::BuiltinInst>()->getName().str();
1137+
}
1138+
11351139
BridgedSubstitutionMap BridgedInstruction::BuiltinInst_getSubstitutionMap() const {
11361140
return getAs<swift::BuiltinInst>()->getSubstitutions();
11371141
}

0 commit comments

Comments
 (0)