Merge from vendor branch FILE:
[dragonfly.git] / gnu / usr.bin / cc34 / cc_prep / patches / combine.c.patch
1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch,v 1.2 2004/06/20 00:10:52 joerg Exp $
2
3 diff -u ../gcc.orig/combine.c combine.c
4 --- ../gcc.orig/combine.c       2004-06-19 22:27:09.000000000 +0200
5 +++ combine.c   2004-06-20 01:16:04.000000000 +0200
6 @@ -1401,6 +1401,10 @@
7               && ! fixed_regs[REGNO (dest)]
8               && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (dest))))))
9      return 1;
10 +  /* Never combine loads and stores protecting argument that use set insn
11 +     with used flag on.  */
12 +  if (SET_VOLATILE_P (set))
13 +    return 1;
14  
15    return 0;
16  }
17 @@ -3780,7 +3784,20 @@
18           rtx inner_op0 = XEXP (XEXP (x, 0), 1);
19           rtx inner_op1 = XEXP (x, 1);
20           rtx inner;
21 -
22 +         
23 +#ifndef FRAME_GROWS_DOWNWARD
24 +         /* For the case where the frame grows upward,
25 +            the stack protector keeps the offset of the frame pointer
26 +            positive integer.  */
27 +         if (flag_propolice_protection
28 +             && code == PLUS
29 +             && other == frame_pointer_rtx
30 +             && GET_CODE (inner_op0) == CONST_INT
31 +             && GET_CODE (inner_op1) == CONST_INT
32 +             && INTVAL (inner_op0) > 0
33 +             && INTVAL (inner_op0) + INTVAL (inner_op1) <= 0)
34 +           return x;
35 +#endif
36           /* Make sure we pass the constant operand if any as the second
37              one if this is a commutative operation.  */
38           if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c')
39 @@ -4145,6 +4162,13 @@
40          they are now checked elsewhere.  */
41        if (GET_CODE (XEXP (x, 0)) == PLUS
42           && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
43 +#ifndef FRAME_GROWS_DOWNWARD
44 +       /* The stack protector keeps the addressing style of a local variable
45 +          to be able to change its stack position.  */
46 +       if (! (flag_propolice_protection
47 +              && XEXP (XEXP (x, 0), 0) == frame_pointer_rtx
48 +              && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT))
49 +#endif
50         return gen_binary (PLUS, mode,
51                            gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0),
52                                        XEXP (x, 1)),
53 @@ -4272,8 +4296,14 @@
54         }
55  
56        /* Canonicalize (minus A (plus B C)) to (minus (minus A B) C) for
57 -        integers.  */
58 -      if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode))
59 +        integers.
60 +        
61 +        The stack protector keeps the addressing style of
62 +        a local variable.  */
63 +      if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode)
64 +         && (! (flag_propolice_protection
65 +                && XEXP (XEXP (x, 1), 0) == frame_pointer_rtx
66 +                && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)))
67         return gen_binary (MINUS, mode,
68                            gen_binary (MINUS, mode, XEXP (x, 0),
69                                        XEXP (XEXP (x, 1), 0)),