[m-rev.] for review: fix lco.m variant proc argument types

Peter Wang novalazy at gmail.com
Mon Jan 14 15:11:57 AEDT 2008


Branches: main

compiler/lco.m:
	Variant procedures generated by the lco.m pass did not have their
	pred_info arg_types fields updated for the arguments which are passed
	by reference after the transformation, i.e. arguments that should have
	type private_builtin.store_by_ref_type(T) instead of T.
	Update them.


Index: compiler/lco.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.49
diff -u -r1.49 lco.m
--- compiler/lco.m	30 Dec 2007 08:23:45 -0000	1.49
+++ compiler/lco.m	14 Jan 2008 04:02:34 -0000
@@ -246,11 +246,22 @@
     transform_variant_proc(!.ModuleInfo, AddrOutArgPosns,
         ProcInfo, VariantProcInfo),
 
+    proc_info_get_headvars(VariantProcInfo, HeadVars),
+    proc_info_get_vartypes(VariantProcInfo, VarTypes),
+    map.apply_to_list(HeadVars, VarTypes, ArgTypes),
+
     some [!VariantPredInfo, !PredTable] (
         module_info_preds(!.ModuleInfo, !:PredTable),
         map.lookup(!.PredTable, VariantPredId, !:VariantPredInfo),
         pred_info_set_name(VariantName, !VariantPredInfo),
         pred_info_set_is_pred_or_func(pf_predicate, !VariantPredInfo),
+
+        % Update the argument types for the variant's pred_info.
+        pred_info_get_arg_types(!.VariantPredInfo, TVarSet, ExistQVars,
+            _ArgTypes0),
+        pred_info_set_arg_types(TVarSet, ExistQVars, ArgTypes,
+            !VariantPredInfo),
+
         pred_info_get_origin(!.VariantPredInfo, Origin0),
         Transform = transform_return_via_ptr(ProcId, AddrOutArgPosns),
         Origin = origin_transformed(Transform, Origin0, PredId),

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