From 5492b5b55afa68e3d628da07ff583a0cac79b7e3 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 28 Sep 2015 13:36:53 +0200 Subject: Added location for the formal parameters and move the end of all scopes before the last statement. --- powerpc/Asmexpand.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'powerpc/Asmexpand.ml') diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 013d3f0a..80aa333e 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -647,7 +647,7 @@ let expand_instruction id l = emit (Plabel lbl); lbl | Some lbl -> lbl in - let rec aux lbl scopes = function + let rec aux lbl scopes = function | [] -> let lbl = get_lbl lbl in Debug.function_end id lbl | (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i)::rest -> @@ -689,7 +689,13 @@ let expand_instruction id l = aux None scopes rest end | i::rest -> expand_instruction_simple i; aux None scopes rest in - aux None [] l + (* We need to move all closing debug annotations before the last real statement *) + let rec move_debug acc = function + | (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i)::rest -> + move_debug (i::acc) rest (* Move the debug annotations forward *) + | b::rest -> List.rev (b::(List.rev acc)@rest) (* We found the first non debug location *) + | [] -> List.rev acc (* This actually can never happen *) in + aux None [] (move_debug [] (List.rev l)) let expand_function id fn = -- cgit