[m-dev.] for review: GCC back-end: integrate with mmc
Tyson Dowd
trd at cs.mu.OZ.AU
Tue Jan 16 14:22:08 AEDT 2001
On 16-Jan-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 16-Jan-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > Although it is NYI, this shoulden't be a problem. mlds_to_c only
> > handles C code, and it checks for C code before it generates code.
> > foreign.m will turn any other code into a separate module (that will be
> > processed using some other translator) and replace it with C code.
>
> The problem is that although mlds_to_c may put the non-C foreign code
> into a separate file, mercury_compile.m won't know that this non-C
> foreign code exists, and so it won't know to invoke the foreign
> language compiler, or to link in the object files that result.
> To make it work properly we'd need to change the `ContainsCCode'
> boolean that we return to instead be a list of the foreign languages
> used.
Here's the plan:
foreign.m should run as a pre-pass over the MLDS that leaves only
preferred foreign code language (in this case, C). The intention is
that each backend need only know how to generate its own code and how to
interface to its preferred language (as mlds_to_gcc already does).
foreign.m (or maybe some other code) will also handle generating the
non-C file, generating dependencies on these extra files and will be
responsible for arranging for the foreign language compiler to be run.
So as far as each backend is concerned, foreign_code will only ever be
the preferred language, which will be handled exactly as you have
handled it here (and as it is handled in mlds_to_ilasm.m).
Note that this isn't how it works at the moment, so it's fine to leave
the XXX in the code at the moment -- mlds_to_c will eventually call
error if non-C code makes it through.
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list