summaryrefslogtreecommitdiff
path: root/gcc/config/v850/v850.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/v850/v850.c')
-rw-r--r--gcc/config/v850/v850.c70
1 files changed, 46 insertions, 24 deletions
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"