aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-21 15:10:06 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-21 15:10:06 +0200
commit6e331ae1185694e1ca542db00445968c107c26b9 (patch)
tree434656b1dc22c795a809ced7199cb0a46f91f85d /test/monniaux
parentad6ff26beeb42b0e34a95939baa6d41b369e5d56 (diff)
parent04dabc46a0c8dd795e5d4090134d5e0f52847f9f (diff)
downloadcompcert-kvx-6e331ae1185694e1ca542db00445968c107c26b9.tar.gz
compcert-kvx-6e331ae1185694e1ca542db00445968c107c26b9.zip
Merge remote-tracking branch 'origin/mppa-work' into mppa-fast-div
Diffstat (limited to 'test/monniaux')
-rwxr-xr-xtest/monniaux/gengraphs.py15
-rwxr-xr-xtest/monniaux/genmake.py17
2 files changed, 17 insertions, 15 deletions
diff --git a/test/monniaux/gengraphs.py b/test/monniaux/gengraphs.py
index 2455c285..fd8098b7 100755
--- a/test/monniaux/gengraphs.py
+++ b/test/monniaux/gengraphs.py
@@ -1,9 +1,10 @@
#!/usr/bin/python3.6
-import numpy as np
-import matplotlib.pyplot as plt
-import pandas as pd
+import numpy as np # type: ignore
+import matplotlib.pyplot as plt # type: ignore
+import pandas as pd # type: ignore
import sys
+from typing import *
##
# Reading data
@@ -28,7 +29,7 @@ colors = ["forestgreen", "darkorange", "cornflowerblue", "darkorchid", "darksalm
# Generating PDF
##
-def extract_envs(keys):
+def extract_envs(keys: List[str]) -> List[str]:
envs = []
for key in keys:
words = key.split()[:-1]
@@ -36,11 +37,11 @@ def extract_envs(keys):
return envs
-def subdivide_interv(inf, sup, n):
+def subdivide_interv(inf: float, sup: float, n: int) -> List[float]:
return [inf + k*(sup-inf)/n for k in range(n)]
-def generate_file(f, cols):
+def generate_file(f: str, cols: List[str]) -> None:
ind = np.arange(len(df[cols[0]]))
width = 0.35 # the width of the bars
@@ -63,7 +64,7 @@ def generate_file(f, cols):
ax.set_xticklabels(benches)
ax.legend()
- def autolabel(rects, xpos='center'):
+ def autolabel(rects: List[Any], xpos='center') -> None:
"""
Attach a text label above each bar in *rects*, displaying its height.
diff --git a/test/monniaux/genmake.py b/test/monniaux/genmake.py
index ad460b14..d04ba70c 100755
--- a/test/monniaux/genmake.py
+++ b/test/monniaux/genmake.py
@@ -8,6 +8,7 @@ See the source for more info.
"""
from collections import namedtuple
+from typing import *
import sys
import yaml
@@ -36,7 +37,7 @@ if len(sys.argv) != 2:
yaml_file = sys.argv[1]
with open(yaml_file, "r") as f:
- settings = yaml.load(f.read(), Loader=yaml.FullLoader)
+ settings = yaml.load(f.read(), Loader=yaml.SafeLoader)
basename = settings["target"]
objdeps = settings["objdeps"] if "objdeps" in settings else []
@@ -56,22 +57,22 @@ for objdep in objdeps:
# Printing the rules
##
-def make_product(env, optim):
+def make_product(env: Env, optim: Optim) -> str:
return basename + "." + env.compiler.short + (("." + optim.short) if optim.short != "" else "") + "." + env.target
-def make_obj(name, env, compiler_short):
+def make_obj(name: str, env: Env, compiler_short: str) -> str:
return name + "." + compiler_short + "." + env.target + ".o"
-def make_clock(env, optim):
+def make_clock(env: Env, optim: Optim) -> str:
return "clock.gcc." + env.target
-def make_sources(env, optim):
+def make_sources(env: Env, optim: Optim) -> str:
if sources:
return "$(src:.c=." + env.compiler.short + (("." + optim.short) if optim.short != "" else "") + "." + env.target + ".o)"
else:
return "{product}.o".format(product = make_product(env, optim))
-def print_rule(env, optim):
+def print_rule(env: Env, optim: Optim) -> None:
print("{product}: {sources} ../{clock}.o "
.format(product = make_product(env, optim),
sources = make_sources(env, optim), clock = make_clock(env, optim))
@@ -79,12 +80,12 @@ def print_rule(env, optim):
print(" {compiler} {flags} $+ -o $@"
.format(compiler = env.compiler.full, flags = optim.full))
-def make_env_list(envs):
+def make_env_list(envs: List[Env]) -> str:
return ",".join([(env.compiler.short + ((" " + optim.short) if optim.short != "" else "") + " " + env.target)
for env in environments
for optim in env.optimizations])
-def print_measure_rule(environments, measures):
+def print_measure_rule(environments: List[Env], measures: List[Union[List[str], str]]) -> None:
print("measures.csv: $(PRODUCTS_OUT)")
print(' echo "benches, {}" > $@'.format(make_env_list(environments)))
for measure in measures: