Skip to content

Commit 42aa21c

Browse files
committed
[NFC] Moved inlining printing to PassManager.
1 parent c40a98a commit 42aa21c

File tree

2 files changed

+37
-30
lines changed

2 files changed

+37
-30
lines changed

lib/SILOptimizer/PassManager/PassManager.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,37 @@ bool isFunctionSelectedForPrinting(SILFunction *F) {
182182
return true;
183183
}
184184

185+
void printInliningDetails(StringRef passName, SILFunction *caller,
186+
SILFunction *callee, bool isCaller,
187+
bool alreadyInlined) {
188+
if (!isFunctionSelectedForPrinting(caller))
189+
return;
190+
llvm::dbgs() << " " << passName
191+
<< (alreadyInlined ? " has inlined " : " will inline ")
192+
<< callee->getName() << " into " << caller->getName() << ".\n";
193+
auto *printee = isCaller ? caller : callee;
194+
printee->dump(caller->getModule().getOptions().EmitVerboseSIL);
195+
llvm::dbgs() << '\n';
196+
}
197+
198+
void printInliningDetailsCallee(StringRef passName, SILFunction *caller,
199+
SILFunction *callee) {
200+
printInliningDetails(passName, caller, callee, /*isCaller=*/false,
201+
/*alreadyInlined=*/false);
202+
}
203+
204+
void printInliningDetailsCallerBefore(StringRef passName, SILFunction *caller,
205+
SILFunction *callee) {
206+
printInliningDetails(passName, caller, callee, /*isCaller=*/true,
207+
/*alreadyInlined=*/false);
208+
}
209+
210+
void printInliningDetailsCallerAfter(StringRef passName, SILFunction *caller,
211+
SILFunction *callee) {
212+
printInliningDetails(passName, caller, callee, /*isCaller=*/true,
213+
/*alreadyInlined=*/true);
214+
}
215+
185216
static bool functionSelectionEmpty() {
186217
return SILPrintFunction.empty() && SILPrintFunctions.empty();
187218
}

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,16 @@ llvm::cl::opt<bool> SILPrintInliningCallerAfter(
6767
// Printing Helpers
6868
//===----------------------------------------------------------------------===//
6969

70-
extern bool isFunctionSelectedForPrinting(SILFunction *F);
70+
extern void printInliningDetailsCallee(StringRef passName, SILFunction *caller,
71+
SILFunction *callee);
7172

72-
static void printInliningDetails(StringRef passName, SILFunction *caller,
73-
SILFunction *callee, bool isCaller,
74-
bool alreadyInlined) {
75-
if (!isFunctionSelectedForPrinting(caller))
76-
return;
77-
llvm::dbgs() << " " << passName
78-
<< (alreadyInlined ? " has inlined " : " will inline ")
79-
<< callee->getName() << " into " << caller->getName() << ".\n";
80-
auto *printee = isCaller ? caller : callee;
81-
printee->dump(caller->getModule().getOptions().EmitVerboseSIL);
82-
llvm::dbgs() << '\n';
83-
}
84-
85-
static void printInliningDetailsCallee(StringRef passName, SILFunction *caller,
86-
SILFunction *callee) {
87-
printInliningDetails(passName, caller, callee, /*isCaller=*/false,
88-
/*alreadyInlined=*/false);
89-
}
90-
91-
static void printInliningDetailsCallerBefore(StringRef passName,
73+
extern void printInliningDetailsCallerBefore(StringRef passName,
9274
SILFunction *caller,
93-
SILFunction *callee) {
94-
printInliningDetails(passName, caller, callee, /*isCaller=*/true,
95-
/*alreadyInlined=*/false);
96-
}
75+
SILFunction *callee);
9776

98-
static void printInliningDetailsCallerAfter(StringRef passName,
77+
extern void printInliningDetailsCallerAfter(StringRef passName,
9978
SILFunction *caller,
100-
SILFunction *callee) {
101-
printInliningDetails(passName, caller, callee, /*isCaller=*/true,
102-
/*alreadyInlined=*/true);
103-
}
79+
SILFunction *callee);
10480

10581
//===----------------------------------------------------------------------===//
10682
// Performance Inliner

0 commit comments

Comments
 (0)