Mercurial > hg > Papers > 2010 > kent-master
diff sources/replace-args.c @ 2:50e23a4b2f40
add many files.
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 05 Feb 2010 10:00:05 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sources/replace-args.c Fri Feb 05 10:00:05 2010 +0900 @@ -0,0 +1,35 @@ +static tree +cbc_replace_arguments (location_t loc, tree call) +{ + tree args; + tree fn; + tree tmp_decl; + int i=0; + + fn = CALL_EXPR_FN (call); + if ( TREE_CODE (fn)==PARM_DECL || !TREE_CONSTANT (fn) ) + { + tmp_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE(fn)); + pushdecl (tmp_decl); + + add_stmt (build_modify_expr (loc, tmp_decl, NOP_EXPR, fn)); + CALL_EXPR_FN (call) = tmp_decl; + } + + args = CALL_EXPR_ARGS (call); + for ( ;args; args = TREE_CHAIN (args), i++) + { + tree arg = TREE_VALUE (args); + + if ( TREE_CODE (arg)==PARM_DECL || !TREE_CONSTANT (arg) ) + { + tmp_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE(arg)); + pushdecl (tmp_decl); + + add_stmt (build_modify_expr (loc, tmp_decl, NOP_EXPR, arg)); + CALL_EXPR_ARG (call, i) = tmp_decl; + } + } + + return call; +}