From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Sun, 25 Oct 2020 14:10:58 +0100

A disjunction is applied by this script for the semantic patch language.
This construct uses short-circuit evaluation. It has got the consequence
that the last element of the specified condition will only be checked
if all previous parts did not match. Such a technical detail leads to
a recommended ordering of condition parts if you would like to care for
optimal run time characteristics of SmPL code.

An usage incidence was determined for the specified identifiers in source
files from the software “Linux next-20201023” by another SmPL script.
This analysis result indicated that a few functions were called more
frequent than others.
Thus reorder the SmPL disjunction items partly according to their
usage incidence.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 scripts/coccinelle/api/pm_runtime.cocci | 40 +++++++++++++------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/scripts/coccinelle/api/pm_runtime.cocci 
b/scripts/coccinelle/api/pm_runtime.cocci
index 1ccce3fd00b8..7d9908cf0803 100644
--- a/scripts/coccinelle/api/pm_runtime.cocci
+++ b/scripts/coccinelle/api/pm_runtime.cocci
@@ -21,25 +21,27 @@ expression ret;
 position p;
 @@
 (
-ret@p = \(pm_runtime_idle\|
-       pm_runtime_suspend\|
-       pm_runtime_autosuspend\|
-       pm_runtime_resume\|
-       pm_request_idle\|
-       pm_request_resume\|
-       pm_request_autosuspend\|
-       pm_runtime_get\|
-       pm_runtime_get_sync\|
-       pm_runtime_put\|
-       pm_runtime_put_autosuspend\|
-       pm_runtime_put_sync\|
-       pm_runtime_put_sync_suspend\|
-       pm_runtime_put_sync_autosuspend\|
-       pm_runtime_set_active\|
-       pm_schedule_suspend\|
-       pm_runtime_barrier\|
-       pm_generic_runtime_suspend\|
-       pm_generic_runtime_resume\)(...);
+ ret@p =
+(pm_runtime_get_sync
+|pm_runtime_set_active
+|pm_runtime_put_sync_autosuspend
+|pm_runtime_put_sync
+|pm_runtime_get
+|pm_runtime_put
+|pm_generic_runtime_suspend
+|pm_generic_runtime_resume
+|pm_request_autosuspend
+|pm_request_idle
+|pm_request_resume
+|pm_runtime_autosuspend
+|pm_runtime_barrier
+|pm_runtime_idle
+|pm_runtime_put_autosuspend
+|pm_runtime_put_sync_suspend
+|pm_runtime_resume
+|pm_runtime_suspend
+|pm_schedule_suspend
+)(...);
 ...
 IS_ERR_VALUE(ret)
 ...
--
2.29.1

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to