extern GTY(()) section *in_section;
extern GTY(()) bool in_cold_section_p;
-/* MAX bit alignment for mergable sections. */
-#define MAX_ALIGN_MERGABLE 256
+/* MAX size for mergeable sections in bits. */
+#define MAX_MERGEABLE_BITSIZE 256
extern section *get_unnamed_section (unsigned int, void (*) (const char *),
const char *);
#include "hwint.h"
#include "internal-fn.h"
#include "diagnostic-core.h"
-#include "output.h"
/* ??? For lang_hooks.types.type_for_mode, but is there a word_mode
type in the GIMPLE type system that is language-independent? */
TREE_CONSTANT (decl) = 1;
TREE_READONLY (decl) = 1;
DECL_IGNORED_P (decl) = 1;
- /* The decl is mergable since we don't take the address ever and
+ /* The decl is mergeable since we don't take the address ever and
just reading from it. */
DECL_MERGEABLE (decl) = 1;
- /* Increase the alignments as needed. */
- if (tree_to_uhwi (DECL_SIZE (decl)) > DECL_ALIGN (decl))
- {
- unsigned HOST_WIDE_INT s = tree_to_uhwi (DECL_SIZE (decl));
- /* Only support up to the max supported for merging. */
- if (s <= MAX_ALIGN_MERGABLE)
- SET_DECL_ALIGN (decl, HOST_WIDE_INT_1U << ceil_log2 (s));
- }
-
if (offloading_function_p (cfun->decl))
DECL_ATTRIBUTES (decl)
= tree_cons (get_identifier ("omp declare target"), NULL_TREE,
if (HAVE_GAS_SHF_MERGE && flag_merge_constants
&& TREE_CODE (decl) == STRING_CST
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- && align <= MAX_ALIGN_MERGABLE
+ && align <= MAX_MERGEABLE_BITSIZE
&& (len = int_size_in_bytes (TREE_TYPE (decl))) > 0
&& TREE_STRING_LENGTH (decl) == len)
{
mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (TREE_TYPE (decl)));
modesize = GET_MODE_BITSIZE (mode);
- if (modesize >= 8 && modesize <= MAX_ALIGN_MERGABLE
+ if (modesize >= 8 && modesize <= MAX_MERGEABLE_BITSIZE
&& (modesize & (modesize - 1)) == 0)
{
if (align < modesize)
if (i == len - unit || (unit == 1 && i == len))
{
sprintf (name, "%s.str%d.%d", prefix,
- modesize / 8, (int) (align / 8));
- flags |= (modesize / 8) | SECTION_MERGE | SECTION_STRINGS;
+ modesize / BITS_PER_UNIT, (int) (align / BITS_PER_UNIT));
+ flags |= (modesize / BITS_PER_UNIT) | SECTION_MERGE | SECTION_STRINGS;
return get_section (name, flags, NULL);
}
}
unsigned HOST_WIDE_INT align,
unsigned int flags)
{
+ unsigned HOST_WIDE_INT newsize;
+ newsize = HOST_WIDE_INT_1U << ceil_log2 (size_bits);
if (HAVE_GAS_SHF_MERGE && flag_merge_constants
- && size_bits <= align
+ && newsize <= MAX_MERGEABLE_BITSIZE
&& align >= 8
- && align <= MAX_ALIGN_MERGABLE
+ && align <= newsize
&& (align & (align - 1)) == 0)
{
const char *prefix = function_mergeable_rodata_prefix ();
char *name = (char *) alloca (strlen (prefix) + 30);
- sprintf (name, "%s.cst%d", prefix, (int) (align / 8));
- flags |= (align / 8) | SECTION_MERGE;
+ sprintf (name, "%s.cst%d", prefix, (int) (newsize / BITS_PER_UNIT));
+ flags |= (newsize / BITS_PER_UNIT) | SECTION_MERGE;
return get_section (name, flags, NULL);
}
return readonly_data_section;