diff options
author | Xinliang David Li <davidxl@google.com> | 2011-04-11 20:37:57 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@gcc.gnu.org> | 2011-04-11 20:37:57 +0000 |
commit | 26e0228f565f3d57769d18fa362a300ff51ba1e7 (patch) | |
tree | 8fba1831628ef1da28cb32bae8e55d3e3fe30a06 /gcc/gimple-low.c | |
parent | 6075765d8c6993df315a8792440673d95741a5e8 (diff) | |
download | gcc-26e0228f565f3d57769d18fa362a300ff51ba1e7.zip gcc-26e0228f565f3d57769d18fa362a300ff51ba1e7.tar.gz gcc-26e0228f565f3d57769d18fa362a300ff51ba1e7.tar.bz2 |
sanity check ic target
From-SVN: r172276
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r-- | gcc/gimple-low.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 9968493..01aeb49 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -208,20 +208,20 @@ struct gimple_opt_pass pass_lower_cf = }; + /* Verify if the type of the argument matches that of the function declaration. If we cannot verify this or there is a mismatch, return false. */ -bool -gimple_check_call_args (gimple stmt) +static bool +gimple_check_call_args (gimple stmt, tree fndecl) { - tree fndecl, parms, p; + tree parms, p; unsigned int i, nargs; nargs = gimple_call_num_args (stmt); /* Get argument types for verification. */ - fndecl = gimple_call_fndecl (stmt); if (fndecl) parms = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); else @@ -272,6 +272,25 @@ gimple_check_call_args (gimple stmt) return true; } +/* Verify if the type of the argument and lhs of CALL_STMT matches + that of the function declaration CALLEE. + If we cannot verify this or there is a mismatch, return false. */ + +bool +gimple_check_call_matching_types (gimple call_stmt, tree callee) +{ + tree lhs; + + if ((DECL_RESULT (callee) + && !DECL_BY_REFERENCE (DECL_RESULT (callee)) + && (lhs = gimple_call_lhs (call_stmt)) != NULL_TREE + && !useless_type_conversion_p (TREE_TYPE (DECL_RESULT (callee)), + TREE_TYPE (lhs)) + && !fold_convertible_p (TREE_TYPE (DECL_RESULT (callee)), lhs)) + || !gimple_check_call_args (call_stmt, callee)) + return false; + return true; +} /* Lower sequence SEQ. Unlike gimplification the statements are not relowered when they are changed -- if this has to be done, the lowering routine must |