aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-nds32.h
diff options
context:
space:
mode:
authorKuan-Lin Chen <kuanlinchentw@gmail.com>2014-09-11 14:25:05 +0800
committerKuan-Lin Chen <kuanlinchentw@gmail.com>2014-09-16 13:08:00 +0800
commit1c8f6a4d1fcca9e56ac705a224778bf690122a07 (patch)
tree7ff41099c5a2f8b433f654b509a7c259899124e4 /gas/config/tc-nds32.h
parent40c7a7cb74ee4a9ec0830d734198fcd0e99c3a37 (diff)
downloadgdb-1c8f6a4d1fcca9e56ac705a224778bf690122a07.zip
gdb-1c8f6a4d1fcca9e56ac705a224778bf690122a07.tar.gz
gdb-1c8f6a4d1fcca9e56ac705a224778bf690122a07.tar.bz2
NDS32: Code refactoring of relaxation.
Refactor each relaxation pattern to raise the maintainability. In origin, all patterns is analysed in nds32_elf_relax_section, so it is hard to debug and maintain. Therefore, we classify all patterns into different functions in this patch. Moreover, we adjust all optimizations into nds32_elf_relax_section to take these optimizations in turn. This can promise all relaxation being done after calling gld${EMULATION_NAME}_after_allocation.
Diffstat (limited to 'gas/config/tc-nds32.h')
-rw-r--r--gas/config/tc-nds32.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/gas/config/tc-nds32.h b/gas/config/tc-nds32.h
index 731bb87..1483d51 100644
--- a/gas/config/tc-nds32.h
+++ b/gas/config/tc-nds32.h
@@ -42,10 +42,6 @@
#define TARGET_BYTES_BIG_ENDIAN 1
#endif
-/* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
- symbols. The relocation type is stored in X_md. */
-#define O_PIC_reloc O_md1
-
/* as.c. */
/* Extend GAS command line option handling capability. */
extern int nds32_parse_option (int, char *);
@@ -154,6 +150,12 @@ extern void nds32_do_align (int);
#define LOCAL_LABELS_FB 1 /* Permit temporary numeric labels. */
/* frags.c. */
+
+#define NDS32_FRAG_RELAXABLE 0x1
+#define NDS32_FRAG_RELAXED 0x2
+#define NDS32_FRAG_BRANCH 0x4
+#define NDS32_FRAG_LABEL 0x8
+
struct nds32_frag_type
{
relax_substateT flag;
@@ -211,10 +213,16 @@ enum nds32_br_range
enum nds32_ramp
{
- NDS32_CREATE_LABLE = 1,
- NDS32_RELAX = 2,
- NDS32_ORIGIN = 4,
- NDS32_CONVERT = 8
+ NDS32_CREATE_LABEL = 1,
+ NDS32_RELAX = (1 << 1), /* Obsolete in the future. */
+ NDS32_ORIGIN = (1 << 2),
+ NDS32_INSN16 = (1 << 3),
+ NDS32_PTR = (1 << 4),
+ NDS32_ABS = (1 << 5),
+ NDS32_HINT = (1 << 6),
+ NDS32_FIX = (1 << 7),
+ NDS32_ADDEND = (1 << 8),
+ NDS32_SYM = (1 << 9)
};
typedef struct nds32_relax_fixup_info
@@ -231,13 +239,15 @@ typedef struct nds32_cond_field
int offset;
int bitpos; /* Register position. */
int bitmask; /* Number of register bits. */
+ bfd_boolean signed_extend;
} nds32_cond_field_t;
/* The max relaxation pattern is 20-bytes including the nop. */
#define NDS32_MAXCHAR 20
/* In current, the max entend number of instruction for one pseudo instruction
- is 4, but its number of relocation may be 5. */
-#define MAX_RELAX_NUM 8
+ is 4, but its number of relocation may be 12. */
+#define MAX_RELAX_NUM 4
+#define MAX_RELAX_FIX 12
typedef struct nds32_relax_info
{
@@ -248,17 +258,24 @@ typedef struct nds32_relax_info
/* Code sequences for different branch range. */
uint32_t relax_code_seq[BR_RANGE_NUM][MAX_RELAX_NUM];
nds32_cond_field_t relax_code_condition[BR_RANGE_NUM][MAX_RELAX_NUM];
- int relax_code_size[BR_RANGE_NUM];
+ unsigned int relax_code_size[BR_RANGE_NUM];
int relax_branch_isize[BR_RANGE_NUM];
- nds32_relax_fixup_info_t relax_fixup[BR_RANGE_NUM][MAX_RELAX_NUM];
+ nds32_relax_fixup_info_t relax_fixup[BR_RANGE_NUM][MAX_RELAX_FIX];
} relax_info_t;
-/* Relocation table. */
-struct nds32_relocation_map
+enum nds32_relax_hint_type
+{
+ NDS32_RELAX_HINT_NONE = 0,
+ NDS32_RELAX_HINT_LA,
+ NDS32_RELAX_HINT_LS
+};
+
+struct nds32_relax_hint_table
{
- unsigned int main_type;
- /* Number of instructions, {relocations type, instruction type}. */
- unsigned int reloc_insn[6][6][3];
+ enum nds32_relax_hint_type main_type;
+ unsigned int relax_code_size;
+ uint32_t relax_code_seq[MAX_RELAX_NUM];
+ nds32_relax_fixup_info_t relax_fixup[MAX_RELAX_FIX];
};
#endif /* TC_NDS32 */