cpu_func_to_cpu_funcs.cocci 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // StarPU --- Runtime system for heterogeneous multicore architectures.
  2. //
  3. // Copyright (C) 2011 Inria
  4. //
  5. // StarPU is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU Lesser General Public License as published by
  7. // the Free Software Foundation; either version 2.1 of the License, or (at
  8. // your option) any later version.
  9. //
  10. // StarPU is distributed in the hope that it will be useful, but
  11. // WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. //
  14. // See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. // $ spatch -sp_file cpu_func_to_cpu_funcs.cocci cpu_func_to_cpu_funcs_test.c
  16. ///////////////////////////////////////////////////////////////////////////////
  17. // There is no need to specify STARPU_MULTIPLE_CPU_IMPLEMENTATIONS any more. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. @@
  20. identifier cl;
  21. @@
  22. struct starpu_codelet cl = {
  23. - .cpu_func = STARPU_MULTIPLE_CPU_IMPLEMENTATIONS,
  24. .cpu_funcs = { ... }
  25. };
  26. ////////////////////////////////////////////////////
  27. // Find all the codelets using the cpu_func field //
  28. ////////////////////////////////////////////////////
  29. @cpu_func@
  30. expression f;
  31. identifier cl;
  32. @@
  33. struct starpu_codelet cl = {
  34. .cpu_func = f
  35. };
  36. ///////////////////////////////////////////////////////////////////
  37. // Find all the codelets that define both cpu_func and cpu_funcs //
  38. ///////////////////////////////////////////////////////////////////
  39. @cpu_funcs depends on cpu_func@
  40. expression cpu_func.f;
  41. identifier cpu_func.cl;
  42. @@
  43. struct starpu_codelet cl = {
  44. .cpu_funcs = { f }
  45. };
  46. //////////////////////////////////////////////////////////////////////////////
  47. // For codelets that define cpu_func but not cpu_funcs, remove cpu_func and //
  48. // add cpu_funcs //
  49. //////////////////////////////////////////////////////////////////////////////
  50. @depends on !cpu_funcs@
  51. identifier cpu_func.cl;
  52. expression cpu_func.f;
  53. @@
  54. struct starpu_codelet cl = {
  55. - .cpu_func = f
  56. + .cpu_funcs = { f }
  57. };
  58. /////////////////////////////////////////////////////////////////
  59. // If both cpu_func and cpu_funcs are defined, remove cpu_func //
  60. /////////////////////////////////////////////////////////////////
  61. @depends on cpu_funcs@
  62. identifier cpu_func.cl;
  63. expression cpu_func.f;
  64. @@
  65. struct starpu_codelet cl = {
  66. - .cpu_func = f
  67. };