[PATCH] Remove mark_addressable langhook

Richard Guenther rguenther@suse.de
Mon Aug 31 22:31:00 GMT 2009


This removes the last two (unneccessary) uses of the mark_addressable
langhook.  And the langhook itself.

Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2009-08-31  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (mark_addressable): Move declaration ...
	* tree.h (mark_addressable): ... here.
	* stmt.c (expand_asm_operands): Use mark_addressable, not
	lang_hooks.mark_addressable.
	* langhooks-def.h (LANG_HOOKS_INITIALIZER): Remove
	LANG_HOOKS_MARK_ADDRESSABLE.
	* langhooks.h (struct lang_hooks): Remove mark_addressable langhook.

	* c-objc-common.h (LANG_HOOKS_MARK_ADDRESSABLE): Remove.

	ada/
	* gcc-interface/misc.c (LANG_HOOKS_MARK_ADDRESSABLE): Remove.

	cp/
	* cp-objcp-common.h (LANG_HOOKS_MARK_ADDRESSABLE): Remove.

	fortran/
	* f95-lang.c (gfc_mark_addressable): Remove.
	(LANG_HOOKS_MARK_ADDRESSABLE): Likewise.

	java/
	* lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Remove.

Index: gcc/tree-flow.h
===================================================================
*** gcc/tree-flow.h.orig	2009-08-28 10:08:13.000000000 +0200
--- gcc/tree-flow.h	2009-08-31 15:33:48.000000000 +0200
*************** tree force_gimple_operand (tree, gimple_
*** 890,896 ****
  tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
  			       bool, enum gsi_iterator_update);
  tree gimple_fold_indirect_ref (tree);
- void mark_addressable (tree);
  
  /* In tree-ssa-live.c */
  extern void remove_unused_locals (void);
--- 890,895 ----
Index: gcc/stmt.c
===================================================================
*** gcc/stmt.c.orig	2009-08-12 19:51:10.000000000 +0200
--- gcc/stmt.c	2009-08-31 15:34:10.000000000 +0200
*************** expand_asm_operands (tree string, tree o
*** 737,743 ****
  	      || (DECL_P (val)
  		  && REG_P (DECL_RTL (val))
  		  && GET_MODE (DECL_RTL (val)) != TYPE_MODE (type))))
! 	lang_hooks.mark_addressable (val);
  
        if (is_inout)
  	ninout++;
--- 737,743 ----
  	      || (DECL_P (val)
  		  && REG_P (DECL_RTL (val))
  		  && GET_MODE (DECL_RTL (val)) != TYPE_MODE (type))))
! 	mark_addressable (val);
  
        if (is_inout)
  	ninout++;
*************** expand_asm_operands (tree string, tree o
*** 766,772 ****
  	return;
  
        if (! allows_reg && allows_mem)
! 	lang_hooks.mark_addressable (TREE_VALUE (tail));
      }
  
    /* Second pass evaluates arguments.  */
--- 766,772 ----
  	return;
  
        if (! allows_reg && allows_mem)
! 	mark_addressable (TREE_VALUE (tail));
      }
  
    /* Second pass evaluates arguments.  */
Index: gcc/ada/gcc-interface/misc.c
===================================================================
*** gcc/ada/gcc-interface/misc.c.orig	2009-08-31 15:36:53.000000000 +0200
--- gcc/ada/gcc-interface/misc.c	2009-08-31 15:36:59.000000000 +0200
*************** static void gnat_get_subrange_bounds	(co
*** 106,113 ****
  #define LANG_HOOKS_WRITE_GLOBALS	gnat_write_global_declarations
  #undef  LANG_HOOKS_GET_ALIAS_SET
  #define LANG_HOOKS_GET_ALIAS_SET	gnat_get_alias_set
- #undef  LANG_HOOKS_MARK_ADDRESSABLE
- #define LANG_HOOKS_MARK_ADDRESSABLE	gnat_mark_addressable
  #undef  LANG_HOOKS_PRINT_DECL
  #define LANG_HOOKS_PRINT_DECL		gnat_print_decl
  #undef  LANG_HOOKS_PRINT_TYPE
--- 106,111 ----
Index: gcc/c-objc-common.h
===================================================================
*** gcc/c-objc-common.h.orig	2009-08-31 15:36:10.000000000 +0200
--- gcc/c-objc-common.h	2009-08-31 15:36:16.000000000 +0200
*************** along with GCC; see the file COPYING3.  
*** 40,47 ****
  #define LANG_HOOKS_POST_OPTIONS c_common_post_options
  #undef LANG_HOOKS_GET_ALIAS_SET
  #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
- #undef LANG_HOOKS_MARK_ADDRESSABLE
- #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
  #undef LANG_HOOKS_PARSE_FILE
  #define LANG_HOOKS_PARSE_FILE c_common_parse_file
  #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
--- 40,45 ----
Index: gcc/cp/cp-objcp-common.h
===================================================================
*** gcc/cp/cp-objcp-common.h.orig	2009-08-31 15:36:26.000000000 +0200
--- gcc/cp/cp-objcp-common.h	2009-08-31 15:36:32.000000000 +0200
*************** extern bool cp_function_decl_explicit_p 
*** 58,65 ****
  #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl
  #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
  #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME mangle_decl
- #undef LANG_HOOKS_MARK_ADDRESSABLE
- #define LANG_HOOKS_MARK_ADDRESSABLE cxx_mark_addressable
  #undef LANG_HOOKS_PRINT_STATISTICS
  #define LANG_HOOKS_PRINT_STATISTICS cxx_print_statistics
  #undef LANG_HOOKS_PRINT_XNODE
--- 58,63 ----
Index: gcc/langhooks-def.h
===================================================================
*** gcc/langhooks-def.h.orig	2009-08-31 15:35:05.000000000 +0200
--- gcc/langhooks-def.h	2009-08-31 15:35:42.000000000 +0200
*************** extern tree lhd_make_node (enum tree_cod
*** 237,243 ****
    LANG_HOOKS_MISSING_NORETURN_OK_P, \
    LANG_HOOKS_GET_ALIAS_SET, \
    LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
-   LANG_HOOKS_MARK_ADDRESSABLE, \
    LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
    LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
    LANG_HOOKS_PRINT_STATISTICS, \
--- 237,242 ----
Index: gcc/langhooks.h
===================================================================
*** gcc/langhooks.h.orig	2009-08-31 15:35:05.000000000 +0200
--- gcc/langhooks.h	2009-08-31 15:35:18.000000000 +0200
*************** struct lang_hooks
*** 291,301 ****
       compilation.  Default hook is does nothing.  */
    void (*finish_incomplete_decl) (tree);
  
-   /* Mark EXP saying that we need to be able to take the address of
-      it; it should not be allocated in a register.  Return true if
-      successful.  */
-   bool (*mark_addressable) (tree);
- 
    /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
       DECL_NODE with a newly GC-allocated copy.  */
    void (*dup_lang_specific_decl) (tree);
--- 291,296 ----
Index: gcc/tree.h
===================================================================
*** gcc/tree.h.orig	2009-08-31 17:31:45.000000000 +0200
--- gcc/tree.h	2009-08-31 17:31:55.000000000 +0200
*************** extern bool in_gimple_form;
*** 5157,5162 ****
--- 5157,5163 ----
  
  /* In gimple.c.  */
  extern tree get_base_address (tree t);
+ extern void mark_addressable (tree);
  
  /* In tree-vectorizer.c.  */
  extern void vect_set_verbosity_level (const char *);
Index: gcc/fortran/f95-lang.c
===================================================================
*** gcc/fortran/f95-lang.c.orig	2009-08-31 17:48:44.000000000 +0200
--- gcc/fortran/f95-lang.c	2009-08-31 17:50:32.000000000 +0200
*************** static void gfc_init_builtin_functions (
*** 94,100 ****
  static bool gfc_init (void);
  static void gfc_finish (void);
  static void gfc_print_identifier (FILE *, tree, int);
- static bool gfc_mark_addressable (tree);
  void do_function_end (void);
  int global_bindings_p (void);
  static void clear_binding_stack (void);
--- 94,99 ----
*************** static void gfc_init_ts (void);
*** 137,143 ****
  #define LANG_HOOKS_POST_OPTIONS		gfc_post_options
  #define LANG_HOOKS_PRINT_IDENTIFIER     gfc_print_identifier
  #define LANG_HOOKS_PARSE_FILE           gfc_be_parse_file
- #define LANG_HOOKS_MARK_ADDRESSABLE	gfc_mark_addressable
  #define LANG_HOOKS_TYPE_FOR_MODE	gfc_type_for_mode
  #define LANG_HOOKS_TYPE_FOR_SIZE	gfc_type_for_size
  #define LANG_HOOKS_GET_ALIAS_SET	gfc_get_alias_set
--- 136,141 ----
*************** gfc_init_decl_processing (void)
*** 563,646 ****
  }
  
  
- /* Mark EXP saying that we need to be able to take the
-    address of it; it should not be allocated in a register.
-    In Fortran 95 this is only the case for variables with
-    the TARGET attribute, but we implement it here for a
-    likely future Cray pointer extension.
-    Value is 1 if successful.  */
- /* TODO: Check/fix mark_addressable.  */
- 
- bool
- gfc_mark_addressable (tree exp)
- {
-   register tree x = exp;
-   while (1)
-     switch (TREE_CODE (x))
-       {
-       case COMPONENT_REF:
-       case ADDR_EXPR:
-       case ARRAY_REF:
-       case REALPART_EXPR:
-       case IMAGPART_EXPR:
- 	x = TREE_OPERAND (x, 0);
- 	break;
- 
-       case CONSTRUCTOR:
- 	TREE_ADDRESSABLE (x) = 1;
- 	return true;
- 
-       case VAR_DECL:
-       case CONST_DECL:
-       case PARM_DECL:
-       case RESULT_DECL:
- 	if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x) && DECL_NONLOCAL (x))
- 	  {
- 	    if (TREE_PUBLIC (x))
- 	      {
- 		error ("global register variable %qs used in nested function",
- 		       IDENTIFIER_POINTER (DECL_NAME (x)));
- 		return false;
- 	      }
- 	    pedwarn (input_location, 0, "register variable %qs used in nested function",
- 		     IDENTIFIER_POINTER (DECL_NAME (x)));
- 	  }
- 	else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
- 	  {
- 	    if (TREE_PUBLIC (x))
- 	      {
- 		error ("address of global register variable %qs requested",
- 		       IDENTIFIER_POINTER (DECL_NAME (x)));
- 		return true;
- 	      }
- 
- #if 0
- 	    /* If we are making this addressable due to its having
- 	       volatile components, give a different error message.  Also
- 	       handle the case of an unnamed parameter by not trying
- 	       to give the name.  */
- 
- 	    else if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (x)))
- 	      {
- 		error ("cannot put object with volatile field into register");
- 		return false;
- 	      }
- #endif
- 
- 	    pedwarn (input_location, 0, "address of register variable %qs requested",
- 		     IDENTIFIER_POINTER (DECL_NAME (x)));
- 	  }
- 
- 	/* drops in */
-       case FUNCTION_DECL:
- 	TREE_ADDRESSABLE (x) = 1;
- 
-       default:
- 	return true;
-       }
- }
- 
- 
  /* Return the typed-based alias set for T, which may be an expression
     or a type.  Return -1 if we don't do anything special.  */
  
--- 561,566 ----
Index: gcc/java/lang.c
===================================================================
*** gcc/java/lang.c.orig	2009-08-31 17:49:44.000000000 +0200
--- gcc/java/lang.c	2009-08-31 17:49:59.000000000 +0200
*************** struct GTY(()) language_function {
*** 129,136 ****
  #define LANG_HOOKS_POST_OPTIONS java_post_options
  #undef LANG_HOOKS_PARSE_FILE
  #define LANG_HOOKS_PARSE_FILE java_parse_file
- #undef LANG_HOOKS_MARK_ADDRESSABLE
- #define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable
  #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
  #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
  #undef LANG_HOOKS_DECL_PRINTABLE_NAME
--- 129,134 ----



More information about the Gcc-patches mailing list