aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-04-11 10:36:16 -0700
committerJim Wilson <wilson@gcc.gnu.org>1994-04-11 10:36:16 -0700
commit9753d4e4b1bc8b024114f36907840023c346ef57 (patch)
tree6525d27120bf73a87c432d222972ceab82443ad4 /gcc
parent365c6a0bb8fcaf03a90766cc5865a7d6b651bf81 (diff)
downloadgcc-9753d4e4b1bc8b024114f36907840023c346ef57.zip
gcc-9753d4e4b1bc8b024114f36907840023c346ef57.tar.gz
gcc-9753d4e4b1bc8b024114f36907840023c346ef57.tar.bz2
(mips_select_rtx_section, mips_select_section): New functions.
(mips_select_rtx_section, mips_select_section): New functions. Prefer rdata when TARGET_EMBEDDED_DATA, and prefer sdata otherwise. From-SVN: r7031
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/mips/mips.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 19a00cc..562a1e9 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -5185,3 +5185,80 @@ simple_epilogue_p ()
return (compute_frame_size (get_frame_size ())) == 0;
}
+
+/* Choose the section to use for the constant rtx expression X that has
+ mode MODE. */
+
+mips_select_rtx_section (mode, x)
+ enum machine_mode mode;
+ rtx x;
+{
+ if (TARGET_EMBEDDED_DATA)
+ {
+ /* For embedded applications, always put constants in read-only data,
+ in order to reduce RAM usage. */
+ rdata_section ();
+ }
+ else
+ {
+ /* For hosted applications, always put constants in small data if
+ possible, as this gives the best performance. */
+
+ if (GET_MODE_SIZE (mode) <= mips_section_threshold
+ && mips_section_threshold > 0)
+ sdata_section ();
+ else
+ rdata_section ();
+ }
+}
+
+/* Choose the section to use for DECL. RELOC is true if its value contains
+ any relocatable expression. */
+
+mips_select_section (decl, reloc)
+ tree decl;
+ int reloc;
+{
+ int size = int_size_in_bytes (TREE_TYPE (decl));
+
+ if (TARGET_EMBEDDED_DATA)
+ {
+ /* For embedded applications, always put an object in read-only data
+ if possible, in order to reduce RAM usage. */
+
+ if (((TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
+ && DECL_INITIAL (decl)
+ && (DECL_INITIAL (decl) == error_mark_node
+ || TREE_CONSTANT (DECL_INITIAL (decl))))
+ /* Deal with calls from output_constant_def_contents. */
+ || (TREE_CODE (decl) != VAR_DECL
+ && (TREE_CODE (decl) != STRING_CST
+ || !flag_writable_strings)))
+ && ! (flag_pic && reloc))
+ rdata_section ();
+ else if (size > 0 && size <= mips_section_threshold)
+ sdata_section ();
+ else
+ data_section ();
+ }
+ else
+ {
+ /* For hosted applications, always put an object in small data if
+ possible, as this gives the best performance. */
+
+ if (size > 0 && size <= mips_section_threshold)
+ sdata_section ();
+ else if (((TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
+ && DECL_INITIAL (decl)
+ && (DECL_INITIAL (decl) == error_mark_node
+ || TREE_CONSTANT (DECL_INITIAL (decl))))
+ /* Deal with calls from output_constant_def_contents. */
+ || (TREE_CODE (decl) != VAR_DECL
+ && (TREE_CODE (decl) != STRING_CST
+ || !flag_writable_strings)))
+ && ! (flag_pic && reloc))
+ rdata_section ();
+ else
+ data_section ();
+ }
+}