Move the default inline threshold to SkSLDefines.h.

Change-Id: Idf3f95ce3d0467c8273c627227c2e6bb16d04614
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364837
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-02-02 18:35:09 -05:00 committed by Skia Commit-Bot
parent 045f87d27f
commit cd067feb1c
2 changed files with 12 additions and 3 deletions

View File

@ -22,4 +22,12 @@
using SKSL_INT = int64_t;
using SKSL_FLOAT = float;
namespace SkSL {
// Functions larger than this (measured in IR nodes) will not be inlined. This growth factor
// accounts for the number of calls being inlined--i.e., a function called five times (that is, with
// five inlining opportunities) would be considered 5x larger than if it were called once. This
// default threshold value is arbitrary, but tends to work well in practice.
static constexpr int kDefaultInlineThreshold = 50;
}
#endif

View File

@ -13,6 +13,7 @@
#include "include/private/SkTHash.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLDefines.h"
#include "src/sksl/ir/SkSLBoolLiteral.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFloatLiteral.h"
@ -137,9 +138,9 @@ struct Program {
// If true, remove any uncalled functions other than main(). Note that a function which
// starts out being used may end up being uncalled after optimization.
bool fRemoveDeadFunctions = true;
// Functions larger than this (measured in IR nodes) will not be inlined. The default value
// is arbitrary. A value of zero will disable the inliner entirely.
int fInlineThreshold = 50;
// Sets an upper limit on the acceptable amount of code growth from inlining.
// A value of zero will disable the inliner entirely.
int fInlineThreshold = SkSL::kDefaultInlineThreshold;
// true to enable optimization passes
bool fOptimize = true;
// If true, implicit conversions to lower precision numeric types are allowed