Skip to content

Commit 17a35a4

Browse files
committed
rx: Update rx gcc from Renesas release
This commit pickup the changes from GCC for RX release by Renesas to support newer RX devices and functionality Changes are pickup from https://llvm-gcc-renesas.com/rx/rx-latest-source-code/ Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
1 parent 8453e39 commit 17a35a4

File tree

17 files changed

+6276
-921
lines changed

17 files changed

+6276
-921
lines changed

gcc/common/config/rx/rx-common.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ rx_handle_option (struct gcc_options *opts,
5151
return value >= 0 && value <= 4;
5252

5353
case OPT_mcpu_:
54-
if ((enum rx_cpu_types) value == RX200 ||
54+
if ((enum rx_cpu_types) value == RX200 ||
5555
(enum rx_cpu_types) value == RX100)
5656
opts->x_target_flags |= MASK_NO_USE_FPU;
5757
break;
58-
58+
5959
case OPT_fpu:
6060
if (opts->x_rx_cpu_type == RX200)
6161
error_at (loc, "the RX200 cpu does not have FPU hardware");

gcc/config.gcc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
# the --with-sysroot configure option or the
188188
# --sysroot command line option is used this
189189
# will be relative to the sysroot.
190-
# target_type_format_char
190+
# target_type_format_char
191191
# The default character to be used for formatting
192192
# the attribute in a
193193
# .type symbol_name, ${t_t_f_c}<property>
@@ -3254,6 +3254,8 @@ rx-*-elf*)
32543254
tmake_file="${tmake_file} rx/t-rx"
32553255
;;
32563256
esac
3257+
c_target_objs="rx-pragma.o"
3258+
cxx_target_objs="rx-pragma.o"
32573259
extra_options="${extra_options} rx/elf.opt"
32583260
;;
32593261
rx-*-linux*)

gcc/config/rx/constraints.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
)
3333
)
3434

35+
(define_constraint "Ibset"
36+
"@internal An unsigned 8-bit immediate value with a single bit set"
37+
(and (match_code "const_int")
38+
(match_test "exact_log2 (ival) != -1")
39+
)
40+
)
41+
3542
(define_constraint "Sint08"
3643
"@internal A signed 8-bit immediate value"
3744
(and (match_code "const_int")
@@ -63,6 +70,20 @@
6370
)
6471
)
6572

73+
(define_constraint "Uint05"
74+
"@internal An unsigned 5-bit immediate value"
75+
(and (match_code "const_int")
76+
(match_test "IN_RANGE (ival, 0, 31)")
77+
)
78+
)
79+
80+
(define_constraint "Uintz5"
81+
"@internal An unsigned ,non-zero, 5-bit immediate value"
82+
(and (match_code "const_int")
83+
(match_test "IN_RANGE (ival, 1, 31)")
84+
)
85+
)
86+
6687
(define_constraint "NEGint4"
6788
"@internal An signed 4-bit negative immediate value"
6889
(and (match_code "const_int")
@@ -87,6 +108,14 @@
87108
)
88109
)
89110

111+
(define_register_constraint "DFPUreg" "DOUBLE_REGS"
112+
"The DFPU registers")
113+
114+
(define_constraint "DoubleC"
115+
"Const double."
116+
(match_code "const_double")
117+
)
118+
90119
(define_constraint "Rpid"
91120
"A MEM to a PID variable"
92121
(and (match_code "mem")
@@ -107,6 +136,56 @@
107136
)
108137
)
109138

139+
(define_memory_constraint "Rreg"
140+
"A MEM which only uses REG addressing."
141+
(and (match_code "mem")
142+
(match_code "reg" "0")
143+
)
144+
)
145+
146+
(define_memory_constraint "Rd05"
147+
"A MEM which only uses REG+INT addressing with 5-bit displacement."
148+
(and (match_code "mem")
149+
(and (match_code "plus" "0")
150+
(and (match_code "reg,subreg" "00")
151+
(and (match_code "const_int" "01")
152+
(match_test "IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)),
153+
0, 31 * GET_MODE_SIZE (GET_MODE (op)))")
154+
)
155+
)
156+
)
157+
)
158+
)
159+
160+
(define_memory_constraint "Rd08"
161+
"A MEM which only uses REG+INT addressing with 8-bit displacement."
162+
(and (match_code "mem")
163+
(and (match_code "plus" "0")
164+
(and (match_code "reg,subreg" "00")
165+
(and (match_code "const_int" "01")
166+
(match_test "IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)),
167+
0, 255 * GET_MODE_SIZE (GET_MODE (op)))")
168+
)
169+
)
170+
)
171+
)
172+
)
173+
174+
(define_constraint "RXV2"
175+
"Reg constraint for RXV2 instructions"
176+
(and (match_code "reg")
177+
(match_test "TARGET_RXV2")
178+
)
179+
)
180+
181+
(define_constraint "RXV3"
182+
"Reg constraint for RXV3 instructions"
183+
(and (match_code "reg")
184+
(match_test "TARGET_RXV3")
185+
)
186+
)
187+
188+
110189
(define_constraint "CALL_OP_SYMBOL_REF"
111190
"constraint for call instructions using symbol ref"
112191
(and (match_test "!TARGET_JSR")

gcc/config/rx/elf.opt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Generate assembler output that is compatible with the Renesas AS100 assembler.
3434
;---------------------------------------------------
3535

3636
mint-register=
37-
Target RejectNegative Joined UInteger Var(rx_interrupt_registers) Init(0)
37+
Target RejectNegative Joined UInteger Var(rx_deferred_options) Defer
3838
Specifies the number of registers to reserve for interrupt handlers.
3939

4040
;---------------------------------------------------

gcc/config/rx/predicates.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@
4949
(match_test "IN_RANGE (INTVAL (op), 0, 31)"))
5050
)
5151

52+
(define_predicate "rx_bitclr_operand"
53+
(and (match_code "const_int")
54+
(match_test "exact_log2 (~INTVAL (op)) != -1"))
55+
)
56+
57+
(define_predicate "rx_bitset_operand"
58+
(and (match_code "const_int")
59+
(match_test "exact_log2 (INTVAL (op)) != -1"))
60+
)
61+
5262
(define_predicate "rx_restricted_mem_operand"
5363
(and (match_code "mem")
5464
(match_test "rx_is_restricted_memory_address (XEXP (op, 0), mode)"))
@@ -64,6 +74,13 @@
6474
(match_operand 0 "rx_restricted_mem_operand"))
6575
)
6676

77+
(define_predicate "rx_speed_source_operand"
78+
(ior (match_operand 0 "register_operand")
79+
(match_operand 0 "immediate_operand")
80+
(and (match_test "optimize_size")
81+
(match_operand 0 "rx_restricted_mem_operand")))
82+
)
83+
6784
;; Check that the operand is suitable as the source operand
6885
;; for a comparison instruction. This is the same as
6986
;; rx_source_operand except that SUBREGs are allowed but
@@ -84,6 +101,18 @@
84101
(match_operand 0 "rx_restricted_mem_operand"))
85102
)
86103

104+
(define_predicate "rx_speed_minmaxex_operand"
105+
(ior (match_operand 0 "immediate_operand")
106+
(and (match_test "optimize_size")
107+
(match_operand 0 "rx_restricted_mem_operand")))
108+
)
109+
110+
(define_predicate "rx_speed_compare_operand"
111+
(ior (match_operand 0 "register_operand")
112+
(and (match_test "optimize_size")
113+
(match_operand 0 "rx_restricted_mem_operand")))
114+
)
115+
87116
;; Return true if OP is a store multiple operation. This looks like:
88117
;;
89118
;; [(set (SP) (MINUS (SP) (INT)))
@@ -114,33 +143,15 @@
114143
|| ! CONST_INT_P (XEXP (SET_SRC (element), 1)))
115144
return false;
116145

117-
/* Check that the next element is the first push. */
118-
element = XVECEXP (op, 0, 1);
119-
if ( ! SET_P (element)
120-
|| ! REG_P (SET_SRC (element))
121-
|| GET_MODE (SET_SRC (element)) != SImode
122-
|| ! MEM_P (SET_DEST (element))
123-
|| GET_MODE (SET_DEST (element)) != SImode
124-
|| GET_CODE (XEXP (SET_DEST (element), 0)) != MINUS
125-
|| ! REG_P (XEXP (XEXP (SET_DEST (element), 0), 0))
126-
|| REGNO (XEXP (XEXP (SET_DEST (element), 0), 0)) != SP_REG
127-
|| ! CONST_INT_P (XEXP (XEXP (SET_DEST (element), 0), 1))
128-
|| INTVAL (XEXP (XEXP (SET_DEST (element), 0), 1))
129-
!= GET_MODE_SIZE (SImode))
130-
return false;
131-
132-
src_regno = REGNO (SET_SRC (element));
133-
134146
/* Check that the remaining elements use SP-<disp>
135147
addressing and decreasing register numbers. */
136-
for (i = 2; i < count; i++)
148+
for (i = 1; i < count - 1; i++)
137149
{
138150
element = XVECEXP (op, 0, i);
139151

140152
if ( ! SET_P (element)
141153
|| ! REG_P (SET_SRC (element))
142154
|| GET_MODE (SET_SRC (element)) != SImode
143-
|| REGNO (SET_SRC (element)) != src_regno - (i - 1)
144155
|| ! MEM_P (SET_DEST (element))
145156
|| GET_MODE (SET_DEST (element)) != SImode
146157
|| GET_CODE (XEXP (SET_DEST (element), 0)) != MINUS

gcc/config/rx/rx-opts.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,38 @@
2222

2323
enum rx_cpu_types
2424
{
25+
RX13T,
26+
RX230,
27+
RX71M,
28+
RX72T,
29+
RX64M,
2530
RX600,
2631
RX610,
32+
RX66T,
2733
RX200,
28-
RX100
34+
RX100,
35+
RX140,
36+
RX_CPUUNINIT
37+
};
38+
enum rx_tfu_versions
39+
{
40+
RX_TFUV1,
41+
RX_TFUV2,
42+
RX_TFUVUNINIT
43+
};
44+
enum rx_isa_versions
45+
{
46+
RX_ISAV1,
47+
RX_ISAV2,
48+
RX_ISAV3,
49+
RX_ISAUNINIT
50+
};
51+
52+
enum rx_tfu_types
53+
{
54+
RX_INTRINSIC,
55+
RX_MATHLIB,
56+
RX_TFUUNINIT
2957
};
3058

3159
#endif

gcc/config/rx/rx-pragma.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#include "config.h"
2+
#include "system.h"
3+
#include "coretypes.h"
4+
#include "tm.h"
5+
#include "tree.h"
6+
#include "c-family/c-pragma.h"
7+
#include "c-family/c-common.h"
8+
#include "diagnostic-core.h"
9+
#include "cpplib.h"
10+
#include "hard-reg-set.h"
11+
#include "output.h"
12+
#include "rx-protos.h"
13+
#include "function.h"
14+
#define MAX_RECOG_OPERANDS 10
15+
#include "reload.h"
16+
#include "target.h"
17+
18+
/* Implements the "pragma ADDRESS" pragma. This pragma takes a
19+
* variable name and an address, and arranges for that variable to be
20+
* "at" that address. The variable is also made volatile. */
21+
static void
22+
rx_pragma_address (cpp_reader * reader ATTRIBUTE_UNUSED)
23+
{
24+
/* on off */
25+
tree var, addr;
26+
enum cpp_ttype type;
27+
28+
type = pragma_lex (&var);
29+
if (type == CPP_NAME)
30+
{
31+
type = pragma_lex (&addr);
32+
if (type == CPP_NUMBER)
33+
{
34+
if (var != error_mark_node)
35+
{
36+
unsigned uaddr = tree_to_uhwi (addr);
37+
rx_note_pragma_address (IDENTIFIER_POINTER (var), uaddr);
38+
}
39+
40+
type = pragma_lex (&var);
41+
if (type != CPP_EOF)
42+
{
43+
error ("junk at end of #pragma ADDRESS");
44+
}
45+
return;
46+
}
47+
}
48+
error ("malformed #pragma ADDRESS variable address");
49+
}
50+
51+
void
52+
rx_register_pragmas (void)
53+
{
54+
c_register_pragma (NULL, "ADDRESS", rx_pragma_address);
55+
c_register_pragma (NULL, "address", rx_pragma_address);
56+
}

gcc/config/rx/rx-protos.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ extern bool rx_can_use_simple_return (void);
2525
extern void rx_expand_epilogue (bool);
2626
extern void rx_expand_prologue (void);
2727
extern int rx_initial_elimination_offset (int, int);
28+
extern void rx_register_pragmas (void);
29+
extern void rx_note_pragma_address (const char *varname, unsigned address);
30+
extern void rx_output_aligned_common (FILE *stream, tree decl ATTRIBUTE_UNUSED, const char *name,int size, int align);
31+
extern void rx_adjust_reg_alloc_order (void);
32+
extern enum reg_class rx_regno_class (int);
33+
extern bool rx_hard_regno_mode_ok (unsigned regno, machine_mode mode);
34+
extern unsigned int rx_regmode_natural_size (enum machine_mode mode);
35+
extern unsigned int rx_dbx_register_number (unsigned int);
2836

2937
bool is_interrupt_func (const_tree decl);
3038
bool is_fast_interrupt_func (const_tree decl);
@@ -53,6 +61,7 @@ extern int rx_adjust_insn_length (rtx_insn *, int);
5361
extern align_flags rx_align_for_label (rtx_insn *, int);
5462
extern void rx_emit_stack_popm (rtx *, bool);
5563
extern void rx_emit_stack_pushm (rtx *);
64+
extern void rx_emit_stack_dpushm (rtx *);
5665
extern char * rx_gen_move_template (rtx *, bool);
5766
extern bool rx_is_legitimate_constant (machine_mode, rtx);
5867
extern bool rx_is_restricted_memory_address (rtx,

0 commit comments

Comments
 (0)