From b81dbb863781a5f450cad0b01f90f729fb1a2244 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 11 May 2018 17:13:14 +0200 Subject: MPPA - refactored instructions --- backend/Asmexpandaux.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'backend/Asmexpandaux.ml') diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml index 07e33efa..23fef3f2 100644 --- a/backend/Asmexpandaux.ml +++ b/backend/Asmexpandaux.ml @@ -39,7 +39,7 @@ let new_label () = List.fold_left (fun next instr -> match instr with - | Plabel l -> if P.lt l next then next else P.succ l + | PExpand (Plabel l) -> if P.lt l next then next else P.succ l | _ -> next) P.one (!current_function).fn_code in @@ -100,17 +100,17 @@ let expand_debug id sp preg simple l = let get_lbl = function | None -> let lbl = new_label () in - emit (Plabel lbl); + emit (PExpand (Plabel lbl)); lbl | Some lbl -> lbl in let rec aux lbl scopes = function | [] -> () - | (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i)::rest -> + | (PExpand (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i))::rest -> let kind = (P.to_int kind) in begin match kind with | 1-> - emit i;aux lbl scopes rest + emit (PExpand i);aux lbl scopes rest | 2 -> aux lbl scopes rest | 3 -> @@ -142,11 +142,11 @@ let expand_debug id sp preg simple l = | _ -> aux None scopes rest end - | (Plabel lbl)::rest -> simple (Plabel lbl); aux (Some lbl) scopes rest + | (PExpand (Plabel lbl))::rest -> simple (PExpand (Plabel lbl)); aux (Some lbl) scopes rest | i::rest -> simple i; aux None scopes rest in (* We need to move all closing debug annotations before the last real statement *) let rec move_debug acc bcc = function - | (Pbuiltin(EF_debug (kind,_,_),_,_) as i)::rest -> + | (PExpand (Pbuiltin(EF_debug (kind,_,_),_,_)) as i)::rest -> let kind = (P.to_int kind) in if kind = 1 then move_debug acc (i::bcc) rest (* Do not move debug line *) -- cgit From d870e17a7a964b48d8e44195ccd12e4160a63f32 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 6 Sep 2018 11:43:28 +0200 Subject: Extraction issue --- backend/Asmexpandaux.ml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'backend/Asmexpandaux.ml') diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml index 23fef3f2..62c4a702 100644 --- a/backend/Asmexpandaux.ml +++ b/backend/Asmexpandaux.ml @@ -26,7 +26,9 @@ let emit i = current_code := i :: !current_code (* Generation of fresh labels *) -let dummy_function = { fn_code = []; fn_sig = signature_main } +(** dummy_funtion is now defined in Asm.v *) +(* let dummy_function = { fn_code = []; fn_sig = signature_main } *) + let current_function = ref dummy_function let next_label = ref (None: label option) @@ -39,7 +41,7 @@ let new_label () = List.fold_left (fun next instr -> match instr with - | PExpand (Plabel l) -> if P.lt l next then next else P.succ l + | Plabel l -> if P.lt l next then next else P.succ l | _ -> next) P.one (!current_function).fn_code in @@ -100,17 +102,17 @@ let expand_debug id sp preg simple l = let get_lbl = function | None -> let lbl = new_label () in - emit (PExpand (Plabel lbl)); + emit (Plabel lbl); lbl | Some lbl -> lbl in let rec aux lbl scopes = function | [] -> () - | (PExpand (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i))::rest -> + | (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i)::rest -> let kind = (P.to_int kind) in begin match kind with | 1-> - emit (PExpand i);aux lbl scopes rest + emit i; aux lbl scopes rest | 2 -> aux lbl scopes rest | 3 -> @@ -142,11 +144,11 @@ let expand_debug id sp preg simple l = | _ -> aux None scopes rest end - | (PExpand (Plabel lbl))::rest -> simple (PExpand (Plabel lbl)); aux (Some lbl) scopes rest + | (Plabel lbl)::rest -> simple (Plabel lbl); aux (Some lbl) scopes rest | i::rest -> simple i; aux None scopes rest in (* We need to move all closing debug annotations before the last real statement *) let rec move_debug acc bcc = function - | (PExpand (Pbuiltin(EF_debug (kind,_,_),_,_)) as i)::rest -> + | (Pbuiltin(EF_debug (kind,_,_),_,_)) as i::rest -> let kind = (P.to_int kind) in if kind = 1 then move_debug acc (i::bcc) rest (* Do not move debug line *) -- cgit From 5631ccb7c416bb7ecbe7920cb432a78436c0a7ac Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 26 Nov 2018 17:35:31 +0100 Subject: BROKEN - works for x86, not for k1 anymore --- backend/Asmexpandaux.ml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'backend/Asmexpandaux.ml') diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml index 0f666a65..f5c76925 100644 --- a/backend/Asmexpandaux.ml +++ b/backend/Asmexpandaux.ml @@ -26,9 +26,7 @@ let emit i = current_code := i :: !current_code (* Generation of fresh labels *) -(** dummy_funtion is now defined in Asm.v *) -(* let dummy_function = { fn_code = []; fn_sig = signature_main } *) - +let dummy_function = { fn_code = []; fn_sig = signature_main } let current_function = ref dummy_function let next_label = ref (None: label option) @@ -122,7 +120,7 @@ let expand_debug id sp preg simple l = begin match kind with | 1-> - emit i; aux lbl scopes rest + emit i;aux lbl scopes rest | 2 -> aux lbl scopes rest | 3 -> @@ -163,7 +161,7 @@ let expand_debug id sp preg simple l = | i::rest -> simple i; aux None scopes rest in (* We need to move all closing debug annotations before the last real statement *) let rec move_debug acc bcc = function - | (Pbuiltin(EF_debug (kind,_,_),_,_)) as i::rest -> + | (Pbuiltin(EF_debug (kind,_,_),_,_) as i)::rest -> let kind = (P.to_int kind) in if kind = 1 then move_debug acc (i::bcc) rest (* Do not move debug line *) -- cgit From 09ebc4ffc4fa22e04e89f47d2f860cc831d6c23c Mon Sep 17 00:00:00 2001 From: Sylvain Boulmé Date: Wed, 28 Nov 2018 13:16:54 +0100 Subject: compilation Asmexpandaux both for x86/ and mppa_k1c/ --- backend/Asmexpandaux.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backend/Asmexpandaux.ml') diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml index f5c76925..b1d822db 100644 --- a/backend/Asmexpandaux.ml +++ b/backend/Asmexpandaux.ml @@ -15,6 +15,7 @@ pseudo-instructions *) open Asm +open Asmaux open AST open Camlcoq @@ -26,7 +27,10 @@ let emit i = current_code := i :: !current_code (* Generation of fresh labels *) +(* now imported from Asmaux.ml let dummy_function = { fn_code = []; fn_sig = signature_main } +*) + let current_function = ref dummy_function let next_label = ref (None: label option) -- cgit