aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/h8300
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1996-05-07 11:42:26 -0600
committerJeff Law <law@gcc.gnu.org>1996-05-07 11:42:26 -0600
commit637dec4188ed71b4d2e0bf04acb97b4ca19980af (patch)
tree8f6ad209bbe87403c1a3652e54dec532f749e9a4 /gcc/config/h8300
parentd51602543daf0e69f1bff13cccedab38d14e4c87 (diff)
downloadgcc-637dec4188ed71b4d2e0bf04acb97b4ca19980af.zip
gcc-637dec4188ed71b4d2e0bf04acb97b4ca19980af.tar.gz
gcc-637dec4188ed71b4d2e0bf04acb97b4ca19980af.tar.bz2
h8300.h (READONLY_DATA_SECTION): Define.
* h8300/h8300.h (READONLY_DATA_SECTION): Define. (EXTRA_SECTIONS): Add in_readonly_data. (READONLY_DATA_SECTION_ASM_OP): Define. (EXTRA_SECTION_FUNCTINOS): Add readonly_data. From-SVN: r11951
Diffstat (limited to 'gcc/config/h8300')
-rw-r--r--gcc/config/h8300/h8300.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 0b6667e..6109a85 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -1014,7 +1014,14 @@ h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
/* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */
#define ASM_WORD_OP (TARGET_H8300 ? ".word" : ".long")
-/* Output before read-only data. */
+/* We define a readonly data section solely to remove readonly data
+ from the instruction stream. This can improve relaxing in two significant
+ ways. First it's more likely that references to readonly data
+ can be done with a 16bit absolute address since they'll be in low
+ memory. Second, it's more likely that jsr instructions can be
+ turned into bsr instructions since read-only data is not in the
+ instruction stream. */
+#define READONLY_DATA_SECTION readonly_data
#define TEXT_SECTION_ASM_OP "\t.section .text"
#define DATA_SECTION_ASM_OP "\t.section .data"
@@ -1022,8 +1029,9 @@ h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
#define INIT_SECTION_ASM_OP "\t.section .init"
#define CTORS_SECTION_ASM_OP "\t.section .ctors"
#define DTORS_SECTION_ASM_OP "\t.section .dtors"
+#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
-#define EXTRA_SECTIONS in_ctors, in_dtors
+#define EXTRA_SECTIONS in_ctors, in_dtors, in_readonly_data
#define EXTRA_SECTION_FUNCTIONS \
\
@@ -1046,6 +1054,18 @@ dtors_section() \
in_section = in_dtors; \
} \
} \
+ \
+void \
+readonly_data() \
+{ \
+ if (in_section != in_readonly_data) \
+ { \
+ fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP);\
+ in_section = in_readonly_data; \
+ } \
+}
+
+
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
do { ctors_section(); \