Skip to content

Commit f46de47

Browse files
committed
[gardening] Move private helper function decls after the public decls/fields.
1 parent 25af770 commit f46de47

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

include/swift/SILOptimizer/Analysis/ARCAnalysis.h

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class SILFunction;
3939
} // end namespace swift
4040

4141
namespace swift {
42+
4243
/// Return true if this is a retain instruction.
4344
bool isRetainInstruction(SILInstruction *II);
4445

@@ -141,16 +142,11 @@ class ConsumedResultToEpilogueRetainMatcher {
141142
SILFunction *F;
142143
RCIdentityFunctionInfo *RCFI;
143144
AliasAnalysis *AA;
145+
144146
// We use a list of instructions for now so that we can keep the same interface
145147
// and handle exploded retain_value later.
146148
RetainList EpilogueRetainInsts;
147149

148-
/// Return true if all the successors of the EpilogueRetainInsts do not have
149-
/// a retain.
150-
bool isTransitiveSuccessorsRetainFree(llvm::DenseSet<SILBasicBlock *> BBs);
151-
152-
/// Finds matching releases in the provided block \p BB.
153-
RetainKindValue findMatchingRetainsInBasicBlock(SILBasicBlock *BB, SILValue V);
154150
public:
155151
/// Finds matching releases in the return block of the function \p F.
156152
ConsumedResultToEpilogueRetainMatcher(RCIdentityFunctionInfo *RCFI,
@@ -182,6 +178,15 @@ class ConsumedResultToEpilogueRetainMatcher {
182178
unsigned size() const { return EpilogueRetainInsts.size(); }
183179

184180
iterator_range<iterator> getRange() { return swift::make_range(begin(), end()); }
181+
182+
private:
183+
/// Return true if all the successors of the EpilogueRetainInsts do not have
184+
/// a retain.
185+
bool isTransitiveSuccessorsRetainFree(llvm::DenseSet<SILBasicBlock *> BBs);
186+
187+
/// Finds matching releases in the provided block \p BB.
188+
RetainKindValue findMatchingRetainsInBasicBlock(SILBasicBlock *BB,
189+
SILValue V);
185190
};
186191

187192
/// A class that attempts to match owned arguments and corresponding epilogue
@@ -205,32 +210,6 @@ class ConsumedArgToEpilogueReleaseMatcher {
205210
/// Eventually this will be used in place of HasBlock.
206211
SILBasicBlock *ProcessedBlock;
207212

208-
/// Return true if we have seen releases to part or all of \p Derived in
209-
/// \p Insts.
210-
///
211-
/// NOTE: This function relies on projections to analyze the relation
212-
/// between the releases values in \p Insts and \p Derived, it also bails
213-
/// out and return true if projection path can not be formed between Base
214-
/// and any one the released values.
215-
bool isRedundantRelease(ReleaseList Insts, SILValue Base, SILValue Derived);
216-
217-
/// Return true if we have a release instruction for all the reference
218-
/// semantics part of \p Argument.
219-
bool releaseArgument(ReleaseList Insts, SILValue Argument);
220-
221-
/// Walk the basic block and find all the releases that match to function
222-
/// arguments.
223-
void collectMatchingReleases(SILBasicBlock *BB);
224-
225-
/// Walk the function and find all the destroy_addr instructions that match
226-
/// to function arguments.
227-
void collectMatchingDestroyAddresses(SILBasicBlock *BB);
228-
229-
/// For every argument in the function, check to see whether all epilogue
230-
/// releases are found. Clear all releases for the argument if not all
231-
/// epilogue releases are found.
232-
void processMatchingReleases();
233-
234213
public:
235214
/// Finds matching releases in the return block of the function \p F.
236215
ConsumedArgToEpilogueReleaseMatcher(
@@ -334,6 +313,33 @@ class ConsumedArgToEpilogueReleaseMatcher {
334313
unsigned size() const { return ArgInstMap.size(); }
335314

336315
iterator_range<iterator> getRange() { return swift::make_range(begin(), end()); }
316+
317+
private:
318+
/// Return true if we have seen releases to part or all of \p Derived in
319+
/// \p Insts.
320+
///
321+
/// NOTE: This function relies on projections to analyze the relation
322+
/// between the releases values in \p Insts and \p Derived, it also bails
323+
/// out and return true if projection path can not be formed between Base
324+
/// and any one the released values.
325+
bool isRedundantRelease(ReleaseList Insts, SILValue Base, SILValue Derived);
326+
327+
/// Return true if we have a release instruction for all the reference
328+
/// semantics part of \p Argument.
329+
bool releaseArgument(ReleaseList Insts, SILValue Argument);
330+
331+
/// Walk the basic block and find all the releases that match to function
332+
/// arguments.
333+
void collectMatchingReleases(SILBasicBlock *BB);
334+
335+
/// Walk the function and find all the destroy_addr instructions that match
336+
/// to function arguments.
337+
void collectMatchingDestroyAddresses(SILBasicBlock *BB);
338+
339+
/// For every argument in the function, check to see whether all epilogue
340+
/// releases are found. Clear all releases for the argument if not all
341+
/// epilogue releases are found.
342+
void processMatchingReleases();
337343
};
338344

339345
class ReleaseTracker {

0 commit comments

Comments
 (0)