blob: b94e1a7b0fcc382d096af60c53f36e451cf48558 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
* Python Front-End to GCC
This is a fully ahead of time implementation of Python, built ontop
of GCC for a feature rich, optimizing middle-end and backend.
** Building
Building GCCPY is fairly confsing to most people who haven't built
GCC before:
YOU CANNOT build GCC within the same directory of the sources!
#+BEGIN_SRC bash
$ apt-get install bison flex build-essential
#+END_SRC
Then to compile:
#+BEGIN_SRC bash
$ git clone ...
$ cd gccpy
$ ./contrib/download_prerequisites # optional
$ mkdir gccpy-build
$ cd gccpy-build
$ ../configure --prefix=/opt/gccpy \
--enable-languages=python \
--disable-multilib \
--disable-bootstrap
$ make
$ cd -
#+END_SRC
*** Usage
For my development sessions i generally pass:
#+BEGIN_SRC bash
$ gccpy -fdump-tree-gimple -fpy-dump-dot -fpy-gen-main -fpy-optimize -O0 -g test.py -o test
#+END_SRC
Options:
-fpy-gen-main Python has no explicit main method so we require at
compile time for the user to explicitly say where the main method
should be compiled in.
-fpy-dump-dot Dumps out the textural output of the DOT IL
-fpy-optimize Experimental optimizers for Python at the DOT IL level
constant folding and propagation to some extend with data-flow
analysis could be implemented.
-fdump-tree-gimple Dumps the textural output of the code generated
for the GCC middle-end.
You can use all normal GCC options -O2 -g -mtune= -march= etc...
** Status
Very must still serves as a proof of concept but most of the core
principles are implemented and work fairly well
** Major Projects
*** Garbage collector
We need one.
*** Port Python stdlib
Port the python stdlib and figure out if we want to implement modules
as static libraries or shared libraries.
*** Multi-core
Implement threading
|