1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/function.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/function.c,v
5 retrieving revision 1.2
6 diff -u -r1.2 function.c
7 --- function.c 20 Dec 2004 19:23:24 -0000 1.2
8 +++ function.c 20 Dec 2004 20:48:10 -0000
10 #include "integrate.h"
11 #include "langhooks.h"
13 +#include "protector.h"
15 #ifndef TRAMPOLINE_ALIGNMENT
16 #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
18 /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
20 static GTY(()) varray_type sibcall_epilogue;
22 +/* Current boundary mark for character arrays. */
23 +static int temp_boundary_mark = 0;
26 /* In order to evaluate some expressions, such as function calls returning
27 structures in memory, we need to temporarily allocate stack locations.
29 /* The size of the slot, including extra space for alignment. This
30 info is for combine_temp_slots. */
31 HOST_WIDE_INT full_size;
32 + /* Boundary mark of a character array and the others. This info is for propolice. */
36 /* This structure is used to record MEMs or pseudos used to replace VAR, any
38 whose lifetime is controlled by CLEANUP_POINT_EXPRs. KEEP is 3
39 if we are to allocate something at an inner level to be treated as
40 a variable in the block (e.g., a SAVE_EXPR).
41 + KEEP is 5 if we allocate a place to return structure.
43 TYPE is the type that will be used for the stack slot. */
47 struct temp_slot *p, *best_p = 0;
49 + int char_array = (flag_propolice_protection
50 + && keep == 1 && search_string_def (type));
52 /* If SIZE is -1 it means that somebody tried to allocate a temporary
53 of a variable size. */
56 && objects_must_conflict_p (p->type, type)
57 && (best_p == 0 || best_p->size > p->size
58 - || (best_p->size == p->size && best_p->align > p->align)))
59 + || (best_p->size == p->size && best_p->align > p->align))
60 + && (! char_array || p->boundary_mark != 0))
62 if (p->align == align && p->size == size)
67 p->type = best_p->type;
68 + p->boundary_mark = best_p->boundary_mark;
73 p->full_size = frame_offset - frame_offset_old;
76 + p->boundary_mark = char_array ? ++temp_boundary_mark : 0;
82 if (! q->in_use && GET_MODE (q->slot) == BLKmode)
84 - if (p->base_offset + p->full_size == q->base_offset)
85 + if (p->base_offset + p->full_size == q->base_offset &&
86 + p->boundary_mark == q->boundary_mark)
88 /* Q comes after P; combine Q into P. */
90 p->full_size += q->full_size;
93 - else if (q->base_offset + q->full_size == p->base_offset)
94 + else if (q->base_offset + q->full_size == p->base_offset &&
95 + p->boundary_mark == q->boundary_mark)
97 /* P comes after Q; combine P into Q. */
103 - new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func);
105 + assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func)
106 + : assign_stack_local_for_pseudo_reg (decl_mode, GET_MODE_SIZE (decl_mode), 0);
109 PUT_MODE (reg, decl_mode);
110 @@ -3940,7 +3957,8 @@
111 constant with that register. */
112 temp = gen_reg_rtx (Pmode);
114 - if (validate_change (object, &XEXP (x, 1), temp, 0))
115 + if (validate_change (object, &XEXP (x, 1), temp, 0)
116 + && !flag_propolice_protection)
117 emit_insn_before (gen_move_insn (temp, new_offset), object);