[m-dev.] diff: update GCC back-end interface
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jan 31 00:33:17 AEDT 2001
I posted the previous diff a bit too quickly.
More testing revealed that the following fix was also needed.
Estimated hours taken: 0.5
gcc/mercury/mercury-gcc.h:
gcc/mercury/mercury-gcc.c:
mercury/compiler/gcc.m:
Move the code for build_real in gcc.m into a new function
merc_build_real in mercury-gcc.c. This works around a gcc
internal error when compiling gcc.m in grade asm_fast.gc with
egcs-1.1.2 on x86, due to the use of gcc global registers.
This problem only showed up in the latest gcc weekly snapshot.
Index: mercury-gcc.c
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/mercury-gcc.c,v
retrieving revision 1.26
diff -u -d -u -r1.26 mercury-gcc.c
--- mercury-gcc.c 2001/01/30 13:26:13 1.26
+++ mercury-gcc.c 2001/01/30 13:26:33
@@ -412,6 +412,17 @@
return string_addr;
}
+tree
+merc_build_real(type, value)
+ tree type;
+ double value;
+{
+ /* XXX this won't work if cross-compiling */
+ union { double dbl; HOST_WIDE_INT ints[20]; } u;
+ u.dbl = value;
+ return build_real(type, REAL_VALUE_FROM_TARGET_DOUBLE(u.ints));
+}
+
/* Make an empty expression list. */
tree
Index: mercury-gcc.h
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/mercury-gcc.h,v
retrieving revision 1.15
diff -u -d -u -r1.15 mercury-gcc.h
--- mercury-gcc.h 2001/01/18 15:44:02 1.15
+++ mercury-gcc.h 2001/01/30 13:14:23
@@ -96,6 +96,9 @@
merc_build_string PARAMS((int len, const char *chars));
extern tree
+merc_build_real PARAMS((tree type, double value));
+
+extern tree
merc_empty_arg_list PARAMS((void));
extern tree
Index: ../../mercury/compiler/gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/gcc.m,v
retrieving revision 1.19
diff -u -d -u -r1.19 gcc.m
--- ../../mercury/compiler/gcc.m 2001/01/22 16:08:00 1.19
+++ ../../mercury/compiler/gcc.m 2001/01/30 13:11:23
@@ -1065,12 +1065,7 @@
:- pragma c_code(build_real(Type::in, Value::in, Expr::out, _IO0::di, _IO::uo),
[will_not_call_mercury],
"
- /* XXX should move to mercury-gcc.c */
- /* XXX this won't work if cross-compiling */
- union { double dbl; HOST_WIDE_INT ints[20]; } u;
- u.dbl = Value;
- Expr = (MR_Word) build_real((tree) Type,
- REAL_VALUE_FROM_TARGET_DOUBLE(u.ints));
+ Expr = (MR_Word) merc_build_real((tree) Type, Value);
").
build_string(String, Expr) -->
--
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