diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-07-16 11:05:18 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-07-16 11:05:18 +0200 |
commit | e14bac52709862b111d8c8ae1fbd0f71c797d254 (patch) | |
tree | 7dbaef9dfe1d6fbce2f1cef78f6de6570c3c1eb4 | |
parent | f912bf890245610acb7f5b2eca58e74ac68460af (diff) | |
download | efl-e14bac52709862b111d8c8ae1fbd0f71c797d254.tar.gz |
wip
-rw-r--r-- | src/compiler-plugins/myplugin.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/compiler-plugins/myplugin.cc b/src/compiler-plugins/myplugin.cc index 5678bc0a6b..339b23e64a 100644 --- a/src/compiler-plugins/myplugin.cc +++ b/src/compiler-plugins/myplugin.cc @@ -175,6 +175,9 @@ static unsigned int eo_execute(void) #if 1 //FIXME we need here: //add another argument "pd - <my_class>_pd_offset + <providing_class>_pd_offset" (TODO check if these are mixins) + /* + * Create function declaration + */ vec<tree> argument_types; unsigned int i = 0; argument_types.create(10); @@ -187,14 +190,21 @@ static unsigned int eo_execute(void) } else { argument_types[i + 1] = argument; } + fprintf(stderr, "COPY\n"); } - tree pd_type = argument_types[0]; //FIXME fill the second argument to contain the pd argument + + tree pd_type = void_type_node;//the pd argument is interpreted as void pointer here. argument_types[1] = pd_type; tree result = DECL_RESULT(c.called_api_decl); if (!result) result = void_type_node; - tree implementation_function_types = build_function_type_array(result, i + 1, argument_types.address()); //CRASH + fprintf(stderr, "----> %d\n", i); + tree implementation_function_types = build_function_type_array(result, i + 1, argument_types.address()); tree implementation_function_declaration = build_fn_decl(TREE_STRING_POINTER(replacement_candidate), implementation_function_types); + + /** + * Create function call + */ vec<tree> new_arguments; new_arguments.create(gimple_call_num_args(stmt) + 1); new_arguments[0] = gimple_call_arg(stmt, 0); @@ -203,8 +213,13 @@ static unsigned int eo_execute(void) for (unsigned int i = 1; i < gimple_call_num_args(stmt); ++i) { new_arguments[i + 1] = gimple_call_arg(stmt, i); + fprintf(stderr, "COPY2\n"); } + gcall *new_call = gimple_build_call_vec(implementation_function_declaration, new_arguments); + const greturn *ret = as_a <const greturn *> (stmt); + tree return_val = gimple_return_retval(ret); + gimple_return_set_retval(as_a<greturn *>(new_call), return_val); gsi_replace(&gsi, new_call, true); #endif } |