@@ -40,6 +40,27 @@ STATISTIC(NumMandatoryInlines,
40
40
" Number of function application sites inlined by the mandatory "
41
41
" inlining pass" );
42
42
43
+ // ===----------------------------------------------------------------------===//
44
+ // Printing Helpers
45
+ // ===----------------------------------------------------------------------===//
46
+
47
+ extern llvm::cl::opt<bool > SILPrintInliningCallee;
48
+
49
+ extern llvm::cl::opt<bool > SILPrintInliningCallerBefore;
50
+
51
+ extern llvm::cl::opt<bool > SILPrintInliningCallerAfter;
52
+
53
+ extern void printInliningDetailsCallee (StringRef passName, SILFunction *caller,
54
+ SILFunction *callee);
55
+
56
+ extern void printInliningDetailsCallerBefore (StringRef passName,
57
+ SILFunction *caller,
58
+ SILFunction *callee);
59
+
60
+ extern void printInliningDetailsCallerAfter (StringRef passName,
61
+ SILFunction *caller,
62
+ SILFunction *callee);
63
+
43
64
template <typename ...T, typename ...U>
44
65
static void diagnose (ASTContext &Context, SourceLoc loc, Diag<T...> diag,
45
66
U &&...args) {
@@ -923,11 +944,21 @@ runOnFunctionRecursively(SILOptFunctionBuilder &FuncBuilder, SILFunction *F,
923
944
924
945
invalidatedStackNesting |= Inliner.invalidatesStackNesting (InnerAI);
925
946
947
+ if (SILPrintInliningCallee) {
948
+ printInliningDetailsCallee (" MandatoryInlining" , F, CalleeFunction);
949
+ }
950
+ if (SILPrintInliningCallerBefore) {
951
+ printInliningDetailsCallerBefore (" MandatoryInlining" , F,
952
+ CalleeFunction);
953
+ }
926
954
// Inlining deletes the apply, and can introduce multiple new basic
927
955
// blocks. After this, CalleeValue and other instructions may be invalid.
928
956
// nextBB will point to the last inlined block
929
957
SILBasicBlock *lastBB =
930
958
Inliner.inlineFunction (CalleeFunction, InnerAI, FullArgs);
959
+ if (SILPrintInliningCallerAfter) {
960
+ printInliningDetailsCallerAfter (" MandatoryInlining" , F, CalleeFunction);
961
+ }
931
962
nextBB = lastBB->getReverseIterator ();
932
963
++NumMandatoryInlines;
933
964
0 commit comments