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] Shrink some more structures for 64bit hosts


This re-orders fields in some more (commonly used) structs to save
a cache line (or half of it) on 64bit archs.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2009-03-23  Richard Guenther  <rguenther@suse.de>

	* cgraph.h (struct cgraph_node): Reorder fields for 64-bit hosts.
	* tree.h (struct tree_type): Likewise.
	* reload.h (struct insn_chain): Likewise.
	* dwarf2out.c (struct dw_loc_descr_struct): Likewise.
	* function.h (struct function): Likewise.
	* tree-ssa-structalias.c (struct equiv_class_label): Likewise.

Index: cgraph.h
===================================================================
*** cgraph.h	(revision 145007)
--- cgraph.h	(working copy)
*************** struct cgraph_node GTY((chain_next ("%h.
*** 163,168 ****
--- 163,172 ----
    /* Ordering of all cgraph nodes.  */
    int order;
  
+   /* unique id for profiling. pid is not suitable because of different
+      number of cfg nodes with -fprofile-generate and -fprofile-use */
+   int pid;
+ 
    /* Set when function must be output - it is externally visible
       or its address is taken.  */
    unsigned needed : 1;
*************** struct cgraph_node GTY((chain_next ("%h.
*** 186,195 ****
       into clone before compiling so the function in original form can be
       inlined later.  This pointer points to the clone.  */
    tree inline_decl;
- 
-   /* unique id for profiling. pid is not suitable because of different
-      number of cfg nodes with -fprofile-generate and -fprofile-use */
-   int pid;
  };
  
  struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller")))
--- 190,195 ----
Index: tree.h
===================================================================
*** tree.h	(revision 145007)
--- tree.h	(working copy)
*************** struct tree_type GTY(())
*** 2286,2291 ****
--- 2286,2292 ----
    unsigned user_align : 1;
  
    unsigned int align;
+   alias_set_type alias_set;
    tree pointer_to;
    tree reference_to;
    union tree_type_symtab {
*************** struct tree_type GTY(())
*** 2302,2308 ****
    tree binfo;
    tree context;
    tree canonical;
-   alias_set_type alias_set;
    /* Points to a structure whose details depend on the language in use.  */
    struct lang_type *lang_specific;
  };
--- 2303,2308 ----
Index: reload.h
===================================================================
*** reload.h	(revision 145007)
--- reload.h	(working copy)
*************** struct insn_chain
*** 205,214 ****
       all insns that need reloading.  */
    struct insn_chain *next_need_reload;
  
-   /* The basic block this insn is in.  */
-   int block;
    /* The rtx of the insn.  */
    rtx insn;
    /* Register life information: record all live hard registers, and
       all live pseudos that have a hard register.  This set also
       contains pseudos spilled by IRA.  */
--- 205,226 ----
       all insns that need reloading.  */
    struct insn_chain *next_need_reload;
  
    /* The rtx of the insn.  */
    rtx insn;
+ 
+   /* The basic block this insn is in.  */
+   int block;
+ 
+   /* Nonzero if find_reloads said the insn requires reloading.  */
+   unsigned int need_reload:1;
+   /* Nonzero if find_reloads needs to be run during reload_as_needed to
+      perform modifications on any operands.  */
+   unsigned int need_operand_change:1;
+   /* Nonzero if eliminate_regs_in_insn said it requires eliminations.  */
+   unsigned int need_elim:1;
+   /* Nonzero if this insn was inserted by perform_caller_saves.  */
+   unsigned int is_caller_save_insn:1;
+ 
    /* Register life information: record all live hard registers, and
       all live pseudos that have a hard register.  This set also
       contains pseudos spilled by IRA.  */
*************** struct insn_chain
*** 221,236 ****
  
    /* Indicates which registers have already been used for spills.  */
    HARD_REG_SET used_spill_regs;
- 
-   /* Nonzero if find_reloads said the insn requires reloading.  */
-   unsigned int need_reload:1;
-   /* Nonzero if find_reloads needs to be run during reload_as_needed to
-      perform modifications on any operands.  */
-   unsigned int need_operand_change:1;
-   /* Nonzero if eliminate_regs_in_insn said it requires eliminations.  */
-   unsigned int need_elim:1;
-   /* Nonzero if this insn was inserted by perform_caller_saves.  */
-   unsigned int is_caller_save_insn:1;
  };
  
  /* A chain of insn_chain structures to describe all non-note insns in
--- 233,238 ----
Index: dwarf2out.c
===================================================================
*** dwarf2out.c	(revision 145007)
--- dwarf2out.c	(working copy)
*************** typedef struct dw_loc_descr_struct GTY((
*** 3499,3507 ****
  {
    dw_loc_descr_ref dw_loc_next;
    enum dwarf_location_atom dw_loc_opc;
    dw_val_node dw_loc_oprnd1;
    dw_val_node dw_loc_oprnd2;
-   int dw_loc_addr;
  }
  dw_loc_descr_node;
  
--- 3499,3507 ----
  {
    dw_loc_descr_ref dw_loc_next;
    enum dwarf_location_atom dw_loc_opc;
+   int dw_loc_addr;
    dw_val_node dw_loc_oprnd1;
    dw_val_node dw_loc_oprnd2;
  }
  dw_loc_descr_node;
  
Index: function.h
===================================================================
*** function.h	(revision 145007)
--- function.h	(working copy)
*************** struct function GTY(())
*** 501,509 ****
       pointer.  */
    tree nonlocal_goto_save_area;
  
-   /* Function sequence number for profiling, debugging, etc.  */
-   int funcdef_no;
- 
    /* List of function local variables, functions, types and constants.  */
    tree local_decls;
  
--- 501,506 ----
*************** struct function GTY(())
*** 521,526 ****
--- 518,526 ----
    /* Last statement uid.  */
    int last_stmt_uid;
  
+   /* Function sequence number for profiling, debugging, etc.  */
+   int funcdef_no;
+ 
    /* Line number of the start of the function for debugging purposes.  */
    location_t function_start_locus;
  
Index: tree-ssa-structalias.c
===================================================================
*** tree-ssa-structalias.c	(revision 145007)
--- tree-ssa-structalias.c	(working copy)
*************** compute_topo_order (constraint_graph_t g
*** 1817,1825 ****
  
  typedef struct equiv_class_label
  {
    unsigned int equivalence_class;
    bitmap labels;
-   hashval_t hashcode;
  } *equiv_class_label_t;
  typedef const struct equiv_class_label *const_equiv_class_label_t;
  
--- 1817,1825 ----
  
  typedef struct equiv_class_label
  {
+   hashval_t hashcode;
    unsigned int equivalence_class;
    bitmap labels;
  } *equiv_class_label_t;
  typedef const struct equiv_class_label *const_equiv_class_label_t;
  


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