summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-21 19:34:34 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-21 19:34:34 +0000
commitf289122f85543ceda75135120d4bc60d7107021d (patch)
tree0d75ce9c1a368d40ad192cfd905132245b4c2bb1
parent6f3e34a3603796b7c60e1d1ed5df50656ddffae8 (diff)
downloadgcc-f289122f85543ceda75135120d4bc60d7107021d.tar.gz
* config/nvptx/nvptx.md (allocate_stack): Emit sorry during
expansion. * config/nvptx/nvptx.c (nvptx_declare_function_name): Look at crtl->stack_alignment_needed to determine alignment. (nvptx_get_drap_rtx): New. (TARGET_GET_DRAP_RTX): Override. * config/nvptx/nvptx.h (MAX_STACK_ALIGNMENT): Set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227084 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/nvptx/nvptx.c16
-rw-r--r--gcc/config/nvptx/nvptx.h2
-rw-r--r--gcc/config/nvptx/nvptx.md6
4 files changed, 32 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 37b8d8edeac..61a3360e20e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2015-08-21 Nathan Sidwell <nathan@acm.org>
+
+ * config/nvptx/nvptx.md (allocate_stack): Emit sorry during
+ expansion.
+ * config/nvptx/nvptx.c (nvptx_declare_function_name): Look at
+ crtl->stack_alignment_needed to determine alignment.
+ (nvptx_get_drap_rtx): New.
+ (TARGET_GET_DRAP_RTX): Override.
+ * config/nvptx/nvptx.h (MAX_STACK_ALIGNMENT): Set.
+
2015-08-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* config.build: Remove case for m68000-hp-hpux* | m68k-hp-hpux*.
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index a3569670d62..8f74a14199a 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -598,9 +598,11 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl)
sz = get_frame_size ();
if (sz > 0 || cfun->machine->has_call_with_sc)
{
+ int alignment = crtl->stack_alignment_needed / BITS_PER_UNIT;
+
fprintf (file, "\t.reg.u%d %%frame;\n"
- "\t.local.align 8 .b8 %%farray[" HOST_WIDE_INT_PRINT_DEC"];\n",
- BITS_PER_WORD, sz == 0 ? 1 : sz);
+ "\t.local.align %d .b8 %%farray[" HOST_WIDE_INT_PRINT_DEC"];\n",
+ BITS_PER_WORD, alignment, sz == 0 ? 1 : sz);
fprintf (file, "\tcvta.local.u%d %%frame, %%farray;\n",
BITS_PER_WORD);
}
@@ -726,6 +728,14 @@ nvptx_function_ok_for_sibcall (tree, tree)
return false;
}
+/* Return Dynamic ReAlignment Pointer RTX. For PTX there isn't any. */
+
+static rtx
+nvptx_get_drap_rtx (void)
+{
+ return NULL_RTX;
+}
+
/* Implement the TARGET_CALL_ARGS hook. Record information about one
argument to the next call. */
@@ -2118,6 +2128,8 @@ nvptx_file_end (void)
#define TARGET_LIBCALL_VALUE nvptx_libcall_value
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL nvptx_function_ok_for_sibcall
+#undef TARGET_GET_DRAP_RTX
+#define TARGET_GET_DRAP_RTX nvptx_get_drap_rtx
#undef TARGET_SPLIT_COMPLEX_ARG
#define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index afe4fcdd361..60a922af93f 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -52,6 +52,8 @@
#define BIGGEST_ALIGNMENT 64
#define STRICT_ALIGNMENT 1
+#define MAX_STACK_ALIGNMENT (1024 * 8)
+
/* Copied from elf.h and other places. We'd otherwise use
BIGGEST_ALIGNMENT and fail a number of testcases. */
#define MAX_OFILE_ALIGNMENT (32768 * 8)
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index 7c2cb9c15bc..b857e53bb22 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -1241,6 +1241,12 @@
(match_operand 1 "nvptx_register_operand")]
""
{
+ /* The ptx documentation specifies an alloca intrinsic (for 32 bit
+ only) but notes it is not implemented. The assembler emits a
+ confused error message. Issue a blunt one now instead. */
+ sorry ("target cannot support alloca.");
+ emit_insn (gen_nop ());
+ DONE;
if (TARGET_ABI64)
emit_insn (gen_allocate_stack_di (operands[0], operands[1]));
else