aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/nvptx/nvptx.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/nvptx/nvptx.cc')
-rw-r--r--gcc/config/nvptx/nvptx.cc42
1 files changed, 36 insertions, 6 deletions
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 022037f..d1e25b9 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -470,9 +470,7 @@ nvptx_encode_section_info (tree decl, rtx rtl, int first)
{
nvptx_data_area area = DATA_AREA_GENERIC;
- if (TREE_CONSTANT (decl))
- area = DATA_AREA_CONST;
- else if (VAR_P (decl))
+ if (VAR_P (decl))
{
if (lookup_attribute ("shared", DECL_ATTRIBUTES (decl)))
{
@@ -482,7 +480,7 @@ nvptx_encode_section_info (tree decl, rtx rtl, int first)
" memory is not supported", decl);
}
else
- area = TREE_READONLY (decl) ? DATA_AREA_CONST : DATA_AREA_GLOBAL;
+ area = DATA_AREA_GLOBAL;
}
SET_SYMBOL_DATA_AREA (XEXP (rtl, 0), area);
@@ -2361,7 +2359,25 @@ nvptx_assemble_integer (rtx x, unsigned int size, int ARG_UNUSED (aligned_p))
{
gcc_checking_assert (!init_frag.active);
/* Just use the default machinery; it's not getting used, anyway. */
- return default_assemble_integer (x, size, aligned_p);
+ bool ok = default_assemble_integer (x, size, aligned_p);
+ /* ..., but a few cases need special handling. */
+ switch (GET_CODE (x))
+ {
+ case SYMBOL_REF:
+ /* The default machinery won't work: we don't define the necessary
+ operations; don't use them outside of this. */
+ gcc_checking_assert (!ok);
+ {
+ /* Just emit something; it's not getting used, anyway. */
+ const char *op = "\t.symbol_ref\t";
+ ok = (assemble_integer_with_op (op, x), true);
+ }
+ break;
+
+ default:
+ break;
+ }
+ return ok;
}
gcc_checking_assert (init_frag.active);
@@ -2597,7 +2613,7 @@ nvptx_asm_declare_constant_name (FILE *file, const char *name,
fprintf (file, "\t");
tree type = TREE_TYPE (exp);
- nvptx_assemble_decl_begin (file, name, ".const", type, obj_size,
+ nvptx_assemble_decl_begin (file, name, ".global", type, obj_size,
TYPE_ALIGN (type));
}
@@ -7768,9 +7784,23 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name,
return;
}
+#ifdef ACCEL_COMPILER
emit_ptx_alias:
+#endif
cgraph_node *cnode = cgraph_node::get (name);
+#ifdef ACCEL_COMPILER
+ /* For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]
+
+ For some reason (yet to be analyzed), they're not 'cnode->referred_to_p ()'.
+ (..., or that's not the right approach at all;
+ <https://inbox.sourceware.org/87v7rx8lbx.fsf@euler.schwinge.ddns.net>
+ "Re: [committed][nvptx] Use .alias directive for mptx >= 6.3"). */
+ if (DECL_CXX_CONSTRUCTOR_P (name)
+ || DECL_CXX_DESTRUCTOR_P (name))
+ ;
+ else
+#endif
if (!cnode->referred_to_p ())
/* Prevent "Internal error: reference to deleted section". */
return;