From: Andrew Stubbs <[email protected]>

In SIMT mode, we want N copies of each stack variable -- one for each thread.
Since the SIMT implementation is primarily in the backend the adjustments need
to happen there also.  These hooks achieve the goal by allowing each variable
to be wider than it appears to need to be (padding), and by inserting a
variable offset element into the address loading code -- the offset calculation
will end up being different in each thread.

The same treatment is applied to stack-passed parameters, on both the caller
(emit_push_insn) and callee (assign_parm_find_stack_rtl) sides.

For amdgcn in SIMT mode, each variable is padded to 64 times its size, and the
offset is the lane ID (held in v1) multiplied by the size of the type.

gcc/ChangeLog:

        * target.def (stack_variable_padding, stack_variable_offset): New
        hooks in the simt hook vector.
        * doc/tm.texi.in (TARGET_SIMT_STACK_VARIABLE_PADDING)
        (TARGET_SIMT_STACK_VARIABLE_OFFSET): Add hook placeholders.
        * doc/tm.texi: Regenerate.
        * cfgexpand.cc (add_stack_var): Adjust the variable size using
        TARGET_SIMT_STACK_VARIABLE_PADDING.
        (expand_one_stack_var_at): Offset the variable address using
        TARGET_SIMT_STACK_VARIABLE_OFFSET.
        (expand_one_stack_var_1): Adjust the variable size using
        TARGET_SIMT_STACK_VARIABLE_PADDING.
        * expr.cc (emit_push_insn): Offset the destination address using
        TARGET_SIMT_STACK_VARIABLE_OFFSET.
        (expand_expr_real_1): Use assign_stack_local_simt.
        * function.cc (simt_stack_object_size): New function.
        (simt_stack_object_address): New function.
        (assign_stack_local_simt): New function.
        (find_temp_slot_from_address): Look through the per-thread offset
        added by simt_stack_object_address.
        (assign_stack_temp_for_type): Allocate one copy of the temporary for
        each SIMT thread, and return the address of the current thread's
        copy.
        (assign_parm_find_stack_rtl): Offset the stack parameter address
        using TARGET_SIMT_STACK_VARIABLE_OFFSET.
        (assign_parm_setup_block): Use assign_stack_local_simt.
        (assign_parm_setup_reg): Likewise.
        (assign_parm_setup_stack): Likewise.
        (assign_parms_unsplit_complex): Likewise.
        (expand_function_start): Likewise, for the saved static chain.
        (locate_and_pad_parm): Adjust the parameter size using
        TARGET_SIMT_STACK_VARIABLE_PADDING.
        * function.h (simt_stack_object_size): Declare.
        (simt_stack_object_address): Declare.
        (assign_stack_local_simt): Declare.
        * config/gcn/gcn.cc (gcn_gimplify_va_arg_expr): In SIMT mode, step
        over the per-lane copies of each argument, and select the current
        lane's copy.
        (gcn_simt_stack_variable_padding): New function.
        (gcn_simt_stack_variable_offset): New function.
        (TARGET_SIMT_STACK_VARIABLE_PADDING): Define.
        (TARGET_SIMT_STACK_VARIABLE_OFFSET): Define.
---
 gcc/cfgexpand.cc      |  15 ++++++
 gcc/config/gcn/gcn.cc |  51 ++++++++++++++++++++
 gcc/doc/tm.texi       |  18 +++++++
 gcc/doc/tm.texi.in    |   4 ++
 gcc/expr.cc           |  20 +++++++-
 gcc/function.cc       | 106 +++++++++++++++++++++++++++++++++++++-----
 gcc/function.h        |   3 ++
 gcc/target.def        |  23 +++++++++
 8 files changed, 228 insertions(+), 12 deletions(-)

diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index dad4393b3e5b2..35b6b038ee735 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -488,6 +488,10 @@ add_stack_var (tree decl, bool really_expand)
   /* All variables initially conflict with no other.  */
   v->conflicts = NULL;
 
+  /* Apply target hooks.  */
+  if (targetm.simt.stack_variable_padding)
+    v->size = targetm.simt.stack_variable_padding (v->size);
+
   /* Ensure that this decl doesn't get put onto the list twice.  */
   set_rtl (decl, pc_rtx);
 
@@ -1344,6 +1348,14 @@ expand_one_stack_var_at (tree decl, rtx base, unsigned 
base_align,
   else
     x = plus_constant (Pmode, base, offset);
 
+  if (targetm.simt.stack_variable_offset)
+    {
+      rtx val = targetm.simt.stack_variable_offset
+                 (tree_to_poly_uint64 (TYPE_SIZE_UNIT (TREE_TYPE (decl))));
+      if (val)
+       x = gen_rtx_PLUS (Pmode, x, val);
+    }
+
   x = gen_rtx_MEM (TREE_CODE (decl) == SSA_NAME
                   ? TYPE_MODE (TREE_TYPE (decl))
                   : DECL_MODE (decl), x);
@@ -1742,6 +1754,9 @@ expand_one_stack_var_1 (tree var)
   else
     size = tree_to_poly_uint64 (DECL_SIZE_UNIT (var));
 
+  if (targetm.simt.stack_variable_padding)
+    size = targetm.simt.stack_variable_padding (size);
+
   byte_align = align_local_variable (var, true);
 
   /* We handle highly aligned variables in expand_stack_vars.  */
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 9354311c88266..73b5c4085b490 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -3148,6 +3148,10 @@ gcn_gimplify_va_arg_expr (tree valist, tree type,
   /* Args grow down.  Not handled by generic routines.  */
 
   u = fold_convert (sizetype, size_in_bytes (type));
+  /* In SIMT mode each stack-passed argument has one copy per lane; see
+     gcn_simt_stack_variable_padding.  */
+  if (flag_simt_mode)
+    u = size_binop (MULT_EXPR, u, size_int (64));
   u = fold_build1 (NEGATE_EXPR, sizetype, u);
   t = fold_build_pointer_plus (valist, u);
 
@@ -3160,6 +3164,19 @@ gcn_gimplify_va_arg_expr (tree valist, tree type,
   t = build2 (MODIFY_EXPR, valist_type, valist, t);
 
   t = fold_convert (ptr, t);
+
+  /* Select this lane's copy; see gcn_simt_stack_variable_offset.  */
+  if (flag_simt_mode)
+    {
+      tree lane = build_call_expr (gcn_builtin_decl (GCN_BUILTIN_OMP_DIM_POS,
+                                                    true),
+                                  1, build_int_cst (integer_type_node, 2));
+      lane = fold_convert (unsigned_type_node, lane);
+      u = size_binop (MULT_EXPR, fold_convert (sizetype, lane),
+                     fold_convert (sizetype, size_in_bytes (type)));
+      t = fold_build_pointer_plus (t, u);
+    }
+
   t = build_va_arg_indirect_ref (t);
 
   if (indirect)
@@ -6059,6 +6076,36 @@ gcn_prefer_gather_scatter (machine_mode ARG_UNUSED 
(mode),
 }
 
 /* }}}  */
+/* {{{ SIMT.  */
+
+/* Implement TARGET_STACK_VARIABLE_PADDING.  */
+
+poly_uint64
+gcn_simt_stack_variable_padding (poly_uint64 default_size)
+{
+  if (!flag_simt_mode)
+    return default_size;
+
+  return default_size * 64;
+}
+
+/* Implement TARGET_STACK_VARIABLE_OFFSET.  */
+
+rtx
+gcn_simt_stack_variable_offset (poly_uint64 unit_size)
+{
+  if (!flag_simt_mode)
+    return const0_rtx;
+
+  rtx _0_1_2_3 = gen_rtx_REG (SImode, VGPR_REGNO (1));
+  rtx _0_1_2_3_di = gen_rtx_ZERO_EXTEND (DImode, _0_1_2_3);
+  rtx result = gen_rtx_MULT (DImode, _0_1_2_3_di,
+                            gen_int_mode (unit_size, DImode));
+
+  return result;
+}
+
+/* }}} */
 /* {{{ md_reorg pass.  */
 
 /* Identify VMEM instructions from their "type" attribute.  */
@@ -8428,6 +8475,10 @@ gcn_dwarf_register_span (rtx rtl)
   gcn_small_register_classes_for_mode_p
 #undef  TARGET_SPILL_CLASS
 #define TARGET_SPILL_CLASS gcn_spill_class
+#undef  TARGET_SIMT_STACK_VARIABLE_PADDING
+#define TARGET_SIMT_STACK_VARIABLE_PADDING gcn_simt_stack_variable_padding
+#undef  TARGET_SIMT_STACK_VARIABLE_OFFSET
+#define TARGET_SIMT_STACK_VARIABLE_OFFSET gcn_simt_stack_variable_offset
 #undef  TARGET_STRICT_ARGUMENT_NAMING
 #define TARGET_STRICT_ARGUMENT_NAMING gcn_strict_argument_naming
 #undef  TARGET_TRAMPOLINE_INIT
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index dc022ae8d8479..bcddd9b898f91 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -4332,6 +4332,24 @@ definition that is usually appropriate, refer to 
@file{expr.h} for additional
 documentation.
 @end deftypefn
 
+@deftypefn {Target Hook} poly_uint64 TARGET_SIMT_STACK_VARIABLE_PADDING 
(poly_uint64 @var{default_size})
+This target hook can modify the padding around stack variables and stack
+parameters. The hook should return the required total size, with padding.
+The primary use case is to support SIMT, where there must be a copy of each
+variable for each thread.  See also @code{TARGET_SIMT_STACK_VARIABLE_OFFSET}.
+@end deftypefn
+
+@deftypefn {Target Hook} rtx TARGET_SIMT_STACK_VARIABLE_OFFSET (poly_uint64 
@var{size})
+This target hook can modify the use of padding around stack variables and
+stack parameters.  The amount of padding should have been specified with
+@code{TARGET_SIMT_STACK_VARIABLE_PADDING}.  The hook should return an offset
+into the padding space as an RTL expression.  @var{size} is the size in
+bytes of one copy of the object.  The offset may be a constant,
+or may be computed at runtime, and may give a different result for each SIMT
+thread.  The primary use case is to support SIMT, where there must be a copy
+of each variable for each thread.  The default is to use no offset.
+@end deftypefn
+
 @deftypefn {Target Hook} rtx TARGET_FUNCTION_INCOMING_ARG (cumulative_args_t 
@var{ca}, const function_arg_info @var{&arg})
 Define this hook if the caller and callee on the target have different
 views of where arguments are passed.  Also define this hook if there are
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 3cbaba910fb61..35c658a46473b 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -3364,6 +3364,10 @@ the stack.
 
 @hook TARGET_MUST_PASS_IN_STACK
 
+@hook TARGET_SIMT_STACK_VARIABLE_PADDING
+
+@hook TARGET_SIMT_STACK_VARIABLE_OFFSET
+
 @hook TARGET_FUNCTION_INCOMING_ARG
 
 @hook TARGET_USE_PSEUDO_PIC_REG
diff --git a/gcc/expr.cc b/gcc/expr.cc
index c654387ab016e..f92b2cdd6f46f 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -5465,6 +5465,13 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx 
size,
                temp = copy_to_reg (temp);
            }
 
+         if (targetm.simt.stack_variable_offset)
+           temp = simplify_gen_binary (PLUS, Pmode, temp,
+                                       targetm.simt.stack_variable_offset
+                                       (type
+                                        ? tree_to_poly_uint64 (TYPE_SIZE_UNIT 
(type))
+                                        : poly_uint64 (rtx_to_poly_int64 
(size))));
+
          target = gen_rtx_MEM (BLKmode, temp);
 
          /* We do *not* set_mem_attributes here, because incoming arguments
@@ -5618,6 +5625,17 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx 
size,
 #endif
        {
          addr = simplify_gen_binary (PLUS, Pmode, args_addr, args_so_far);
+
+         if (targetm.simt.stack_variable_offset)
+           {
+             rtx offset = targetm.simt.stack_variable_offset
+                            (type
+                             ? tree_to_poly_uint64 (TYPE_SIZE_UNIT (type))
+                             : poly_uint64 (GET_MODE_SIZE (mode)));
+             if (offset)
+               addr = simplify_gen_binary (PLUS, Pmode, addr, offset);
+           }
+
          dest = gen_rtx_MEM (mode, memory_address (mode, addr));
 
          /* We do *not* set_mem_attributes here, because incoming arguments
@@ -12530,7 +12548,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode 
tmode,
                  align = MAX (align, TYPE_ALIGN (TREE_TYPE (tem)));
                align = MIN (align, (unsigned) MAX_SUPPORTED_STACK_ALIGNMENT);
              }
-           memloc = assign_stack_local (tem_mode, size, align);
+           memloc = assign_stack_local_simt (tem_mode, size, align);
            emit_move_insn (memloc, op0);
            op0 = memloc;
            clear_mem_expr = true;
diff --git a/gcc/function.cc b/gcc/function.cc
index 0ff9f676b8141..57d04b88401dd 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -590,6 +590,50 @@ assign_stack_local (machine_mode mode, poly_int64 size, 
int align)
 {
   return assign_stack_local_1 (mode, size, align, ASLK_RECORD_PAD);
 }
+
+/* Return the stack space required for an object of SIZE bytes whose value
+   may differ between SIMT threads.  On SIMT targets each thread needs its
+   own copy, so this may be larger than SIZE.  */
+
+poly_int64
+simt_stack_object_size (poly_int64 size)
+{
+  if (targetm.simt.stack_variable_padding)
+    return targetm.simt.stack_variable_padding (size);
+  return size;
+}
+
+/* ADDR is the address of a stack slot allocated with room for
+   simt_stack_object_size (SIZE) bytes.  Return the address of the copy that
+   belongs to the current SIMT thread.  */
+
+rtx
+simt_stack_object_address (rtx addr, poly_int64 size)
+{
+  if (!targetm.simt.stack_variable_offset)
+    return addr;
+
+  rtx offset = targetm.simt.stack_variable_offset (size);
+  if (!offset || offset == const0_rtx)
+    return addr;
+  return gen_rtx_PLUS (Pmode, addr, offset);
+}
+
+/* Like assign_stack_local, but for an object whose value may differ between
+   SIMT threads, such as a parameter or other user-visible value.  Each SIMT
+   thread gets its own copy, and the returned MEM refers to the current
+   thread's copy.  Do not use this for slots that hold wave-uniform state, or
+   after the SIMT transformations have run.  */
+
+rtx
+assign_stack_local_simt (machine_mode mode, poly_int64 size, int align)
+{
+  rtx slot = assign_stack_local (mode, simt_stack_object_size (size), align);
+  rtx addr = simt_stack_object_address (XEXP (slot, 0), size);
+  if (addr != XEXP (slot, 0))
+    slot = replace_equiv_address_nv (slot, addr);
+  return slot;
+}
 
 /* In order to evaluate some expressions, such as function calls returning
    structures in memory, we need to temporarily allocate stack locations.
@@ -813,7 +857,8 @@ find_temp_slot_from_address (rtx x)
 
   /* Last resort: Address is a virtual stack var address.  */
   poly_int64 offset;
-  if (strip_offset (x, &offset) == virtual_stack_vars_rtx)
+  rtx base = strip_offset (x, &offset);
+  if (base == virtual_stack_vars_rtx)
     {
       int i;
       for (i = max_slot_level (); i >= 0; i--)
@@ -822,6 +867,13 @@ find_temp_slot_from_address (rtx x)
            return p;
     }
 
+  /* The address of a SIMT thread's copy of a temporary has a non-constant
+     per-thread term added; see simt_stack_object_address.  */
+  if (targetm.simt.stack_variable_offset
+      && GET_CODE (base) == PLUS
+      && !CONSTANT_P (XEXP (base, 1)))
+    return find_temp_slot_from_address (XEXP (base, 0));
+
   return NULL;
 }
 
@@ -858,6 +910,15 @@ assign_stack_temp_for_type (machine_mode mode, poly_int64 
size, tree type)
   else
     align = MAX (required_align, MIN (align, MAX_SUPPORTED_STACK_ALIGNMENT));
 
+  /* Temporaries hold values that may differ between SIMT threads, so each
+     thread needs its own copy.  From here on SIZE is the space for all the
+     copies; LANE_SIZE is the size of each one.  */
+  poly_int64 lane_size = (mode == BLKmode
+                         ? aligned_upper_bound (size,
+                                                (int) align / BITS_PER_UNIT)
+                         : size);
+  size = simt_stack_object_size (lane_size);
+
   /* Try to find an available, already-allocated temporary of the proper
      mode which meets the size and alignment requirements.  Choose the
      smallest one with the closest alignment.
@@ -1008,6 +1069,14 @@ assign_stack_temp_for_type (machine_mode mode, 
poly_int64 size, tree type)
 
   insert_temp_slot_address (addr, p);
 
+  /* Select this SIMT thread's copy.  */
+  rtx lane_addr = simt_stack_object_address (addr, lane_size);
+  if (lane_addr != addr)
+    {
+      addr = lane_addr;
+      insert_temp_slot_address (addr, p);
+    }
+
   /* Create a new MEM rtx to avoid clobbering MEM flags of old slots.  */
   slot = gen_rtx_MEM (mode, addr);
   vec_safe_push (stack_slot_list, slot);
@@ -2755,6 +2824,15 @@ assign_parm_find_stack_rtl (tree parm, struct 
assign_parm_data_one *data)
   stack_parm = crtl->args.internal_arg_pointer;
   if (offset_rtx != const0_rtx)
     stack_parm = gen_rtx_PLUS (Pmode, stack_parm, offset_rtx);
+
+  if (targetm.simt.stack_variable_offset)
+    {
+      rtx hook_offset = targetm.simt.stack_variable_offset
+                         (tree_to_poly_uint64 (TYPE_SIZE_UNIT (TREE_TYPE 
(parm))));
+      if (hook_offset)
+       stack_parm = gen_rtx_PLUS (Pmode, stack_parm, hook_offset);
+    }
+
   stack_parm = gen_rtx_MEM (data->arg.mode, stack_parm);
 
   if (!data->arg.pass_by_reference)
@@ -3037,8 +3115,8 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
           ? MAX (DECL_ALIGN (parm), BITS_PER_WORD) : DECL_ALIGN (parm));
 
       SET_DECL_ALIGN (parm, parm_align);
-      stack_parm = assign_stack_local (BLKmode, size_stored,
-                                      DECL_ALIGN (parm));
+      stack_parm = assign_stack_local_simt (BLKmode, size_stored,
+                                           DECL_ALIGN (parm));
       if (known_eq (GET_MODE_SIZE (GET_MODE (entry_parm)), size))
        PUT_MODE (stack_parm, GET_MODE (entry_parm));
       set_mem_attributes (stack_parm, parm, 1);
@@ -3443,9 +3521,10 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, 
tree parm,
                                            TYPE_MODE (TREE_TYPE (parm)),
                                            TYPE_ALIGN (TREE_TYPE (parm)));
          parmreg
-           = assign_stack_local (TYPE_MODE (TREE_TYPE (parm)),
-                                 GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parm))),
-                                 align);
+           = assign_stack_local_simt (TYPE_MODE (TREE_TYPE (parm)),
+                                      GET_MODE_SIZE (TYPE_MODE
+                                                     (TREE_TYPE (parm))),
+                                      align);
          set_mem_attributes (parmreg, parm, 1);
        }
 
@@ -3600,9 +3679,10 @@ assign_parm_setup_stack (struct assign_parm_data_all 
*all, tree parm,
                                                    align)))
            align = GET_MODE_ALIGNMENT (GET_MODE (data->entry_parm));
          data->stack_parm
-           = assign_stack_local (GET_MODE (data->entry_parm),
-                                 GET_MODE_SIZE (GET_MODE (data->entry_parm)),
-                                 align);
+           = assign_stack_local_simt (GET_MODE (data->entry_parm),
+                                      GET_MODE_SIZE (GET_MODE
+                                                     (data->entry_parm)),
+                                      align);
          align = MEM_ALIGN (data->stack_parm);
          set_mem_attributes (data->stack_parm, parm, 1);
          set_mem_align (data->stack_parm, align);
@@ -3680,7 +3760,7 @@ assign_parms_unsplit_complex (struct assign_parm_data_all 
*all,
 
              /* split_complex_arg put the real and imag parts in
                 pseudos.  Move them to memory.  */
-             tmp = assign_stack_local (DECL_MODE (parm), size, align);
+             tmp = assign_stack_local_simt (DECL_MODE (parm), size, align);
              set_mem_attributes (tmp, parm, 1);
              rmem = adjust_address_nv (tmp, inner, 0);
              imem = adjust_address_nv (tmp, inner, GET_MODE_SIZE (inner));
@@ -4144,6 +4224,10 @@ locate_and_pad_parm (machine_mode passed_mode, tree 
type, int in_regs,
                                                              type);
   locate->where_pad = where_pad;
 
+  if (targetm.simt.stack_variable_padding)
+    sizetree = size_int (targetm.simt.stack_variable_padding
+                        (tree_to_uhwi (sizetree)));
+
   /* Alignment can't exceed MAX_SUPPORTED_STACK_ALIGNMENT.  */
   if (boundary > MAX_SUPPORTED_STACK_ALIGNMENT)
     boundary = MAX_SUPPORTED_STACK_ALIGNMENT;
@@ -5328,7 +5412,7 @@ expand_function_start (tree subr)
            = build_decl (DECL_SOURCE_LOCATION (parm), VAR_DECL,
                          DECL_NAME (parm), TREE_TYPE (parm));
          rtx saved_static_chain_rtx
-           = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0);
+           = assign_stack_local_simt (Pmode, GET_MODE_SIZE (Pmode), 0);
          SET_DECL_RTL (saved_static_chain_decl, saved_static_chain_rtx);
          emit_move_insn (saved_static_chain_rtx, chain);
          SET_DECL_VALUE_EXPR (parm, saved_static_chain_decl);
diff --git a/gcc/function.h b/gcc/function.h
index e11f26c64f95e..8eea362b75d5a 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -668,6 +668,9 @@ extern unsigned int spill_slot_alignment (machine_mode);
 
 extern rtx assign_stack_local_1 (machine_mode, poly_int64, int, int);
 extern rtx assign_stack_local (machine_mode, poly_int64, int);
+extern poly_int64 simt_stack_object_size (poly_int64);
+extern rtx simt_stack_object_address (rtx, poly_int64);
+extern rtx assign_stack_local_simt (machine_mode, poly_int64, int);
 extern rtx assign_stack_temp_for_type (machine_mode, poly_int64, tree);
 extern rtx assign_stack_temp (machine_mode, poly_int64);
 extern rtx assign_temp (tree, int, int);
diff --git a/gcc/target.def b/gcc/target.def
index 029956b62681b..c470b38a481f8 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1679,6 +1679,29 @@ DEFHOOK
 "Return number of threads in SIMT thread group on the target.",
 int, (void), NULL)
 
+/* Allow the target to pad stack variables.  */
+DEFHOOK
+(stack_variable_padding,
+ "This target hook can modify the padding around stack variables and stack\n\
+parameters. The hook should return the required total size, with padding.\n\
+The primary use case is to support SIMT, where there must be a copy of each\n\
+variable for each thread.  See also @code{TARGET_SIMT_STACK_VARIABLE_OFFSET}.",
+poly_uint64, (poly_uint64 default_size), NULL)
+
+/* Allow the target to use custom offset within the padding of
+   stack variables.  */
+DEFHOOK
+(stack_variable_offset,
+ "This target hook can modify the use of padding around stack variables and\n\
+stack parameters.  The amount of padding should have been specified with\n\
+@code{TARGET_SIMT_STACK_VARIABLE_PADDING}.  The hook should return an offset\n\
+into the padding space as an RTL expression.  @var{size} is the size in\n\
+bytes of one copy of the object.  The offset may be a constant,\n\
+or may be computed at runtime, and may give a different result for each SIMT\n\
+thread.  The primary use case is to support SIMT, where there must be a copy\n\
+of each variable for each thread.  The default is to use no offset.",
+rtx, (poly_uint64 size), NULL)
+
 HOOK_VECTOR_END (simt)
 
 /* Functions relating to OpenMP.  */
-- 
2.56.0

Reply via email to