Added VirtualRegister class. Added generation of Register/Resource tables
[jitcs.git] / makefile
blobd7ebeb95c50f847e0b406538835fdeefca8feda8
1 CC = g++.bat
2 CFLAGS = -I ./include
3 CFLAGS_DBG32 =
4 CFLAGS_REL32 = -O3
5 CFLAGS_DBG64 = -m64
6 CFLAGS_REL64 = -O3 -m64
7 LUA = luax51.bat
8 SRC_SRC = cpu.cpp dumper.cpp tmpalloc.cpp memmgr.cpp bblock.cpp function.cpp callingconvention.cpp \
9 bblock_impl.cpp function_impl.cpp callingconvention_impl.cpp spillslotinfo.cpp \
10 host.cpp machine.cpp virtualregister.cpp
11 SRC_X86 = x86_32_callingconvention.cpp x86_64_callingconvention.cpp \
12 x86_32_machine.cpp x86_64_machine.cpp x86_32_regs.cpp x86_64_regs.cpp
13 SRC_UNITTEST = test_unittest.cpp test_main.cpp test_fnctypeinfo.cpp \
14 test_adt_range.cpp test_adt_slice.cpp test_callingconvention.cpp
15 PREFIXES_LIBSRC = dbg32_ rel32_ dbg64_ rel64_
16 PREFIXES_TESTSRC = test32_ test64_
17 OBJDIR = _objs
18 LIBDIR = _lib
19 BINDIR = _bin
20 TEST_NAMES = $(patsubst %.cpp,%.o,$(SRC_SRC))
21 LIBOBJ_NAMES = $(addprefix src_,$(patsubst %.cpp,%.o,$(SRC_SRC))) \
22 $(addprefix x86_,$(patsubst %.cpp,%.o,$(SRC_X86)))
23 LIBOBJS_DEBUG32 = $(addprefix $(OBJDIR)/dbg32_,$(LIBOBJ_NAMES))
24 LIBOBJS_RELEASE32 = $(addprefix $(OBJDIR)/rel32_,$(LIBOBJ_NAMES))
25 LIBOBJS_DEBUG64 = $(addprefix $(OBJDIR)/dbg64_,$(LIBOBJ_NAMES))
26 LIBOBJS_RELEASE64 = $(addprefix $(OBJDIR)/rel64_,$(LIBOBJ_NAMES))
27 UNITTESTOBJS_RELEASE32 = $(addprefix $(OBJDIR)/test32_,$(patsubst test_%.cpp,%.o,$(SRC_UNITTEST)))
28 UNITTESTOBJS_RELEASE64 = $(addprefix $(OBJDIR)/test64_,$(patsubst test_%.cpp,%.o,$(SRC_UNITTEST)))
29 OBJPREFIX_SRC = $(addprefix $(OBJDIR)/,$(addsuffix src_,$(PREFIXES_LIBSRC)))
30 OBJPREFIX_X86 = $(addprefix $(OBJDIR)/,$(addsuffix x86_,$(PREFIXES_LIBSRC)))
31 OBJPREFIX_TEST = $(addprefix $(OBJDIR)/,$(PREFIXES_TESTSRC))
33 #all : debug release tests
34 all : lua debug tests
35 clean:
36 del _objs\\*
37 del _lib\\*
38 del _bin\\*
39 info:
40 rem - $(SRC_SRC)
41 rem - $(TEST_NAMES)
42 rem - $(LIBOBJ_NAMES)
43 rem - $(LIBOBJS_DEBUG32)
44 rem - $(UNITTESTOBJS_RELEASE32)
45 rem -- $(OBJPREFIX_SRC)
46 rem -- $(OBJPREFIX_X86)
47 rem -- $(OBJPREFIX_SRC)
48 rem --- $(OBJDIR)/dbg32_src_cpu.o $(OBJDIR)/rel32_src_cpu.o \
49 $(OBJDIR)/dbg64_src_cpu.o $(OBJDIR)/rel64_src_cpu.o: \
50 rem --- $(addsuffix cpu.o, $(OBJPREFIX_SRC)):
51 debug : $(LIBDIR)/jitcs_debug32.a $(LIBDIR)/jitcs_debug64.a
53 release : $(LIBDIR)/jitcs_release32.a $(LIBDIR)/jitcs_release64.a
54 tests : $(BINDIR)/test_cpuinfo32.exe $(BINDIR)/test_cpuinfo64.exe \
55 $(BINDIR)/unittests32.exe $(BINDIR)/unittests64.exe
56 lua : include/jitcs_x86_32_cons.h include/jitcs_x86_64_cons.h \
57 include/jitcs_x86_32_insids.h include/jitcs_x86_64_insids.h \
58 include/jitcs_x86_32_regs.h include/jitcs_x86_64_regs.h
60 include/jitcs_x86_32_cons.h : include/jitcs_x86_xx_cons.lh \
61 src/data/x86_inslist.dat src/data/x86_insalias.dat \
62 tools/template2header.lua
63 $(LUA) tools/template2header.lua $< 32 $@
64 include/jitcs_x86_64_cons.h : include/jitcs_x86_xx_cons.lh \
65 src/data/x86_inslist.dat src/data/x86_insalias.dat \
66 tools/template2header.lua
67 $(LUA) tools/template2header.lua $< 64 $@
68 include/jitcs_x86_32_insids.h : include/jitcs_x86_xx_insids.lh \
69 src/data/x86_inslist.dat src/data/x86_insalias.dat \
70 tools/template2header.lua
71 $(LUA) tools/template2header.lua $< 32 $@
72 include/jitcs_x86_64_insids.h : include/jitcs_x86_xx_insids.lh \
73 src/data/x86_inslist.dat src/data/x86_insalias.dat \
74 tools/template2header.lua
75 $(LUA) tools/template2header.lua $< 64 $@
76 include/jitcs_x86_32_regs.h : include/jitcs_x86_xx_regs.lh src/data/x86_reglist.dat \
77 tools/template2header.lua
78 $(LUA) tools/template2header.lua $< 32 $@
79 include/jitcs_x86_64_regs.h : include/jitcs_x86_xx_regs.lh src/data/x86_reglist.dat \
80 tools/template2header.lua
81 $(LUA) tools/template2header.lua $< 64 $@
82 src/x86/jitcs_int_x86_32_regs.h : src/x86/jitcs_int_x86_xx_regs.lh src/data/x86_reglist.dat \
83 tools/template2header.lua
84 $(LUA) tools/template2header.lua $< 32 $@
85 src/x86/jitcs_int_x86_64_regs.h : src/x86/jitcs_int_x86_xx_regs.lh src/data/x86_reglist.dat \
86 tools/template2header.lua
87 $(LUA) tools/template2header.lua $< 64 $@
88 src/x86/src/x86_32_callingconvention.cpp : src/x86/src/x86_xx_callingconvention.lcpp \
89 src/data/x86_reglist.dat \
90 tools/template2header.lua
91 $(LUA) tools/template2header.lua $< 32 $@
92 src/x86/src/x86_64_callingconvention.cpp : src/x86/src/x86_xx_callingconvention.lcpp \
93 src/data/x86_reglist.dat \
94 tools/template2header.lua
95 $(LUA) tools/template2header.lua $< 64 $@
96 src/x86/src/x86_32_machine.cpp : src/x86/src/x86_xx_machine.lcpp src/data/x86_reglist.dat \
97 tools/template2header.lua
98 $(LUA) tools/template2header.lua $< 32 $@
99 src/x86/src/x86_64_machine.cpp : src/x86/src/x86_xx_machine.lcpp src/data/x86_reglist.dat \
100 tools/template2header.lua
101 $(LUA) tools/template2header.lua $< 64 $@
102 src/x86/src/x86_32_regs.cpp : src/x86/src/x86_xx_regs.lcpp src/data/x86_reglist.dat \
103 tools/template2header.lua
104 $(LUA) tools/template2header.lua $< 32 $@
105 src/x86/src/x86_64_regs.cpp : src/x86/src/x86_xx_regs.lcpp src/data/x86_reglist.dat \
106 tools/template2header.lua
107 $(LUA) tools/template2header.lua $< 64 $@
109 src/data/x86_inslist.dat : src/data/x86_inslist.ltxt tools/x86_inslist2data.lua
110 $(LUA) tools/x86_inslist2data.lua $< $@
111 src/data/x86_insalias.dat : src/data/x86_insalias.ltxt tools/x86_insalias2data.lua
112 $(LUA) tools/x86_insalias2data.lua $< $@
114 $(LIBDIR)/jitcs_debug32.a : $(LIBOBJS_DEBUG32) | $(LIBDIR)
115 ar r $@ $?
116 $(LIBDIR)/jitcs_release32.a : $(LIBOBJS_RELEASE32) | $(LIBDIR)
117 ar r $@ $?
118 $(LIBDIR)/jitcs_debug64.a : | $(LIBDIR)
119 rem --
120 $(LIBDIR)/jitcs_release64.a : | $(LIBDIR)
121 rem --
123 $(BINDIR)/test_cpuinfo32.exe : tests/cpuinfo.cpp $(LIBDIR)/jitcs_release32.a \
124 include/jitcs_cpu.h \
125 | $(BINDIR)
126 $(CC) -o $@ $(CFLAGS) $(CFLAGS_REL32) $< $(LIBDIR)/jitcs_release32.a
127 $(BINDIR)/test_cpuinfo64.exe : | $(BINDIR)
128 rem --
129 $(BINDIR)/unittests32.exe : $(UNITTESTOBJS_RELEASE32) $(LIBDIR)/jitcs_release32.a \
130 | $(BINDIR)
131 $(CC) -o $@ $(CFLAGS) $(CFLAGS_REL32) $(UNITTESTOBJS_RELEASE32) $(LIBDIR)/jitcs_release32.a
132 $(BINDIR)/unittests64.exe : | $(BINDIR)
133 rem --
135 $(addsuffix cpu.o, $(OBJPREFIX_SRC)): \
136 include/jitcs_base.h include/jitcs_cpu.h \
137 include/jitcs_adt_bitstore.h
138 $(OBJDIR)/dbg32_src_bblock.o $(OBJDIR)/rel32_src_bblock.o \
139 $(OBJDIR)/dbg64_src_bblock.o $(OBJDIR)/rel64_src_bblock.o: \
140 include/jitcs_base.h include/jitcs_bblock.h \
141 src/jitcs_int_bblock_impl.h
142 $(OBJDIR)/dbg32_src_bblock_impl.o $(OBJDIR)/rel32_src_bblock_impl.o \
143 $(OBJDIR)/dbg64_src_bblock_impl.o $(OBJDIR)/rel64_src_bblock_impl.o: \
144 include/jitcs_base.h include/jitcs_dumper.h \
145 src/jitcs_int_bblock_impl.h src/jitcs_int_function_impl.h
146 $(OBJDIR)/dbg32_src_function.o $(OBJDIR)/rel32_src_function.o \
147 $(OBJDIR)/dbg64_src_function.o $(OBJDIR)/rel64_src_function.o: \
148 include/jitcs_base.h include/jitcs_function.h \
149 src/jitcs_int_function_impl.h
150 $(OBJDIR)/dbg32_src_function_impl.o $(OBJDIR)/rel32_src_function_impl.o \
151 $(OBJDIR)/dbg64_src_function_impl.o $(OBJDIR)/rel64_src_function_impl.o: \
152 include/jitcs_base.h include/jitcs_dumper.h \
153 src/jitcs_int_function_impl.h src/jitcs_int_bblock_impl.h
154 $(OBJDIR)/dbg32_src_callingconvention.o $(OBJDIR)/rel32_src_callingconvention.o \
155 $(OBJDIR)/dbg64_src_callingconvention.o $(OBJDIR)/rel64_src_callingconvention.o: \
156 include/jitcs_base.h include/jitcs_callingconvention.h \
157 include/jitcs_dumper.h
158 $(OBJDIR)/dbg32_src_callingconvention_impl.o $(OBJDIR)/rel32_src_callingconvention_impl.o \
159 $(OBJDIR)/dbg64_src_callingconvention_impl.o $(OBJDIR)/rel64_src_callingconvention_impl.o: \
160 include/jitcs_base.h \
161 src/jitcs_int_callingconvention_impl.h
162 $(OBJDIR)/dbg32_src_memmgr.o $(OBJDIR)/rel32_src_memmgr.o \
163 $(OBJDIR)/dbg64_src_memmgr.o $(OBJDIR)/rel64_src_memmgr.o: \
164 include/jitcs_base.h \
165 include/jitcs_memmgr.h include/jitcs_cpu.h
166 $(OBJDIR)/dbg32_src_spillslotinfo.o $(OBJDIR)/rel32_src_spillslotinfo.o \
167 $(OBJDIR)/dbg64_src_spillslotinfo.o $(OBJDIR)/rel64_src_spillslotinfo.o: \
168 include/jitcs_base.h \
169 include/jitcs_spillslotinfo.h include/jitcs_dumper.h
170 $(OBJDIR)/dbg32_src_tmpalloc.o $(OBJDIR)/rel32_src_tmpalloc.o \
171 $(OBJDIR)/dbg64_src_tmpalloc.o $(OBJDIR)/rel64_src_tmpalloc.o: \
172 include/jitcs_base.h \
173 include/jitcs_tmpalloc.h
174 $(addsuffix virtualregister.o, $(OBJPREFIX_SRC)): \
175 include/jitcs_machine.h src/jitcs_int_virtualregister.h
176 $(addsuffix x86_32_callingconvention.o, $(OBJPREFIX_X86)): \
177 include/jitcs_x86_32_machine.h src/x86/jitcs_int_x86_32_regs.h
178 $(addsuffix x86_64_callingconvention.o, $(OBJPREFIX_X86)): \
179 include/jitcs_x86_64_machine.h src/x86/jitcs_int_x86_64_regs.h
180 $(addsuffix x86_32_machine.o, $(OBJPREFIX_X86)): \
181 include/jitcs_x86_32_machine.h src/x86/jitcs_int_x86_32_regs.h
182 $(addsuffix x86_64_machine.o, $(OBJPREFIX_X86)): \
183 include/jitcs_x86_64_machine.h src/x86/jitcs_int_x86_64_regs.h
184 $(addsuffix x86_32_regs.o, $(OBJPREFIX_X86)): \
185 src/x86/jitcs_int_x86_32_regs.h
186 $(addsuffix x86_64_regs.o, $(OBJPREFIX_X86)): \
187 src/x86/jitcs_int_x86_64_regs.h
190 $(addsuffix main.o, $(OBJPREFIX_TEST)): \
191 include/jitcs_base.h tests/unittest.h
192 $(addsuffix unittest.o, $(OBJPREFIX_TEST)): \
193 include/jitcs_base.h tests/unittest.h
194 $(addsuffix fnctypeinfo.o, $(OBJPREFIX_TEST)): \
195 include/jitcs_base.h include/jitcs_fnctypeinfo.h
196 $(addsuffix adt_range.o, $(OBJPREFIX_TEST)): \
197 include/jitcs_base.h include/jitcs_adt_range.h
198 $(addsuffix adt_slice.o, $(OBJPREFIX_TEST)): \
199 include/jitcs_base.h include/jitcs_adt_slice.h
200 $(addsuffix callingconvention.o, $(OBJPREFIX_TEST)): \
201 include/jitcs_base.h include/jitcs_callingconvention.h \
202 include/jitcs_x86_32_machine.h include/jitcs_x86_64_machine.h
204 $(OBJDIR)/dbg32_src_%.o : src/src/%.cpp
205 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_DBG32) $<
206 $(OBJDIR)/rel32_src_%.o : src/src/%.cpp
207 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_REL32) $<
208 $(OBJDIR)/dbg64_src_%.o : src/src/%.cpp
209 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_DBG64) $<
210 $(OBJDIR)/rel64_src_%.o : src/src/%.cpp
211 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_REL64) $<
212 $(OBJDIR)/dbg32_x86_%.o : src/x86/src/%.cpp
213 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_DBG32) $<
214 $(OBJDIR)/rel32_x86_%.o : src/x86/src/%.cpp
215 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_REL32) $<
216 $(OBJDIR)/dbg64_x86_%.o : src/x86/src/%.cpp
217 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_DBG64) $<
218 $(OBJDIR)/rel64_x86_%.o : src/x86/src/%.cpp
219 $(CC) -o $@ -c -I ./src $(CFLAGS) $(CFLAGS_REL64) $<
220 $(OBJDIR)/test32_%.o : tests/test_%.cpp
221 $(CC) -o $@ -c -I ./tests $(CFLAGS) $(CFLAGS_REL32) $<
222 $(OBJDIR)/test64_%.o : tests/test_%.cpp
223 $(CC) -o $@ -c -I ./tests $(CFLAGS) $(CFLAGS_REL64) $<
225 $(LIBOBJS_DEBUG32) $(LIBOBJS_RELEASE32) \
226 $(LIBOBJS_DEBUG64) $(LIBOBJS_RELEASE64) \
227 $(UNITTESTOBJS_RELEASE32) : | $(OBJDIR)
228 $(OBJDIR) $(LIBDIR) $(BINDIR) :
229 mkdir $@