Commit aa26db13 authored by Cyril SIX's avatar Cyril SIX
Browse files

MPPA - Added coverage test

parent 28db3119
[submodule "test/mppa/asm_coverage"]
path = test/mppa/asm_coverage
url = git@gricad-gitlab.univ-grenoble-alpes.fr:sixcy/asm-scanner.git
......@@ -196,7 +196,7 @@ module Target : TARGET =
| Pj_l(s) ->
fprintf oc " goto %a\n;;\n" print_label s
| Pret ->
fprintf oc " ret\n;;\n"
fprintf oc " ret \n;;\n"
| Pget (rd, rs) ->
fprintf oc " get %a = %a\n;;\n" ireg rd preg rs
| Pset (rd, rs) ->
......@@ -288,11 +288,11 @@ module Target : TARGET =
| Pcompw (it, rd, rs1, rs2) ->
fprintf oc " compw.%a %a = %a, %a\n;;\n" icond it ireg rd ireg rs1 ireg rs2
| Pcompiw (it, rd, rs1, imm) ->
fprintf oc " compiw.%a %a = %a, %a\n;;\n" icond it ireg rd ireg rs1 coqint64 imm
fprintf oc " compw.%a %a = %a, %a\n;;\n" icond it ireg rd ireg rs1 coqint64 imm
| Pcompd (it, rd, rs1, rs2) ->
fprintf oc " compd.%a %a = %a, %a\n;;\n" icond it ireg rd ireg rs1 ireg rs2
| Pcompid (it, rd, rs1, imm) ->
fprintf oc " compid.%a %a = %a, %a\n;;\n" icond it ireg rd ireg rs1 coqint64 imm
fprintf oc " compd.%a %a = %a, %a\n;;\n" icond it ireg rd ireg rs1 coqint64 imm
| Pcb (bt, r, lbl) | Pcbu (bt, r, lbl) ->
fprintf oc " cb.%a %a?%a\n;;\n" bcond bt ireg r print_label lbl
......
......@@ -36,6 +36,11 @@ FORCE:
.PHONY:
check: $(TOK) sort mmult
.PHONY:
coverage: $(ASM)
bash coverage.sh $(DIR)/$(ASMDIR)
.PHONY:
sort: FORCE
(cd sort && make compc-check)
......
Subproject commit 5bdb081bc5fd4962315e960af3c539f2ddd24477
asmdir=$1
to_cover_raw=/tmp/to_cover_raw
to_cover=/tmp/to_cover
covered_raw=/tmp/covered_raw
covered=/tmp/covered
sed -n "s/^.*fprintf oc \" \(.*\) .*/\1/p" ../../mppa_k1c/TargetPrinter.ml > $to_cover_raw
sed -n "s/^.*fprintf oc \" \(.*\)\\n.*/\1/p" ../../mppa_k1c/TargetPrinter.ml >> $to_cover_raw
python2.7 coverage_helper.py $to_cover_raw > $to_cover
rm -f $covered_raw
for asm in $(ls $asmdir/*.s); do
bash asm_coverage/asm-coverage.sh $asm >> $covered_raw
done
python2.7 coverage_helper.py $covered_raw > $covered
vimdiff $to_cover $covered
import fileinput
occurs = {}
for line in fileinput.input():
line_noc = line.replace('\n', '')
if line_noc not in occurs:
occurs[line_noc] = 0
occurs[line_noc] += 1
# HACK: Removing all the instructions with "%a", replacing them with all their variations
# Also removing all instructions starting with '.'
pruned_occurs = dict(occurs)
for inst in occurs:
if inst[0] == '.':
del pruned_occurs[inst]
if "%a" not in inst:
continue
inst_no_a = inst.replace(".%a", "")
if inst_no_a in ("compw", "compd"):
del pruned_occurs[inst]
for mod in ("ne", "eq", "lt", "gt", "le", "ge", "ltu", "leu", "geu",
"gtu", "all", "any", "nall", "none"):
pruned_occurs[inst_no_a + "." + mod] = 1
elif inst_no_a in ("cb"):
del pruned_occurs[inst]
for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "dnez",
"dltz", "dgez", "dlez", "dgtz"):
pruned_occurs[inst_no_a + "." + mod] = 1
else:
assert False, "Found instruction with %a: " + inst
occurs = pruned_occurs
for inst in sorted(occurs):
print inst
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment