Browse Source

gcc: Initialize the `name' field of codelets.

* gcc-plugin/src/starpu.c (build_codelet_initializer)[codelet_name]: New
  function.
  Initialize The `name' field of the generated codelet.

* gcc-plugin/tests/mocks.h (starpu_insert_task): Make sure `cl->name' is
  a valid string.
Ludovic Courtès 13 years ago
parent
commit
f8fe1aa35d
2 changed files with 9 additions and 1 deletions
  1. 8 1
      gcc-plugin/src/starpu.c
  2. 1 0
      gcc-plugin/tests/mocks.h

+ 8 - 1
gcc-plugin/src/starpu.c

@@ -1735,6 +1735,12 @@ build_codelet_initializer (tree task_decl)
     return init;
   }
 
+  tree codelet_name ()
+  {
+    const char *name = IDENTIFIER_POINTER (DECL_NAME (task_decl));
+    return build_string_literal (strlen (name) + 1, name);
+  }
+
   tree where_init (tree impls)
   {
     tree impl;
@@ -1841,7 +1847,8 @@ build_codelet_initializer (tree task_decl)
   impls = task_implementation_list (task_decl);
 
   inits =
-    chain_trees (field_initializer ("where", where_init (impls)),
+    chain_trees (field_initializer ("name", codelet_name ()),
+		 field_initializer ("where", where_init (impls)),
 		 field_initializer ("nbuffers", pointer_arg_count ()),
 		 field_initializer ("modes", access_mode_array ()),
 		 field_initializer ("cpu_funcs",

+ 1 - 0
gcc-plugin/tests/mocks.h

@@ -57,6 +57,7 @@ const struct insert_task_argument *expected_insert_task_arguments;
 int
 starpu_insert_task (struct starpu_codelet *cl, ...)
 {
+  assert (cl->name != NULL && strlen (cl->name) > 0);
   assert (cl->where == (STARPU_CPU | STARPU_OPENCL));
 
   /* TODO: Call `cpu_func' & co. and check whether they do the right