1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch,v 1.2 2004/06/20 00:10:52 joerg Exp $
3 diff -u ../gcc.orig/simplify-rtx.c simplify-rtx.c
4 --- ../gcc.orig/simplify-rtx.c 2004-06-19 22:27:14.000000000 +0200
5 +++ simplify-rtx.c 2004-06-20 01:16:05.000000000 +0200
7 int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
10 + HOST_WIDE_INT fp_offset = 0;
12 memset (ops, 0, sizeof ops);
14 @@ -2311,6 +2312,10 @@
18 + if (flag_propolice_protection
19 + && XEXP (this_op, 0) == virtual_stack_vars_rtx
20 + && GET_CODE (XEXP (this_op, 1)) == CONST_INT)
21 + fp_offset = INTVAL (XEXP (this_op, 1));
25 @@ -2472,11 +2477,24 @@
26 && GET_CODE (ops[n_ops - 1].op) == CONST_INT
27 && CONSTANT_P (ops[n_ops - 2].op))
29 - rtx value = ops[n_ops - 1].op;
30 - if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
31 - value = neg_const_int (mode, value);
32 - ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
34 + if (!flag_propolice_protection)
36 + rtx value = ops[n_ops - 1].op;
37 + if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
38 + value = neg_const_int (mode, value);
39 + ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
42 + /* The stack protector keeps the addressing style of a local variable,
43 + so it doesn't use neg_const_int function not to change
44 + the offset value. */
46 + HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
47 + if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
49 + ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, value);
54 /* Count the number of CONSTs that we generated. */
55 @@ -2494,6 +2512,59 @@
56 || (n_ops + n_consts == input_ops && n_consts <= input_consts)))
59 + if (flag_propolice_protection)
61 + /* keep the addressing style of local variables
62 + as (plus (virtual_stack_vars_rtx) (CONST_int x)).
63 + For the case array[r-1],
64 + converts from (+ (+VFP c1) (+r -1)) to (SET R (+VFP c1)) (+ R (+r -1)).
66 + This loop finds ops[i] which is the register for the frame
67 + addressing, Then, makes the frame addressing using the register and
68 + the constant of ops[n_ops - 1]. */
69 + for (i = 0; i < n_ops; i++)
70 +#ifdef FRAME_GROWS_DOWNWARD
71 + if (ops[i].op == virtual_stack_vars_rtx)
73 + if (ops[i].op == virtual_stack_vars_rtx
74 + || ops[i].op == frame_pointer_rtx)
77 + if (GET_CODE (ops[n_ops - 1].op) == CONST_INT)
79 + HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
80 + if (value >= fp_offset)
82 + ops[i].op = plus_constant (ops[i].op, value);
88 + && (n_ops + 1 + n_consts > input_ops
89 + || (n_ops + 1 + n_consts == input_ops
90 + && n_consts <= input_consts)))
92 + ops[n_ops - 1].op = GEN_INT (value-fp_offset);
93 + ops[i].op = plus_constant (ops[i].op, fp_offset);
96 + /* keep the following address pattern;
97 + (1) buf[BUFSIZE] is the first assigned variable.
98 + (+ (+ fp -BUFSIZE) BUFSIZE)
99 + (2) ((+ (+ fp 1) r) -1). */
100 + else if (fp_offset != 0)
102 + /* keep the (+ fp 0) pattern for the following case;
103 + (1) buf[i]: i: REG, buf: (+ fp 0) in !FRAME_GROWS_DOWNWARD
104 + (2) argument: the address is (+ fp 0). */
105 + else if (fp_offset == 0)
112 /* Put a non-negated operand first, if possible. */
114 for (i = 0; i < n_ops && ops[i].neg; i++)