Mercurial > hg > Papers > 2010 > kent-master
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:aa09c34b90d3 | 2:50e23a4b2f40 |
---|---|
1 static tree | |
2 cbc_replace_arguments (location_t loc, tree call) | |
3 { | |
4 tree args; | |
5 tree fn; | |
6 tree tmp_decl; | |
7 int i=0; | |
8 | |
9 fn = CALL_EXPR_FN (call); | |
10 if ( TREE_CODE (fn)==PARM_DECL || !TREE_CONSTANT (fn) ) | |
11 { | |
12 tmp_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE(fn)); | |
13 pushdecl (tmp_decl); | |
14 | |
15 add_stmt (build_modify_expr (loc, tmp_decl, NOP_EXPR, fn)); | |
16 CALL_EXPR_FN (call) = tmp_decl; | |
17 } | |
18 | |
19 args = CALL_EXPR_ARGS (call); | |
20 for ( ;args; args = TREE_CHAIN (args), i++) | |
21 { | |
22 tree arg = TREE_VALUE (args); | |
23 | |
24 if ( TREE_CODE (arg)==PARM_DECL || !TREE_CONSTANT (arg) ) | |
25 { | |
26 tmp_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE(arg)); | |
27 pushdecl (tmp_decl); | |
28 | |
29 add_stmt (build_modify_expr (loc, tmp_decl, NOP_EXPR, arg)); | |
30 CALL_EXPR_ARG (call, i) = tmp_decl; | |
31 } | |
32 } | |
33 | |
34 return call; | |
35 } |