mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 15:26:31 +00:00
Add field names for the proc_layout_info type.
Estimated hours taken: 1 compiler/continuation_info.m: Add field names for the proc_layout_info type. compiler/optimize.m: Use the new field names.
This commit is contained in:
@@ -61,28 +61,37 @@
|
|||||||
%
|
%
|
||||||
:- type proc_layout_info
|
:- type proc_layout_info
|
||||||
---> proc_layout_info(
|
---> proc_layout_info(
|
||||||
label, % The entry label.
|
entry_label :: label,
|
||||||
determinism, % Determines which stack is used.
|
% Determines which stack is used.
|
||||||
int, % Number of stack slots.
|
detism :: determinism,
|
||||||
maybe(int), % Location of succip on stack.
|
% Number of stack slots.
|
||||||
maybe(label), % If the trace level is not none,
|
stack_slot_count :: int,
|
||||||
% this contains the label associated
|
% Location of succip on stack.
|
||||||
% with the call event, whose stack
|
succip_slot :: maybe(int),
|
||||||
% layout says which variables were
|
% If the trace level is not none, this
|
||||||
% live and where on entry.
|
% contains the label associated with
|
||||||
int, % The number of the highest numbered
|
% the call event, whose stack layout
|
||||||
|
% gives the locations of the input
|
||||||
|
% arguments on procedure entry, for
|
||||||
|
% use in implementing retry in the
|
||||||
|
% debugger.
|
||||||
|
call_label :: maybe(label),
|
||||||
|
% The number of the highest numbered
|
||||||
% rN register that can contain useful
|
% rN register that can contain useful
|
||||||
% information during a call to MR_trace
|
% information during a call to MR_trace
|
||||||
% from within this procedure.
|
% from within this procedure.
|
||||||
trace_slot_info,% Info about the stack slots used
|
max_trace_reg :: int,
|
||||||
|
% Info about the stack slots used
|
||||||
% for tracing.
|
% for tracing.
|
||||||
bool, % Do we require the procedure id
|
trace_slot_info :: trace_slot_info,
|
||||||
|
% Do we require the procedure id
|
||||||
% section of the procedure layout
|
% section of the procedure layout
|
||||||
% to be present, even if the option
|
% to be present, even if the option
|
||||||
% procid_stack_layout is not set?
|
% procid_stack_layout is not set?
|
||||||
proc_label_layout_info
|
need_proc_id :: bool,
|
||||||
% Info for each internal label,
|
% Info for each internal label,
|
||||||
% needed for basic_stack_layouts.
|
% needed for basic_stack_layouts.
|
||||||
|
internal_map :: proc_label_layout_info
|
||||||
).
|
).
|
||||||
|
|
||||||
%
|
%
|
||||||
@@ -338,7 +347,7 @@ continuation_info__process_proc_llds(PredProcId, Instructions,
|
|||||||
|
|
||||||
% Get all the continuation info from the call instructions.
|
% Get all the continuation info from the call instructions.
|
||||||
global_data_get_proc_layout(GlobalData0, PredProcId, ProcLayoutInfo0),
|
global_data_get_proc_layout(GlobalData0, PredProcId, ProcLayoutInfo0),
|
||||||
ProcLayoutInfo0 = proc_layout_info(A, B, C, D, E, F, G, H, Internals0),
|
Internals0 = ProcLayoutInfo0^internal_map,
|
||||||
GetCallInfo = lambda([Instr::in, Call::out] is semidet, (
|
GetCallInfo = lambda([Instr::in, Call::out] is semidet, (
|
||||||
Instr = call(Target, label(ReturnLabel), LiveInfo, Context, _)
|
Instr = call(Target, label(ReturnLabel), LiveInfo, Context, _)
|
||||||
- _Comment,
|
- _Comment,
|
||||||
@@ -350,7 +359,7 @@ continuation_info__process_proc_llds(PredProcId, Instructions,
|
|||||||
list__foldl(continuation_info__process_continuation(WantReturnInfo),
|
list__foldl(continuation_info__process_continuation(WantReturnInfo),
|
||||||
Calls, Internals0, Internals),
|
Calls, Internals0, Internals),
|
||||||
|
|
||||||
ProcLayoutInfo = proc_layout_info(A, B, C, D, E, F, G, H, Internals),
|
ProcLayoutInfo = ProcLayoutInfo0^internal_map := Internals,
|
||||||
global_data_update_proc_layout(GlobalData0, PredProcId, ProcLayoutInfo,
|
global_data_update_proc_layout(GlobalData0, PredProcId, ProcLayoutInfo,
|
||||||
GlobalData).
|
GlobalData).
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ optimize__proc(CProc0, GlobalData, CProc) -->
|
|||||||
global_data_maybe_get_proc_layout(GlobalData, PredProcId,
|
global_data_maybe_get_proc_layout(GlobalData, PredProcId,
|
||||||
ProcLayout)
|
ProcLayout)
|
||||||
->
|
->
|
||||||
ProcLayout = proc_layout_info(_, _, _, _, _, _, _, _,
|
LabelMap = ProcLayout^internal_map,
|
||||||
LabelMap),
|
|
||||||
map__sorted_keys(LabelMap, LayoutLabels),
|
map__sorted_keys(LabelMap, LayoutLabels),
|
||||||
set__sorted_list_to_set(LayoutLabels, LayoutLabelSet)
|
set__sorted_list_to_set(LayoutLabels, LayoutLabelSet)
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user