1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch,v 1.1 2004/06/19 10:30:08 joerg Exp $
3 --- ../gcc.orig/function.c 2004-06-18 23:08:11.000000000 +0200
4 +++ function.c 2004-06-18 23:27:25.000000000 +0200
9 +#include "protector.h"
11 #ifndef TRAMPOLINE_ALIGNMENT
12 #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
14 /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
16 static GTY(()) varray_type sibcall_epilogue;
18 +/* Current boundary mark for character arrays. */
19 +static int temp_boundary_mark = 0;
22 /* In order to evaluate some expressions, such as function calls returning
23 structures in memory, we need to temporarily allocate stack locations.
25 /* The size of the slot, including extra space for alignment. This
26 info is for combine_temp_slots. */
27 HOST_WIDE_INT full_size;
28 + /* Boundary mark of a character array and the others. This info is for propolice. */
32 /* This structure is used to record MEMs or pseudos used to replace VAR, any
34 whose lifetime is controlled by CLEANUP_POINT_EXPRs. KEEP is 3
35 if we are to allocate something at an inner level to be treated as
36 a variable in the block (e.g., a SAVE_EXPR).
37 + KEEP is 5 if we allocate a place to return structure.
39 TYPE is the type that will be used for the stack slot. */
43 struct temp_slot *p, *best_p = 0;
45 + int char_array = (flag_propolice_protection
46 + && keep == 1 && search_string_def (type));
48 /* If SIZE is -1 it means that somebody tried to allocate a temporary
49 of a variable size. */
52 && objects_must_conflict_p (p->type, type)
53 && (best_p == 0 || best_p->size > p->size
54 - || (best_p->size == p->size && best_p->align > p->align)))
55 + || (best_p->size == p->size && best_p->align > p->align))
56 + && (! char_array || p->boundary_mark != 0))
58 if (p->align == align && p->size == size)
63 p->type = best_p->type;
64 + p->boundary_mark = best_p->boundary_mark;
69 p->full_size = frame_offset - frame_offset_old;
72 + p->boundary_mark = char_array ? ++temp_boundary_mark : 0;
78 if (! q->in_use && GET_MODE (q->slot) == BLKmode)
80 - if (p->base_offset + p->full_size == q->base_offset)
81 + if (p->base_offset + p->full_size == q->base_offset &&
82 + p->boundary_mark == q->boundary_mark)
84 /* Q comes after P; combine Q into P. */
86 p->full_size += q->full_size;
89 - else if (q->base_offset + q->full_size == p->base_offset)
90 + else if (q->base_offset + q->full_size == p->base_offset &&
91 + p->boundary_mark == q->boundary_mark)
93 /* P comes after Q; combine P into Q. */
99 - new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func);
101 + assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func)
102 + : assign_stack_local_for_pseudo_reg (decl_mode, GET_MODE_SIZE (decl_mode), 0);
105 PUT_MODE (reg, decl_mode);
106 @@ -3930,7 +3947,8 @@
107 constant with that register. */
108 temp = gen_reg_rtx (Pmode);
110 - if (validate_change (object, &XEXP (x, 1), temp, 0))
111 + if (validate_change (object, &XEXP (x, 1), temp, 0)
112 + && !flag_propolice_protection)
113 emit_insn_before (gen_move_insn (temp, new_offset), object);