[m-dev.] diff: clean-up of gcc/mercury/*
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jan 31 03:54:49 AEDT 2001
Estimated hours taken: 2
Clean up the documentation and copyright notices
of the stuff in gcc/mercury.
gcc/mercury/README:
Rewrite.
gcc/mercury/Make-lang.in:
Update copyright dates.
gcc/mercury/Makefile:
Update copyright dates, and add missing copyright notice.
Add some comments.
Delete the `backup' target (which was just a hack for my own
personal use).
gcc/mercury/Mmakefile:
Add missing copyright notice.
Add some comments.
Add new `.diff' target, for comparing the assembler
generated via C with that generated directly.
gcc/mercury/config-lang.in:
Add missing copyright notice.
s/cc1mercury/mercury1/
Add build_by_default=no.
Delete some unnecessary junk (the `outputs' and `headers' variables).
gcc/mercury/lang-options.in:
gcc/mercury/lang-specs.in:
gcc/mercury/mercury-gcc.c:
gcc/mercury/mercury-gcc.h:
Update copyright dates and header comments.
gcc/mercury/test.m:
gcc/mercury/testmercury.c:
Add some comments.
cvs diff: Diffing .
Index: Make-lang.in
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/Make-lang.in,v
retrieving revision 1.4
diff -u -d -u -r1.4 Make-lang.in
--- Make-lang.in 2001/01/17 02:45:42 1.4
+++ Make-lang.in 2001/01/30 16:18:34
@@ -1,5 +1,5 @@
# Top level makefile fragment for Mercury.
-# Copyright (C) 2000 Fergus Henderson
+# Copyright (C) 2000, 2001 Fergus Henderson
# Copyright (C) 1999, 2000 Tim Josling
# Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
Index: Makefile
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/Makefile,v
retrieving revision 1.3
diff -u -d -u -r1.3 Makefile
--- Makefile 2001/01/17 02:45:43 1.3
+++ Makefile 2001/01/30 16:10:14
@@ -1,3 +1,27 @@
+# Makefile for Mercury. Just some convenience targets.
+# Copyright (C) 2000, 2001 Fergus Henderson
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+# This file just provides some targets for convenience.
+# All the real work is done by Make-lang.in, which gets
+# included into the Makefile in ..
+
all: mercury
mercury: force
@@ -11,13 +35,3 @@
.PHONY: force
force:
-
-BACKUPDIR := $$HOME/src/mercury/back-$(shell date +%Y-%m-%d)
-
-backup:
- echo $(BACKUPDIR)
- [ -d $(BACKUPDIR) ] || mkdir $(BACKUPDIR)
- cp Make-lang.in Makefile README config-lang.in \
- test.m test.mer testmercury.c \
- mercury-gcc.h mercury-gcc.c $(BACKUPDIR)
- cp mercury/cvd.out $(BACKUPDIR)
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/Mmakefile,v
retrieving revision 1.4
diff -u -d -u -r1.4 Mmakefile
--- Mmakefile 2001/01/30 14:15:37 1.4
+++ Mmakefile 2001/01/30 16:41:33
@@ -1,5 +1,30 @@
-# This Mmakefile is used to do some simple-minded testing.
+# Mmakefile for Mercury. For some simple-minded testing.
+# Copyright (C) 2000, 2001 Fergus Henderson
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+# An Mmakefile is like a Makefile, except that it is for Mmake
+# rather than ordinary Make. "Mmake" is the Mercury build utility;
+# it is built on top of GNU Make.
+#
+# This Mmakefile is used to do some simple-minded testing of
+# the Mercury front-end.
+
# Compile Mercury code via asm
GRADE = hlc.gc
TARGET_ASM = yes
@@ -45,12 +70,24 @@
#%.o : %.m ../mercury1 Mmakefile
#$(GCC) -x mercury $(GMCFLAGS) -c $<
+# This rule builds the `.s' files using the Mercury GCC front-end.
+
%.s : %.m ../mercury1 Mmakefile
$(GCC) -x mercury $(GMCFLAGS) -S $<
+# The `.c0' and `.s0' targets compile Mercury programs using the Mercury
+# compiler's C back-end rather than the GCC back-end interface.
+
%.c0: %.m
$(MCG) $(USUAL_GRADEFLAGS) $(ALL_MCGFLAGS) $<
mv $*.c $*.c0
%.s0 : %.c0
MERCURY_C_COMPILER="$(CC)" $(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) -x c -S $< -o $@
+
+# The `.diff' targets can be used to compare the assembler produced
+# by compiling via C with the assembler produced by interfacing with
+# the GCC back-end.
+
+%.diff: %.s0 %.s
+ diff -u $*.s0 $*.s > $@
Index: README
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/README,v
retrieving revision 1.2
diff -u -d -u -r1.2 README
--- README 2001/01/14 09:48:12 1.2
+++ README 2001/01/30 16:37:33
@@ -1,13 +1,143 @@
-GCC front end code for Mercury.
-See <http://www.cs.mu.oz.au/mercury/> for more info on Mercury.
+GCC Mercury front-end
+---------------------
-Put into the subdirectory gcc/mercury/
+This directory contains part of the GCC front end code for
+the Mercury programming language. For more info on Mercury,
+see the Mercury web site, at <http://www.cs.mu.oz.au/mercury/>.
-To test the output
+This directory contains the part of the Mercury front-end that is
+written in C. The majority of the Mercury front-end is written in
+Mercury, and is distributed with the Mercury compiler source
+distribution. The Mercury distribution is available from the
+Mercury web site.
+The "Mercury front-end for GCC" is also known as the
+"GCC back-end for the Mercury compiler".
+
+Installation
+------------
+
+The Mercury distribution should go in a directory `mercury'.
+
+The gcc distribution should go in a directory `gcc'
+(this will have subdirectories `gcc', `libiberty', etc.)
+The directory containing this README should be put in the
+subdirectory `gcc/gcc/mercury'.
+The file `gcc/gcc/mercury/mercury' should be a symbolic
+link to the location of the Mercury distribution directory.
+
+Once you've unpacked or checked out the sources,
+and created the above-mentioned symbolic link,
+you just need to run `configure', `make', and then
+`make install' in the gcc and mercury directories.
+
+When configuring gcc, you should pass the `--enable-languages'
+option, and `mercury' should be one of the languages in
+the list. For example, use `sh configure --enable-languages=mercury',
+or `sh configure --enable-languages="c fortran mercury"'.
+When configuring Mercury, you can use `--enable-gcc-back-end' to tell
+it to link in the gcc back-end, but the Mercury autoconfiguration
+script should enable that by default when it finds the GCC source.
+
+So, to summarize:
+
+ # password for gcc cvs is `anoncvs'
+ cvs checkout -d :pserver:anoncvs at gcc.gnu.org:/cvs/gcc gcc
+
+ # password for Mercury cvs is `guest'
+ cvs checkout -d :pserver:guest at hydra.cs.mu.oz.au:/home/mercury1/repository gcc/mercury
+ cvs checkout -d :pserver:guest at hydra.cs.mu.oz.au:/home/mercury1/repository mercury
+
+ cd gcc/gcc/mercury
+ ln -s ../../mercury mercury
+ cd ../../..
+
cd gcc
- make mercury
+ sh configure --enable-languages=mercury
+ cd ../mercury
+ sh configure
-Unfortunately the Objective C people stole the `.m' extension,
-so to compile Mercury programs with gcc, you need to use the
-`-x mercury' option.
+ cd ../gcc
+ make
+ cd ../mercury
+ make
+
+ cd ../gcc
+ make install
+ cd ../mercury
+ make install
+
+Invoking the compiler
+---------------------
+
+The Mercury front-end to GCC can be invoked using `mmake'
+(the Mercury make program), using `mmc' (the Mercury compiler),
+or using `gcc' (the GCC driver program).
+
+The simplest approach is using `mmake'. To use the Mercury front-end
+to GCC, you need to specify the `--target asm' option to `mmake'.
+Apart from that, the details are the same as usual, and are documented
+in the "Using Mmake" chapter of the Mercury user's guide.
+`mmake' will invoke `mmc' and the other necessarily commands.
+Options to `mmc' can be specified by setting the MCFLAGS variable
+in your Mmakefile or by overriding the EXTRA_MCFLAGS variable
+on the `mmake' command line, i.e. `mmake EXTRA_MCFLAGS=...'.
+
+The next simplest approach is using `mmc'. In this case, the driver is
+a script named `mmc', which invokes a program named `mercury_compile'.
+Options to the Mercury compiler are passed to `mmc' in the usual
+fashion, and options to the GCC back-end can be specified using the
+`--cflags' option to `mmc'. Again, you need to use the `--target asm'
+option, but apart from that, the details are the same as usual,
+and are documented in the "Using mmc" chapter of the Mercury user's guide.
+
+The most difficult approach is using `gcc'. In this case, the driver
+is a program named `gcc', and that drive invokes a program named
+`mercury1' which contains the actual Mercury compiler. Options to the
+GCC back-end are passed to the `gcc' program in the usual fashion,
+and options to the Mercury front-end can be specified using the
+`--mmc-flag=' option to `gcc'. Unfortunately the Objective C people
+stole the `.m' extension, so if you want to use the gcc driver to
+compile Mercury programs, you need to explcitly use the `-x mercury'
+option.
+
+Currently the recommended approach is to use `mmake' or `mmc', not
+`gcc', since the `gcc' driver doesn't handle linking correctly for
+Mercury programs. For programs that consist of more than one source
+file, we recommend that you use `mmake' rather than using `mmc' directly.
+
+Status
+------
+
+The Mercury compiler bootstraps itself and has passed the Mercury test
+suite on i686-pc-linux-gnu. So it should be reasonably reliable.
+However, it has not yet been subject to external testing.
+And it has not yet been tested in any configuration other than
+i686-pc-linux-gnu.
+
+The `--debug', `--profiling' and `--memory-profiling' options to mmc
+are not yet supported by the GCC back-end interface of the Mercury
+compiler. The `--use-trail' option should work in theory but has not
+yet been tested. In other words, the only grade (compilation model)
+which is currently supported with the GCC back-end is the `hlc.gc'
+grade. (See the "Compilation model options" section of the Mercury
+user's guide for more information about grades.)
+
+For debugging, we recommend you stick with the original Mercury
+back-end (i.e. drop the `--target asm' option, and just use `--debug').
+Debugging using `gdb' is possible, to a limited extent, but it is
+*not* a lot of fun, since gdb doesn't demangle Mercury symbol names,
+doesn't know how to display Mercury data structures, doesn't handle
+`nondet' procedures nicely, and doesn't support mdb's very handy
+`retry' command.
+
+For profiling, using `gprof' may work OK. But we haven't tested it.
+
+Further reading
+---------------
+See the "Documentation" page of the Mercury web site,
+at <http://www.cs.mu.oz.au/mercury/information/documentation.html>.
+
+Reporting bugs
+--------------
+Please send bug reports to mercury-bugs at cs.mu.oz.au.
Index: config-lang.in
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/config-lang.in,v
retrieving revision 1.1
diff -u -d -u -r1.1 config-lang.in
--- config-lang.in 2000/12/17 09:44:39 1.1
+++ config-lang.in 2001/01/30 16:34:33
@@ -1,3 +1,24 @@
+# configure script fragment for Mercury.
+# Copyright (C) 2000, 2001 Fergus Henderson
+# Copyright (C) 1994, 1995, 2000 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
# Configure looks for the existence of this file to auto-config each language.
# We define several parameters used by configure:
#
@@ -5,17 +26,17 @@
# compilers - value to add to $(COMPILERS)
# stagestuff - files to add to $(STAGESTUFF)
# diff_excludes - files to ignore when building diffs between two versions.
+# build_by_default
+# - `no' here means that you need to explictly use the
+# `--enable-languages' configure option (or set the
+# LANGUAGES environment variable) to build this front-end.
language="mercury"
-compilers="cc1mercury\$(exeext)"
+compilers="mercury1\$(exeext)"
-stagestuff="cc1mercury"
+stagestuff="mercury1"
-# diff_excludes="-x parse.tab.c"
diff_excludes=
-
-headers=
-
-#outputs=mercury/Makefile
+build_by_default=no
Index: lang-options.h
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/lang-options.h,v
retrieving revision 1.1
diff -u -d -u -r1.1 lang-options.h
--- lang-options.h 2000/12/23 16:31:11 1.1
+++ lang-options.h 2001/01/30 16:13:47
@@ -1,5 +1,5 @@
-/* Switch definitions for the GNU compiler for the Mercury language.
- Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Command-line switch definitions for the Mercury front-end.
+ Copyright (C) 2000, 2001 Fergus Henderson.
This file is part of GNU CC.
Index: lang-specs.h
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/lang-specs.h,v
retrieving revision 1.3
diff -u -d -u -r1.3 lang-specs.h
--- lang-specs.h 2001/01/17 02:45:44 1.3
+++ lang-specs.h 2001/01/30 16:16:00
@@ -1,5 +1,5 @@
-/* Definitions for specs for the GNU compiler for the Mercury language.
- Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Definitions for specs for the Mercury front-end.
+ Copyright (C) 2000, 2001 Fergus Henderson.
This file is part of GNU CC.
Index: mercury-gcc.c
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/mercury-gcc.c,v
retrieving revision 1.27
diff -u -d -u -r1.27 mercury-gcc.c
--- mercury-gcc.c 2001/01/30 13:33:40 1.27
+++ mercury-gcc.c 2001/01/30 16:17:15
@@ -1,5 +1,5 @@
-/* mercury-gcc.c: Mercury language front-end.
- Copyright (C) 2001 Fergus Henderson.
+/* mercury-gcc.c: C source code for the Mercury language front-end to GCC.
+ Copyright (C) 2000, 2001 Fergus Henderson.
This file is part of GNU CC.
Index: mercury-gcc.h
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/mercury-gcc.h,v
retrieving revision 1.16
diff -u -d -u -r1.16 mercury-gcc.h
--- mercury-gcc.h 2001/01/30 13:33:40 1.16
+++ mercury-gcc.h 2001/01/30 16:38:21
@@ -1,5 +1,5 @@
-/* mercury-gcc.h: Mercury language front-end for GNU CC.
- Copyright (C) 2001 Fergus Henderson.
+/* mercury-gcc.h: C header file for the Mercury language front-end for GCC.
+ Copyright (C) 2000, 2001 Fergus Henderson.
This file is part of GNU CC.
Index: test.m
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/test.m,v
retrieving revision 1.1
diff -u -d -u -r1.1 test.m
--- test.m 2000/12/17 09:44:39 1.1
+++ test.m 2001/01/30 16:20:59
@@ -1,3 +1,7 @@
+% An example Mercury module.
+% We compile and link this module as a very trivial test
+% that the Mercury front-end isn't completely broken.
+
:- module test.
:- interface.
:- import_module int.
Index: testmercury.c
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/testmercury.c,v
retrieving revision 1.2
diff -u -d -u -r1.2 testmercury.c
--- testmercury.c 2000/12/20 18:10:51 1.2
+++ testmercury.c 2001/01/30 16:21:44
@@ -1,3 +1,5 @@
+/* A driver program that invokes the example Mercury module in test.m. */
+
#include <stdio.h>
#include <stdlib.h>
--
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