wip
This commit is contained in:
parent
78c929fb32
commit
e8dc613123
|
@ -930,7 +930,6 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
|
||||||
if (internal && !eolian_function_is_static(fid) && !eolian_implement_is_pure_virtual(impl, ftype) && !is_empty)
|
if (internal && !eolian_function_is_static(fid) && !eolian_implement_is_pure_virtual(impl, ftype) && !is_empty)
|
||||||
{
|
{
|
||||||
/* T _class_name[_orig_class]_func_name_suffix */
|
/* T _class_name[_orig_class]_func_name_suffix */
|
||||||
eina_strbuf_append(buf, "EAPI ");
|
|
||||||
eina_strbuf_append(buf, rtpn);
|
eina_strbuf_append(buf, rtpn);
|
||||||
if (rtpn[strlen(rtpn) - 1] != '*')
|
if (rtpn[strlen(rtpn) - 1] != '*')
|
||||||
eina_strbuf_append_char(buf, ' ');
|
eina_strbuf_append_char(buf, ' ');
|
||||||
|
@ -1182,14 +1181,15 @@ _is_function_type_compatible(const Eolian_Function_Type t1, const Eolian_Functio
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
_gen_next_super_implementation_registering(Eina_Array *call_chain, const Eolian_Class *impl_klass, const Eolian_Implement *impl, const Eolian_Function_Type ftype, const Eolian_Function *fid, Eina_Strbuf *buf)
|
_gen_next_super_implementation_registering(Eina_Array *call_chain, const Eolian_Class *current, const Eolian_Implement *impl, const Eolian_Function_Type ftype, const Eolian_Function *fid, Eina_Strbuf *buf)
|
||||||
{
|
{
|
||||||
const Eolian_Class *next_implemen_class = NULL;
|
const Eolian_Class *next_implemen_class = NULL;
|
||||||
const Eolian_Class *definition_class = eolian_function_class_get(fid);
|
const Eolian_Class *definition_class = eolian_function_class_get(fid);
|
||||||
char *impl_name;
|
char *impl_name;
|
||||||
char *defi_name;
|
char *defi_name;
|
||||||
|
char *current_name;
|
||||||
|
|
||||||
if (eolian_class_type_get(impl_klass) == EOLIAN_CLASS_MIXIN)
|
if (eolian_class_type_get(current) == EOLIAN_CLASS_MIXIN)
|
||||||
{
|
{
|
||||||
//mixins cannot fast forward to a fixed implementation, so we cannot register there anything sane
|
//mixins cannot fast forward to a fixed implementation, so we cannot register there anything sane
|
||||||
return;
|
return;
|
||||||
|
@ -1213,6 +1213,7 @@ _gen_next_super_implementation_registering(Eina_Array *call_chain, const Eolian_
|
||||||
|
|
||||||
if (!next_implemen_class) return;
|
if (!next_implemen_class) return;
|
||||||
|
|
||||||
|
eo_gen_class_names_get(current, NULL, NULL, ¤t_name);
|
||||||
eo_gen_class_names_get(next_implemen_class, NULL, NULL, &impl_name);
|
eo_gen_class_names_get(next_implemen_class, NULL, NULL, &impl_name);
|
||||||
eo_gen_class_names_get(definition_class, NULL, NULL, &defi_name);
|
eo_gen_class_names_get(definition_class, NULL, NULL, &defi_name);
|
||||||
|
|
||||||
|
@ -1225,7 +1226,12 @@ _gen_next_super_implementation_registering(Eina_Array *call_chain, const Eolian_
|
||||||
else if (ftype == EOLIAN_PROP_SET)
|
else if (ftype == EOLIAN_PROP_SET)
|
||||||
prefix = "_set";
|
prefix = "_set";
|
||||||
|
|
||||||
eina_strbuf_append_printf(buf, "COMPILER_PLUGIN_REGISTER_NEXT(\"%s\", \"%s\", ", eolian_function_full_c_name_get(fid, ftype), class_name);
|
eina_strbuf_append_printf(buf, "COMPILER_PLUGIN_REGISTER_NEXT(\"%s\", ", eolian_function_full_c_name_get(fid, ftype));
|
||||||
|
eina_strbuf_append_printf(buf, "\"%s_pd_offset\", ", current_name);
|
||||||
|
if (eolian_class_type_get(next_implemen_class) == EOLIAN_CLASS_MIXIN)
|
||||||
|
eina_strbuf_append_printf(buf, "\"%s_%s_pd_offset\", ", current_name, class_name);
|
||||||
|
else
|
||||||
|
eina_strbuf_append_printf(buf, "\"%s_pd_offset\", ", class_name);
|
||||||
eina_strbuf_append_printf(buf, "\"_NEVA_USE_ME_internal_%s", impl_name);
|
eina_strbuf_append_printf(buf, "\"_NEVA_USE_ME_internal_%s", impl_name);
|
||||||
if (definition_class != next_implemen_class)
|
if (definition_class != next_implemen_class)
|
||||||
eina_strbuf_append_printf(buf, "_%s", defi_name);
|
eina_strbuf_append_printf(buf, "_%s", defi_name);
|
||||||
|
@ -1356,7 +1362,7 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
|
||||||
{
|
{
|
||||||
Eolian_Class *called = eina_array_data_get(call_chain, i);
|
Eolian_Class *called = eina_array_data_get(call_chain, i);
|
||||||
if (eolian_class_type_get(called) != EOLIAN_CLASS_MIXIN)
|
if (eolian_class_type_get(called) != EOLIAN_CLASS_MIXIN)
|
||||||
break;
|
continue;
|
||||||
eina_strbuf_append_printf(name, "unsigned int %s_%s_pd_offset = -1;\n", eolian_class_c_name_get(cl), eolian_class_c_name_get(called));
|
eina_strbuf_append_printf(name, "unsigned int %s_%s_pd_offset = -1;\n", eolian_class_c_name_get(cl), eolian_class_c_name_get(called));
|
||||||
eina_strbuf_tolower(name);
|
eina_strbuf_tolower(name);
|
||||||
eina_strbuf_append_buffer(buf, name);
|
eina_strbuf_append_buffer(buf, name);
|
||||||
|
@ -1417,9 +1423,9 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
|
||||||
|
|
||||||
/* create macro for COMPILER_PLUGIN_REGISTER_NEXT */
|
/* create macro for COMPILER_PLUGIN_REGISTER_NEXT */
|
||||||
eina_strbuf_append(buf, "#ifdef COMPILER_PLUGIN_REGISTER_NEXT_SUPPORT\n");
|
eina_strbuf_append(buf, "#ifdef COMPILER_PLUGIN_REGISTER_NEXT_SUPPORT\n");
|
||||||
eina_strbuf_append(buf, " #define COMPILER_PLUGIN_REGISTER_NEXT(a, b, c, d) __attribute__((register_next(a, b, c, d)))\n");
|
eina_strbuf_append(buf, " #define COMPILER_PLUGIN_REGISTER_NEXT(a, b, c, d, e) __attribute__((register_next(a, b, c, d)))\n");
|
||||||
eina_strbuf_append(buf, "#else\n");
|
eina_strbuf_append(buf, "#else\n");
|
||||||
eina_strbuf_append(buf, " #define COMPILER_PLUGIN_REGISTER_NEXT(a, b, c, d) /* NOP */\n");
|
eina_strbuf_append(buf, " #define COMPILER_PLUGIN_REGISTER_NEXT(a, b, c, d, e) /* NOP */\n");
|
||||||
eina_strbuf_append(buf, "#endif\n");
|
eina_strbuf_append(buf, "#endif\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,12 @@ static Caller fetch_efl_super_class(const_gimple stmt)
|
||||||
|
|
||||||
struct Registered_Api{
|
struct Registered_Api{
|
||||||
bool valid;
|
bool valid;
|
||||||
|
tree call;
|
||||||
|
tree pd_minus_field;
|
||||||
|
tree pd_plus_field;
|
||||||
tree replacement_candidate;
|
tree replacement_candidate;
|
||||||
tree provider_of_replacement_candidate;
|
|
||||||
|
bool is_mixin;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Registered_Api
|
static Registered_Api
|
||||||
|
@ -145,12 +149,12 @@ fetch_replacement_api(tree klass_decl, const char* called_api)
|
||||||
continue;
|
continue;
|
||||||
//this here assumes a special tree_list structure
|
//this here assumes a special tree_list structure
|
||||||
tree attribute_arguments = TREE_VALUE(attribute);
|
tree attribute_arguments = TREE_VALUE(attribute);
|
||||||
tree call = TREE_VALUE(attribute_arguments);
|
result.call = TREE_VALUE(attribute_arguments);
|
||||||
tree providing_class = TREE_VALUE(TREE_CHAIN(attribute_arguments));
|
result.pd_minus_field = TREE_VALUE(TREE_CHAIN(attribute_arguments));
|
||||||
tree implementation = TREE_VALUE(TREE_CHAIN(TREE_CHAIN(attribute_arguments)));
|
result.pd_plus_field = TREE_VALUE(TREE_CHAIN(TREE_CHAIN(attribute_arguments)));
|
||||||
if (!!strncmp(TREE_STRING_POINTER(call), called_api, strlen(called_api))) continue;
|
result.replacement_candidate = TREE_VALUE(TREE_CHAIN(TREE_CHAIN(TREE_CHAIN(attribute_arguments))));
|
||||||
result.provider_of_replacement_candidate = providing_class;
|
//result.is_mixin = !!(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(TREE_CHAIN(TREE_CHAIN(attribute_arguments))))));
|
||||||
result.replacement_candidate = implementation;
|
if (!!strncmp(TREE_STRING_POINTER(result.call), called_api, strlen(called_api))) continue;
|
||||||
result.valid = true;
|
result.valid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +175,7 @@ static unsigned int eo_execute(void)
|
||||||
gcc_assert(single_succ_p(ENTRY_BLOCK_PTR_FOR_FN(cfun)));
|
gcc_assert(single_succ_p(ENTRY_BLOCK_PTR_FOR_FN(cfun)));
|
||||||
entry_bb = single_succ(ENTRY_BLOCK_PTR_FOR_FN(cfun));
|
entry_bb = single_succ(ENTRY_BLOCK_PTR_FOR_FN(cfun));
|
||||||
|
|
||||||
|
//FIXME this is jerky but we are checking if args are more than 2, if so we might be a eo op, and thats fine
|
||||||
for (tree argument = DECL_ARGUMENTS(cfun->decl); argument; argument = DECL_CHAIN(argument))
|
for (tree argument = DECL_ARGUMENTS(cfun->decl); argument; argument = DECL_CHAIN(argument))
|
||||||
{
|
{
|
||||||
length ++;
|
length ++;
|
||||||
|
@ -197,9 +202,6 @@ static unsigned int eo_execute(void)
|
||||||
fprintf(stderr, "Replace! %s %s\n", c.called_api, TREE_STRING_POINTER(api.replacement_candidate));
|
fprintf(stderr, "Replace! %s %s\n", c.called_api, TREE_STRING_POINTER(api.replacement_candidate));
|
||||||
|
|
||||||
//Create a new call to the found replacement candidate
|
//Create a new call to the found replacement candidate
|
||||||
#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
|
* Create function declaration
|
||||||
*/
|
*/
|
||||||
|
@ -227,10 +229,10 @@ static unsigned int eo_execute(void)
|
||||||
new_arguments.create(gimple_call_num_args(stmt) + 1);
|
new_arguments.create(gimple_call_num_args(stmt) + 1);
|
||||||
new_arguments.safe_push(DECL_ARGUMENTS(cfun->decl));
|
new_arguments.safe_push(DECL_ARGUMENTS(cfun->decl));
|
||||||
|
|
||||||
tree field1 = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("efl_object_pd_offset"), integer_type_node); //FIXME wrong field
|
tree field1 = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier(TREE_STRING_POINTER(api.pd_minus_field)), integer_type_node);
|
||||||
DECL_EXTERNAL(field1) = 1;
|
DECL_EXTERNAL(field1) = 1;
|
||||||
TREE_PUBLIC(field1) = 1;
|
TREE_PUBLIC(field1) = 1;
|
||||||
tree field2 = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("efl_loop_consumer_pd_offset"), integer_type_node); //FIXME wrong field
|
tree field2 = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier(TREE_STRING_POINTER(api.pd_plus_field)), integer_type_node);
|
||||||
DECL_EXTERNAL(field2) = 1;
|
DECL_EXTERNAL(field2) = 1;
|
||||||
TREE_PUBLIC(field2) = 1;
|
TREE_PUBLIC(field2) = 1;
|
||||||
tree tmp1 = build2(MINUS_EXPR, integer_type_node, DECL_CHAIN(DECL_ARGUMENTS(cfun->decl)), field1);
|
tree tmp1 = build2(MINUS_EXPR, integer_type_node, DECL_CHAIN(DECL_ARGUMENTS(cfun->decl)), field1);
|
||||||
|
@ -253,7 +255,7 @@ static unsigned int eo_execute(void)
|
||||||
gsi_remove(&removal, false);
|
gsi_remove(&removal, false);
|
||||||
removal = gsi_for_stmt(c.class_get_call);
|
removal = gsi_for_stmt(c.class_get_call);
|
||||||
gsi_remove(&removal, false);
|
gsi_remove(&removal, false);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue