15
15
16
16
#include " swift/Basic/Compiler.h"
17
17
#include " swift/SIL/SILArgumentConvention.h"
18
- #include " swift/SIL/SILFunction.h"
19
18
#include " swift/SIL/SILValue.h"
19
+ #include " swift/SIL/SILFunctionConventions.h"
20
20
21
21
namespace swift {
22
22
23
23
class SILBasicBlock ;
24
24
class SILModule ;
25
25
class SILUndef ;
26
+ class TermInst ;
26
27
27
28
// Map an argument index onto a SILArgumentConvention.
28
29
inline SILArgumentConvention
@@ -72,11 +73,6 @@ class SILArgument : public ValueBase {
72
73
SILType type, ValueOwnershipKind ownershipKind,
73
74
const ValueDecl *inputDecl = nullptr );
74
75
75
- SILArgument (ValueKind subClassKind, SILBasicBlock *inputParentBlock,
76
- SILBasicBlock::arg_iterator positionInArgumentArray, SILType type,
77
- ValueOwnershipKind ownershipKind,
78
- const ValueDecl *inputDecl = nullptr );
79
-
80
76
// A special constructor, only intended for use in
81
77
// SILBasicBlock::replacePHIArg and replaceFunctionArg.
82
78
explicit SILArgument (ValueKind subClassKind, SILType type,
@@ -115,14 +111,7 @@ class SILArgument : public ValueBase {
115
111
node->getKind () <= SILNodeKind::Last_SILArgument;
116
112
}
117
113
118
- unsigned getIndex () const {
119
- for (auto p : llvm::enumerate (getParent ()->getArguments ())) {
120
- if (p.value () == this ) {
121
- return p.index ();
122
- }
123
- }
124
- llvm_unreachable (" SILArgument not argument of its parent BB" );
125
- }
114
+ unsigned getIndex () const ;
126
115
127
116
// / Return true if this block argument is actually a phi argument as
128
117
// / opposed to a cast or projection.
@@ -208,14 +197,6 @@ class SILPhiArgument : public SILArgument {
208
197
const ValueDecl *decl = nullptr )
209
198
: SILArgument(ValueKind::SILPhiArgument, parentBlock, type, ownershipKind,
210
199
decl) {}
211
-
212
- SILPhiArgument (SILBasicBlock *parentBlock,
213
- SILBasicBlock::arg_iterator argArrayInsertPt, SILType type,
214
- ValueOwnershipKind ownershipKind,
215
- const ValueDecl *decl = nullptr )
216
- : SILArgument(ValueKind::SILPhiArgument, parentBlock, argArrayInsertPt,
217
- type, ownershipKind, decl) {}
218
-
219
200
// A special constructor, only intended for use in
220
201
// SILBasicBlock::replacePHIArg.
221
202
explicit SILPhiArgument (SILType type, ValueOwnershipKind ownershipKind,
@@ -311,13 +292,6 @@ class SILFunctionArgument : public SILArgument {
311
292
const ValueDecl *decl = nullptr )
312
293
: SILArgument(ValueKind::SILFunctionArgument, parentBlock, type,
313
294
ownershipKind, decl) {}
314
- SILFunctionArgument (SILBasicBlock *parentBlock,
315
- SILBasicBlock::arg_iterator argArrayInsertPt,
316
- SILType type, ValueOwnershipKind ownershipKind,
317
- const ValueDecl *decl = nullptr )
318
- : SILArgument(ValueKind::SILFunctionArgument, parentBlock,
319
- argArrayInsertPt, type, ownershipKind, decl) {}
320
-
321
295
// A special constructor, only intended for use in
322
296
// SILBasicBlock::replaceFunctionArg.
323
297
explicit SILFunctionArgument (SILType type, ValueOwnershipKind ownershipKind,
@@ -326,22 +300,14 @@ class SILFunctionArgument : public SILArgument {
326
300
}
327
301
328
302
public:
329
- bool isIndirectResult () const {
330
- auto numIndirectResults =
331
- getFunction ()->getConventions ().getNumIndirectSILResults ();
332
- return getIndex () < numIndirectResults;
333
- }
303
+ bool isIndirectResult () const ;
334
304
335
- SILArgumentConvention getArgumentConvention () const {
336
- return getFunction ()->getConventions ().getSILArgumentConvention (getIndex ());
337
- }
305
+ SILArgumentConvention getArgumentConvention () const ;
338
306
339
307
// / Given that this is an entry block argument, and given that it does
340
308
// / not correspond to an indirect result, return the corresponding
341
309
// / SILParameterInfo.
342
- SILParameterInfo getKnownParameterInfo () const {
343
- return getFunction ()->getConventions ().getParamInfoForSILArg (getIndex ());
344
- }
310
+ SILParameterInfo getKnownParameterInfo () const ;
345
311
346
312
// / Returns true if this SILArgument is the self argument of its
347
313
// / function. This means that this will return false always for SILArguments
0 commit comments