Patchwork [committed] Alpha/VMS: adjust condition to create trampoline entry point

login
register
mail settings
Submitter Tristan Gingold
Date Dec. 20, 2011, 8:37 a.m.
Message ID <98678E31-4331-47D5-B325-C7E1438825AA@adacore.com>
Download mbox | patch
Permalink /patch/132354/
State New
Headers show

Comments

Tristan Gingold - Dec. 20, 2011, 8:37 a.m.
Hi,

the alpha/vms backend emitted the trampoline entry point too often, as functions declared directly within a translation unit weren't considered as top-level functions.

Fixed by this patch, applied on trunk.

Tristan.

2011-12-20  Tristan Gingold  <gingold@adacore.com>

	* config/alpha/alpha.c (alpha_start_function): Adjust condition to
	create VMS trampoline entry point.
Richard Guenther - Dec. 20, 2011, 9:57 a.m.
On Tue, Dec 20, 2011 at 9:37 AM, Tristan Gingold <gingold@adacore.com> wrote:
> Hi,
>
> the alpha/vms backend emitted the trampoline entry point too often, as functions declared directly within a translation unit weren't considered as top-level functions.
>
> Fixed by this patch, applied on trunk.
>
> Tristan.
>
> 2011-12-20  Tristan Gingold  <gingold@adacore.com>
>
>        * config/alpha/alpha.c (alpha_start_function): Adjust condition to
>        create VMS trampoline entry point.
>
> Index: config/alpha/alpha.c
> ===================================================================
> --- config/alpha/alpha.c        (revision 182519)
> +++ config/alpha/alpha.c        (working copy)
> @@ -7935,7 +7935,8 @@
>    if (TARGET_ABI_OPEN_VMS
>        && !TREE_PUBLIC (decl)
>        && DECL_CONTEXT (decl)
> -       && !TYPE_P (DECL_CONTEXT (decl)))
> +       && !TYPE_P (DECL_CONTEXT (decl))
> +       && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)

We'd have !DECL_FILE_SCOPE_P (decl) which covers the
DECL_CONTEXT (decl) && TREE_CODE check.

>      {
>        strcpy (tramp_label, fnname);
>        strcat (tramp_label, "..tr");
>
Tristan Gingold - Dec. 20, 2011, 10:10 a.m.
On Dec 20, 2011, at 10:57 AM, Richard Guenther wrote:

> On Tue, Dec 20, 2011 at 9:37 AM, Tristan Gingold <gingold@adacore.com> wrote:
>> Hi,
>> 
>> the alpha/vms backend emitted the trampoline entry point too often, as functions declared directly within a translation unit weren't considered as top-level functions.
>> 
>> Fixed by this patch, applied on trunk.
>> 
>> Tristan.
>> 
>> 2011-12-20  Tristan Gingold  <gingold@adacore.com>
>> 
>>        * config/alpha/alpha.c (alpha_start_function): Adjust condition to
>>        create VMS trampoline entry point.
>> 
>> Index: config/alpha/alpha.c
>> ===================================================================
>> --- config/alpha/alpha.c        (revision 182519)
>> +++ config/alpha/alpha.c        (working copy)
>> @@ -7935,7 +7935,8 @@
>>    if (TARGET_ABI_OPEN_VMS
>>        && !TREE_PUBLIC (decl)
>>        && DECL_CONTEXT (decl)
>> -       && !TYPE_P (DECL_CONTEXT (decl)))
>> +       && !TYPE_P (DECL_CONTEXT (decl))
>> +       && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)
> 
> We'd have !DECL_FILE_SCOPE_P (decl) which covers the
> DECL_CONTEXT (decl) && TREE_CODE check.

Thanks.  I will use it.

Tristan.

Patch

Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 182519)
+++ config/alpha/alpha.c	(working copy)
@@ -7935,7 +7935,8 @@ 
    if (TARGET_ABI_OPEN_VMS
        && !TREE_PUBLIC (decl)
        && DECL_CONTEXT (decl)
-       && !TYPE_P (DECL_CONTEXT (decl)))
+       && !TYPE_P (DECL_CONTEXT (decl))
+       && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)
      {
 	strcpy (tramp_label, fnname);
 	strcat (tramp_label, "..tr");