Skip to content
Snippets Groups Projects
Commit 1146410c authored by Thomas Schwinge's avatar Thomas Schwinge
Browse files

nvptx: Support '-mfake-ptx-alloca'

With '-mfake-ptx-alloca' enabled, the user-visible behavior changes only
for configurations where PTX 'alloca' is not available.  Rather than a
compile-time 'sorry, unimplemented: dynamic stack allocation not supported'
in presence of dynamic stack allocation, compilation and assembly then
succeeds.  However, attempting to link in such '*.o' files then fails due
to unresolved symbol '__GCC_nvptx__PTX_alloca_not_supported'.

This is meant to be used in scenarios where large volumes of code are
compiled, a small fraction of which runs into dynamic stack allocation, but
these parts are not important for specific use cases, and we'd thus like the
build to succeed, and error out just upon actual, very rare use of the
offending '*.o' files.

	gcc/
	* config/nvptx/nvptx.opt (-mfake-ptx-alloca): New.
	* config/nvptx/nvptx-protos.h (nvptx_output_fake_ptx_alloca):
	Declare.
	* config/nvptx/nvptx.cc (nvptx_output_fake_ptx_alloca): New.
	* config/nvptx/nvptx.md (define_insn "@nvptx_alloca_<mode>")
	[!(TARGET_PTX_7_3 && TARGET_SM52)]: Use it for
	'-mfake-ptx-alloca'.
	gcc/testsuite/
	* gcc.target/nvptx/alloca-1-O0_-mfake-ptx-alloca.c: New.
	* gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c: Likewise.
	* gcc.target/nvptx/alloca-4-O3_-mfake-ptx-alloca.c: Likewise.
	* gcc.target/nvptx/vla-1-O0_-mfake-ptx-alloca.c: Likewise.
	* gcc.target/nvptx/alloca-4-O3.c:
	'dg-additional-options -mfake-ptx-alloca'.
parent 22e76700
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment