Include ProPolice suport for GCC 3.4.
[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.1 2004/06/19 10:30:08 joerg Exp $
2
3 --- ../gcc.orig/explow.c        2004-06-18 23:08:11.000000000 +0200
4 +++ explow.c    2004-06-18 23:18:11.000000000 +0200
5 @@ -84,7 +84,8 @@
6    rtx tem;
7    int all_constant = 0;
8  
9 -  if (c == 0)
10 +  if (c == 0
11 +      && ! (flag_propolice_protection && x == virtual_stack_vars_rtx))
12      return x;
13  
14   restart:
15 @@ -185,7 +186,8 @@
16        break;
17      }
18  
19 -  if (c != 0)
20 +  if (c != 0
21 +      || (flag_propolice_protection && x == virtual_stack_vars_rtx))
22      x = gen_rtx_PLUS (mode, x, GEN_INT (c));
23  
24    if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
25 @@ -474,6 +476,26 @@
26        if (memory_address_p (mode, oldx))
27         goto win2;
28  
29 +      /* The stack protector keeps the addressing style of a local variable.
30 +        LEGITIMIZE_ADDRESS changes the addressing to the machine-dependent
31 +        style, so the protector split the frame address to a register using
32 +        force_reg. */
33 +      if (flag_propolice_protection)
34 +       {
35 +#define FRAMEADDR_P(X) (GET_CODE (X) == PLUS                           \
36 +                       && XEXP (X, 0) == virtual_stack_vars_rtx        \
37 +                       && GET_CODE (XEXP (X, 1)) == CONST_INT)
38 +         rtx y;
39 +         if (FRAMEADDR_P (x))
40 +           goto win;
41 +         for (y = x; y != 0 && GET_CODE (y) == PLUS; y = XEXP (y, 0))
42 +           {
43 +             if (FRAMEADDR_P (XEXP (y, 0)))
44 +               XEXP (y, 0) = force_reg (GET_MODE (XEXP (y, 0)), XEXP (y, 0));
45 +             if (FRAMEADDR_P (XEXP (y, 1)))
46 +               XEXP (y, 1) = force_reg (GET_MODE (XEXP (y, 1)), XEXP (y, 1));
47 +           }
48 +       }
49        /* Perform machine-dependent transformations on X
50          in certain cases.  This is not necessary since the code
51          below can handle all possible cases, but machine-dependent