diff options
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index d997c73..697340f 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -397,7 +397,7 @@ get_string_length (strinfo si) callee = gimple_call_fndecl (stmt); gcc_assert (callee && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL); lhs = gimple_call_lhs (stmt); - gcc_assert (implicit_built_in_decls[BUILT_IN_STRCPY] != NULL_TREE); + gcc_assert (builtin_decl_implicit_p (BUILT_IN_STRCPY)); /* unshare_strinfo is intentionally not called here. The (delayed) transformation of strcpy or strcat into stpcpy is done at the place of the former strcpy/strcat call and so can affect all the strinfos @@ -409,7 +409,7 @@ get_string_length (strinfo si) case BUILT_IN_STRCAT: case BUILT_IN_STRCAT_CHK: gsi = gsi_for_stmt (stmt); - fn = implicit_built_in_decls[BUILT_IN_STRLEN]; + fn = builtin_decl_implicit (BUILT_IN_STRLEN); gcc_assert (lhs == NULL_TREE); lhs_var = create_tmp_var (TREE_TYPE (TREE_TYPE (fn)), NULL); add_referenced_var (lhs_var); @@ -434,9 +434,9 @@ get_string_length (strinfo si) case BUILT_IN_STRCPY: case BUILT_IN_STRCPY_CHK: if (gimple_call_num_args (stmt) == 2) - fn = implicit_built_in_decls[BUILT_IN_STPCPY]; + fn = builtin_decl_implicit (BUILT_IN_STPCPY); else - fn = built_in_decls[BUILT_IN_STPCPY_CHK]; + fn = builtin_decl_explicit (BUILT_IN_STPCPY_CHK); gcc_assert (lhs == NULL_TREE); if (dump_file && (dump_flags & TDF_DETAILS) != 0) { @@ -1070,8 +1070,7 @@ handle_builtin_strcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi) { case BUILT_IN_STRCPY: case BUILT_IN_STRCPY_CHK: - if (implicit_built_in_decls[BUILT_IN_STPCPY] == NULL_TREE - || lhs != NULL_TREE) + if (lhs != NULL_TREE || !builtin_decl_implicit_p (BUILT_IN_STPCPY)) return; break; case BUILT_IN_STPCPY: @@ -1154,12 +1153,12 @@ handle_builtin_strcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi) switch (bcode) { case BUILT_IN_STRCPY: - fn = implicit_built_in_decls[BUILT_IN_MEMCPY]; + fn = builtin_decl_implicit (BUILT_IN_MEMCPY); if (lhs) VEC_replace (int, ssa_ver_to_stridx, SSA_NAME_VERSION (lhs), didx); break; case BUILT_IN_STRCPY_CHK: - fn = built_in_decls[BUILT_IN_MEMCPY_CHK]; + fn = builtin_decl_explicit (BUILT_IN_MEMCPY_CHK); if (lhs) VEC_replace (int, ssa_ver_to_stridx, SSA_NAME_VERSION (lhs), didx); break; @@ -1167,7 +1166,7 @@ handle_builtin_strcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi) /* This would need adjustment of the lhs (subtract one), or detection that the trailing '\0' doesn't need to be written, if it will be immediately overwritten. - fn = built_in_decls[BUILT_IN_MEMPCPY]; */ + fn = builtin_decl_explicit (BUILT_IN_MEMPCPY); */ if (lhs) { dsi->endptr = lhs; @@ -1178,7 +1177,7 @@ handle_builtin_strcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi) /* This would need adjustment of the lhs (subtract one), or detection that the trailing '\0' doesn't need to be written, if it will be immediately overwritten. - fn = built_in_decls[BUILT_IN_MEMPCPY_CHK]; */ + fn = builtin_decl_explicit (BUILT_IN_MEMPCPY_CHK); */ if (lhs) { dsi->endptr = lhs; @@ -1400,8 +1399,7 @@ handle_builtin_strcat (enum built_in_function bcode, gimple_stmt_iterator *gsi) with length endptr - p if we need to compute the length later on. Don't do this transformation if we don't need it. */ - if (implicit_built_in_decls[BUILT_IN_STPCPY] != NULL_TREE - && lhs == NULL_TREE) + if (builtin_decl_implicit_p (BUILT_IN_STPCPY) && lhs == NULL_TREE) { if (didx == 0) { @@ -1460,8 +1458,7 @@ handle_builtin_strcat (enum built_in_function bcode, gimple_stmt_iterator *gsi) else { dsi->length = NULL; - if (implicit_built_in_decls[BUILT_IN_STPCPY] != NULL_TREE - && lhs == NULL_TREE) + if (lhs == NULL_TREE && builtin_decl_implicit_p (BUILT_IN_STPCPY)) dsi->dont_invalidate = true; } @@ -1481,15 +1478,15 @@ handle_builtin_strcat (enum built_in_function bcode, gimple_stmt_iterator *gsi) { case BUILT_IN_STRCAT: if (srclen != NULL_TREE) - fn = implicit_built_in_decls[BUILT_IN_MEMCPY]; + fn = builtin_decl_implicit (BUILT_IN_MEMCPY); else - fn = implicit_built_in_decls[BUILT_IN_STRCPY]; + fn = builtin_decl_implicit (BUILT_IN_STRCPY); break; case BUILT_IN_STRCAT_CHK: if (srclen != NULL_TREE) - fn = built_in_decls[BUILT_IN_MEMCPY_CHK]; + fn = builtin_decl_explicit (BUILT_IN_MEMCPY_CHK); else - fn = built_in_decls[BUILT_IN_STRCPY_CHK]; + fn = builtin_decl_explicit (BUILT_IN_STRCPY_CHK); objsz = gimple_call_arg (stmt, 2); break; default: |