[m-dev.] for review: fix inter-module optimization bugs

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Feb 10 16:00:04 AEDT 2001


On 07-Feb-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> compiler/mercury_to_mercury.m:
> 	The code to output `:- pragma import' declarations was
> 	writing `:- pragma import(p(Arg1::in, Arg2::out), "imported")'.
> 	The correct output is `:- pragma import(p(in, out), "imported")'.

That one is fine...

> compiler/mercury_compile.m:
> 	For modules containing `:- pragma export' declarations, add
> 	":- pragma c_header_code("#include ModuleName.h")." to
> 	the `.opt' file so the C compiler can find the function
> 	prototypes for Mercury predicates exported to C when
> 	compiling the C code in the `.opt' file.

Can you explain in more detail why that is needed?

Why would the C code refer to the wrapper functions for exported
predicates?  If the programmer writes such C code explicitly,
shouldn't they add the `#include' themself?  Why should the compiler
do it automatically?

> 	Write the `.h' file for a module when writing the `.opt' file
> 	when using the LLDS backend to avoid trying to use the `.h' file
> 	before it has been created.

That change looks to be quite expensive in terms of compilation time.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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