Fixes for RISC evaluation
This commit is contained in:
@ -116,9 +116,13 @@ module RISCAssembly = struct
|
||||
|
||||
let pp (ppf: out_channel) (t: t) : unit =
|
||||
Printf.fprintf ppf "Input Val: ";
|
||||
match t.inputval with
|
||||
None -> Printf.fprintf ppf "None\n"
|
||||
| Some i -> Printf.fprintf ppf "Some %d\n" i;
|
||||
( match t.inputval with
|
||||
None -> Printf.fprintf ppf "None\n"
|
||||
| Some i -> Printf.fprintf ppf "Some %d\n" i );
|
||||
Printf.fprintf ppf "Input/Output Registers: ";
|
||||
( match t.inputoutputreg with
|
||||
None -> Printf.fprintf ppf "None\n"
|
||||
| Some (i, o) -> Printf.fprintf ppf "[i: Some r%s, o: Some r%s]\n" i.index o.index);
|
||||
Printf.fprintf ppf "Code:\n";
|
||||
List.iter (pp_risci ppf) t.code
|
||||
end
|
||||
@ -225,7 +229,7 @@ let rec helper
|
||||
in
|
||||
match nextnodes with
|
||||
| Some (nextnode1, None) ->
|
||||
let res, vis = (helper prg nextnode1) (currentnode :: alreadyVisited) in
|
||||
let res, vis = (helper prg nextnode1 (currentnode :: alreadyVisited)) in
|
||||
(currentcode @ res, vis)
|
||||
| Some (nextnode1, Some nextnode2) -> (
|
||||
let ncs = nextCommonSuccessor prg nextnode1 nextnode2 in
|
||||
@ -248,6 +252,7 @@ let rec helper
|
||||
| BImmOp (_, _, _, r)
|
||||
| URegOp (_, _, r)
|
||||
| Load (_, r)
|
||||
| Store (r, _)
|
||||
| LoadI (_, r) -> (([Label label1] : RISCAssembly.risci list) @
|
||||
currentcode @
|
||||
([CJump (r, label2, label3); Label label2] : RISCAssembly.risci list) @
|
||||
@ -269,6 +274,7 @@ let rec helper
|
||||
| BImmOp (_, _, _, r)
|
||||
| URegOp (_, _, r)
|
||||
| Load (_, r)
|
||||
| Store (r, _)
|
||||
| LoadI (_, r) -> (currentcode @
|
||||
([CJump (r, label1, label2); Label label1] : RISCAssembly.risci list) @
|
||||
res1 @
|
||||
|
||||
Reference in New Issue
Block a user