Debian Codegraph @

gcc/config/gcn/gcn-hsa.h

raw
1 /* Copyright (C) 2016-2025 Free Software Foundation, Inc.
2
3 This file is free software; you can redistribute it and/or modify it under
4 the terms of the GNU General Public License as published by the Free
5 Software Foundation; either version 3 of the License, or (at your option)
6 any later version.
7
8 This file is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with GCC; see the file COPYING3. If not see
15 <http://www.gnu.org/licenses/>. */
16
17 #ifndef OBJECT_FORMAT_ELF
18 #error elf.h included before elfos.h
19 #endif
20
21 #define TEXT_SECTION_ASM_OP "\t.text"
22 #define BSS_SECTION_ASM_OP "\t.bss"
23 #define GLOBAL_ASM_OP "\t.globl\t"
24 #define DATA_SECTION_ASM_OP "\t.data\t"
25 #define SET_ASM_OP "\t.set\t"
26 #define LOCAL_LABEL_PREFIX "."
27 #define USER_LABEL_PREFIX ""
28 #define ASM_COMMENT_START ";"
29 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
30
31 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
32 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
33
34 #undef ASM_DECLARE_FUNCTION_NAME
35 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
36 gcn_hsa_declare_function_name ((FILE), (NAME), (DECL))
37
38 /* Unlike GNU as, the LLVM assembler uses log2 alignments. */
39 #undef ASM_OUTPUT_ALIGNED_COMMON
40 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
41 (fprintf ((FILE), "%s", COMMON_ASM_OP), \
42 assemble_name ((FILE), (NAME)), \
43 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", \
44 (SIZE) > 0 ? (SIZE) : 1, exact_log2 ((ALIGNMENT) / BITS_PER_UNIT)))
45
46 #define ASM_OUTPUT_LABEL(FILE,NAME) \
47 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
48
49 /* Used in lieu of '../elfos.h:ASM_WEAKEN_LABEL'. */
50 #define ASM_WEAKEN_DECL(STREAM, DECL, NAME, VALUE) \
51 gcn_asm_weaken_decl ((STREAM), (DECL), (NAME), (VALUE))
52
53 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
54 asm_fprintf (FILE, "%U%s", default_strip_name_encoding (NAME))
55
56 extern unsigned int gcn_local_sym_hash (const char *name);
57
58 #define ASM_OUTPUT_SYMBOL_REF(FILE, X) gcn_asm_output_symbol_ref (FILE, X)
59
60 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
61 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
62
63 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
64 fprintf (FILE, "\t.word .L%d\n", VALUE)
65
66 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
67 do { if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", 1<<(LOG)); } while (0)
68 #define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \
69 do { \
70 if (LOG!=0) \
71 fprintf (FILE, "\t.p2alignl\t%d, 0xBF800000" \
72 " ; Fill value is 's_nop 0'\n", (LOG)); \
73 } while (0)
74
75 #define ASM_APP_ON ""
76 #define ASM_APP_OFF ""
77
78 /* Avoid the default in ../../gcc.cc, which adds "-pthread", which is not
79 supported for gcn. */
80 #define GOMP_SELF_SPECS ""
81
82 #include "gcn-device-macros.h"
83
84 /* Use LLVM assembler and linker options. */
85 #define ASM_SPEC "-triple=amdgcn--amdhsa " \
86 "%{march=*:-mcpu=%*} " \
87 ABI_VERSION_OPT \
88 XNACKOPT \
89 SRAMOPT \
90 WAVE64OPT \
91 CUMODEOPT \
92 "-filetype=obj"
93 #define LINK_SPEC "--pie --export-dynamic"
94 #define LIB_SPEC "-lc"
95
96 /* Provides a _start symbol to keep the linker happy. */
97 #define STARTFILE_SPEC "crt0.o%s"
98 #define ENDFILE_SPEC ""
99 #define STANDARD_STARTFILE_PREFIX_2 ""
100
101 #undef LOCAL_INCLUDE_DIR
102
103 /* FIXME: Review debug info settings.
104 * In particular, EH_FRAME_THROUGH_COLLECT2 is probably the wrong
105 * thing but stuff fails to build without it.
106 * (Debug info is not a big deal until we get a debugger.) */
107 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
108 #define DWARF2_DEBUGGING_INFO 1
109 #define DWARF2_ASM_LINE_DEBUG_INFO 1
110 #define EH_FRAME_THROUGH_COLLECT2 1
111 #define DEBUGGER_REGNO(REGNO) gcn_dwarf_register_number (REGNO)