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

Simon Taylor stayl at cs.mu.OZ.AU
Mon Feb 12 00:21:08 AEDT 2001


On Sat, Feb 10, 2001 at 04:00:04PM +1100, Fergus Henderson wrote:
> On 07-Feb-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > 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?

I don't know whether it should, but it does
(see mercury_compile__maybe_add_header_file_include).
 
> > 	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.

It only happens for modules containing `:- pragma export' declarations,
which are fairly rare.

Simon.
--------------------------------------------------------------------------
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