]> git.pld-linux.org Git - packages/crossavr-gcc.git/blob - 504-gcc-conditional-register.patch
crossavr-gcc: Synchronized with official AVR toolchain 3.4.0.663.
[packages/crossavr-gcc.git] / 504-gcc-conditional-register.patch
1 diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
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
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  
41 diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
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 {
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 -   \91-ffixed-reg\92\91-fcall-used-reg\92 and \91-fcall-saved-reg\92 command options
58 -   have been applied.
59 -
60 -   You need not define this macro if it has no work to do.
61 -
62 -   If the usage of an entire class of registers depends on the target flags,
63 -   you may indicate this to GCC by using this macro to modify fixed_regs and
64 -   call_used_regs to 1 for each of the registers in the classes which should
65 -   not be used by GCC. Also define the macro REG_CLASS_FROM_LETTER /
66 -   REG_CLASS_FROM_CONSTRAINT to return NO_REGS if it is called with a letter
67 -   for a class that shouldn\92t be used.  (However, if this class is not included
68 -   in GENERAL_REGS and all of the insn patterns whose constraints permit this
69 -   class are controlled by target switches, then GCC will automatically avoid
70 -   using these registers when the target switches are opposed to them.) */
71 -
72 -#define CONDITIONAL_REGISTER_USAGE             \
73 -   if (AVR_TINY) {                             \
74 -     int i;                                    \
75 -     for (i = 0;  i <= 17;  i++) {             \
76 -       fixed_regs[i] = 1;                      \
77 -       call_used_regs[i] = 1;                  \
78 -     }                                         \
79 -       CLEAR_HARD_REG_SET(reg_class_contents[(int)ADDW_REGS]);           \
80 -       CLEAR_HARD_REG_SET(reg_class_contents[(int)NO_LD_REGS]);           \
81 -   }
82 -
83  #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
84  
85  /* The following macro defines cover classes for Integrated Register
This page took 0.035657 seconds and 3 git commands to generate.