Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
libgcj41
fpreserve-function-arguments4.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fpreserve-function-arguments4.patch of Package libgcj41
Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c.orig 2006-11-21 14:16:55.000000000 +0100 +++ gcc/gimplify.c 2009-11-20 13:42:26.000000000 +0100 @@ -4963,6 +4963,56 @@ gimplify_body (tree *body_p, tree fndecl BIND_EXPR_BODY (body) = parm_stmts; } + /* If we want to forcibly preserve function argument values, do so here. */ + if (flag_preserve_function_arguments) + { + char s[1024] = "# "; + tree asmt, parm, inputs = NULL_TREE, stmts = NULL_TREE; + bool mem_p = false; + int i = 0; + + sprintf (s + strlen(s), "%s ", IDENTIFIER_POINTER (DECL_NAME (fndecl))); + + for (parm = DECL_ARGUMENTS (fndecl); parm ; parm = TREE_CHAIN (parm)) + { + tree pt = parm; + tree type = TREE_TYPE (parm); + /* Maybe build a fancy memory operand here. For now just use + a pointer input and let the operand scanner deal with the rest. */ + if (TYPE_MODE (type) == BLKmode) + { + pt = build_fold_addr_expr (parm); + type = TREE_TYPE (pt); + } + if (POINTER_TYPE_P (type)) + mem_p = true; + sprintf (s + strlen(s), "%%%i ", i++); + inputs = tree_cons (tree_cons (NULL_TREE, build_string (1, "g"), + NULL_TREE), pt, inputs); + } + + if (i != 0) + { + /* While on the tree level we can do w/o explicit "memory" + clobbering because we tweak the operand scanner, on RTL level + we need it. */ + tree clobbers = NULL_TREE; + if (mem_p) + clobbers = tree_cons (NULL_TREE, build_string (6, "memory"), + NULL_TREE); + asmt = build4 (ASM_EXPR, void_type_node, + build_string (strlen (s), s), + NULL_TREE, /* no outputs */ + inputs, clobbers); + ASM_VOLATILE_P (asmt) = 1; + TREE_READONLY (asmt) = 1; + gimplify_and_add (asmt, &stmts); + + append_to_statement_list_force (BIND_EXPR_BODY (body), &stmts); + BIND_EXPR_BODY (body) = stmts; + } + } + /* Unshare again, in case gimplification was sloppy. */ unshare_all_trees (body); Index: gcc/common.opt =================================================================== --- gcc/common.opt.orig 2009-11-20 13:42:25.000000000 +0100 +++ gcc/common.opt 2009-11-20 13:42:26.000000000 +0100 @@ -594,6 +594,10 @@ fmudflapir Common RejectNegative Report Var(flag_mudflap_ignore_reads) Ignore read operations when inserting mudflap instrumentation +fpreserve-function-arguments +Common Report Var(flag_preserve_function_arguments) +Preserve function argument values for debugging + freschedule-modulo-scheduled-loops Common Report Var(flag_resched_modulo_sched) Enable/Disable the traditional scheduling in loops that already passed modulo scheduling Index: gcc/tree-ssa-operands.c =================================================================== --- gcc/tree-ssa-operands.c.orig 2006-10-19 11:19:06.000000000 +0200 +++ gcc/tree-ssa-operands.c 2009-11-20 13:42:26.000000000 +0100 @@ -103,6 +103,8 @@ Boston, MA 02110-1301, USA. */ to distinguish "reset the world" events from explicit MODIFY_EXPRs. */ #define opf_non_specific (1 << 3) +/* Hack to mark all SSA_NAME uses in asms as abnormal. */ +#define opf_mark_abnormal (1 << 4) /* Array for building all the def operands. */ static VEC(tree,heap) *build_defs; @@ -1343,7 +1345,7 @@ get_asm_expr_operands (tree stmt) int i; tree link; const char *constraint; - bool allows_mem, allows_reg, is_inout; + bool allows_mem, allows_reg, is_inout, memory_p; for (i=0, link = ASM_OUTPUTS (stmt); link; ++i, link = TREE_CHAIN (link)) { @@ -1367,26 +1369,7 @@ get_asm_expr_operands (tree stmt) get_expr_operands (stmt, &TREE_VALUE (link), opf_is_def); } - for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link)) - { - constraint - = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); - parse_input_constraint (&constraint, 0, 0, noutputs, 0, - oconstraints, &allows_mem, &allows_reg); - - /* Memory operands are addressable. Note that STMT needs the - address of this operand. */ - if (!allows_reg && allows_mem) - { - tree t = get_base_address (TREE_VALUE (link)); - if (t && DECL_P (t) && s_ann) - add_to_addressable_set (t, &s_ann->addresses_taken); - } - - get_expr_operands (stmt, &TREE_VALUE (link), 0); - } - - + memory_p = false; /* Clobber memory for asm ("" : : : "memory"); */ for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link)) if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0) @@ -1394,6 +1377,12 @@ get_asm_expr_operands (tree stmt) unsigned i; bitmap_iterator bi; + if (TREE_READONLY (stmt)) + { + memory_p = true; + break; + } + /* Clobber all call-clobbered variables (or .GLOBAL_VAR if we decided to group them). */ if (global_var) @@ -1425,6 +1414,57 @@ get_asm_expr_operands (tree stmt) break; } + + for (link = ASM_INPUTS (stmt); link; link = TREE_CHAIN (link)) + { + constraint + = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); + parse_input_constraint (&constraint, 0, 0, noutputs, 0, + oconstraints, &allows_mem, &allows_reg); + + /* Memory operands are addressable. Note that STMT needs the + address of this operand. */ + if (!allows_reg && allows_mem) + { + tree t = get_base_address (TREE_VALUE (link)); + if (t && DECL_P (t) && s_ann) + add_to_addressable_set (t, &s_ann->addresses_taken); + } + + get_expr_operands (stmt, &TREE_VALUE (link), opf_mark_abnormal); + + /* Read-only memory. Copied from get_indirect_ref_operands. */ + if (memory_p + && POINTER_TYPE_P (TREE_TYPE (TREE_VALUE (link))) + && SSA_VAR_P (TREE_VALUE (link))) + { + tree ptr = TREE_VALUE (link); + int flags = 0; + struct ptr_info_def *pi = NULL; + + /* If PTR has flow-sensitive points-to information, use it. */ + if (TREE_CODE (ptr) == SSA_NAME + && (pi = SSA_NAME_PTR_INFO (ptr)) != NULL + && pi->name_mem_tag) + { + /* PTR has its own memory tag. Use it. */ + add_stmt_operand (&pi->name_mem_tag, s_ann, flags); + } + else + { + /* If PTR is not an SSA_NAME or it doesn't have a name + tag, use its type memory tag. */ + var_ann_t v_ann; + + if (TREE_CODE (ptr) == SSA_NAME) + ptr = SSA_NAME_VAR (ptr); + v_ann = var_ann (ptr); + if (v_ann->type_mem_tag) + add_stmt_operand (&v_ann->type_mem_tag, s_ann, flags); + } + } + } + } /* A subroutine of get_expr_operands to handle INDIRECT_REF, @@ -1681,6 +1721,10 @@ add_stmt_operand (tree *var_p, stmt_ann_ append_def (var_p); else append_use (var_p); + + if (flags & opf_mark_abnormal + && TREE_CODE (*var_p) == SSA_NAME) + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (*var_p) = true; } else { Index: gcc/combine.c =================================================================== --- gcc/combine.c.orig 2007-01-15 11:11:08.000000000 +0100 +++ gcc/combine.c 2009-11-20 13:42:26.000000000 +0100 @@ -1258,7 +1258,14 @@ can_combine_p (rtx insn, rtx i3, rtx pre and it is a pain to update that information. Exception: if source is a constant, moving it later can't hurt. Accept that special case, because it helps -fforce-addr a lot. */ - || (INSN_CUID (insn) < last_call_cuid && ! CONSTANT_P (src))) + || (INSN_CUID (insn) < last_call_cuid && ! CONSTANT_P (src)) + || (flag_preserve_function_arguments + && REG_P (dest) + && REG_P (src) + && GET_CODE (PATTERN (i3)) == PARALLEL + && GET_CODE (XVECEXP (PATTERN (i3), 0, 0)) == ASM_OPERANDS + && REG_USERVAR_P (dest) + && REG_EXPR (dest) != REG_EXPR (src))) return 0; /* DEST must either be a REG or CC0. */ Index: gcc/var-tracking.c =================================================================== --- gcc/var-tracking.c.orig 2009-11-20 13:41:46.000000000 +0100 +++ gcc/var-tracking.c 2009-11-20 13:42:26.000000000 +0100 @@ -1923,8 +1923,9 @@ dump_variable (void **slot, void *data A int i; location_chain node; - fprintf (dump_file, " name: %s\n", - IDENTIFIER_POINTER (DECL_NAME (var->decl))); + fprintf (dump_file, " name: %sD.%u\n", + IDENTIFIER_POINTER (DECL_NAME (var->decl)), + DECL_UID (var->decl)); for (i = 0; i < var->n_var_parts; i++) { fprintf (dump_file, " offset %ld\n", Index: gcc/recog.c =================================================================== --- gcc/recog.c.orig 2005-12-22 13:49:10.000000000 +0100 +++ gcc/recog.c 2009-11-20 13:42:26.000000000 +0100 @@ -336,6 +336,34 @@ num_changes_pending (void) return num_changes; } +/* If we want to preserve arguments to inlined functions we need + to preserve some asm operands. We know we changed OLD into NEW + in an asm instruction. Return 1 if this wasn't okay, 0 otherwise. */ +static int +invalid_asm_change (rtx old, rtx new) +{ + tree e1, e2; + /* It is invalid to change a REG which had an associated decl expression, + with something which has a different expression. It's okay, though, + to change a REG with no expression to some other. */ + if (GET_CODE (old) == SUBREG) + old = SUBREG_REG (old); + if (GET_CODE (new) == SUBREG) + new = SUBREG_REG (new); + /* If we replaced something else than a REG or MEM, it's okay. */ + if (!REG_P (old) && !MEM_P (old)) + return 0; + /* If we replaced a REG or MEM with something else, we are going + to loose that information. */ + if (!REG_P (new) && !MEM_P (new)) + return 1; + e1 = REG_P (old) ? REG_EXPR (old) : MEM_EXPR (old); + if (!e1) + return 0; + e2 = REG_P (new) ? REG_EXPR (new) : MEM_EXPR (new); + return e1 != e2; +} + /* Tentatively apply the changes numbered NUM and up. Return 1 if all changes are valid, zero otherwise. */ @@ -368,6 +396,10 @@ verify_changes (int num) if (! memory_address_p (GET_MODE (object), XEXP (object, 0))) break; } + else if (flag_preserve_function_arguments + && asm_noperands (PATTERN (object)) >= 0 + && invalid_asm_change (changes[i].old, *changes[i].loc)) + break; else if (insn_invalid_p (object)) { rtx pat = PATTERN (object);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor