diff mbox

[Ada] Minor cleanup in gigi (4/4)

Message ID 9429502.9PIbOdOJjs@polaris
State New
Headers show

Commit Message

Eric Botcazou May 25, 2015, 9:12 p.m. UTC
Tested on x86_64-suse-linux, applied on the mainline.


2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>

	* get_targ.adb (C_Get_Float_Words_BE): Adjust import name.
	(C_Get_Words_BE): Likewise.
	(C_Get_Bytes_BE): Likewise.
	(C_Get_Bits_BE): Likewise.
	(Width_From_Size): Remove superfluous space.
	* gcc-interface/targtyps.c (get_float_words_be): Rename into...
	(get_target_float_words_be): ...this.
	(get_words_be): Rename into...
	(get_target_words_be): ...this.
	(get_bytes_be): Rename into...
	(get_target_bytes_be): ...this.
	(get_bits_be): Rename into...
	(get_target_bits_be): ...this.
	* gcc-interface/gigi.h (standard_datatypes): Remove ADT_ptr_void_type.
	(ptr_void_type_node): Delete.
	(get_target_float_size): Likewise.
	(get_target_double_size): Likewise.
	(get_target_long_double_size): Likewise.
	(get_float_words_be): Likewise.
	(get_words_be): Likewise.
	(get_bytes_be): Likewise.
	(get_bits_be): Likewise.
	(get_target_float_words_be): Declare.
	(get_target_words_be): Likewise.
	(get_target_bytes_be): Likewise.
	(get_target_bits_be): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Replace ptr_void_type_node
	with ptr_type_node.
	(intrin_return_compatible_p): Likewise.
	* gcc-interface/trans.c (gigi): Likewise.
	* gcc-interface/utils2.c (maybe_wrap_malloc): Likewise.
	(maybe_wrap_free): Likewise.
	* gcc-interface/utils.c (maybe_pad_type): Remove superfluous space.
	* gcc-interface/misc.c (gnat_init): Do not set ptr_void_type_node.
diff mbox

Patch

Index: get_targ.adb
===================================================================
--- get_targ.adb	(revision 223641)
+++ get_targ.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -23,12 +23,12 @@ 
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Version for use with gcc
+--  Version for use with GCC
 
 package body Get_Targ is
 
-   --  Functions returning individual runtime. For the standard (GCC) back
-   --  end these come from C interface functions (one for each value).
+   --  Functions returning individual run-time values. For the standard (GCC)
+   --  back end, these come from C interface functions (one for each value).
 
    -----------------------
    -- Get_Bits_Per_Unit --
@@ -157,7 +157,7 @@  package body Get_Targ is
    function Get_Float_Words_BE return Nat is
       function C_Get_Float_Words_BE return Nat;
       pragma Import (C, C_Get_Float_Words_BE,
-                        "get_float_words_be");
+                        "get_target_float_words_be");
    begin
       return C_Get_Float_Words_BE;
    end Get_Float_Words_BE;
@@ -169,7 +169,7 @@  package body Get_Targ is
    function Get_Words_BE return Nat is
       function C_Get_Words_BE return Nat;
       pragma Import (C, C_Get_Words_BE,
-                        "get_words_be");
+                        "get_target_words_be");
    begin
       return C_Get_Words_BE;
    end Get_Words_BE;
@@ -181,7 +181,7 @@  package body Get_Targ is
    function Get_Bytes_BE return Nat is
       function C_Get_Bytes_BE return Nat;
       pragma Import (C, C_Get_Bytes_BE,
-                        "get_bytes_be");
+                        "get_target_bytes_be");
    begin
       return C_Get_Bytes_BE;
    end Get_Bytes_BE;
@@ -193,7 +193,7 @@  package body Get_Targ is
    function Get_Bits_BE return Nat is
       function C_Get_Bits_BE return Nat;
       pragma Import (C, C_Get_Bits_BE,
-                        "get_bits_be");
+                        "get_target_bits_be");
    begin
       return C_Get_Bits_BE;
    end Get_Bits_BE;
@@ -306,7 +306,7 @@  package body Get_Targ is
    -- Width_From_Size --
    ---------------------
 
-   function Width_From_Size  (Size : Pos) return Pos is
+   function Width_From_Size (Size : Pos) return Pos is
    begin
       case Size is
          when  8     => return  4;
Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c	(revision 223653)
+++ gcc-interface/utils.c	(working copy)
@@ -1351,8 +1351,8 @@  maybe_pad_type (tree type, tree size, un
     }
 
   /* Now create the field with the original size.  */
-  field  = create_field_decl (get_identifier ("F"), type, record, orig_size,
-			      bitsize_zero_node, 0, 1);
+  field = create_field_decl (get_identifier ("F"), type, record, orig_size,
+			     bitsize_zero_node, 0, 1);
   DECL_INTERNAL_P (field) = 1;
 
   /* Do not emit debug info until after the auxiliary record is built.  */
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 223655)
+++ gcc-interface/decl.c	(working copy)
@@ -2055,7 +2055,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 	   a pointer to the array type since we don't have the array type
 	   yet (it will reference the fat pointer via the bounds).  */
 	tem
-	  = create_field_decl (get_identifier ("P_ARRAY"), ptr_void_type_node,
+	  = create_field_decl (get_identifier ("P_ARRAY"), ptr_type_node,
 			       gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
 	DECL_CHAIN (tem)
 	  = create_field_decl (get_identifier ("P_BOUNDS"), gnu_ptr_template,
@@ -3889,7 +3889,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 	/* If expansion is disabled, the equivalent type of a concurrent type
 	   is absent, so build a dummy pointer type.  */
 	else if (type_annotate_only && No (gnat_desig_equiv))
-	  gnu_type = ptr_void_type_node;
+	  gnu_type = ptr_type_node;
 
 	/* Finally, handle the default case where we can just elaborate our
 	   designated type.  */
@@ -4008,7 +4008,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
     case E_Access_Protected_Subprogram_Type:
     case E_Anonymous_Access_Protected_Subprogram_Type:
       if (type_annotate_only && No (gnat_equiv_type))
-	gnu_type = ptr_void_type_node;
+	gnu_type = ptr_type_node;
       else
 	{
 	  /* The run-time representation is the equivalent type.  */
@@ -4232,7 +4232,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 	       we are only annotating types, break circularities here.  */
 	    if (type_annotate_only
 	        && is_from_limited_with_of_main (gnat_return_type))
-	      gnu_return_type = ptr_void_type_node;
+	      gnu_return_type = void_type_node;
 	    else
 	      gnu_return_type = gnat_to_gnu_type (gnat_return_type);
 
@@ -4343,7 +4343,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 	    if (type_annotate_only
 	        && is_from_limited_with_of_main (gnat_param_type))
 	      {
-		gnu_param_type = ptr_void_type_node;
+		gnu_param_type = void_type_node;
 		fake_param_type = true;
 	      }
 	    else
@@ -5681,7 +5681,7 @@  gnat_to_gnu_param (Entity_Id gnat_param,
   if (Convention (gnat_subprog) == Convention_Intrinsic
       && Present (Interface_Name (gnat_subprog))
       && Is_Descendent_Of_Address (Etype (gnat_param)))
-    gnu_param_type = ptr_void_type_node;
+    gnu_param_type = ptr_type_node;
 
   /* Arrays are passed as pointers to element type for foreign conventions.  */
   if (foreign && mech != By_Copy && TREE_CODE (gnu_param_type) == ARRAY_TYPE)
@@ -8310,7 +8310,7 @@  intrin_return_compatible_p (intrin_bindi
 
   /* If return type is Address (integer type), map it to void *.  */
   if (Is_Descendent_Of_Address (Etype (inb->gnat_entity)))
-    ada_return_type = ptr_void_type_node;
+    ada_return_type = ptr_type_node;
 
   /* Check return types compatibility otherwise.  Note that this
      handles void/void as well.  */
Index: gcc-interface/targtyps.c
===================================================================
--- gcc-interface/targtyps.c	(revision 223641)
+++ gcc-interface/targtyps.c	(working copy)
@@ -23,7 +23,7 @@ 
  *                                                                          *
  ****************************************************************************/
 
-/* Functions for retrieving target types. See Ada package Get_Targ */
+/* Functions for retrieving target types.  See Ada package Get_Targ.  */
 
 #include "config.h"
 #include "system.h"
@@ -192,25 +192,25 @@  get_target_maximum_alignment (void)
 #endif
 
 Nat
-get_float_words_be (void)
+get_target_float_words_be (void)
 {
   return FLOAT_WORDS_BIG_ENDIAN;
 }
 
 Nat
-get_words_be (void)
+get_target_words_be (void)
 {
   return WORDS_BIG_ENDIAN;
 }
 
 Nat
-get_bytes_be (void)
+get_target_bytes_be (void)
 {
   return BYTES_BIG_ENDIAN;
 }
 
 Nat
-get_bits_be (void)
+get_target_bits_be (void)
 {
   return BITS_BIG_ENDIAN;
 }
Index: gcc-interface/utils2.c
===================================================================
--- gcc-interface/utils2.c	(revision 223653)
+++ gcc-interface/utils2.c	(working copy)
@@ -833,7 +833,7 @@  tree
 build_binary_op (enum tree_code op_code, tree result_type,
                  tree left_operand, tree right_operand)
 {
-  tree left_type  = TREE_TYPE (left_operand);
+  tree left_type = TREE_TYPE (left_operand);
   tree right_type = TREE_TYPE (right_operand);
   tree left_base_type = get_base_type (left_type);
   tree right_base_type = get_base_type (right_type);
@@ -2289,14 +2289,14 @@  maybe_wrap_malloc (tree data_size, tree
       /* Then arrange to store the allocator's return value ahead
 	 and return.  */
       tree storage_ptr_slot_addr
-	= build_binary_op (POINTER_PLUS_EXPR, ptr_void_type_node,
-			   convert (ptr_void_type_node, aligning_field_addr),
+	= build_binary_op (POINTER_PLUS_EXPR, ptr_type_node,
+			   convert (ptr_type_node, aligning_field_addr),
 			   size_int (-(HOST_WIDE_INT) POINTER_SIZE
 				     / BITS_PER_UNIT));
 
       tree storage_ptr_slot
 	= build_unary_op (INDIRECT_REF, NULL_TREE,
-			  convert (build_pointer_type (ptr_void_type_node),
+			  convert (build_pointer_type (ptr_type_node),
 				   storage_ptr_slot_addr));
 
       return
@@ -2331,15 +2331,15 @@  maybe_wrap_free (tree data_ptr, tree dat
 	 = (void *)DATA_PTR - (void *)sizeof (void *))  */
       tree data_front_ptr
 	= build_binary_op
-	  (POINTER_PLUS_EXPR, ptr_void_type_node,
-	   convert (ptr_void_type_node, data_ptr),
+	  (POINTER_PLUS_EXPR, ptr_type_node,
+	   convert (ptr_type_node, data_ptr),
 	   size_int (-(HOST_WIDE_INT) POINTER_SIZE / BITS_PER_UNIT));
 
       /* FREE_PTR (void *) = *(void **)DATA_FRONT_PTR  */
       free_ptr
 	= build_unary_op
 	  (INDIRECT_REF, NULL_TREE,
-	   convert (build_pointer_type (ptr_void_type_node), data_front_ptr));
+	   convert (build_pointer_type (ptr_type_node), data_front_ptr));
     }
   else
     free_ptr = data_ptr;
Index: gcc-interface/gigi.h
===================================================================
--- gcc-interface/gigi.h	(revision 223652)
+++ gcc-interface/gigi.h	(working copy)
@@ -373,9 +373,6 @@  enum standard_datatypes
   /* The type of an exception.  */
   ADT_except_type,
 
-  /* Type declaration node  <==> typedef void *T */
-  ADT_ptr_void_type,
-
   /* Function type declaration -- void T() */
   ADT_void_ftype,
 
@@ -461,7 +458,6 @@  extern GTY(()) tree gnat_raise_decls_ext
 
 #define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type]
 #define except_type_node gnat_std_decls[(int) ADT_except_type]
-#define ptr_void_type_node gnat_std_decls[(int) ADT_ptr_void_type]
 #define void_ftype gnat_std_decls[(int) ADT_void_ftype]
 #define ptr_void_ftype gnat_std_decls[(int) ADT_ptr_void_ftype]
 #define fdesc_type_node gnat_std_decls[(int) ADT_fdesc_type]
@@ -1035,18 +1031,15 @@  extern Pos get_target_short_size (void);
 extern Pos get_target_int_size (void);
 extern Pos get_target_long_size (void);
 extern Pos get_target_long_long_size (void);
-extern Pos get_target_float_size (void);
-extern Pos get_target_double_size (void);
-extern Pos get_target_long_double_size (void);
 extern Pos get_target_pointer_size (void);
 extern Pos get_target_maximum_default_alignment (void);
 extern Pos get_target_system_allocator_alignment (void);
 extern Pos get_target_maximum_allowed_alignment (void);
 extern Pos get_target_maximum_alignment (void);
-extern Nat get_float_words_be (void);
-extern Nat get_words_be (void);
-extern Nat get_bytes_be (void);
-extern Nat get_bits_be (void);
+extern Nat get_target_float_words_be (void);
+extern Nat get_target_words_be (void);
+extern Nat get_target_bytes_be (void);
+extern Nat get_target_bits_be (void);
 extern Nat get_target_strict_alignment (void);
 extern Nat get_target_double_float_alignment (void);
 extern Nat get_target_double_scalar_alignment (void);
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 223653)
+++ gcc-interface/trans.c	(working copy)
@@ -414,7 +414,7 @@  gigi (Node_Id gnat_root,
   ptr_void_ftype = build_pointer_type (void_ftype);
 
   /* Now declare run-time functions.  */
-  ftype = build_function_type_list (ptr_void_type_node, sizetype, NULL_TREE);
+  ftype = build_function_type_list (ptr_type_node, sizetype, NULL_TREE);
 
   /* malloc is a function declaration tree for a function to allocate
      memory.  */
@@ -428,7 +428,7 @@  gigi (Node_Id gnat_root,
   free_decl
     = create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE,
 			   build_function_type_list (void_type_node,
-						     ptr_void_type_node,
+						     ptr_type_node,
 						     NULL_TREE),
 			   NULL_TREE, is_disabled, true, true, true, NULL,
 			   Empty);
@@ -494,8 +494,7 @@  gigi (Node_Id gnat_root,
   DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF;
 
   /* Hooks to call when entering/leaving an exception handler.  */
-  ftype
-    = build_function_type_list (void_type_node, ptr_void_type_node, NULL_TREE);
+  ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
 
   begin_handler_decl
     = create_subprog_decl (get_identifier ("__gnat_begin_handler"), NULL_TREE,
@@ -576,9 +575,7 @@  gigi (Node_Id gnat_root,
   set_exception_parameter_decl
     = create_subprog_decl
       (get_identifier ("__gnat_set_exception_parameter"), NULL_TREE,
-       build_function_type_list (void_type_node,
-				 ptr_void_type_node,
-				 ptr_void_type_node,
+       build_function_type_list (void_type_node, ptr_type_node, ptr_type_node,
 				 NULL_TREE),
        NULL_TREE, is_disabled, true, true, true, NULL, Empty);
 
Index: gcc-interface/misc.c
===================================================================
--- gcc-interface/misc.c	(revision 223652)
+++ gcc-interface/misc.c	(working copy)
@@ -370,8 +370,6 @@  gnat_init (void)
   sbitsize_one_node = sbitsize_int (1);
   sbitsize_unit_node = sbitsize_int (BITS_PER_UNIT);
 
-  ptr_void_type_node = build_pointer_type (void_type_node);
-
   /* Show that REFERENCE_TYPEs are internal and should be Pmode.  */
   internal_reference_types ();