xtensa constify

Move lots of read-only arrays to .rodata.

include/
	* xtensa-isa-internal.h (xtensa_format_internal),
	(xtensa_slot_internal, xtensa_operand_internal),
	(xtensa_arg_internal, xtensa_iclass_internal),
	(xtensa_opcode_internal, xtensa_regfile_internal),
	(xtensa_interface_internal, xtensa_funcUnit_internal),
	(xtensa_state_internal, xtensa_sysreg_internal): Constify.
bfd/
	* elf32-xtensa.c (narrowable, widenable): Constify.
	* xtensa-modules.c: Constify many arrays.
This commit is contained in:
Alan Modra 2020-12-15 22:09:06 +10:30
parent 8cb1c2c857
commit 61d2295d72
5 changed files with 581 additions and 567 deletions

View file

@ -1,3 +1,8 @@
2020-12-16 Alan Modra <amodra@gmail.com>
* elf32-xtensa.c (narrowable, widenable): Constify.
* xtensa-modules.c: Constify many arrays.
2020-12-16 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (synthetic_opd): Constify.

View file

@ -4341,7 +4341,7 @@ struct string_pair
const char *narrow;
};
struct string_pair narrowable[] =
const struct string_pair narrowable[] =
{
{ "add", "add.n" },
{ "addi", "addi.n" },
@ -4354,7 +4354,7 @@ struct string_pair narrowable[] =
{ "or", "mov.n" } /* special case only when op1 == op2 */
};
struct string_pair widenable[] =
const struct string_pair widenable[] =
{
{ "add", "add.n" },
{ "addi", "addi.n" },

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,12 @@
2020-12-16 Alan Modra <amodra@gmail.com>
* xtensa-isa-internal.h (xtensa_format_internal),
(xtensa_slot_internal, xtensa_operand_internal),
(xtensa_arg_internal, xtensa_iclass_internal),
(xtensa_opcode_internal, xtensa_regfile_internal),
(xtensa_interface_internal, xtensa_funcUnit_internal),
(xtensa_state_internal, xtensa_sysreg_internal): Constify.
2020-12-15 Vivek Das Mohapatra <vivek@collabora.com>
* elf/common.h (DT_GNU_FLAGS_1, DF_GNU_1_UNIQUE): Define.

View file

@ -53,29 +53,29 @@ typedef void (*xtensa_opcode_encode_fn) (xtensa_insnbuf);
typedef int (*xtensa_format_decode_fn) (const xtensa_insnbuf);
typedef int (*xtensa_length_decode_fn) (const unsigned char *);
typedef struct xtensa_format_internal_struct
typedef const struct xtensa_format_internal_struct
{
const char *name; /* Instruction format name. */
int length; /* Instruction length in bytes. */
xtensa_format_encode_fn encode_fn;
int num_slots;
int *slot_id; /* Array[num_slots] of slot IDs. */
const int *slot_id; /* Array[num_slots] of slot IDs. */
} xtensa_format_internal;
typedef struct xtensa_slot_internal_struct
typedef const struct xtensa_slot_internal_struct
{
const char *name; /* Not necessarily unique. */
const char *format;
int position;
xtensa_get_slot_fn get_fn;
xtensa_set_slot_fn set_fn;
xtensa_get_field_fn *get_field_fns; /* Array[field_id]. */
xtensa_set_field_fn *set_field_fns; /* Array[field_id]. */
const xtensa_get_field_fn *get_field_fns; /* Array[field_id]. */
const xtensa_set_field_fn *set_field_fns; /* Array[field_id]. */
xtensa_opcode_decode_fn opcode_decode_fn;
const char *nop_name;
} xtensa_slot_internal;
typedef struct xtensa_operand_internal_struct
typedef const struct xtensa_operand_internal_struct
{
const char *name;
int field_id;
@ -88,7 +88,7 @@ typedef struct xtensa_operand_internal_struct
xtensa_undo_reloc_fn undo_reloc; /* Undo a PC-relative relocation. */
} xtensa_operand_internal;
typedef struct xtensa_arg_internal_struct
typedef const struct xtensa_arg_internal_struct
{
union {
int operand_id; /* For normal operands. */
@ -97,7 +97,7 @@ typedef struct xtensa_arg_internal_struct
char inout; /* Direction: 'i', 'o', or 'm'. */
} xtensa_arg_internal;
typedef struct xtensa_iclass_internal_struct
typedef const struct xtensa_iclass_internal_struct
{
int num_operands; /* Size of "operands" array. */
xtensa_arg_internal *operands; /* Array[num_operands]. */
@ -109,17 +109,17 @@ typedef struct xtensa_iclass_internal_struct
xtensa_interface *interfaceOperands; /* Array[num_interfaceOperands]. */
} xtensa_iclass_internal;
typedef struct xtensa_opcode_internal_struct
typedef const struct xtensa_opcode_internal_struct
{
const char *name; /* Opcode mnemonic. */
int iclass_id; /* Iclass for this opcode. */
uint32 flags; /* See XTENSA_OPCODE_* flags. */
xtensa_opcode_encode_fn *encode_fns; /* Array[slot_id]. */
const xtensa_opcode_encode_fn *encode_fns; /* Array[slot_id]. */
int num_funcUnit_uses; /* Number of funcUnit_use entries. */
xtensa_funcUnit_use *funcUnit_uses; /* Array[num_funcUnit_uses]. */
} xtensa_opcode_internal;
typedef struct xtensa_regfile_internal_struct
typedef const struct xtensa_regfile_internal_struct
{
const char *name; /* Full name of the regfile. */
const char *shortname; /* Abbreviated name. */
@ -128,7 +128,7 @@ typedef struct xtensa_regfile_internal_struct
int num_entries; /* Number of registers. */
} xtensa_regfile_internal;
typedef struct xtensa_interface_internal_struct
typedef const struct xtensa_interface_internal_struct
{
const char *name; /* Interface name. */
int num_bits; /* Width of the interface. */
@ -137,20 +137,20 @@ typedef struct xtensa_interface_internal_struct
char inout; /* "i" or "o". */
} xtensa_interface_internal;
typedef struct xtensa_funcUnit_internal_struct
typedef const struct xtensa_funcUnit_internal_struct
{
const char *name; /* Functional unit name. */
int num_copies; /* Number of instances. */
} xtensa_funcUnit_internal;
typedef struct xtensa_state_internal_struct
typedef const struct xtensa_state_internal_struct
{
const char *name; /* State name. */
int num_bits; /* Number of state bits. */
uint32 flags; /* See XTENSA_STATE_* flags. */
} xtensa_state_internal;
typedef struct xtensa_sysreg_internal_struct
typedef const struct xtensa_sysreg_internal_struct
{
const char *name; /* Register name. */
int number; /* Register number. */