diff options
Diffstat (limited to 'gcc/config/v850')
-rw-r--r-- | gcc/config/v850/v850-protos.h | 7 | ||||
-rw-r--r-- | gcc/config/v850/v850.c | 70 | ||||
-rw-r--r-- | gcc/config/v850/v850.h | 92 |
3 files changed, 48 insertions, 121 deletions
diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index aff12412fed..8374b53c105 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -27,13 +27,6 @@ extern void expand_prologue (void); extern void expand_epilogue (void); -extern void sdata_section (void); -extern void rosdata_section (void); -extern void sbss_section (void); -extern void tdata_section (void); -extern void zdata_section (void); -extern void rozdata_section (void); -extern void zbss_section (void); extern int v850_handle_pragma (int (*)(void), void (*)(int), char *); extern int compute_register_save_size (long *); extern int compute_frame_size (int, long *); diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index e77d56ab5e7..7629a7af3a7 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -62,7 +62,8 @@ const struct attribute_spec v850_attribute_table[]; static tree v850_handle_interrupt_attribute (tree *, tree, tree, int, bool *); static tree v850_handle_data_area_attribute (tree *, tree, tree, int, bool *); static void v850_insert_attributes (tree, tree *); -static void v850_select_section (tree, int, unsigned HOST_WIDE_INT); +static void v850_asm_init_sections (void); +static section *v850_select_section (tree, int, unsigned HOST_WIDE_INT); static void v850_encode_data_area (tree, rtx); static void v850_encode_section_info (tree, rtx, int); static bool v850_return_in_memory (tree, tree); @@ -96,6 +97,12 @@ static int v850_interrupt_cache_p = FALSE; /* Whether current function is an interrupt handler. */ static int v850_interrupt_p = FALSE; + +static GTY(()) section *rosdata_section; +static GTY(()) section *rozdata_section; +static GTY(()) section *tdata_section; +static GTY(()) section *zdata_section; +static GTY(()) section *zbss_section; /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -2498,18 +2505,18 @@ v850_output_aligned_bss (FILE * file, switch (v850_get_data_area (decl)) { case DATA_AREA_ZDA: - zbss_section (); + switch_to_section (zbss_section); break; case DATA_AREA_SDA: - sbss_section (); + switch_to_section (sbss_section); break; case DATA_AREA_TDA: - tdata_section (); + switch_to_section (tdata_section); default: - bss_section (); + switch_to_section (bss_section); break; } @@ -2927,7 +2934,34 @@ v850_return_addr (int count) return get_hard_reg_initial_val (Pmode, LINK_POINTER_REGNUM); } +/* Implement TARGET_ASM_INIT_SECTIONS. */ + static void +v850_asm_init_sections (void) +{ + rosdata_section + = get_unnamed_section (0, output_section_asm_op, + "\t.section .rosdata,\"a\""); + + rozdata_section + = get_unnamed_section (0, output_section_asm_op, + "\t.section .rozdata,\"a\""); + + tdata_section + = get_unnamed_section (SECTION_WRITE, output_section_asm_op, + "\t.section .tdata,\"aw\""); + + zdata_section + = get_unnamed_section (SECTION_WRITE, output_section_asm_op, + "\t.section .zdata,\"aw\""); + + zbss_section + = get_unnamed_section (SECTION_WRITE | SECTION_BSS, + output_section_asm_op, + "\t.section .zbss,\"aw\""); +} + +static section * v850_select_section (tree exp, int reloc ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) @@ -2947,33 +2981,19 @@ v850_select_section (tree exp, switch (v850_get_data_area (exp)) { case DATA_AREA_ZDA: - if (is_const) - rozdata_section (); - else - zdata_section (); - break; + return is_const ? rozdata_section : zdata_section; case DATA_AREA_TDA: - tdata_section (); - break; + return tdata_section; case DATA_AREA_SDA: - if (is_const) - rosdata_section (); - else - sdata_section (); - break; + return is_const ? rosdata_section : sdata_section; default: - if (is_const) - readonly_data_section (); - else - data_section (); - break; + return is_const ? readonly_data_section : data_section; } } - else - readonly_data_section (); + return readonly_data_section; } /* Worker function for TARGET_RETURN_IN_MEMORY. */ @@ -2996,3 +3016,5 @@ v850_setup_incoming_varargs (CUMULATIVE_ARGS *ca, { ca->anonymous_args = (!TARGET_GHS ? 1 : 0); } + +#include "gt-v850.h" diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index c43c802838a..c1dbd783113 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -876,101 +876,11 @@ typedef enum DATA_AREA_ZDA } v850_data_area; -/* A list of names for sections other than the standard two, which are - `in_text' and `in_data'. You need not define this macro on a - system with no other sections (that GCC needs to use). */ -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, \ - in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon - -/* One or more functions to be defined in `varasm.c'. These - functions should do jobs analogous to those of `text_section' and - `data_section', for your additional sections. Do not define this - macro if you do not define `EXTRA_SECTIONS'. */ -#undef EXTRA_SECTION_FUNCTIONS - -/* This could be done a lot more cleanly using ANSI C.... */ -#define EXTRA_SECTION_FUNCTIONS \ -void \ -sdata_section () \ -{ \ - if (in_section != in_sdata) \ - { \ - fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \ - in_section = in_sdata; \ - } \ -} \ - \ -void \ -rosdata_section () \ -{ \ - if (in_section != in_rosdata) \ - { \ - fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \ - in_section = in_sdata; \ - } \ -} \ - \ -void \ -sbss_section () \ -{ \ - if (in_section != in_sbss) \ - { \ - fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \ - in_section = in_sbss; \ - } \ -} \ - \ -void \ -tdata_section () \ -{ \ - if (in_section != in_tdata) \ - { \ - fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \ - in_section = in_tdata; \ - } \ -} \ - \ -void \ -zdata_section () \ -{ \ - if (in_section != in_zdata) \ - { \ - fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \ - in_section = in_zdata; \ - } \ -} \ - \ -void \ -rozdata_section () \ -{ \ - if (in_section != in_rozdata) \ - { \ - fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \ - in_section = in_rozdata; \ - } \ -} \ - \ -void \ -zbss_section () \ -{ \ - if (in_section != in_zbss) \ - { \ - fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \ - in_section = in_zbss; \ - } \ -} - #define TEXT_SECTION_ASM_OP "\t.section .text" #define DATA_SECTION_ASM_OP "\t.section .data" #define BSS_SECTION_ASM_OP "\t.section .bss" #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\"" #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\"" -#define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\"" -#define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\"" -#define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\"" -#define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\"" -#define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\"" #define SCOMMON_ASM_OP "\t.scomm\t" #define ZCOMMON_ASM_OP "\t.zcomm\t" @@ -1230,4 +1140,6 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K #define SYMBOL_REF_TDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_TDA) != 0) #define SYMBOL_REF_SDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SDA) != 0) +#define TARGET_ASM_INIT_SECTIONS v850_asm_init_sections + #endif /* ! GCC_V850_H */ |