]> git.pld-linux.org Git - packages/crossavr-gcc.git/blame - 504-gcc-conditional-register.patch
- rebuild with ppl 1.0
[packages/crossavr-gcc.git] / 504-gcc-conditional-register.patch
CommitLineData
6ef8d480 1diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
08a89ff7
JR
2--- gcc/config/avr/avr.c 2011-10-28 16:28:16.000000000 +0530
3+++ gcc/config/avr/avr.c 2011-10-28 16:40:20.000000000 +0530
6ef8d480
PZ
4@@ -96,6 +96,7 @@ static struct machine_function * avr_ini
5 static void avr_init_builtins (void);
6 static rtx avr_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
7 static rtx avr_builtin_setjmp_frame_value (void);
8+static void avr_conditional_register_usage (void);
9 static bool avr_hard_regno_scratch_ok (unsigned int);
10 static unsigned int avr_case_values_threshold (void);
11 static bool avr_frame_pointer_required_p (void);
12@@ -212,6 +213,8 @@ static const struct default_options avr_
13 #undef TARGET_BUILTIN_SETJMP_FRAME_VALUE
14 #define TARGET_BUILTIN_SETJMP_FRAME_VALUE avr_builtin_setjmp_frame_value
15
16+#undef TARGET_CONDITIONAL_REGISTER_USAGE
17+#define TARGET_CONDITIONAL_REGISTER_USAGE avr_conditional_register_usage
18 #undef TARGET_HARD_REGNO_SCRATCH_OK
19 #define TARGET_HARD_REGNO_SCRATCH_OK avr_hard_regno_scratch_ok
20 #undef TARGET_CASE_VALUES_THRESHOLD
21@@ -7388,6 +7391,19 @@ avr_output_addr_vec_elt (FILE *stream, i
22 fprintf (stream, "\trjmp .L%d\n", value);
23 }
24
25+static void
26+avr_conditional_register_usage(void) {
27+ if (AVR_TINY) {
28+ int i;
29+ for (i = 0; i <= 17; i++) {
30+ fixed_regs[i] = 1;
31+ call_used_regs[i] = 1;
32+ }
33+ CLEAR_HARD_REG_SET(reg_class_contents[(int)ADDW_REGS]);
34+ CLEAR_HARD_REG_SET(reg_class_contents[(int)NO_LD_REGS]);
35+ }
36+}
37+
38 /* Returns true if SCRATCH are safe to be allocated as a scratch
39 registers (for a define_peephole2) in the current function. */
40
41diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
08a89ff7
JR
42--- gcc/config/avr/avr.h 2011-10-28 16:29:55.000000000 +0530
43+++ gcc/config/avr/avr.h 2011-10-28 16:40:20.000000000 +0530
44@@ -313,41 +313,6 @@ enum reg_class {
6ef8d480
PZ
45 {0xffffffff,0x00000003} /* ALL_REGS */ \
46 }
47
48-/* Zero or more C statements that may conditionally modify five variables
49- fixed_regs, call_used_regs, global_regs, reg_names, and reg_class_contents,
50- to take into account any dependence of these register sets on target flags.
51- The first three of these are of type char [] (interpreted as Boolean
52- vectors). global_regs is a const char *[], and reg_class_contents is a
53- HARD_REG_SET. Before the macro is called, fixed_regs, call_used_regs,
54- reg_class_contents, and reg_names have been initialized from
55- FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS, and
56- REGISTER_NAMES, respectively. global_regs has been cleared, and any
57