Commit 5563d5c0 by Nathan Sidwell

nvptx.h (OUTGOING_STATIC_CHAIN_REGNUM): Remove.

	* config/nvptx/nvptx.h (OUTGOING_STATIC_CHAIN_REGNUM): Remove.
	(REGISTER_NAMES): Adjust.
	* config/nvptx/nvptx.c (nvptx_pass_by_reference): Avoid long line.
	(nvptx_static_hain): Delete.
	(write_arg_mode): Don't emit initializer if argno < 0.
	(write_arg_type): Fix whitespace.
	(init_frame): Initialize reg to zero if frame is zero-sized.
	(nvptx_declare_function_name):  Use write_arg_type to emit chain
	decl.
	(nvptx_output_call_insn): Adjust static chain emission.
	(nvptx_goacc_reduction): Make static.
	(TARGET_STATIC_CHAIN): Don't override.

From-SVN: r231718
parent 7ee2e7f6
2015-12-16 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx.h (OUTGOING_STATIC_CHAIN_REGNUM): Remove.
(REGISTER_NAMES): Adjust.
* config/nvptx/nvptx.c (nvptx_pass_by_reference): Avoid long line.
(nvptx_static_hain): Delete.
(write_arg_mode): Don't emit initializer if argno < 0.
(write_arg_type): Fix whitespace.
(init_frame): Initialize reg to zero if frame is zero-sized.
(nvptx_declare_function_name): Use write_arg_type to emit chain
decl.
(nvptx_output_call_insn): Adjust static chain emission.
(nvptx_goacc_reduction): Make static.
(TARGET_STATIC_CHAIN): Don't override.
2015-12-16 Aditya Kumar <aditya.k7@samsung.com> 2015-12-16 Aditya Kumar <aditya.k7@samsung.com>
* graphite-dependences.c (scop_get_dependences): Use local pointers. * graphite-dependences.c (scop_get_dependences): Use local pointers.
* graphite-isl-ast-to-gimple.c * graphite-isl-ast-to-gimple.c
(translate_isl_ast_to_gimple::scop_to_isl_ast): Use scop->dependence. (translate_isl_ast_to_gimple::scop_to_isl_ast): Use scop->dependence.
* graphite-optimize-isl.c (optimize_isl): Same. * graphite-optimize-isl.c (optimize_isl): Same.
* graphite-poly.c (new_scop): Remove initialization of removed members. * graphite-poly.c (new_scop): Remove initialization of removed
members.
(free_scop): Same. (free_scop): Same.
* graphite.h (struct scop): Remove individial dependence pointers and * graphite.h (struct scop): Remove individial dependence pointers and
add a scop::dependence to contain all the dependence. add a scop::dependence to contain all the dependence.
...@@ -525,8 +525,9 @@ nvptx_function_value_regno_p (const unsigned int regno) ...@@ -525,8 +525,9 @@ nvptx_function_value_regno_p (const unsigned int regno)
reference in memory. */ reference in memory. */
static bool static bool
nvptx_pass_by_reference (cumulative_args_t ARG_UNUSED (cum), machine_mode mode, nvptx_pass_by_reference (cumulative_args_t ARG_UNUSED (cum),
const_tree type, bool ARG_UNUSED (named)) machine_mode mode, const_tree type,
bool ARG_UNUSED (named))
{ {
return pass_in_memory (mode, type, false); return pass_in_memory (mode, type, false);
} }
...@@ -549,18 +550,6 @@ nvptx_promote_function_mode (const_tree type, machine_mode mode, ...@@ -549,18 +550,6 @@ nvptx_promote_function_mode (const_tree type, machine_mode mode,
return promote_arg (mode, for_return || !type || TYPE_ARG_TYPES (funtype)); return promote_arg (mode, for_return || !type || TYPE_ARG_TYPES (funtype));
} }
/* Implement TARGET_STATIC_CHAIN. */
static rtx
nvptx_static_chain (const_tree fndecl, bool incoming_p)
{
if (!DECL_STATIC_CHAIN (fndecl))
return NULL;
return gen_rtx_REG (Pmode, (incoming_p ? STATIC_CHAIN_REGNUM
: OUTGOING_STATIC_CHAIN_REGNUM));
}
/* Helper for write_arg. Emit a single PTX argument of MODE, either /* Helper for write_arg. Emit a single PTX argument of MODE, either
in a prototype, or as copy in a function prologue. ARGNO is the in a prototype, or as copy in a function prologue. ARGNO is the
index of this argument in the PTX function. FOR_REG is negative, index of this argument in the PTX function. FOR_REG is negative,
...@@ -588,12 +577,15 @@ write_arg_mode (std::stringstream &s, int for_reg, int argno, ...@@ -588,12 +577,15 @@ write_arg_mode (std::stringstream &s, int for_reg, int argno,
else else
s << "%ar" << argno; s << "%ar" << argno;
s << ";\n"; s << ";\n";
s << "\tld.param" << ptx_type << " "; if (argno >= 0)
if (for_reg) {
s << reg_names[for_reg]; s << "\tld.param" << ptx_type << " ";
else if (for_reg)
s << "%ar" << argno; s << reg_names[for_reg];
s << ", [%in_ar" << argno << "];\n"; else
s << "%ar" << argno;
s << ", [%in_ar" << argno << "];\n";
}
} }
return argno + 1; return argno + 1;
} }
...@@ -625,7 +617,7 @@ write_arg_type (std::stringstream &s, int for_reg, int argno, ...@@ -625,7 +617,7 @@ write_arg_type (std::stringstream &s, int for_reg, int argno,
{ {
/* Complex types are sent as two separate args. */ /* Complex types are sent as two separate args. */
type = TREE_TYPE (type); type = TREE_TYPE (type);
mode = TYPE_MODE (type); mode = TYPE_MODE (type);
prototyped = true; prototyped = true;
} }
...@@ -917,16 +909,20 @@ nvptx_maybe_record_fnsym (rtx sym) ...@@ -917,16 +909,20 @@ nvptx_maybe_record_fnsym (rtx sym)
} }
/* Emit a local array to hold some part of a conventional stack frame /* Emit a local array to hold some part of a conventional stack frame
and initialize REGNO to point to it. */ and initialize REGNO to point to it. If the size is zero, it'll
never be valid to dereference, so we can simply initialize to
zero. */
static void static void
init_frame (FILE *file, int regno, unsigned align, unsigned size) init_frame (FILE *file, int regno, unsigned align, unsigned size)
{ {
fprintf (file, "\t.reg.u%d %s;\n" if (size)
"\t.local.align %d .b8 %s_ar[%u];\n" fprintf (file, "\t.local .align %d .b8 %s_ar[%u];\n",
"\tcvta.local.u%d %s, %s_ar;\n", align, reg_names[regno], size);
POINTER_SIZE, reg_names[regno], fprintf (file, "\t.reg.u%d %s;\n",
align, reg_names[regno], size ? size : 1, POINTER_SIZE, reg_names[regno]);
fprintf (file, (size ? "\tcvta.local.u%d %s, %s_ar;\n"
: "\tmov.u%d %s, 0;\n"),
POINTER_SIZE, reg_names[regno], reg_names[regno]); POINTER_SIZE, reg_names[regno], reg_names[regno]);
} }
...@@ -981,12 +977,14 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl) ...@@ -981,12 +977,14 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl)
} }
if (stdarg_p (fntype)) if (stdarg_p (fntype))
argno = write_arg_type (s, ARG_POINTER_REGNUM, argno, ptr_type_node, true); argno = write_arg_type (s, ARG_POINTER_REGNUM, argno, ptr_type_node,
if (DECL_STATIC_CHAIN (decl))
argno = write_arg_type (s, STATIC_CHAIN_REGNUM, argno, ptr_type_node,
true); true);
if (DECL_STATIC_CHAIN (decl) || cfun->machine->has_chain)
write_arg_type (s, STATIC_CHAIN_REGNUM,
DECL_STATIC_CHAIN (decl) ? argno : -1, ptr_type_node,
true);
fprintf (file, "%s", s.str().c_str()); fprintf (file, "%s", s.str().c_str());
/* Declare a local var for outgoing varargs. */ /* Declare a local var for outgoing varargs. */
...@@ -1000,10 +998,6 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl) ...@@ -1000,10 +998,6 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl)
init_frame (file, FRAME_POINTER_REGNUM, init_frame (file, FRAME_POINTER_REGNUM,
crtl->stack_alignment_needed / BITS_PER_UNIT, sz); crtl->stack_alignment_needed / BITS_PER_UNIT, sz);
if (cfun->machine->has_chain)
fprintf (file, "\t.reg.u%d %s;\n", GET_MODE_BITSIZE (Pmode),
reg_names[OUTGOING_STATIC_CHAIN_REGNUM]);
/* Declare the pseudos we have as ptx registers. */ /* Declare the pseudos we have as ptx registers. */
int maxregs = max_reg_num (); int maxregs = max_reg_num ();
for (int i = LAST_VIRTUAL_REGISTER + 1; i < maxregs; i++) for (int i = LAST_VIRTUAL_REGISTER + 1; i < maxregs; i++)
...@@ -1864,8 +1858,7 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee) ...@@ -1864,8 +1858,7 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee)
} }
if (decl && DECL_STATIC_CHAIN (decl)) if (decl && DECL_STATIC_CHAIN (decl))
{ {
fprintf (asm_out_file, ", %s%s", open, fprintf (asm_out_file, ", %s%s", open, reg_names [STATIC_CHAIN_REGNUM]);
reg_names [OUTGOING_STATIC_CHAIN_REGNUM]);
open = ""; open = "";
} }
if (!open[0]) if (!open[0])
...@@ -4779,7 +4772,7 @@ nvptx_goacc_reduction_teardown (gcall *call) ...@@ -4779,7 +4772,7 @@ nvptx_goacc_reduction_teardown (gcall *call)
/* NVPTX reduction expander. */ /* NVPTX reduction expander. */
void static void
nvptx_goacc_reduction (gcall *call) nvptx_goacc_reduction (gcall *call)
{ {
unsigned code = (unsigned)TREE_INT_CST_LOW (gimple_call_arg (call, 0)); unsigned code = (unsigned)TREE_INT_CST_LOW (gimple_call_arg (call, 0));
...@@ -4845,9 +4838,6 @@ nvptx_goacc_reduction (gcall *call) ...@@ -4845,9 +4838,6 @@ nvptx_goacc_reduction (gcall *call)
#define TARGET_OMIT_STRUCT_RETURN_REG true #define TARGET_OMIT_STRUCT_RETURN_REG true
#undef TARGET_STRICT_ARGUMENT_NAMING #undef TARGET_STRICT_ARGUMENT_NAMING
#define TARGET_STRICT_ARGUMENT_NAMING nvptx_strict_argument_naming #define TARGET_STRICT_ARGUMENT_NAMING nvptx_strict_argument_naming
#undef TARGET_STATIC_CHAIN
#define TARGET_STATIC_CHAIN nvptx_static_chain
#undef TARGET_CALL_ARGS #undef TARGET_CALL_ARGS
#define TARGET_CALL_ARGS nvptx_call_args #define TARGET_CALL_ARGS nvptx_call_args
#undef TARGET_END_CALL_ARGS #undef TARGET_END_CALL_ARGS
......
...@@ -157,12 +157,11 @@ enum reg_class ...@@ -157,12 +157,11 @@ enum reg_class
#define ARG_POINTER_REGNUM 14 #define ARG_POINTER_REGNUM 14
#define STATIC_CHAIN_REGNUM 12 #define STATIC_CHAIN_REGNUM 12
#define OUTGOING_STATIC_CHAIN_REGNUM 10
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{ \ { \
"%hr0", "%outargs", "%hfp", "%hr3", "%retval", "%hr5", "%hr6", "%hr7", \ "%hr0", "%outargs", "%hfp", "%hr3", "%retval", "%hr5", "%hr6", "%hr7", \
"%hr8", "%hr9", "%chain_out", "%hr11", "%chain_in", "%hr13", "%argp", "%frame" \ "%hr8", "%hr9", "%hr10", "%hr11", "%chain_in", "%hr13", "%argp", "%frame" \
} }
#define FIRST_PARM_OFFSET(FNDECL) ((void)(FNDECL), 0) #define FIRST_PARM_OFFSET(FNDECL) ((void)(FNDECL), 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment