File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import sys , os , time
2
+ from pythonparser import diagnostic
3
+ from .. import Module
4
+ from ..targets import OR1KTarget
5
+
6
+ def main ():
7
+ if not len (sys .argv ) > 1 :
8
+ print ("Expected at least one module filename" , file = sys .stderr )
9
+ exit (1 )
10
+
11
+ def process_diagnostic (diag ):
12
+ print ("\n " .join (diag .render ()), file = sys .stderr )
13
+ if diag .level in ("fatal" , "error" ):
14
+ exit (1 )
15
+
16
+ engine = diagnostic .Engine ()
17
+ engine .process = process_diagnostic
18
+
19
+ modules = []
20
+ for filename in sys .argv [1 :]:
21
+ modules .append (Module .from_filename (filename , engine = engine ))
22
+
23
+ runs = 100
24
+ start = time .perf_counter ()
25
+ for _ in range (runs ):
26
+ llobj = OR1KTarget ().compile_and_link (modules )
27
+ end = time .perf_counter ()
28
+
29
+ print ("{} compilation runs: {:.2f}s, {:.2f}ms/run" .format (
30
+ runs , end - start , (end - start ) / runs * 1000 ))
31
+
32
+ if __name__ == "__main__" :
33
+ main ()
You can’t perform that action at this time.
0 commit comments