[m-dev.] for review: fix a code gen bug
David Overton
dmo at cs.mu.OZ.AU
Fri Jun 4 01:28:31 AEST 1999
Estimated hours taken: 10
compiler/code_info.m:
In code_info__place_vars, place references in their required
locations as well as values. This bug was causing the else
branch of an if_then_else to get the wrong locations for
references to variables. The test case for this is
vn_block__split_at_next_ctrl_instr/4 which was being compiled
incorrectly with --optimize-constructor-last-call turned on.
Index: code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.211.2.21
diff -u -r1.211.2.21 code_info.m
--- 1.211.2.21 1999/05/05 01:22:57
+++ code_info.m 1999/06/03 07:22:46
@@ -3087,15 +3087,19 @@
code_info__place_vars([], empty) --> [].
code_info__place_vars([V - Rs | RestList], Code) -->
- (
- { set__to_sorted_list(Rs, VList) },
- { list__filter_map(code_exprn__value_to_rval, VList, RList) },
- { code_info__lval_in_rval_list(L, RList) }
- ->
- code_info__place_var(V, L, ThisCode)
+ { set__to_sorted_list(Rs, VList) },
+ { list__filter_map(code_exprn__value_to_rval, VList, RList, RefList) },
+ ( { code_info__lval_in_rval_list(L, RList) } ->
+ code_info__place_var(V, L, ValueCode)
+ ;
+ { ValueCode = empty }
+ ),
+ ( { RefList = [reference(RefLval) | _] } ->
+ code_info__place_var_reference(V, RefLval, ReferenceCode)
;
- { ThisCode = empty }
+ { ReferenceCode = empty }
),
+ { ThisCode = tree(ValueCode, ReferenceCode) },
code_info__place_vars(RestList, RestCode),
{ Code = tree(ThisCode, RestCode) }.
--
David Overton Department of Computer Science & Software Engineering
MEngSc Student The University of Melbourne, Australia
+61 3 9344 9159 http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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