int sgpr_count;
int vgpr_count;
char *kernel_name;
- } regcount;
+ } regcount = { -1, -1, NULL };
/* Always add _init_array and _fini_array as kernels. */
obstack_ptr_grow (&fns_os, xstrdup ("_init_array"));
fn_count += 2;
char buf[1000];
- enum { IN_CODE, IN_AMD_KERNEL_CODE_T, IN_VARS, IN_FUNCS } state = IN_CODE;
+ enum
+ { IN_CODE,
+ IN_METADATA,
+ IN_VARS,
+ IN_FUNCS
+ } state = IN_CODE;
while (fgets (buf, sizeof (buf), in))
{
switch (state)
obstack_grow (&dims_os, &dim, sizeof (dim));
dims_count++;
}
- else if (sscanf (buf, " .amdgpu_hsa_kernel %ms\n",
- ®count.kernel_name) == 1)
- break;
break;
}
- case IN_AMD_KERNEL_CODE_T:
+ case IN_METADATA:
{
- gcc_assert (regcount.kernel_name);
- if (sscanf (buf, " wavefront_sgpr_count = %d\n",
- ®count.sgpr_count) == 1)
+ if (sscanf (buf, " - .name: %ms\n", ®count.kernel_name) == 1)
break;
- else if (sscanf (buf, " workitem_vgpr_count = %d\n",
+ else if (sscanf (buf, " .sgpr_count: %d\n",
+ ®count.sgpr_count) == 1)
+ {
+ gcc_assert (regcount.kernel_name);
+ break;
+ }
+ else if (sscanf (buf, " .vgpr_count: %d\n",
®count.vgpr_count) == 1)
- break;
+ {
+ gcc_assert (regcount.kernel_name);
+ break;
+ }
break;
}
state = IN_VARS;
else if (sscanf (buf, " .section .gnu.offload_funcs%c", &dummy) > 0)
state = IN_FUNCS;
- else if (sscanf (buf, " .amd_kernel_code_%c", &dummy) > 0)
+ else if (sscanf (buf, " .amdgpu_metadata%c", &dummy) > 0)
{
- state = IN_AMD_KERNEL_CODE_T;
+ state = IN_METADATA;
+ regcount.kernel_name = NULL;
regcount.sgpr_count = regcount.vgpr_count = -1;
}
else if (sscanf (buf, " .section %c", &dummy) > 0
|| sscanf (buf, " .data%c", &dummy) > 0
|| sscanf (buf, " .ident %c", &dummy) > 0)
state = IN_CODE;
- else if (sscanf (buf, " .end_amd_kernel_code_%c", &dummy) > 0)
+ else if (sscanf (buf, " .end_amdgpu_metadata%c", &dummy) > 0)
{
state = IN_CODE;
gcc_assert (regcount.kernel_name != NULL
regcount.sgpr_count = regcount.vgpr_count = -1;
}
- if (state == IN_CODE || state == IN_AMD_KERNEL_CODE_T)
+ if (state == IN_CODE || state == IN_METADATA)
fputs (buf, out);
}