[m-dev.] for review: a replacement of code_exprn.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Aug 17 19:24:01 AEST 2000
On 06-Aug-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> compiler/pragma_c_gen.m:
> When using var_locn, ensure that none of the input arguments is
> assigned to r1, in order to avoid forcing the C compiler to generate
> code to shuffle it out of the way.
I don't understand that.
Why would the C compiler generate code to shuffle r1?
> compiler/mercury_compile.m:
> compiler/code_gen.m:
> Turn off tracing in any predicate that originates in a builtin module
> for backend_by_preds and backend_by_phases respectively.
>
> Look up options in the globals structure in the module_info, not in the
> globals structure in the I/O state, since this is where we turn off
> tracing. (We should later make sure that other parts of the compiler
> are also consistent on this issue.)
I think it would be much better to just set the globals in both the io__state
and the module_info. Trying to ensure that other parts of the
compiler only access the globals via the module_info rather than via
the io__state is not going to work, because there are lots of places
in the compiler that only get passed the io__state, not the module_info.
Passing down the module_info to all of those places would be a nightmare...
> +++ call_gen.m 2000/08/03 08:53:28
> @@ -97,19 +98,14 @@
> code_info__get_instmap(InstMap),
> { goal_info_get_instmap_delta(GoalInfo, InstMapDelta) },
> { instmap__apply_instmap_delta(InstMap, InstMapDelta, ReturnInstMap) },
> - { call_gen__output_arg_locs(ArgsInfos, OutputArgLocs) },
> - % We must update the code generator state to reflect
> - % the situation after the call before building
> - % the return liveness info. No later code in this
> - % predicate depends on the old state.
> - call_gen__rebuild_registers(ArgsInfos),
> - code_info__generate_return_live_lvalues(OutputArgLocs, ReturnInstMap,
> - ReturnLiveLvalues),
>
> + % Update the code generator state to reflect the situation
> + % after the call.
> + call_gen__handle_return(ArgsInfos, ReturnInstMap, ReturnLiveLvalues),
> +
> % Make the call.
> code_info__get_module_info(ModuleInfo),
...
With this change, the code & comments are somewhat mystifying: why
does it "update the code generator state to reflect the sitatuation
after the call" *before* (generating code to) make the call?
Hence I prefer the old comment.
[... to be continued ...]
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- 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