Include ProPolice suport for GCC 3.4.
[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.1 2004/06/19 10:30:08 joerg Exp $
2
3 --- ../gcc.orig/combine.c       2004-06-18 23:08:10.000000000 +0200
4 +++ combine.c   2004-06-18 23:13:41.000000000 +0200
5 @@ -1401,6 +1401,10 @@
6               && ! fixed_regs[REGNO (dest)]
7               && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (dest))))))
8      return 1;
9 +  /* Never combine loads and stores protecting argument that use set insn
10 +     with used flag on.  */
11 +  if (SET_VOLATILE_P (set))
12 +    return 1;
13  
14    return 0;
15  }
16 @@ -3781,6 +3785,19 @@
17           rtx inner_op1 = XEXP (x, 1);
18           rtx inner;
19  
20 +#ifndef FRAME_GROWS_DOWNWARD
21 +         /* For the case where the frame grows upward,
22 +            the stack protector keeps the offset of the frame pointer
23 +            positive integer.  */
24 +         if (flag_propolice_protection
25 +             && code == PLUS
26 +             && other == frame_pointer_rtx
27 +             && GET_CODE (inner_op0) == CONST_INT
28 +             && GET_CODE (inner_op1) == CONST_INT
29 +             && INTVAL (inner_op0) > 0
30 +             && INTVAL (inner_op0) + INTVAL (inner_op1) <= 0)
31 +           return x;
32 +#endif
33           /* Make sure we pass the constant operand if any as the second
34              one if this is a commutative operation.  */
35           if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c')
36 @@ -4143,6 +4160,13 @@
37          outermost.  That's because that's the way indexed addresses are
38          supposed to appear.  This code used to check many more cases, but
39          they are now checked elsewhere.  */
40 +#ifndef FRAME_GROWS_DOWNWARD
41 +       /* The stack protector keeps the addressing style of a local variable
42 +          to be able to change its stack position.  */
43 +       if (! (flag_propolice_protection
44 +              && XEXP (XEXP (x, 0), 0) == frame_pointer_rtx
45 +              && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT))
46 +#endif
47        if (GET_CODE (XEXP (x, 0)) == PLUS
48           && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
49         return gen_binary (PLUS, mode,
50 @@ -4272,8 +4296,14 @@
51         }
52  
53        /* Canonicalize (minus A (plus B C)) to (minus (minus A B) C) for
54 -        integers.  */
55 -      if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode))
56 +        integers.
57 +        
58 +        The stack protector keeps the addressing style of
59 +        a local variable.  */
60 +      if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode)
61 +         && (! (flag_propolice_protection
62 +                && XEXP (XEXP (x, 1), 0) == frame_pointer_rtx
63 +                && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)))
64         return gen_binary (MINUS, mode,
65                            gen_binary (MINUS, mode, XEXP (x, 0),
66                                        XEXP (XEXP (x, 1), 0)),