Re: [PATCH]: Remove remaining traces of MPX bounded pointers

2018-08-24 Thread Jakub Jelinek
On Fri, Aug 24, 2018 at 03:56:27PM +0200, Uros Bizjak wrote:
> 2018-08-23  Uros Bizjak  
> 
> * emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
> * emit-rtl.h (rtl_data): Remove return_bnd.
> * explow.c (trunc_int_for_mode): Do not handle POINTER_BOUNDS_MODE_P.
> * function.c (diddle_return_value): Do not handle crtl->return_bnd.
> * genmodes.c (complete_mode): Do not handle MODE_POINTER_BOUNDS.
> (POINTER_BOUNDS_MODE): Remove definition.
> (make_pointer_bounds_mode): Remove.
> (get_mode_class): Do not handle MODE_POINTER_BOUNDS.
> * machmode.h (POINTER_BOUNDS_MODE_P): Remove definition.
> (scalare_mode::includes_p): Do not handle MODE_POINTER_BOUNDS.
> * mode-classes.def: Do not define MODE_POINTER_BOUNDS.
> * stor-layout.c (int_mode_for_mode): Do not handle MODE_POINTER_BOUNDS.
> * tree-core.h (enum tree_index): Remove TI_POINTER_BOUNDS_TYPE.
> * varasm.c (output_constant_pool_2): Do not handle MODE_POINTER_BOUNDS.
> 
> * config/i386/i386-modes.def (BND32, BND64): Remove.
> * config/i386/i386.c (dbx_register_map): Remove bound registers.
> (dbx64_register_map): Ditto.
> (svr4_dbx_register_map): Ditto.
> (indirect_thunk_bnd_needed): Remove.
> (indirect_thunks_bnd_used): Ditto.
> (indirect_return_bnd_needed): Ditto.
> (indirect_return_via_cx_bnd): Ditto.
> (enum indirect_thunk_prefix): Remove indirect_thunk_prefix_bnd.
> (indirect_thunk_name): Remove handling of indirect_thunk_prefix_bnd.
> (output_indirect_thunk): Ditto.  Remove need_prefix argument.
> (output_indirect_thunk_function): Remove handling of
> indirect_return_bnd_needed, indirect_return_via_cx_bnd,
> indirect_thunk_bnd_needed and indirect_thunks_bnd_used variables.
> (ix86_save_reg): Remove handling of crtl->return_bnd.
> (ix86_legitimate_constant_p): Remove handling of POINTER_BOUNDS_MODE_P.
> (ix86_print_operand_address_as): Remove handling of UNSPEC_BNDMK_ADDR
> and UNSPEC_BNDLX_ADDR.
> (ix86_output_indirect_branch_via_reg): Remove handling of
> indirect_thunk_prefix_bnd.
> (ix86_output_indirect_branch_via_push): Ditto.
> (ix86_output_function_return): Ditto.
> (ix86_output_indirect_function_return): Ditto.
> (avoid_func_arg_motion): Do not handle UNSPEC_BNDSTX.
> * config/i386/i386.h (FIXED_REGISTERS): Remove bound registers.
> (CALL_USED_REGISTERS): Ditto.
> (REG_ALLOC_ORDER): Update for removal of bound registers.
> (HI_REGISTER_NAMES): Ditto.
> * config/i386/i386.md (UNSPEC_BNDMK, UNSPEC_BNDMK_ADDR, UNSPEC_BNDSTX)
> (UNSPEC_BNDLDX, UNSPEC_BNDLDX_ADDR, UNSPEC_BNDCL, UNSPEC_BNDCU)
> (UNSPEC_BNDCN, UNSPEC_MPX_FENCE): Remove.
> (BND0_REG, BND1_REG, BND2_REG, BND3_REG): Remove
> (FIRST_PSEUDO_REG): Update.
> (BND): Remove mode iterator.
> * config/i386/predicates.md (bnd_mem_operator): Remove.
> 
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
> 
> OK for mainline?

OPk, thanks.

Jakub


Re: [PATCH]: Remove remaining traces of MPX bounded pointers

2018-08-24 Thread Jeff Law
On 08/24/2018 07:56 AM, Uros Bizjak wrote:
> 2018-08-23  Uros Bizjak  
> 
> * emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
> * emit-rtl.h (rtl_data): Remove return_bnd.
> * explow.c (trunc_int_for_mode): Do not handle POINTER_BOUNDS_MODE_P.
> * function.c (diddle_return_value): Do not handle crtl->return_bnd.
> * genmodes.c (complete_mode): Do not handle MODE_POINTER_BOUNDS.
> (POINTER_BOUNDS_MODE): Remove definition.
> (make_pointer_bounds_mode): Remove.
> (get_mode_class): Do not handle MODE_POINTER_BOUNDS.
> * machmode.h (POINTER_BOUNDS_MODE_P): Remove definition.
> (scalare_mode::includes_p): Do not handle MODE_POINTER_BOUNDS.
> * mode-classes.def: Do not define MODE_POINTER_BOUNDS.
> * stor-layout.c (int_mode_for_mode): Do not handle MODE_POINTER_BOUNDS.
> * tree-core.h (enum tree_index): Remove TI_POINTER_BOUNDS_TYPE.
> * varasm.c (output_constant_pool_2): Do not handle MODE_POINTER_BOUNDS.
> 
> * config/i386/i386-modes.def (BND32, BND64): Remove.
> * config/i386/i386.c (dbx_register_map): Remove bound registers.
> (dbx64_register_map): Ditto.
> (svr4_dbx_register_map): Ditto.
> (indirect_thunk_bnd_needed): Remove.
> (indirect_thunks_bnd_used): Ditto.
> (indirect_return_bnd_needed): Ditto.
> (indirect_return_via_cx_bnd): Ditto.
> (enum indirect_thunk_prefix): Remove indirect_thunk_prefix_bnd.
> (indirect_thunk_name): Remove handling of indirect_thunk_prefix_bnd.
> (output_indirect_thunk): Ditto.  Remove need_prefix argument.
> (output_indirect_thunk_function): Remove handling of
> indirect_return_bnd_needed, indirect_return_via_cx_bnd,
> indirect_thunk_bnd_needed and indirect_thunks_bnd_used variables.
> (ix86_save_reg): Remove handling of crtl->return_bnd.
> (ix86_legitimate_constant_p): Remove handling of POINTER_BOUNDS_MODE_P.
> (ix86_print_operand_address_as): Remove handling of UNSPEC_BNDMK_ADDR
> and UNSPEC_BNDLX_ADDR.
> (ix86_output_indirect_branch_via_reg): Remove handling of
> indirect_thunk_prefix_bnd.
> (ix86_output_indirect_branch_via_push): Ditto.
> (ix86_output_function_return): Ditto.
> (ix86_output_indirect_function_return): Ditto.
> (avoid_func_arg_motion): Do not handle UNSPEC_BNDSTX.
> * config/i386/i386.h (FIXED_REGISTERS): Remove bound registers.
> (CALL_USED_REGISTERS): Ditto.
> (REG_ALLOC_ORDER): Update for removal of bound registers.
> (HI_REGISTER_NAMES): Ditto.
> * config/i386/i386.md (UNSPEC_BNDMK, UNSPEC_BNDMK_ADDR, UNSPEC_BNDSTX)
> (UNSPEC_BNDLDX, UNSPEC_BNDLDX_ADDR, UNSPEC_BNDCL, UNSPEC_BNDCU)
> (UNSPEC_BNDCN, UNSPEC_MPX_FENCE): Remove.
> (BND0_REG, BND1_REG, BND2_REG, BND3_REG): Remove
> (FIRST_PSEUDO_REG): Update.
> (BND): Remove mode iterator.
> * config/i386/predicates.md (bnd_mem_operator): Remove.
> 
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Oh how I wish we'd done all this back in 2017.  It would have made the
spectrev2 work easier to backport to the old releases which didn't have
all the BND stuff.  Such is life.

> 
> OK for mainline?
OK.

Jeff


[PATCH]: Remove remaining traces of MPX bounded pointers

2018-08-24 Thread Uros Bizjak
2018-08-23  Uros Bizjak  

* emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
* emit-rtl.h (rtl_data): Remove return_bnd.
* explow.c (trunc_int_for_mode): Do not handle POINTER_BOUNDS_MODE_P.
* function.c (diddle_return_value): Do not handle crtl->return_bnd.
* genmodes.c (complete_mode): Do not handle MODE_POINTER_BOUNDS.
(POINTER_BOUNDS_MODE): Remove definition.
(make_pointer_bounds_mode): Remove.
(get_mode_class): Do not handle MODE_POINTER_BOUNDS.
* machmode.h (POINTER_BOUNDS_MODE_P): Remove definition.
(scalare_mode::includes_p): Do not handle MODE_POINTER_BOUNDS.
* mode-classes.def: Do not define MODE_POINTER_BOUNDS.
* stor-layout.c (int_mode_for_mode): Do not handle MODE_POINTER_BOUNDS.
* tree-core.h (enum tree_index): Remove TI_POINTER_BOUNDS_TYPE.
* varasm.c (output_constant_pool_2): Do not handle MODE_POINTER_BOUNDS.

* config/i386/i386-modes.def (BND32, BND64): Remove.
* config/i386/i386.c (dbx_register_map): Remove bound registers.
(dbx64_register_map): Ditto.
(svr4_dbx_register_map): Ditto.
(indirect_thunk_bnd_needed): Remove.
(indirect_thunks_bnd_used): Ditto.
(indirect_return_bnd_needed): Ditto.
(indirect_return_via_cx_bnd): Ditto.
(enum indirect_thunk_prefix): Remove indirect_thunk_prefix_bnd.
(indirect_thunk_name): Remove handling of indirect_thunk_prefix_bnd.
(output_indirect_thunk): Ditto.  Remove need_prefix argument.
(output_indirect_thunk_function): Remove handling of
indirect_return_bnd_needed, indirect_return_via_cx_bnd,
indirect_thunk_bnd_needed and indirect_thunks_bnd_used variables.
(ix86_save_reg): Remove handling of crtl->return_bnd.
(ix86_legitimate_constant_p): Remove handling of POINTER_BOUNDS_MODE_P.
(ix86_print_operand_address_as): Remove handling of UNSPEC_BNDMK_ADDR
and UNSPEC_BNDLX_ADDR.
(ix86_output_indirect_branch_via_reg): Remove handling of
indirect_thunk_prefix_bnd.
(ix86_output_indirect_branch_via_push): Ditto.
(ix86_output_function_return): Ditto.
(ix86_output_indirect_function_return): Ditto.
(avoid_func_arg_motion): Do not handle UNSPEC_BNDSTX.
* config/i386/i386.h (FIXED_REGISTERS): Remove bound registers.
(CALL_USED_REGISTERS): Ditto.
(REG_ALLOC_ORDER): Update for removal of bound registers.
(HI_REGISTER_NAMES): Ditto.
* config/i386/i386.md (UNSPEC_BNDMK, UNSPEC_BNDMK_ADDR, UNSPEC_BNDSTX)
(UNSPEC_BNDLDX, UNSPEC_BNDLDX_ADDR, UNSPEC_BNDCL, UNSPEC_BNDCU)
(UNSPEC_BNDCN, UNSPEC_MPX_FENCE): Remove.
(BND0_REG, BND1_REG, BND2_REG, BND3_REG): Remove
(FIRST_PSEUDO_REG): Update.
(BND): Remove mode iterator.
* config/i386/predicates.md (bnd_mem_operator): Remove.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for mainline?

Uros.
diff --git a/gcc/config/i386/i386-modes.def b/gcc/config/i386/i386-modes.def
index 08c79a5df4e9..12c17ce7dfc2 100644
--- a/gcc/config/i386/i386-modes.def
+++ b/gcc/config/i386/i386-modes.def
@@ -98,9 +98,6 @@ VECTOR_MODE (INT, QI, 14);/*  V14QI */
 VECTOR_MODE (INT, HI, 6); /*   V6HI */
 VECTOR_MODE (INT, SI, 64);/* V64SI */
 
-POINTER_BOUNDS_MODE (BND32, 8);
-POINTER_BOUNDS_MODE (BND64, 16);
-
 INT_MODE (OI, 32);
 INT_MODE (XI, 64);
 
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 03118102319b..98677386a2b9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -262,7 +262,7 @@ enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER] =
   EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS,
   /* Mask registers.  */
   MASK_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS,
-  MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS,
+  MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS
 };
 
 /* The "default" register map used in 32bit mode.  */
@@ -278,8 +278,7 @@ int const dbx_register_map[FIRST_PSEUDO_REGISTER] =
   -1, -1, -1, -1, -1, -1, -1, -1,  /* extended SSE registers */
   -1, -1, -1, -1, -1, -1, -1, -1,   /* AVX-512 registers 16-23*/
   -1, -1, -1, -1, -1, -1, -1, -1,   /* AVX-512 registers 24-31*/
-  93, 94, 95, 96, 97, 98, 99, 100,  /* Mask registers */
-  101, 102, 103, 104,  /* bound registers */
+  93, 94, 95, 96, 97, 98, 99, 100   /* Mask registers */
 };
 
 /* The "default" register map used in 64bit mode.  */
@@ -295,8 +294,7 @@ int const dbx64_register_map[FIRST_PSEUDO_REGISTER] =
   25, 26, 27, 28, 29, 30, 31, 32,  /* extended SSE registers */
   67, 68, 69, 70, 71, 72, 73, 74,   /* AVX-512 registers 16-23 */
   75, 76, 77, 78, 79, 80, 81, 82,   /* AVX-512 registers 24-31 */
-  118, 119, 120, 121, 122, 123, 124, 125, /* Mask registers */
-  126, 127, 128, 129,  /* bound registers */
+  118, 119, 120, 121, 122, 123, 124, 125 /* Mask registers */
 };
 
 /* Define the register numbers to be used in Dwarf