@@ -27,11 +27,12 @@ typedef struct {
2727
2828typedef struct {
2929 const unsigned char * _Nonnull data ;
30- size_t numOperands ;
31- } BridgedOperandArray ;
30+ size_t numElements ;
31+ } BridgedArrayRef ;
3232
3333enum {
34- BridgedOperandSize = 4 * sizeof (uintptr_t )
34+ BridgedOperandSize = 4 * sizeof (uintptr_t ),
35+ BridgedSuccessorSize = 5 * sizeof (uintptr_t )
3536};
3637
3738typedef struct {
@@ -75,6 +76,14 @@ typedef struct {
7576 const void * _Nullable op ;
7677} OptionalBridgedOperand ;
7778
79+ typedef struct {
80+ const void * _Nonnull succ ;
81+ } BridgedSuccessor ;
82+
83+ typedef struct {
84+ const void * _Nullable succ ;
85+ } OptionalBridgedSuccessor ;
86+
7887typedef struct {
7988 SwiftObject obj ;
8089} BridgedFunction ;
@@ -119,6 +128,16 @@ typedef struct {
119128 SwiftObject obj ;
120129} BridgedMultiValueResult ;
121130
131+ // Must be in sync with SILInstruction::MemoryBehavior
132+ // TODO: do this less hacky.
133+ typedef enum {
134+ NoneBehavior ,
135+ MayReadBehavior ,
136+ MayWriteBehavior ,
137+ MayReadWriteBehavior ,
138+ MayHaveSideEffectsBehavior
139+ } BridgedMemoryBehavior ;
140+
122141typedef long SwiftInt ;
123142
124143void registerBridgedClass (BridgedStringRef className , SwiftMetatype metatype );
@@ -145,11 +164,16 @@ BridgedStringRef SILGlobalVariable_debugDescription(BridgedGlobalVar global);
145164
146165OptionalBridgedBasicBlock SILBasicBlock_next (BridgedBasicBlock block );
147166OptionalBridgedBasicBlock SILBasicBlock_previous (BridgedBasicBlock block );
167+ BridgedFunction SILBasicBlock_getFunction (BridgedBasicBlock block );
148168BridgedStringRef SILBasicBlock_debugDescription (BridgedBasicBlock block );
149169OptionalBridgedInstruction SILBasicBlock_firstInst (BridgedBasicBlock block );
150170OptionalBridgedInstruction SILBasicBlock_lastInst (BridgedBasicBlock block );
151171SwiftInt SILBasicBlock_getNumArguments (BridgedBasicBlock block );
152172BridgedArgument SILBasicBlock_getArgument (BridgedBasicBlock block , SwiftInt index );
173+ OptionalBridgedSuccessor SILBasicBlock_getFirstPred (BridgedBasicBlock block );
174+ OptionalBridgedSuccessor SILSuccessor_getNext (BridgedSuccessor succ );
175+ BridgedBasicBlock SILSuccessor_getTargetBlock (BridgedSuccessor succ );
176+ BridgedInstruction SILSuccessor_getContainingInst (BridgedSuccessor succ );
153177
154178BridgedValue Operand_getValue (BridgedOperand );
155179OptionalBridgedOperand Operand_nextUse (BridgedOperand );
@@ -159,25 +183,40 @@ BridgedStringRef SILNode_debugDescription(BridgedNode node);
159183OptionalBridgedOperand SILValue_firstUse (BridgedValue value );
160184BridgedType SILValue_getType (BridgedValue value );
161185
186+ SwiftInt SILType_isAddress (BridgedType );
187+
162188BridgedBasicBlock SILArgument_getParent (BridgedArgument argument );
163189
164190OptionalBridgedInstruction SILInstruction_next (BridgedInstruction inst );
165191OptionalBridgedInstruction SILInstruction_previous (BridgedInstruction inst );
166192BridgedBasicBlock SILInstruction_getParent (BridgedInstruction inst );
167- BridgedOperandArray SILInstruction_getOperands (BridgedInstruction inst );
193+ BridgedArrayRef SILInstruction_getOperands (BridgedInstruction inst );
168194BridgedLocation SILInstruction_getLocation (BridgedInstruction inst );
169- int SILInstruction_mayHaveSideEffects (BridgedInstruction inst );
170- int SILInstruction_mayReadFromMemory (BridgedInstruction inst );
171- int SILInstruction_mayWriteToMemory (BridgedInstruction inst );
172- int SILInstruction_mayReadOrWriteMemory (BridgedInstruction inst );
195+ BridgedMemoryBehavior SILInstruction_getMemBehavior (BridgedInstruction inst );
173196
174197BridgedInstruction MultiValueInstResult_getParent (BridgedMultiValueResult result );
175198SwiftInt MultipleValueInstruction_getNumResults (BridgedInstruction inst );
176199BridgedMultiValueResult
177200 MultipleValueInstruction_getResult (BridgedInstruction inst , SwiftInt index );
178201
202+ BridgedArrayRef TermInst_getSuccessors (BridgedInstruction term );
203+
179204BridgedStringRef CondFailInst_getMessage (BridgedInstruction cfi );
180205BridgedGlobalVar GlobalAccessInst_getGlobal (BridgedInstruction globalInst );
206+ SwiftInt TupleExtractInst_fieldIndex (BridgedInstruction tei );
207+ SwiftInt TupleElementAddrInst_fieldIndex (BridgedInstruction teai );
208+ SwiftInt StructExtractInst_fieldIndex (BridgedInstruction sei );
209+ SwiftInt StructElementAddrInst_fieldIndex (BridgedInstruction seai );
210+ SwiftInt EnumInst_caseIndex (BridgedInstruction ei );
211+ SwiftInt UncheckedEnumDataInst_caseIndex (BridgedInstruction uedi );
212+ SwiftInt RefElementAddrInst_fieldIndex (BridgedInstruction reai );
213+ SwiftInt PartialApplyInst_numArguments (BridgedInstruction ai );
214+ SwiftInt ApplyInst_numArguments (BridgedInstruction ai );
215+ SwiftInt BeginApplyInst_numArguments (BridgedInstruction ai );
216+ SwiftInt TryApplyInst_numArguments (BridgedInstruction ai );
217+ BridgedBasicBlock BranchInst_getTargetBlock (BridgedInstruction bi );
218+ SwiftInt SwitchEnumInst_getNumCases (BridgedInstruction se );
219+ SwiftInt SwitchEnumInst_getCaseIndex (BridgedInstruction se , SwiftInt idx );
181220
182221BridgedInstruction SILBuilder_createBuiltinBinaryFunction (
183222 BridgedInstruction insertionPoint ,
0 commit comments