Skip to content

Commit 816372b

Browse files
committed
ego and -O2 works.
1 parent c15abbf commit 816372b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+636
-413
lines changed

build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"util/ack+all",
1515
"util/amisc+all",
1616
"util/arch+all",
17+
"util/ego+all",
1718
"util/led+all",
1819
"util/misc+all",
1920
"util/opt+all",

examples/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
plat=plat,
1313
lang="c",
1414
srcs=[f"./{prog}"],
15-
cflags=["-O"],
15+
cflags=["-O2"],
1616
)
1717
exports[f"$(PLATIND)/examples/{name}_{plat}.exe"] = f".+{name}_{plat}"
1818

h/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"arch.h",
3333
"ranlib.h",
3434
"em_abs.h",
35+
"em_ego.h",
3536
"em_flag.h",
3637
"em_ptyp.h",
3738
"em_mes.h",

util/ego/bo/bo.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
#include <em_pseu.h>
1515
#include <em_spec.h>
1616
#include <em_flag.h>
17-
#include "../share/types.h"
18-
#include "../share/debug.h"
19-
#include "../share/global.h"
20-
#include "../share/files.h"
21-
#include "../share/get.h"
22-
#include "../share/put.h"
23-
#include "../share/lset.h"
24-
#include "../share/map.h"
25-
#include "../share/alloc.h"
26-
#include "../share/utils.h"
27-
#include "../share/def.h"
28-
#include "../share/go.h"
17+
#include "ego/share/types.h"
18+
#include "ego/share/debug.h"
19+
#include "ego/share/global.h"
20+
#include "ego/share/files.h"
21+
#include "ego/share/get.h"
22+
#include "ego/share/put.h"
23+
#include "ego/share/lset.h"
24+
#include "ego/share/map.h"
25+
#include "ego/share/alloc.h"
26+
#include "ego/share/utils.h"
27+
#include "ego/share/def.h"
28+
#include "ego/share/go.h"
2929

3030
extern char em_flag[];
3131

util/ego/build.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
from build.ab import export, simplerule, filenamesof, targetof, filenameof
2+
from build.c import cprogram
3+
from glob import glob
4+
from fnmatch import filter
5+
6+
em_mnem = filter(filenamesof([targetof("modules/src/em_data")]), "*/em_mnem.h")[
7+
0
8+
]
9+
exports = {}
10+
11+
12+
def build_ego_helper(name, srcs=[], deps=[]):
13+
cprogram(
14+
name=name,
15+
srcs=(
16+
glob(f"util/ego/{name}/*.c") + glob(f"util/ego/{name}/*.h") + srcs
17+
),
18+
deps=[
19+
"util/ego/share",
20+
"modules/src/em_data",
21+
"modules/src/system",
22+
"h",
23+
]
24+
+ deps,
25+
cflags=["-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"],
26+
)
27+
exports[f"$(PLATDEP)/ego/{name}"] = f".+{name}"
28+
29+
30+
def build_descr(name):
31+
simplerule(
32+
name=f"{name}_descr",
33+
ins=[
34+
"lang/cem/cpp.ansi",
35+
f"./descr/{name}.descr",
36+
"./descr/descr.sed",
37+
em_mnem,
38+
],
39+
outs=[f"={name}.descr"],
40+
commands=[
41+
"$[ins[0]] -P -I$[dirname(filenameof(ins[3]))] $[ins[1]] > $[dir]/temp",
42+
"sed -f $[ins[2]] < $[dir]/temp > $[outs]",
43+
],
44+
)
45+
46+
exports[f"$(PLATIND)/ego/{name}.descr"] = f".+{name}_descr"
47+
48+
49+
build_ego_helper("bo")
50+
build_ego_helper("ca")
51+
build_ego_helper("cf")
52+
build_ego_helper("cj")
53+
build_ego_helper("cs")
54+
build_ego_helper("ic")
55+
build_ego_helper("il")
56+
build_ego_helper("lv")
57+
build_ego_helper("sp")
58+
build_ego_helper("sr")
59+
build_ego_helper("ud")
60+
61+
build_descr("i86")
62+
63+
cprogram(
64+
name="em_ego",
65+
srcs=["./em_ego/em_ego.c"],
66+
deps=[
67+
"modules/src/string",
68+
"modules/src/system",
69+
"modules/src/data",
70+
"modules/h",
71+
"h",
72+
],
73+
)
74+
75+
export(
76+
name="all",
77+
items={"$(PLATDEP)/em_ego": ".+em_ego", "$(PLATDEP)/ego/ra": "./ra"}
78+
| exports,
79+
)

util/ego/ca/ca.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
#include <em_pseu.h>
1515
#include <em_mes.h>
1616
#include "system.h"
17-
#include "../share/types.h"
17+
#include "ego/share/types.h"
1818
#include "ca.h"
19-
#include "../share/debug.h"
20-
#include "../share/global.h"
21-
#include "../share/lset.h"
22-
#include "../share/files.h"
23-
#include "../share/map.h"
24-
#include "../share/alloc.h"
25-
#include "../share/get.h"
19+
#include "ego/share/debug.h"
20+
#include "ego/share/global.h"
21+
#include "ego/share/lset.h"
22+
#include "ego/share/files.h"
23+
#include "ego/share/map.h"
24+
#include "ego/share/alloc.h"
25+
#include "ego/share/get.h"
2626
#include "ca_put.h"
2727

2828
/* This phase transforms the Intermediate Code of the global optimizer

util/ego/ca/ca_put.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#include <em_mnem.h>
1010
#include <em_flag.h>
1111
#include <em_mes.h>
12-
#include "../share/types.h"
12+
#include "ego/share/types.h"
1313
#include "ca.h"
1414
#include "ca_put.h"
15-
#include "../share/debug.h"
16-
#include "../share/def.h"
17-
#include "../share/map.h"
18-
#include "../share/alloc.h"
15+
#include "ego/share/debug.h"
16+
#include "ego/share/def.h"
17+
#include "ego/share/map.h"
18+
#include "ego/share/alloc.h"
1919

2020
#define outbyte(b) putc(b, outfile)
2121

util/ego/cf/cf.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
#include <em_spec.h>
1616
#include <em_flag.h>
1717
#include <em_mes.h>
18-
#include "../share/types.h"
19-
#include "../share/debug.h"
20-
#include "../share/map.h"
21-
#include "../share/files.h"
22-
#include "../share/global.h"
23-
#include "../share/alloc.h"
24-
#include "../share/lset.h"
25-
#include "../share/cset.h"
26-
#include "../share/get.h"
27-
#include "../share/put.h"
28-
#include "../share/def.h"
29-
#include "../share/utils.h"
18+
#include "ego/share/types.h"
19+
#include "ego/share/debug.h"
20+
#include "ego/share/map.h"
21+
#include "ego/share/files.h"
22+
#include "ego/share/global.h"
23+
#include "ego/share/alloc.h"
24+
#include "ego/share/lset.h"
25+
#include "ego/share/cset.h"
26+
#include "ego/share/get.h"
27+
#include "ego/share/put.h"
28+
#include "ego/share/def.h"
29+
#include "ego/share/utils.h"
3030
#include "cf.h"
3131
#include "cf_succ.h"
3232
#include "cf_idom.h"

util/ego/cf/cf_idom.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* C F _ I D O M . C
99
*/
1010

11-
#include "../share/types.h"
12-
#include "../share/debug.h"
13-
#include "../share/lset.h"
14-
#include "../share/alloc.h"
11+
#include "ego/share/types.h"
12+
#include "ego/share/debug.h"
13+
#include "ego/share/lset.h"
14+
#include "ego/share/alloc.h"
1515
#include "cf.h"
1616

1717
/* The algorithm for finding dominators in a flowgraph

util/ego/cf/cf_loop.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
*/
1010

1111
#include <stdlib.h>
12-
#include "../share/types.h"
13-
#include "../share/debug.h"
14-
#include "../share/lset.h"
15-
#include "../share/alloc.h"
16-
#include "../share/utils.h"
12+
#include "ego/share/types.h"
13+
#include "ego/share/debug.h"
14+
#include "ego/share/lset.h"
15+
#include "ego/share/alloc.h"
16+
#include "ego/share/utils.h"
1717
#include "cf.h"
1818

1919
#define MARK_STRONG(b) b->b_flags |= BF_STRONG

0 commit comments

Comments
 (0)