cpu_func_to_cpu_funcs.cocci 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // $ spatch -sp_file cpu_func_to_cpu_funcs.cocci cpu_func_to_cpu_funcs_test.c
  2. ///////////////////////////////////////////////////////////////////////////////
  3. // There is no need to specify STARPU_MULTIPLE_CPU_IMPLEMENTATIONS any more. //
  4. // XXX : We must find a way to make sure cpu_funcs is NULL-terminated. //
  5. ///////////////////////////////////////////////////////////////////////////////
  6. @@
  7. identifier cl;
  8. @@
  9. struct starpu_codelet cl = {
  10. - .cpu_func = STARPU_MULTIPLE_CPU_IMPLEMENTATIONS,
  11. .cpu_funcs = { ... }
  12. };
  13. ////////////////////////////////////////////////////
  14. // Find all the codelets using the cpu_func field //
  15. ////////////////////////////////////////////////////
  16. @cpu_func@
  17. expression f;
  18. identifier cl;
  19. @@
  20. struct starpu_codelet cl = {
  21. .cpu_func = f
  22. };
  23. ///////////////////////////////////////////////////////////////////
  24. // Find all the codelets that define both cpu_func and cpu_funcs //
  25. ///////////////////////////////////////////////////////////////////
  26. @cpu_funcs depends on cpu_func@
  27. expression cpu_func.f;
  28. identifier cpu_func.cl;
  29. @@
  30. struct starpu_codelet cl = {
  31. .cpu_funcs = { f, NULL }
  32. };
  33. //////////////////////////////////////////////////////////////////////////////
  34. // For codelets that define cpu_func but not cpu_funcs, remove cpu_func and //
  35. // add cpu_funcs //
  36. //////////////////////////////////////////////////////////////////////////////
  37. @depends on !cpu_funcs@
  38. identifier cpu_func.cl;
  39. expression cpu_func.f;
  40. @@
  41. struct starpu_codelet cl = {
  42. - .cpu_func = f
  43. + .cpu_funcs = { f, NULL }
  44. };
  45. /////////////////////////////////////////////////////////////////
  46. // If both cpu_func and cpu_funcs are defined, remove cpu_func //
  47. /////////////////////////////////////////////////////////////////
  48. @depends on cpu_funcs@
  49. identifier cpu_func.cl;
  50. expression cpu_func.f;
  51. @@
  52. struct starpu_codelet cl = {
  53. - .cpu_func = f
  54. };