Install the GCC 2.95 main info pages as gcc2.info and cpp2.info.
[dragonfly.git] / gnu / usr.bin / cc34 / cc_prep / patches / explow.c.patch
1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/explow.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $
2
3 ===================================================================
4 RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/explow.c,v
5 retrieving revision 1.1
6 diff -u -r1.1 explow.c
7 --- explow.c    20 Jun 2004 02:14:49 -0000      1.1
8 +++ explow.c    20 Dec 2004 20:48:09 -0000
9 @@ -84,7 +84,8 @@
10    rtx tem;
11    int all_constant = 0;
12  
13 -  if (c == 0)
14 +  if (c == 0
15 +      && ! (flag_propolice_protection && x == virtual_stack_vars_rtx))
16      return x;
17  
18   restart:
19 @@ -185,7 +186,8 @@
20        break;
21      }
22  
23 -  if (c != 0)
24 +  if (c != 0
25 +      || (flag_propolice_protection && x == virtual_stack_vars_rtx))
26      x = gen_rtx_PLUS (mode, x, GEN_INT (c));
27  
28    if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
29 @@ -474,6 +476,26 @@
30        if (memory_address_p (mode, oldx))
31         goto win2;
32  
33 +      /* The stack protector keeps the addressing style of a local variable.
34 +        LEGITIMIZE_ADDRESS changes the addressing to the machine-dependent
35 +        style, so the protector split the frame address to a register using
36 +        force_reg. */
37 +      if (flag_propolice_protection)
38 +       {
39 +#define FRAMEADDR_P(X) (GET_CODE (X) == PLUS                           \
40 +                       && XEXP (X, 0) == virtual_stack_vars_rtx        \
41 +                       && GET_CODE (XEXP (X, 1)) == CONST_INT)
42 +         rtx y;
43 +         if (FRAMEADDR_P (x))
44 +           goto win;
45 +         for (y = x; y != 0 && GET_CODE (y) == PLUS; y = XEXP (y, 0))
46 +           {
47 +             if (FRAMEADDR_P (XEXP (y, 0)))
48 +               XEXP (y, 0) = force_reg (GET_MODE (XEXP (y, 0)), XEXP (y, 0));
49 +             if (FRAMEADDR_P (XEXP (y, 1)))
50 +               XEXP (y, 1) = force_reg (GET_MODE (XEXP (y, 1)), XEXP (y, 1));
51 +           }
52 +       }
53        /* Perform machine-dependent transformations on X
54          in certain cases.  This is not necessary since the code
55          below can handle all possible cases, but machine-dependent