1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $
3 ===================================================================
4 RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/simplify-rtx.c,v
5 retrieving revision 1.2
6 diff -u -r1.2 simplify-rtx.c
7 --- simplify-rtx.c 20 Dec 2004 19:23:24 -0000 1.2
8 +++ simplify-rtx.c 20 Dec 2004 20:48:13 -0000
10 int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
13 + HOST_WIDE_INT fp_offset = 0;
15 memset (ops, 0, sizeof ops);
17 @@ -2312,6 +2313,10 @@
21 + if (flag_propolice_protection
22 + && XEXP (this_op, 0) == virtual_stack_vars_rtx
23 + && GET_CODE (XEXP (this_op, 1)) == CONST_INT)
24 + fp_offset = INTVAL (XEXP (this_op, 1));
28 @@ -2473,11 +2478,24 @@
29 && GET_CODE (ops[n_ops - 1].op) == CONST_INT
30 && CONSTANT_P (ops[n_ops - 2].op))
32 - rtx value = ops[n_ops - 1].op;
33 - if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
34 - value = neg_const_int (mode, value);
35 - ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
37 + if (!flag_propolice_protection)
39 + rtx value = ops[n_ops - 1].op;
40 + if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
41 + value = neg_const_int (mode, value);
42 + ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
45 + /* The stack protector keeps the addressing style of a local variable,
46 + so it doesn't use neg_const_int function not to change
47 + the offset value. */
49 + HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
50 + if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
52 + ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, value);
57 /* Count the number of CONSTs that we generated. */
58 @@ -2495,6 +2513,59 @@
59 || (n_ops + n_consts == input_ops && n_consts <= input_consts)))
62 + if (flag_propolice_protection)
64 + /* keep the addressing style of local variables
65 + as (plus (virtual_stack_vars_rtx) (CONST_int x)).
66 + For the case array[r-1],
67 + converts from (+ (+VFP c1) (+r -1)) to (SET R (+VFP c1)) (+ R (+r -1)).
69 + This loop finds ops[i] which is the register for the frame
70 + addressing, Then, makes the frame addressing using the register and
71 + the constant of ops[n_ops - 1]. */
72 + for (i = 0; i < n_ops; i++)
73 +#ifdef FRAME_GROWS_DOWNWARD
74 + if (ops[i].op == virtual_stack_vars_rtx)
76 + if (ops[i].op == virtual_stack_vars_rtx
77 + || ops[i].op == frame_pointer_rtx)
80 + if (GET_CODE (ops[n_ops - 1].op) == CONST_INT)
82 + HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
83 + if (value >= fp_offset)
85 + ops[i].op = plus_constant (ops[i].op, value);
91 + && (n_ops + 1 + n_consts > input_ops
92 + || (n_ops + 1 + n_consts == input_ops
93 + && n_consts <= input_consts)))
95 + ops[n_ops - 1].op = GEN_INT (value-fp_offset);
96 + ops[i].op = plus_constant (ops[i].op, fp_offset);
99 + /* keep the following address pattern;
100 + (1) buf[BUFSIZE] is the first assigned variable.
101 + (+ (+ fp -BUFSIZE) BUFSIZE)
102 + (2) ((+ (+ fp 1) r) -1). */
103 + else if (fp_offset != 0)
105 + /* keep the (+ fp 0) pattern for the following case;
106 + (1) buf[i]: i: REG, buf: (+ fp 0) in !FRAME_GROWS_DOWNWARD
107 + (2) argument: the address is (+ fp 0). */
108 + else if (fp_offset == 0)
115 /* Put a non-negated operand first, if possible. */
117 for (i = 0; i < n_ops && ops[i].neg; i++)