This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Remove Darwin-specific machopic stub optmimisation


Hello there,

This patch removes some Darwin-specific machopic stub optimisations I did
last month (alas, it produced code which was incompatible with mach-o
scatter loading.)  Also remove an obsoleted prototype in darwin.c.

Bootstrapped gcc, no new regressions.

     * darwin.c (func_name_maybe_scoped): Remove prototype.
     (machopic_finish): Remove 'defined' check: always emit stub.
     (machopic_output_possible_stub_label): Remove.
     * darwin.h (ASM_DECLARE_FUNCTION_NAME): Don't call it.
     * darwin-protos.h: Don't prototype it.


Index: darwin-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin-protos.h,v
retrieving revision 1.8
diff -c -3 -p -r1.8 darwin-protos.h
*** darwin-protos.h     2001/12/21 10:44:50     1.8
--- darwin-protos.h     2002/01/15 16:15:00
*************** extern void darwin_encode_section_info P
*** 64,71 ****
  
  extern void machopic_finish PARAMS ((FILE *));
  
- extern void machopic_output_possible_stub_label PARAMS ((FILE *, const
char*));
- 
  extern void darwin_exception_section PARAMS ((void));
  extern void darwin_eh_frame_section PARAMS ((void));
  
--- 64,69 ----
Index: darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 darwin.c
*** darwin.c    2002/01/03 17:13:37     1.17
--- darwin.c    2002/01/15 16:15:00
*************** Boston, MA 02111-1307, USA.  */
*** 44,50 ****
  extern void machopic_output_stub PARAMS ((FILE *, const char *, const char
*));
  
  static int machopic_data_defined_p PARAMS ((const char *));
- static int func_name_maybe_scoped PARAMS ((const char *));
  static void update_non_lazy_ptrs PARAMS ((const char *));
  static void update_stubs PARAMS ((const char *));
  
--- 44,49 ----
*************** machopic_finish (asm_out_file)
*** 842,851 ****
        if (! TREE_USED (temp))
        continue;
  
-       /* If the symbol is actually defined, we don't need a stub.  */
-       if (sym_name[0] == '!' && sym_name[1] == 'T')
-       continue;
- 
        STRIP_NAME_ENCODING (sym_name, sym_name);
  
        sym = alloca (strlen (sym_name) + 2);
--- 841,846 ----
*************** update_non_lazy_ptrs (name)
*** 1040,1079 ****
              IDENTIFIER_POINTER (TREE_VALUE (temp)) = name;
              break;
            }
-       }
-     }
- }
- 
- /* Function NAME is being defined, and its label has just been output.
-    If there's already a reference to a stub for this function, we can
-    just emit the stub label now and we don't bother emitting the stub
later. */
- 
- void
- machopic_output_possible_stub_label (file, name)
-      FILE *file;
-      const char *name;
- {
-   tree temp;
- 
- 
-   /* Ensure we're looking at a section-encoded name.  */
-   if (name[0] != '!' || (name[1] != 't' && name[1] != 'T'))
-     return;
- 
-   for (temp = machopic_stubs;
-        temp != NULL_TREE;
-        temp = TREE_CHAIN (temp))
-     {
-       const char *sym_name;
- 
-       sym_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
-       if (sym_name[0] == '!' && sym_name[1] == 'T'
-         && ! strcmp (name+2, sym_name+2))
-       {
-         ASM_OUTPUT_LABEL (file, IDENTIFIER_POINTER (TREE_PURPOSE (temp)));
-         /* Avoid generating a stub for this.  */
-         TREE_USED (temp) = 0;
-         break;
        }
      }
  }
--- 1035,1040 ----
Index: darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.22
diff -c -3 -p -r1.22 darwin.h
*** darwin.h    2001/12/21 10:44:50     1.22
--- darwin.h    2002/01/15 16:15:00
*************** do { text_section ();
\
*** 232,240 ****
          || DECL_INITIAL (DECL))                                         \
        ENCODE_SECTION_INFO (DECL);                                     \
      ASM_OUTPUT_LABEL (FILE, xname);                                     \
-     /* Avoid generating stubs for functions we've just defined by     \
-        outputting any required stub name label now.  */               \
-     machopic_output_possible_stub_label (FILE, xname);                \
    } while (0)
  
  /* Wrap new method names in quotes so the assembler doesn't gag.
--- 232,237 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]