From: DJ Delorie Date: Wed, 29 Jul 2009 01:07:58 +0000 (-0400) Subject: mep.c (vtext_section): New. X-Git-Tag: releases/gcc-4.5.0~4298 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=820ca27683d68421c487ec10f7acb8869e114044;p=thirdparty%2Fgcc.git mep.c (vtext_section): New. * config/mep/mep.c (vtext_section): New. (vftext_section): New. (ftext_section): New. (mep_select_section): Add support for functions. (mep_unique_section): Likewise. (mep_asm_init_sections): Likewise. From-SVN: r150193 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de1cef3731c1..f603e0462373 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2009-07-28 DJ Delorie + + * config/mep/mep.c (vtext_section): New. + (vftext_section): New. + (ftext_section): New. + (mep_select_section): Add support for functions. + (mep_unique_section): Likewise. + (mep_asm_init_sections): Likewise. + + * config/mep/mep.h (USE_SELECT_SECTION_FOR_FUNCTIONS): Define. + 2009-07-28 Paolo Bonzini * tree.h (TREE_DEPRECATED): Document it is used for types too. diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index e237c4741991..dd229ee05d38 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -129,6 +129,10 @@ static GTY(()) section * farbss_section; static GTY(()) section * frodata_section; static GTY(()) section * srodata_section; +static GTY(()) section * vtext_section; +static GTY(()) section * vftext_section; +static GTY(()) section * ftext_section; + static void mep_set_leaf_registers (int); static bool symbol_p (rtx); static bool symbolref_p (rtx); @@ -4553,38 +4557,6 @@ mep_encode_section_info (tree decl, rtx rtl, int first) maxsize); } } - - /* Functions do not go through select_section, so we force it here - by using the DECL_SECTION_NAME as if the user specified the - .vtext or .ftext sections. */ - if (! DECL_SECTION_NAME (decl) - && TREE_CODE (decl) == FUNCTION_DECL) - { - tree secname; - - if (lookup_attribute ("vliw", TYPE_ATTRIBUTES (TREE_TYPE (decl)))) - { - if (encoding == 'f') - DECL_SECTION_NAME (decl) = build_string (7, ".vftext"); - else - DECL_SECTION_NAME (decl) = build_string (6, ".vtext"); - } - else if (encoding == 'f') - { - if (flag_function_sections || DECL_ONE_ONLY (decl)) - mep_unique_section (decl, 0); - else - DECL_SECTION_NAME (decl) = build_string (6, ".ftext"); - } - - /* This is so we can control inlining. It does not matter what - attribute we add, just that it has one. */ - secname = build_tree_list (get_identifier ("section"), DECL_SECTION_NAME (decl)); - if (TYPE_P (decl)) - TYPE_ATTRIBUTES (decl) = chainon (TYPE_ATTRIBUTES (decl), secname); - else - DECL_ATTRIBUTES (decl) = chainon (DECL_ATTRIBUTES (decl), secname); - } } const char * @@ -4606,6 +4578,7 @@ mep_select_section (tree decl, int reloc ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) { int readonly = 1; + int encoding; switch (TREE_CODE (decl)) { @@ -4626,6 +4599,30 @@ mep_select_section (tree decl, int reloc ATTRIBUTE_UNUSED, break; } + if (TREE_CODE (decl) == FUNCTION_DECL) + { + const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); + + if (name[0] == '@' && name[2] == '.') + encoding = name[1]; + else + encoding = 0; + + if (flag_function_sections || DECL_ONE_ONLY (decl)) + mep_unique_section (decl, 0); + else if (lookup_attribute ("vliw", TYPE_ATTRIBUTES (TREE_TYPE (decl)))) + { + if (encoding == 'f') + return vftext_section; + else + return vtext_section; + } + else if (encoding == 'f') + return ftext_section; + else + return text_section; + } + if (TREE_CODE (decl) == VAR_DECL) { const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); @@ -4680,7 +4677,9 @@ mep_unique_section (tree decl, int reloc) { ".far.", ".gnu.linkonce.far." }, { ".ftext.", ".gnu.linkonce.ft." }, { ".frodata.", ".gnu.linkonce.frd." }, - { ".srodata.", ".gnu.linkonce.srd." } + { ".srodata.", ".gnu.linkonce.srd." }, + { ".vtext.", ".gnu.linkonce.v." }, + { ".vftext.", ".gnu.linkonce.vf." } }; int sec = 2; /* .data */ int len; @@ -4692,7 +4691,12 @@ mep_unique_section (tree decl, int reloc) name = XSTR (XEXP (DECL_RTL (decl), 0), 0); if (TREE_CODE (decl) == FUNCTION_DECL) - sec = 0; /* .text */ + { + if (lookup_attribute ("vliw", TYPE_ATTRIBUTES (TREE_TYPE (decl)))) + sec = 9; /* .vtext */ + else + sec = 0; /* .text */ + } else if (decl_readonly_section (decl, reloc)) sec = 1; /* .rodata */ @@ -4712,6 +4716,8 @@ mep_unique_section (tree decl, int reloc) case 'f': if (sec == 0) sec = 6; /* .ftext */ + else if (sec == 9) + sec = 10; /* .vftext */ else if (sec == 1) sec = 7; /* .frodata */ else @@ -7353,6 +7359,18 @@ mep_asm_init_sections (void) = get_unnamed_section (0, output_section_asm_op, "\t.section .srodata,\"a\""); + vtext_section + = get_unnamed_section (0, output_section_asm_op, + "\t.section .vtext,\"ax\""); + + vftext_section + = get_unnamed_section (0, output_section_asm_op, + "\t.section .vftext,\"ax\""); + + ftext_section + = get_unnamed_section (0, output_section_asm_op, + "\t.section .ftext,\"ax\""); + } #include "gt-mep.h" diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h index 353823cef016..1cdd74682842 100644 --- a/gcc/config/mep/mep.h +++ b/gcc/config/mep/mep.h @@ -621,6 +621,8 @@ typedef struct #define DATA_SECTION_ASM_OP "\t.data" #define BSS_SECTION_ASM_OP ".bss" +#define USE_SELECT_SECTION_FOR_FUNCTIONS 1 + #define TARGET_ASM_FILE_END mep_file_cleanups #define ASM_APP_ON "#APP\n"