[m-rev.] for post-commit review: document status of clang support
Julien Fischer
juliensf at csse.unimelb.edu.au
Mon Oct 3 00:07:54 AEDT 2011
Branches: main, 11.07
Document the status of clang support.
README.clang:
Document how to use clang as a C compiler with Mercury.
NEWS:
Announce the suport for clang.
Julien.
Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.591
diff -u -r1.591 NEWS
--- NEWS 19 Aug 2011 03:26:33 -0000 1.591
+++ NEWS 2 Oct 2011 13:03:11 -0000
@@ -24,6 +24,11 @@
bag, bimap, eqvclass, map, multi_map, queue and set modules in order
to make them more conducive to the use of state variable notation.
+Changes to the Mercury compiler:
+
+* Support for using clang (<http://clang.llvm.org/>) as a C compiler with
+ Mercury has been added. See README.clang for further details
+
Changes to the Mercury profiler:
* We have added a new form of profiling, memory retention profiling, to mprof
Index: README.clang
===================================================================
RCS file: README.clang
diff -N README.clang
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ README.clang 2 Oct 2011 13:04:50 -0000
@@ -0,0 +1,51 @@
+This file documents how to use clang as the C compiler with Mercury. Support
+for Mercury with clang has been tested on Linux and Mac OS X. To use clang as
+the C compiler for Mercury invoke Mercury's configure script with the --with-cc
+option set as follows:
+
+ $ ./configure --with-cc=clang
+
+Note that the asm_fast* and reg* grades are not usable with clang as they rely
+on GNU C extensions that clang does not support.
+
+Versions of LLVM (the underlying compiler infrastructure used by clang) before
+about 2.9 contain bugs that require most C compiler optimizations to be
+disabled when compiling Mercury generated C code with clang (i.e. the generated
+C files have to be compiled at -O0). If you are using a more recent version of
+LLVM then you should be able to safely increase the optimization level used by
+clang by applying the following patch:
+
+Index: configure.in
+===================================================================
+RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
+retrieving revision 1.593
+diff -u -r1.593 configure.in
+--- configure.in 21 Sep 2011 06:11:30 -0000 1.593
++++ configure.in 2 Oct 2011 12:57:59 -0000
+@@ -4483,7 +4483,7 @@
+ # XXX we need go through the warning and optimization options for clang
+ # more carefully.
+ CFLAGS_FOR_WARNINGS="-w"
+- CFLAGS_FOR_OPT="-fomit-frame-pointer"
++ CFLAGS_FOR_OPT="-O2 -fomit-frame-pointer"
+ CFLAGS_FOR_DEBUG="-g"
+ CFLAGS_FOR_NO_STRICT_ALIASING="-fno-strict-aliasing"
+ MCFLAGS_FOR_CC=
+Index: scripts/mgnuc.in
+===================================================================
+RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
+retrieving revision 1.137
+diff -u -r1.137 mgnuc.in
+--- scripts/mgnuc.in 25 Aug 2011 14:16:53 -0000 1.137
++++ scripts/mgnuc.in 2 Oct 2011 12:57:37 -0000
+@@ -72,7 +72,7 @@
+ *clang*)
+ ANSI_OPTS="-ansi"
+ CHECK_OPTS="-w"
+- OPT_OPTS="-O0 $CFLAGS_FOR_NO_STRICT_ALIASING -fomit-frame-pointer"
++ OPT_OPTS="-O2 $CFLAGS_FOR_NO_STRICT_ALIASING -fomit-frame-pointer"
+ DEBUG_OPT="-g"
+ COMPILER=clang
+ ;;
+
+
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list