[m-dev.] for review: use gcc's regparm attribute (was: fastcall for the x86)

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 30 01:15:24 AEDT 2000


Another addendum to this diff: testing revealed that my changes
to runtime/mercury_grade.h weren't having any effect, since we
weren't including any reference to the mangled grade in the
generated code.

compiler/mlds_to_c.m:
        Output "MR_CALL" in function declarations.
+	Also output a reference to MR_GRADE_VAR, like we do for the
+	LLDS back-end.

Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.71
diff -u -d -u -r1.71 mlds_to_c.m
--- compiler/mlds_to_c.m	2000/11/21 13:37:42	1.71
+++ compiler/mlds_to_c.m	2000/11/28 14:37:53
@@ -261,6 +261,7 @@
 	mlds_output_defns(Indent, MLDS_ModuleName, NonTypeDefns), io__nl,
 	mlds_output_init_fn_defns(MLDS_ModuleName, FuncDefns,
 		TypeCtorInfoDefns), io__nl,
+	mlds_output_grade_var, io__nl,
 	mlds_output_src_end(Indent, ModuleName).
 
 :- pred mlds_output_hdr_start(indent, mercury_module_name,
@@ -383,6 +384,19 @@
 	output_c_file_intro_and_grade(SourceFileName, Version),
 	io__nl.
 
+	%
+	% Output a reference to the mangled grade name for the grade
+	% that the C file gets compiled with.  This ensures that
+	% we don't try to link objects files compiled in different
+	% grades.
+	%
+:- pred mlds_output_grade_var(io__state::di, io__state::uo) is det.
+mlds_output_grade_var -->
+	io__write_string(
+		"/* ensure everything is compiled with the same grade */\n"),
+	io__write_string(
+		"static const void *const MR_grade = &MR_GRADE_VAR;\n").
+
 %-----------------------------------------------------------------------------%
 
 	%

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