@@ -22,7 +22,7 @@ function(create_standalone_jit)
2222
2323 if (TARGETDETAILS_OS STREQUAL "unix_osx" OR TARGETDETAILS_OS STREQUAL "unix_anyos" )
2424 set (JIT_ARCH_LINK_LIBRARIES gcinfo_unix_${TARGETDETAILS_ARCH} )
25- else ( )
25+ elseif ( NOT ${TARGETDETAILS_ARCH} MATCHES "wasm" )
2626 set (JIT_ARCH_LINK_LIBRARIES gcinfo_${TARGETDETAILS_OS} _${TARGETDETAILS_ARCH} )
2727 endif ()
2828
@@ -53,6 +53,9 @@ function(create_standalone_jit)
5353 elseif (TARGETDETAILS_ARCH STREQUAL "riscv64" )
5454 set (JIT_ARCH_SOURCES ${JIT_RISCV64_SOURCES} )
5555 set (JIT_ARCH_HEADERS ${JIT_RISCV64_HEADERS} )
56+ elseif (TARGETDETAILS_ARCH STREQUAL "wasm" )
57+ set (JIT_ARCH_SOURCES ${JIT_WASM_SOURCES} )
58+ set (JIT_ARCH_HEADERS ${JIT_WASM_HEADERS} )
5659 else ()
5760 clr_unknown_arch()
5861 endif ()
@@ -94,7 +97,6 @@ set( JIT_SOURCES
9497 block.cpp
9598 buildstring.cpp
9699 codegencommon.cpp
97- codegenlinear.cpp
98100 compiler.cpp
99101 copyprop.cpp
100102 debuginfo.cpp
@@ -115,8 +117,6 @@ set( JIT_SOURCES
115117 fgstmt.cpp
116118 flowgraph.cpp
117119 forwardsub.cpp
118- gcdecode.cpp
119- gcencode.cpp
120120 gcinfo.cpp
121121 gentree.cpp
122122 gschecks.cpp
@@ -145,8 +145,6 @@ set( JIT_SOURCES
145145 liveness.cpp
146146 loopcloning.cpp
147147 lower.cpp
148- lsra.cpp
149- lsrabuild.cpp
150148 morph.cpp
151149 morphblock.cpp
152150 objectalloc.cpp
@@ -163,8 +161,6 @@ set( JIT_SOURCES
163161 rangecheckcloning.cpp
164162 rationalize.cpp
165163 redundantbranchopts.cpp
166- regalloc.cpp
167- regMaskTPOps.cpp
168164 regset.cpp
169165 scev.cpp
170166 scopeinfo.cpp
@@ -178,11 +174,21 @@ set( JIT_SOURCES
178174 stacklevelsetter.cpp
179175 switchrecognition.cpp
180176 treelifeupdater.cpp
181- unwind.cpp
182177 utils.cpp
183178 valuenum.cpp
184179)
185180
181+ set ( JIT_PHYSICAL_TARGET_SOURCES
182+ lsra.cpp
183+ lsrabuild.cpp
184+ regalloc.cpp
185+ regMaskTPOps.cpp
186+ codegenlinear.cpp
187+ gcdecode.cpp
188+ gcencode.cpp
189+ unwind.cpp
190+ )
191+
186192if (CLR_CMAKE_TARGET_WIN32)
187193 # Append clrjit.natvis file
188194 list (APPEND JIT_SOURCES
@@ -192,6 +198,7 @@ endif(CLR_CMAKE_TARGET_WIN32)
192198# Define all the architecture-specific source files
193199
194200set ( JIT_AMD64_SOURCES
201+ ${JIT_PHYSICAL_TARGET_SOURCES}
195202 codegenxarch.cpp
196203 emitxarch.cpp
197204 lowerxarch.cpp
@@ -205,6 +212,7 @@ set( JIT_AMD64_SOURCES
205212)
206213
207214set ( JIT_ARM_SOURCES
215+ ${JIT_PHYSICAL_TARGET_SOURCES}
208216 codegenarmarch.cpp
209217 codegenarm.cpp
210218 decomposelongs.cpp
@@ -217,6 +225,7 @@ set( JIT_ARM_SOURCES
217225)
218226
219227set ( JIT_I386_SOURCES
228+ ${JIT_PHYSICAL_TARGET_SOURCES}
220229 codegenxarch.cpp
221230 decomposelongs.cpp
222231 emitxarch.cpp
@@ -231,6 +240,7 @@ set( JIT_I386_SOURCES
231240)
232241
233242set ( JIT_ARM64_SOURCES
243+ ${JIT_PHYSICAL_TARGET_SOURCES}
234244 codegenarmarch.cpp
235245 codegenarm64.cpp
236246 codegenarm64test.cpp
@@ -260,6 +270,7 @@ set( JIT_POWERPC64_SOURCES
260270)
261271
262272set ( JIT_LOONGARCH64_SOURCES
273+ ${JIT_PHYSICAL_TARGET_SOURCES}
263274 codegenloongarch64.cpp
264275 emitloongarch64.cpp
265276 lowerloongarch64.cpp
@@ -269,6 +280,7 @@ set( JIT_LOONGARCH64_SOURCES
269280)
270281
271282set ( JIT_RISCV64_SOURCES
283+ ${JIT_PHYSICAL_TARGET_SOURCES}
272284 codegenriscv64.cpp
273285 emitriscv64.cpp
274286 lowerriscv64.cpp
@@ -277,6 +289,14 @@ set( JIT_RISCV64_SOURCES
277289 unwindriscv64.cpp
278290)
279291
292+ set ( JIT_WASM_SOURCES
293+ codegenwasm.cpp
294+ emitwasm.cpp
295+ lowerwasm.cpp
296+ regallocwasm.cpp
297+ targetwasm.cpp
298+ )
299+
280300# We include the headers here for better experience in IDEs.
281301set ( JIT_HEADERS
282302 ../inc/corinfo.h
@@ -448,6 +468,15 @@ set( JIT_RISCV64_HEADERS
448468 registerriscv64.h
449469)
450470
471+ set ( JIT_WASM_HEADERS
472+ regallocwasm.h
473+ targetwasm.h
474+ emitwasm.h
475+ emitfmtswasm.h
476+ instrswasm.h
477+ registerwasm.h
478+ )
479+
451480convert_to_absolute_path(JIT_SOURCES ${JIT_SOURCES} )
452481convert_to_absolute_path(JIT_HEADERS ${JIT_HEADERS} )
453482convert_to_absolute_path(JIT_RESOURCES ${JIT_RESOURCES} )
@@ -470,6 +499,8 @@ convert_to_absolute_path(JIT_LOONGARCH64_SOURCES ${JIT_LOONGARCH64_SOURCES})
470499convert_to_absolute_path(JIT_LOONGARCH64_HEADERS ${JIT_LOONGARCH64_HEADERS} )
471500convert_to_absolute_path(JIT_RISCV64_SOURCES ${JIT_RISCV64_SOURCES} )
472501convert_to_absolute_path(JIT_RISCV64_HEADERS ${JIT_RISCV64_HEADERS} )
502+ convert_to_absolute_path(JIT_WASM_SOURCES ${JIT_WASM_SOURCES} )
503+ convert_to_absolute_path(JIT_WASM_HEADERS ${JIT_WASM_HEADERS} )
473504
474505if (CLR_CMAKE_TARGET_ARCH_AMD64)
475506 set (JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES} )
@@ -499,13 +530,12 @@ elseif(CLR_CMAKE_TARGET_ARCH_RISCV64)
499530 set (JIT_ARCH_SOURCES ${JIT_RISCV64_SOURCES} )
500531 set (JIT_ARCH_HEADERS ${JIT_RISCV64_HEADERS} )
501532elseif (CLR_CMAKE_TARGET_ARCH_WASM)
502- set (JIT_ARCH_SOURCES ${JIT_WASM32_SOURCES } )
503- set (JIT_ARCH_HEADERS ${JIT_WASM32_HEADERS } )
533+ set (JIT_ARCH_SOURCES ${JIT_WASM_SOURCES } )
534+ set (JIT_ARCH_HEADERS ${JIT_WASM_HEADERS } )
504535else ()
505536 clr_unknown_arch()
506537endif ()
507538
508-
509539set (JIT_DLL_MAIN_FILE ${CMAKE_CURRENT_LIST_DIR} /dllmain.cpp)
510540
511541if (CLR_CMAKE_HOST_WIN32)
@@ -623,7 +653,12 @@ function(add_jit jitName)
623653 target_compile_definitions (${jitName} PRIVATE JIT_STANDALONE_BUILD)
624654
625655 # add the install targets
626- install_clr(TARGETS ${jitName} DESTINATIONS . COMPONENT alljits)
656+ if (${jitName} MATCHES "clrjit_universal_wasm" )
657+ # TODO-WASM: add the WASM Jit to alljits once that becomes necessary.
658+ install_clr(TARGETS ${jitName} DESTINATIONS . COMPONENT wasmjit)
659+ else ()
660+ install_clr(TARGETS ${jitName} DESTINATIONS . COMPONENT alljits)
661+ endif ()
627662endfunction ()
628663
629664set (JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -653,6 +688,7 @@ add_pgo(clrjit)
653688
654689if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
655690 create_standalone_jit(TARGET clrjit_universal_arm64_${ARCH_HOST_NAME} OS universal ARCH arm64)
691+ create_standalone_jit(TARGET clrjit_universal_wasm_${ARCH_HOST_NAME} OS universal ARCH wasm)
656692 create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix_anyos ARCH x64)
657693 create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64)
658694 if (CLR_CMAKE_BUILD_COMMUNITY_ALTJITS EQUAL 1)
@@ -678,7 +714,7 @@ if (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX)
678714endif (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX)
679715
680716if (CLR_CMAKE_TARGET_UNIX)
681- if (NOT ARCH_TARGET_NAME STREQUAL s390x AND NOT ARCH_TARGET_NAME STREQUAL armv6 AND NOT ARCH_TARGET_NAME STREQUAL ppc64le AND NOT ARCH_TARGET_NAME STREQUAL riscv64)
717+ if (NOT ARCH_TARGET_NAME STREQUAL s390x AND NOT ARCH_TARGET_NAME STREQUAL armv6 AND NOT ARCH_TARGET_NAME STREQUAL ppc64le AND NOT ARCH_TARGET_NAME STREQUAL riscv64 AND NOT ARCH_TARGET_NAME STREQUAL wasm )
682718 if (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)
683719 install_clr(TARGETS clrjit_universal_${ARCH_TARGET_NAME} _${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit)
684720 else ()
0 commit comments