Change hw6 to an unsolved version.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
0c04936ccf
commit
ee01a8f5b2
186 changed files with 9605 additions and 4019 deletions
|
|
@ -18,7 +18,7 @@ let exec_ll_ast path ll_ast args extra_files =
|
|||
let output_path = !Platform.output_path in
|
||||
|
||||
(* First - optimize the ll ast *)
|
||||
let _ = Opt.opt_level := 1 in
|
||||
let _ = Opt.do_opt := true in
|
||||
let ll_ast = Opt.optimize ll_ast in
|
||||
|
||||
(* Write out the optimized ll file for debugging purposes *)
|
||||
|
|
@ -86,23 +86,23 @@ let compile_with_config live regalloc ll_ast =
|
|||
|
||||
let assert_quality fn ll_ast =
|
||||
if not !pass_all then failwith "Your register allocator failed a correctness test" else
|
||||
let _ = Opt.opt_level := 1 in
|
||||
let _ = Opt.do_opt := true in
|
||||
let ll_ast = Opt.optimize ll_ast in
|
||||
let h_greedy, size_greedy, x86_greedy = compile_with_config "dataflow" "greedy" ll_ast in
|
||||
let h_better, size_better, x86_better = compile_with_config "dataflow" "better" ll_ast in
|
||||
let mem_greedy = Registers.memop_of_prog x86_greedy in
|
||||
let mem_better = Registers.memop_of_prog x86_better in
|
||||
let _ =
|
||||
if !Driver.print_regs_flag then begin
|
||||
Printf.printf "greedy sz: %4d mem: %4d\t\tbetter sz: %4d mem: %4d \t diff_sz: %4d diff_mem: %4d - %s\n"
|
||||
let msg =
|
||||
Printf.sprintf "greedy sz: %4d mem: %4d\t\tbetter sz: %4d mem: %4d \t diff_sz: %4d diff_mem: %4d - %s\n"
|
||||
size_greedy mem_greedy size_better mem_better (size_greedy - size_better) (mem_greedy - mem_better) fn
|
||||
end
|
||||
in
|
||||
let _ = if !Driver.print_regs_flag then begin Printf.printf "%s" msg end
|
||||
in
|
||||
if
|
||||
mem_better < mem_greedy then ()
|
||||
else if
|
||||
size_better < size_greedy then ()
|
||||
else failwith @@ Printf.sprintf "greedy is better"
|
||||
else failwith @@ Printf.sprintf "GREEDY is better\n%s" msg
|
||||
|
||||
let assert_quality_oat fn () =
|
||||
let oat_ast = parse_oat_file fn in
|
||||
|
|
@ -322,8 +322,10 @@ let greedy_is_good_tests = [
|
|||
("hw4programs/run38.oat", "", "31");
|
||||
("hw4programs/run40.oat", "", "8");
|
||||
("hw4programs/run60.oat", "", "85");
|
||||
("hw4programs/heap.oat", "", "1");
|
||||
("hw5programs/ifq2.oat", "", "5");
|
||||
("hw5programs/length1.oat", "", "5");
|
||||
("hw4programs/lcs.oat", "", "OAT0");
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -361,7 +363,7 @@ let hw4_easy_tests = [
|
|||
("hw4programs/run42.oat", "", "2");
|
||||
("hw4programs/run49.oat", "", "abc0");
|
||||
("hw4programs/run50.oat", "", "abcde0");
|
||||
("hw4programs/run61.oat", "", "3410");
|
||||
("hw4programs/run61.oat", "", "131");
|
||||
]
|
||||
|
||||
let hw4_medium_tests = [
|
||||
|
|
@ -401,9 +403,19 @@ let hw4_hard_tests = [
|
|||
("hw4programs/msort2.oat", "", "~}|{zyxwvu uvwxyz{|}~ 0");
|
||||
("hw4programs/selectionsort.oat", "", "01253065992000");
|
||||
("hw4programs/matrixmult.oat", "", "19 16 13 23 \t5 6 7 6 \t19 16 13 23 \t5 6 7 6 \t0");
|
||||
("hw4programs/binary_search.oat", "", "Correct!0");
|
||||
("hw4programs/xor_shift.oat", "", "838867572\n22817190600");
|
||||
("hw4programs/gcd.oat", "", "16")
|
||||
]
|
||||
|
||||
let hw4_old_student_tests = [
|
||||
("hw4programs/binary_search.oat", "", "Correct!0")
|
||||
; ("hw4programs/xor_shift.oat", "", "838867572\n22817190600")
|
||||
; ("hw4programs/sieve.oat", "", "25")
|
||||
; ("hw4programs/fibo.oat", "", "0")
|
||||
; ("hw4programs/lfsr.oat", "", "TFTF FFTT0")
|
||||
; ("hw4programs/gnomesort.oat", "", "01253065992000")
|
||||
; ("hw4programs/josh_joyce_test.oat", "", "0")
|
||||
; ("hw4programs/gcd.oat", "", "16")
|
||||
; ("hw4programs/insertion_sort.oat", "", "42")
|
||||
; ("hw4programs/maxsubsequence.oat", "", "107")
|
||||
]
|
||||
|
||||
let struct_tests = [
|
||||
|
|
@ -438,6 +450,7 @@ let regalloc_challenge_tests = [
|
|||
("hw4programs/run54.oat", "", "10");
|
||||
("hw4programs/run55.oat", "", "6");
|
||||
("hw4programs/qsort.oat", "", "kpyf{shomfhkmopsy{255");
|
||||
("hw4programs/count_sort.oat", "", "AFHZAAEYC\nAAACEFHYZ0");
|
||||
]
|
||||
|
||||
let new_tests = [
|
||||
|
|
@ -447,81 +460,94 @@ let new_tests = [
|
|||
("hw5programs/initarr2.oat", "", "2");
|
||||
]
|
||||
|
||||
|
||||
let oat_regalloc_quality_tests =
|
||||
hw4_easiest_tests
|
||||
@ hw4_path_tests
|
||||
@ hw4_easy_tests
|
||||
@ hw4_medium_tests
|
||||
@ hw4_hard_tests
|
||||
@ hw4_old_student_tests
|
||||
@ struct_tests
|
||||
@ fptr_tests
|
||||
@ new_tests
|
||||
@ regalloc_challenge_tests
|
||||
|
||||
|
||||
|
||||
let oat_correctness_tests =
|
||||
oat_regalloc_quality_tests
|
||||
@ hw4_globals_tests
|
||||
@ greedy_is_good_tests
|
||||
|
||||
let dce_opt_tests =
|
||||
[ "llprograms/analysis1_cf_opt.ll", "llprograms/analysis1_dce_opt.ll"
|
||||
; "llprograms/analysis2_cf_opt.ll", "llprograms/analysis2_dce_opt.ll"
|
||||
; "llprograms/analysis3_cf_opt.ll", "llprograms/analysis3_dce_opt.ll"
|
||||
; "llprograms/analysis4_cf_opt.ll", "llprograms/analysis4_dce_opt.ll"
|
||||
; "llprograms/analysis5_cf_opt.ll", "llprograms/analysis5_dce_opt.ll"
|
||||
; "llprograms/analysis6_cf_opt.ll", "llprograms/analysis6_dce_opt.ll"
|
||||
; "llprograms/analysis7_cf_opt.ll", "llprograms/analysis7_dce_opt.ll"
|
||||
; "llprograms/analysis8_cf_opt.ll", "llprograms/analysis8_dce_opt.ll"
|
||||
; "llprograms/analysis9_cf_opt.ll", "llprograms/analysis9_dce_opt.ll"
|
||||
; "llprograms/analysis10_cf_opt.ll", "llprograms/analysis10_dce_opt.ll"
|
||||
; "llprograms/analysis11_cf_opt.ll", "llprograms/analysis11_dce_opt.ll"
|
||||
; "llprograms/analysis12_cf_opt.ll", "llprograms/analysis12_dce_opt.ll"
|
||||
; "llprograms/analysis13_cf_opt.ll", "llprograms/analysis13_dce_opt.ll"
|
||||
; "llprograms/analysis14_cf_opt.ll", "llprograms/analysis14_dce_opt.ll"
|
||||
; "llprograms/analysis15_cf_opt.ll", "llprograms/analysis15_dce_opt.ll"
|
||||
; "llprograms/analysis16_cf_opt.ll", "llprograms/analysis16_dce_opt.ll"
|
||||
; "llprograms/analysis17_cf_opt.ll", "llprograms/analysis17_dce_opt.ll"
|
||||
; "llprograms/analysis18_cf_opt.ll", "llprograms/analysis18_dce_opt.ll"
|
||||
; "llprograms/analysis19_cf_opt.ll", "llprograms/analysis19_dce_opt.ll"
|
||||
]
|
||||
|
||||
let dce_opt_tests =
|
||||
[ "llprograms/analysis1_cf_opt.ll", "llprograms/analysis1_dce_opt.ll"
|
||||
; "llprograms/analysis2_cf_opt.ll", "llprograms/analysis2_dce_opt.ll"
|
||||
; "llprograms/analysis3_cf_opt.ll", "llprograms/analysis3_dce_opt.ll"
|
||||
; "llprograms/analysis4_cf_opt.ll", "llprograms/analysis4_dce_opt.ll"
|
||||
; "llprograms/analysis5_cf_opt.ll", "llprograms/analysis5_dce_opt.ll"
|
||||
; "llprograms/analysis6_cf_opt.ll", "llprograms/analysis6_dce_opt.ll"
|
||||
; "llprograms/analysis7_cf_opt.ll", "llprograms/analysis7_dce_opt.ll"
|
||||
; "llprograms/analysis8_cf_opt.ll", "llprograms/analysis8_dce_opt.ll"
|
||||
; "llprograms/analysis9_cf_opt.ll", "llprograms/analysis9_dce_opt.ll"
|
||||
; "llprograms/analysis10_cf_opt.ll", "llprograms/analysis10_dce_opt.ll"
|
||||
; "llprograms/analysis11_cf_opt.ll", "llprograms/analysis11_dce_opt.ll"
|
||||
; "llprograms/analysis12_cf_opt.ll", "llprograms/analysis12_dce_opt.ll"
|
||||
]
|
||||
|
||||
let constprop_opt_tests =
|
||||
[ "llprograms/analysis1.ll", "llprograms/analysis1_cf_opt.ll"
|
||||
; "llprograms/analysis2.ll", "llprograms/analysis2_cf_opt.ll"
|
||||
; "llprograms/analysis3.ll", "llprograms/analysis3_cf_opt.ll"
|
||||
; "llprograms/analysis4.ll", "llprograms/analysis4_cf_opt.ll"
|
||||
; "llprograms/analysis5.ll", "llprograms/analysis5_cf_opt.ll"
|
||||
; "llprograms/analysis6.ll", "llprograms/analysis6_cf_opt.ll"
|
||||
; "llprograms/analysis7.ll", "llprograms/analysis7_cf_opt.ll"
|
||||
; "llprograms/analysis8.ll", "llprograms/analysis8_cf_opt.ll"
|
||||
; "llprograms/analysis9.ll", "llprograms/analysis9_cf_opt.ll"
|
||||
; "llprograms/analysis10.ll", "llprograms/analysis10_cf_opt.ll"
|
||||
; "llprograms/analysis11.ll", "llprograms/analysis11_cf_opt.ll"
|
||||
; "llprograms/analysis12.ll", "llprograms/analysis12_cf_opt.ll"
|
||||
; "llprograms/analysis13.ll", "llprograms/analysis13_cf_opt.ll"
|
||||
; "llprograms/analysis14.ll", "llprograms/analysis14_cf_opt.ll"
|
||||
; "llprograms/analysis15.ll", "llprograms/analysis15_cf_opt.ll"
|
||||
; "llprograms/analysis16.ll", "llprograms/analysis16_cf_opt.ll"
|
||||
; "llprograms/analysis17.ll", "llprograms/analysis17_cf_opt.ll"
|
||||
; "llprograms/analysis18.ll", "llprograms/analysis18_cf_opt.ll"
|
||||
; "llprograms/analysis19.ll", "llprograms/analysis19_cf_opt.ll"
|
||||
]
|
||||
|
||||
|
||||
|
||||
let constprop_opt_tests =
|
||||
[ "llprograms/analysis1.ll", "llprograms/analysis1_cf_opt.ll"
|
||||
; "llprograms/analysis2.ll", "llprograms/analysis2_cf_opt.ll"
|
||||
; "llprograms/analysis3.ll", "llprograms/analysis3_cf_opt.ll"
|
||||
; "llprograms/analysis4.ll", "llprograms/analysis4_cf_opt.ll"
|
||||
; "llprograms/analysis5.ll", "llprograms/analysis5_cf_opt.ll"
|
||||
; "llprograms/analysis6.ll", "llprograms/analysis6_cf_opt.ll"
|
||||
; "llprograms/analysis7.ll", "llprograms/analysis7_cf_opt.ll"
|
||||
; "llprograms/analysis8.ll", "llprograms/analysis8_cf_opt.ll"
|
||||
; "llprograms/analysis9.ll", "llprograms/analysis9_cf_opt.ll"
|
||||
; "llprograms/analysis10.ll", "llprograms/analysis10_cf_opt.ll"
|
||||
; "llprograms/analysis11.ll", "llprograms/analysis11_cf_opt.ll"
|
||||
; "llprograms/analysis12.ll", "llprograms/analysis12_cf_opt.ll"
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
let tests : suite =
|
||||
[
|
||||
GradedTest("solver / liveness analysis tests", 13, dfa_liveness_file liveness_analysis_tests);
|
||||
GradedTest("alias analysis tests", 13, dfa_alias_file alias_analysis_tests);
|
||||
GradedTest("constprop analysis tests", 18, dfa_constprop_file constprop_analysis_tests);
|
||||
GradedTest("dce optimization tests", 13, opt_dce_file dce_opt_tests);
|
||||
GradedTest("constprop optimization tests", 13, opt_constfold_file constprop_opt_tests);
|
||||
|
||||
]
|
||||
(* Uncomment the following code if you are doing the optional Task IV Register Allocation *)
|
||||
(*
|
||||
@
|
||||
[
|
||||
Test("ll regalloc correctness tests", pass_all_executed_ll_file ll_tests);
|
||||
Test("oat regalloc correctness tests", pass_all_executed_oat_file (oat_correctness_tests @ regalloc_challenge_tests));
|
||||
GradedTest("oat regalloc quality tests", 0, quality_oat oat_regalloc_quality_tests);
|
||||
]
|
||||
*)
|
||||
|
||||
|
||||
|
||||
let graded_tests : suite =
|
||||
timeout_suite 10 tests
|
||||
|
||||
|
||||
let tests : suite =
|
||||
[
|
||||
GradedTest("solver / liveness analysis tests", 10, dfa_liveness_file liveness_analysis_tests);
|
||||
GradedTest("alias analysis tests", 10, dfa_alias_file alias_analysis_tests);
|
||||
GradedTest("dce optimization tests", 10, opt_dce_file dce_opt_tests);
|
||||
GradedTest("constprop analysis tests", 15, dfa_constprop_file constprop_analysis_tests);
|
||||
GradedTest("constprop optimization tests", 10, opt_constfold_file constprop_opt_tests);
|
||||
Test("ll regalloc correctness tests", pass_all_executed_ll_file ll_tests);
|
||||
Test("oat regalloc correctness tests", pass_all_executed_oat_file (oat_correctness_tests @ regalloc_challenge_tests));
|
||||
GradedTest("oat regalloc quality tests", 35, quality_oat oat_regalloc_quality_tests);
|
||||
|
||||
|
||||
]
|
||||
|
||||
let manual_tests : suite = [
|
||||
GradedTest ("Submitted Test Case", 5,
|
||||
[("manually", assert_eq true false)]
|
||||
)
|
||||
; GradedTest ("Performance Comparison", 5,
|
||||
[("manually", assert_eq true false)]
|
||||
)
|
||||
]
|
||||
|
||||
let graded_tests : suite =
|
||||
tests @
|
||||
manual_tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue