* Adding new runtime library
@ 2009-05-22 9:11 Petros Panayi
2009-05-22 13:57 ` Basile STARYNKEVITCH
2009-06-10 10:45 ` Adding a new Struct (RECORD_TYPE) Petros Panayi
0 siblings, 2 replies; 3+ messages in thread
From: Petros Panayi @ 2009-05-22 9:11 UTC (permalink / raw)
To: gcc
Hi,
I try to write an optimization pass which at some point will make a call
to a new runtime library.
To achieve this I need to write my own runtime library i.e something
like libgomp but much simpler for now.
I will like to know if there is a tutorial of any documentation on how
to do this?
If not can you enumerate which files I have to modify to achieve it?
Thanks in advance.
Petros
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Adding new runtime library
2009-05-22 9:11 Adding new runtime library Petros Panayi
@ 2009-05-22 13:57 ` Basile STARYNKEVITCH
2009-06-10 10:45 ` Adding a new Struct (RECORD_TYPE) Petros Panayi
1 sibling, 0 replies; 3+ messages in thread
From: Basile STARYNKEVITCH @ 2009-05-22 13:57 UTC (permalink / raw)
To: Petros Panayi; +Cc: gcc
Petros Panayi wrote:
> Hi,
> I try to write an optimization pass which at some point will make a
> call to a new runtime library.
> To achieve this I need to write my own runtime library i.e something
> like libgomp but much simpler for now.
> I will like to know if there is a tutorial of any documentation on how
> to do this?
With the new plugin mechanism in the trunk it should be even simpler
(basically, link your libary into your plugin or extend your library to
make it a GCC plugin).
However, even without plugins, it is not that hard.
The easy part is to change the gcc/Makefile.in - you might consider
looking into the MELT branch
http://gcc.gnu.org/viewcvs/branches/melt-branch/gcc/Makefile.in (which
adds some additional libraries into cc1). You probably should add stuff
into the BACKENDLIBS= make variable (not far from line 923 in
gcc/Makefile.in in the trunk)
The less easy part (which you might consider optional) would be to hack
the gcc/configure.ac file to test the availability of your additional
library. You may also want to add a --with-XXX argument to configure...
and be able to set your libraries header files and linkable archive
paths (ie the -I or -L arguments needed).
The hardest part is indeed to write an optimisation pass :-)
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* Adding a new Struct (RECORD_TYPE)
2009-05-22 9:11 Adding new runtime library Petros Panayi
2009-05-22 13:57 ` Basile STARYNKEVITCH
@ 2009-06-10 10:45 ` Petros Panayi
1 sibling, 0 replies; 3+ messages in thread
From: Petros Panayi @ 2009-06-10 10:45 UTC (permalink / raw)
To: gcc
Hi,
I try to create and populate a new struct into my the generated code.
Something like:
struct ddm_temaplate{
int loop_interations;
int ddm_thread_num;
};
What I have up to now is the following:
static tree build_ddm_template_struct() {
tree type = lang_hooks.types.make_type(RECORD_TYPE);
tree id, field, fields;
id = get_identifier("loop_interations");
fields = build_decl (FIELD_DECL,id, integer_type_node);
id = get_identifier("ddm_thread_num");
field = build_decl (FIELD_DECL, id, integer_type_node);
TREE_CHAIN (field) = fields;
fields = field;
finish_builtin_struct(type, "__ddm_template", fields, NULL_TREE);
return type;
}
/* After this call I get somthing like struct __ddm_template
.ddm_template_instance.38; ...*/
static tree build_struct_instance(tree type) {
tree arg_struct_instance, var;
arg_struct_instance = create_tmp_var(type, ".ddm_template_instance");
return arg_struct_instance;
}
and I use them as
type = build_ddm_template_struct();
struct_instance = build_struct_instance(type);
fields = TYPE_FIELDS (type);
t = build3(COMPONENT_REF, type, struct_instance, fields, NULL_TREE);
tree astmt = build_gimple_modify_stmt(t,build_int_cstu
(lang_hooks.types.type_for_size (32, true),99));
print_generic_stmt(stderr, astmt,0); /* Here i get something like
.ddm_template_instance.38.loop_interations = 99; */
bsi_insert_after(&si, astmt, BSI_NEW_STMT);
This code will create an error when verify_loop_closed_ssa() is called.
I believe the problem is that loop_interations field does not get an SSA
name.
Can anyone help me fixing this problem.
Thanks in advance
Petros
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-10 10:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-22 9:11 Adding new runtime library Petros Panayi
2009-05-22 13:57 ` Basile STARYNKEVITCH
2009-06-10 10:45 ` Adding a new Struct (RECORD_TYPE) Petros Panayi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).