1 // CodeGen/RuntimeLibcallSignatures.cpp - R.T. Lib. Call Signatures -*- C++ -*--
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file contains signature information for runtime libcalls.
12 /// CodeGen uses external symbols, which it refers to by name. The WebAssembly
13 /// target needs type information for all functions. This file contains a big
14 /// table providing type signatures for all runtime library functions that LLVM
17 /// This is currently a fairly heavy-handed solution.
19 //===----------------------------------------------------------------------===//
21 #include "WebAssemblyRuntimeLibcallSignatures.h"
22 #include "WebAssemblySubtarget.h"
23 #include "llvm/CodeGen/RuntimeLibcalls.h"
24 #include "llvm/Support/ManagedStatic.h"
30 enum RuntimeLibcallSignature
{
63 i32_func_i32_i32_iPTR
,
65 i64_func_i64_i64_iPTR
,
71 i64_i64_func_i64_i64_i64_i64
,
72 i64_i64_func_i64_i64_i64_i64_iPTR
,
73 i64_i64_i64_i64_func_i64_i64_i64_i64
,
74 i64_i64_func_i64_i64_i32
,
75 iPTR_func_iPTR_i32_iPTR
,
76 iPTR_func_iPTR_iPTR_iPTR
,
79 func_i64_i64_iPTR_iPTR
,
85 func_iPTR_i64_i64_i64_i64
,
86 func_iPTR_i64_i64_i64_i64_i64_i64
,
88 i32_func_i64_i64_i64_i64
,
95 struct RuntimeLibcallSignatureTable
{
96 std::vector
<RuntimeLibcallSignature
> Table
;
98 // Any newly-added libcalls will be unsupported by default.
99 RuntimeLibcallSignatureTable() : Table(RTLIB::UNKNOWN_LIBCALL
, unsupported
) {
101 Table
[RTLIB::SHL_I16
] = i16_func_i16_i16
;
102 Table
[RTLIB::SHL_I32
] = i32_func_i32_i32
;
103 Table
[RTLIB::SHL_I64
] = i64_func_i64_i64
;
104 Table
[RTLIB::SHL_I128
] = i64_i64_func_i64_i64_i32
;
105 Table
[RTLIB::SRL_I16
] = i16_func_i16_i16
;
106 Table
[RTLIB::SRL_I32
] = i32_func_i32_i32
;
107 Table
[RTLIB::SRL_I64
] = i64_func_i64_i64
;
108 Table
[RTLIB::SRL_I128
] = i64_i64_func_i64_i64_i32
;
109 Table
[RTLIB::SRA_I16
] = i16_func_i16_i16
;
110 Table
[RTLIB::SRA_I32
] = i32_func_i32_i32
;
111 Table
[RTLIB::SRA_I64
] = i64_func_i64_i64
;
112 Table
[RTLIB::SRA_I128
] = i64_i64_func_i64_i64_i32
;
113 Table
[RTLIB::MUL_I8
] = i8_func_i8_i8
;
114 Table
[RTLIB::MUL_I16
] = i16_func_i16_i16
;
115 Table
[RTLIB::MUL_I32
] = i32_func_i32_i32
;
116 Table
[RTLIB::MUL_I64
] = i64_func_i64_i64
;
117 Table
[RTLIB::MUL_I128
] = i64_i64_func_i64_i64_i64_i64
;
118 Table
[RTLIB::MULO_I32
] = i32_func_i32_i32_iPTR
;
119 Table
[RTLIB::MULO_I64
] = i64_func_i64_i64_iPTR
;
120 Table
[RTLIB::MULO_I128
] = i64_i64_func_i64_i64_i64_i64_iPTR
;
121 Table
[RTLIB::SDIV_I8
] = i8_func_i8_i8
;
122 Table
[RTLIB::SDIV_I16
] = i16_func_i16_i16
;
123 Table
[RTLIB::SDIV_I32
] = i32_func_i32_i32
;
124 Table
[RTLIB::SDIV_I64
] = i64_func_i64_i64
;
125 Table
[RTLIB::SDIV_I128
] = i64_i64_func_i64_i64_i64_i64
;
126 Table
[RTLIB::UDIV_I8
] = i8_func_i8_i8
;
127 Table
[RTLIB::UDIV_I16
] = i16_func_i16_i16
;
128 Table
[RTLIB::UDIV_I32
] = i32_func_i32_i32
;
129 Table
[RTLIB::UDIV_I64
] = i64_func_i64_i64
;
130 Table
[RTLIB::UDIV_I128
] = i64_i64_func_i64_i64_i64_i64
;
131 Table
[RTLIB::SREM_I8
] = i8_func_i8_i8
;
132 Table
[RTLIB::SREM_I16
] = i16_func_i16_i16
;
133 Table
[RTLIB::SREM_I32
] = i32_func_i32_i32
;
134 Table
[RTLIB::SREM_I64
] = i64_func_i64_i64
;
135 Table
[RTLIB::SREM_I128
] = i64_i64_func_i64_i64_i64_i64
;
136 Table
[RTLIB::UREM_I8
] = i8_func_i8_i8
;
137 Table
[RTLIB::UREM_I16
] = i16_func_i16_i16
;
138 Table
[RTLIB::UREM_I32
] = i32_func_i32_i32
;
139 Table
[RTLIB::UREM_I64
] = i64_func_i64_i64
;
140 Table
[RTLIB::UREM_I128
] = i64_i64_func_i64_i64_i64_i64
;
141 Table
[RTLIB::SDIVREM_I8
] = i8_func_i8_i8
;
142 Table
[RTLIB::SDIVREM_I16
] = i16_i16_func_i16_i16
;
143 Table
[RTLIB::SDIVREM_I32
] = i32_i32_func_i32_i32
;
144 Table
[RTLIB::SDIVREM_I64
] = i64_func_i64_i64
;
145 Table
[RTLIB::SDIVREM_I128
] = i64_i64_i64_i64_func_i64_i64_i64_i64
;
146 Table
[RTLIB::UDIVREM_I8
] = i8_func_i8_i8
;
147 Table
[RTLIB::UDIVREM_I16
] = i16_i16_func_i16_i16
;
148 Table
[RTLIB::UDIVREM_I32
] = i32_i32_func_i32_i32
;
149 Table
[RTLIB::UDIVREM_I64
] = i64_i64_func_i64_i64
;
150 Table
[RTLIB::UDIVREM_I128
] = i64_i64_i64_i64_func_i64_i64_i64_i64
;
151 Table
[RTLIB::NEG_I32
] = i32_func_i32
;
152 Table
[RTLIB::NEG_I64
] = i64_func_i64
;
155 // All F80 and PPCF128 routines are unsupported.
156 Table
[RTLIB::ADD_F32
] = f32_func_f32_f32
;
157 Table
[RTLIB::ADD_F64
] = f64_func_f64_f64
;
158 Table
[RTLIB::ADD_F128
] = func_iPTR_i64_i64_i64_i64
;
159 Table
[RTLIB::SUB_F32
] = f32_func_f32_f32
;
160 Table
[RTLIB::SUB_F64
] = f64_func_f64_f64
;
161 Table
[RTLIB::SUB_F128
] = func_iPTR_i64_i64_i64_i64
;
162 Table
[RTLIB::MUL_F32
] = f32_func_f32_f32
;
163 Table
[RTLIB::MUL_F64
] = f64_func_f64_f64
;
164 Table
[RTLIB::MUL_F128
] = func_iPTR_i64_i64_i64_i64
;
165 Table
[RTLIB::DIV_F32
] = f32_func_f32_f32
;
166 Table
[RTLIB::DIV_F64
] = f64_func_f64_f64
;
167 Table
[RTLIB::DIV_F128
] = func_iPTR_i64_i64_i64_i64
;
168 Table
[RTLIB::REM_F32
] = f32_func_f32_f32
;
169 Table
[RTLIB::REM_F64
] = f64_func_f64_f64
;
170 Table
[RTLIB::REM_F128
] = func_iPTR_i64_i64_i64_i64
;
171 Table
[RTLIB::FMA_F32
] = f32_func_f32_f32_f32
;
172 Table
[RTLIB::FMA_F64
] = f64_func_f64_f64_f64
;
173 Table
[RTLIB::FMA_F128
] = func_iPTR_i64_i64_i64_i64_i64_i64
;
174 Table
[RTLIB::POWI_F32
] = f32_func_f32_i32
;
175 Table
[RTLIB::POWI_F64
] = f64_func_f64_i32
;
176 Table
[RTLIB::POWI_F128
] = func_iPTR_i64_i64_i64_i64
;
177 Table
[RTLIB::SQRT_F32
] = f32_func_f32
;
178 Table
[RTLIB::SQRT_F64
] = f64_func_f64
;
179 Table
[RTLIB::SQRT_F128
] = func_iPTR_i64_i64
;
180 Table
[RTLIB::LOG_F32
] = f32_func_f32
;
181 Table
[RTLIB::LOG_F64
] = f64_func_f64
;
182 Table
[RTLIB::LOG_F128
] = func_iPTR_i64_i64
;
183 Table
[RTLIB::LOG2_F32
] = f32_func_f32
;
184 Table
[RTLIB::LOG2_F64
] = f64_func_f64
;
185 Table
[RTLIB::LOG2_F128
] = func_iPTR_i64_i64
;
186 Table
[RTLIB::LOG10_F32
] = f32_func_f32
;
187 Table
[RTLIB::LOG10_F64
] = f64_func_f64
;
188 Table
[RTLIB::LOG10_F128
] = func_iPTR_i64_i64
;
189 Table
[RTLIB::EXP_F32
] = f32_func_f32
;
190 Table
[RTLIB::EXP_F64
] = f64_func_f64
;
191 Table
[RTLIB::EXP_F128
] = func_iPTR_i64_i64
;
192 Table
[RTLIB::EXP2_F32
] = f32_func_f32
;
193 Table
[RTLIB::EXP2_F64
] = f64_func_f64
;
194 Table
[RTLIB::EXP2_F128
] = func_iPTR_i64_i64
;
195 Table
[RTLIB::SIN_F32
] = f32_func_f32
;
196 Table
[RTLIB::SIN_F64
] = f64_func_f64
;
197 Table
[RTLIB::SIN_F128
] = func_iPTR_i64_i64
;
198 Table
[RTLIB::COS_F32
] = f32_func_f32
;
199 Table
[RTLIB::COS_F64
] = f64_func_f64
;
200 Table
[RTLIB::COS_F128
] = func_iPTR_i64_i64
;
201 Table
[RTLIB::SINCOS_F32
] = func_f32_iPTR_iPTR
;
202 Table
[RTLIB::SINCOS_F64
] = func_f64_iPTR_iPTR
;
203 Table
[RTLIB::SINCOS_F128
] = func_i64_i64_iPTR_iPTR
;
204 Table
[RTLIB::POW_F32
] = f32_func_f32_f32
;
205 Table
[RTLIB::POW_F64
] = f64_func_f64_f64
;
206 Table
[RTLIB::POW_F128
] = func_iPTR_i64_i64_i64_i64
;
207 Table
[RTLIB::CEIL_F32
] = f32_func_f32
;
208 Table
[RTLIB::CEIL_F64
] = f64_func_f64
;
209 Table
[RTLIB::CEIL_F128
] = func_iPTR_i64_i64
;
210 Table
[RTLIB::TRUNC_F32
] = f32_func_f32
;
211 Table
[RTLIB::TRUNC_F64
] = f64_func_f64
;
212 Table
[RTLIB::TRUNC_F128
] = func_iPTR_i64_i64
;
213 Table
[RTLIB::RINT_F32
] = f32_func_f32
;
214 Table
[RTLIB::RINT_F64
] = f64_func_f64
;
215 Table
[RTLIB::RINT_F128
] = func_iPTR_i64_i64
;
216 Table
[RTLIB::NEARBYINT_F32
] = f32_func_f32
;
217 Table
[RTLIB::NEARBYINT_F64
] = f64_func_f64
;
218 Table
[RTLIB::NEARBYINT_F128
] = func_iPTR_i64_i64
;
219 Table
[RTLIB::ROUND_F32
] = f32_func_f32
;
220 Table
[RTLIB::ROUND_F64
] = f64_func_f64
;
221 Table
[RTLIB::ROUND_F128
] = func_iPTR_i64_i64
;
222 Table
[RTLIB::LROUND_F32
] = iPTR_func_f32
;
223 Table
[RTLIB::LROUND_F64
] = iPTR_func_f64
;
224 Table
[RTLIB::LROUND_F128
] = iPTR_func_i64_i64
;
225 Table
[RTLIB::LLROUND_F32
] = i64_func_f32
;
226 Table
[RTLIB::LLROUND_F64
] = i64_func_f64
;
227 Table
[RTLIB::LLROUND_F128
] = i64_func_i64_i64
;
228 Table
[RTLIB::LRINT_F32
] = iPTR_func_f32
;
229 Table
[RTLIB::LRINT_F64
] = iPTR_func_f64
;
230 Table
[RTLIB::LRINT_F128
] = iPTR_func_i64_i64
;
231 Table
[RTLIB::LLRINT_F32
] = i64_func_f32
;
232 Table
[RTLIB::LLRINT_F64
] = i64_func_f64
;
233 Table
[RTLIB::LLRINT_F128
] = i64_func_i64_i64
;
234 Table
[RTLIB::FLOOR_F32
] = f32_func_f32
;
235 Table
[RTLIB::FLOOR_F64
] = f64_func_f64
;
236 Table
[RTLIB::FLOOR_F128
] = func_iPTR_i64_i64
;
237 Table
[RTLIB::COPYSIGN_F32
] = f32_func_f32_f32
;
238 Table
[RTLIB::COPYSIGN_F64
] = f64_func_f64_f64
;
239 Table
[RTLIB::COPYSIGN_F128
] = func_iPTR_i64_i64_i64_i64
;
240 Table
[RTLIB::FMIN_F32
] = f32_func_f32_f32
;
241 Table
[RTLIB::FMIN_F64
] = f64_func_f64_f64
;
242 Table
[RTLIB::FMIN_F128
] = func_iPTR_i64_i64_i64_i64
;
243 Table
[RTLIB::FMAX_F32
] = f32_func_f32_f32
;
244 Table
[RTLIB::FMAX_F64
] = f64_func_f64_f64
;
245 Table
[RTLIB::FMAX_F128
] = func_iPTR_i64_i64_i64_i64
;
248 // All F80 and PPCF128 routines are unsupported.
249 Table
[RTLIB::FPEXT_F64_F128
] = func_iPTR_f64
;
250 Table
[RTLIB::FPEXT_F32_F128
] = func_iPTR_f32
;
251 Table
[RTLIB::FPEXT_F32_F64
] = f64_func_f32
;
252 Table
[RTLIB::FPEXT_F16_F32
] = f32_func_i16
;
253 Table
[RTLIB::FPROUND_F32_F16
] = i16_func_f32
;
254 Table
[RTLIB::FPROUND_F64_F16
] = i16_func_f64
;
255 Table
[RTLIB::FPROUND_F64_F32
] = f32_func_f64
;
256 Table
[RTLIB::FPROUND_F128_F16
] = i16_func_i64_i64
;
257 Table
[RTLIB::FPROUND_F128_F32
] = f32_func_i64_i64
;
258 Table
[RTLIB::FPROUND_F128_F64
] = f64_func_i64_i64
;
259 Table
[RTLIB::FPTOSINT_F32_I32
] = i32_func_f32
;
260 Table
[RTLIB::FPTOSINT_F32_I64
] = i64_func_f32
;
261 Table
[RTLIB::FPTOSINT_F32_I128
] = i64_i64_func_f32
;
262 Table
[RTLIB::FPTOSINT_F64_I32
] = i32_func_f64
;
263 Table
[RTLIB::FPTOSINT_F64_I64
] = i64_func_f64
;
264 Table
[RTLIB::FPTOSINT_F64_I128
] = i64_i64_func_f64
;
265 Table
[RTLIB::FPTOSINT_F128_I32
] = i32_func_i64_i64
;
266 Table
[RTLIB::FPTOSINT_F128_I64
] = i64_func_i64_i64
;
267 Table
[RTLIB::FPTOSINT_F128_I128
] = i64_i64_func_i64_i64
;
268 Table
[RTLIB::FPTOUINT_F32_I32
] = i32_func_f32
;
269 Table
[RTLIB::FPTOUINT_F32_I64
] = i64_func_f32
;
270 Table
[RTLIB::FPTOUINT_F32_I128
] = i64_i64_func_f32
;
271 Table
[RTLIB::FPTOUINT_F64_I32
] = i32_func_f64
;
272 Table
[RTLIB::FPTOUINT_F64_I64
] = i64_func_f64
;
273 Table
[RTLIB::FPTOUINT_F64_I128
] = i64_i64_func_f64
;
274 Table
[RTLIB::FPTOUINT_F128_I32
] = i32_func_i64_i64
;
275 Table
[RTLIB::FPTOUINT_F128_I64
] = i64_func_i64_i64
;
276 Table
[RTLIB::FPTOUINT_F128_I128
] = i64_i64_func_i64_i64
;
277 Table
[RTLIB::SINTTOFP_I32_F32
] = f32_func_i32
;
278 Table
[RTLIB::SINTTOFP_I32_F64
] = f64_func_i32
;
279 Table
[RTLIB::SINTTOFP_I32_F128
] = func_iPTR_i32
;
280 Table
[RTLIB::SINTTOFP_I64_F32
] = f32_func_i64
;
281 Table
[RTLIB::SINTTOFP_I64_F64
] = f64_func_i64
;
282 Table
[RTLIB::SINTTOFP_I64_F128
] = func_iPTR_i64
;
283 Table
[RTLIB::SINTTOFP_I128_F32
] = f32_func_i64_i64
;
284 Table
[RTLIB::SINTTOFP_I128_F64
] = f64_func_i64_i64
;
285 Table
[RTLIB::SINTTOFP_I128_F128
] = func_iPTR_i64_i64
;
286 Table
[RTLIB::UINTTOFP_I32_F32
] = f32_func_i32
;
287 Table
[RTLIB::UINTTOFP_I32_F64
] = f64_func_i64
;
288 Table
[RTLIB::UINTTOFP_I32_F128
] = func_iPTR_i32
;
289 Table
[RTLIB::UINTTOFP_I64_F32
] = f32_func_i64
;
290 Table
[RTLIB::UINTTOFP_I64_F64
] = f64_func_i64
;
291 Table
[RTLIB::UINTTOFP_I64_F128
] = func_iPTR_i64
;
292 Table
[RTLIB::UINTTOFP_I128_F32
] = f32_func_i64_i64
;
293 Table
[RTLIB::UINTTOFP_I128_F64
] = f64_func_i64_i64
;
294 Table
[RTLIB::UINTTOFP_I128_F128
] = func_iPTR_i64_i64
;
297 // ALl F80 and PPCF128 routines are unsupported.
298 Table
[RTLIB::OEQ_F32
] = i32_func_f32_f32
;
299 Table
[RTLIB::OEQ_F64
] = i32_func_f64_f64
;
300 Table
[RTLIB::OEQ_F128
] = i32_func_i64_i64_i64_i64
;
301 Table
[RTLIB::UNE_F32
] = i32_func_f32_f32
;
302 Table
[RTLIB::UNE_F64
] = i32_func_f64_f64
;
303 Table
[RTLIB::UNE_F128
] = i32_func_i64_i64_i64_i64
;
304 Table
[RTLIB::OGE_F32
] = i32_func_f32_f32
;
305 Table
[RTLIB::OGE_F64
] = i32_func_f64_f64
;
306 Table
[RTLIB::OGE_F128
] = i32_func_i64_i64_i64_i64
;
307 Table
[RTLIB::OLT_F32
] = i32_func_f32_f32
;
308 Table
[RTLIB::OLT_F64
] = i32_func_f64_f64
;
309 Table
[RTLIB::OLT_F128
] = i32_func_i64_i64_i64_i64
;
310 Table
[RTLIB::OLE_F32
] = i32_func_f32_f32
;
311 Table
[RTLIB::OLE_F64
] = i32_func_f64_f64
;
312 Table
[RTLIB::OLE_F128
] = i32_func_i64_i64_i64_i64
;
313 Table
[RTLIB::OGT_F32
] = i32_func_f32_f32
;
314 Table
[RTLIB::OGT_F64
] = i32_func_f64_f64
;
315 Table
[RTLIB::OGT_F128
] = i32_func_i64_i64_i64_i64
;
316 Table
[RTLIB::UO_F32
] = i32_func_f32_f32
;
317 Table
[RTLIB::UO_F64
] = i32_func_f64_f64
;
318 Table
[RTLIB::UO_F128
] = i32_func_i64_i64_i64_i64
;
319 // O_FXX has the weird property that it uses the same libcall name as UO_FXX
320 // This breaks our name-based lookup. Fortunately only the UO family of
321 // libcalls appears to be actually used.
322 Table
[RTLIB::O_F32
] = unsupported
;
323 Table
[RTLIB::O_F64
] = unsupported
;
324 Table
[RTLIB::O_F128
] = unsupported
;
327 Table
[RTLIB::MEMCPY
] = iPTR_func_iPTR_iPTR_iPTR
;
328 Table
[RTLIB::MEMSET
] = iPTR_func_iPTR_i32_iPTR
;
329 Table
[RTLIB::MEMMOVE
] = iPTR_func_iPTR_iPTR_iPTR
;
332 Table
[RTLIB::STACKPROTECTOR_CHECK_FAIL
] = func
;
334 // Return address handling
335 Table
[RTLIB::RETURN_ADDRESS
] = i32_func_i32
;
337 // Element-wise Atomic memory
338 // TODO: Fix these when we implement atomic support
339 Table
[RTLIB::MEMCPY_ELEMENT_UNORDERED_ATOMIC_1
] = unsupported
;
340 Table
[RTLIB::MEMCPY_ELEMENT_UNORDERED_ATOMIC_2
] = unsupported
;
341 Table
[RTLIB::MEMCPY_ELEMENT_UNORDERED_ATOMIC_4
] = unsupported
;
342 Table
[RTLIB::MEMCPY_ELEMENT_UNORDERED_ATOMIC_8
] = unsupported
;
343 Table
[RTLIB::MEMCPY_ELEMENT_UNORDERED_ATOMIC_16
] = unsupported
;
344 Table
[RTLIB::MEMMOVE_ELEMENT_UNORDERED_ATOMIC_1
] = unsupported
;
345 Table
[RTLIB::MEMMOVE_ELEMENT_UNORDERED_ATOMIC_2
] = unsupported
;
346 Table
[RTLIB::MEMMOVE_ELEMENT_UNORDERED_ATOMIC_4
] = unsupported
;
347 Table
[RTLIB::MEMMOVE_ELEMENT_UNORDERED_ATOMIC_8
] = unsupported
;
348 Table
[RTLIB::MEMMOVE_ELEMENT_UNORDERED_ATOMIC_16
] = unsupported
;
350 Table
[RTLIB::MEMSET_ELEMENT_UNORDERED_ATOMIC_1
] = unsupported
;
351 Table
[RTLIB::MEMSET_ELEMENT_UNORDERED_ATOMIC_2
] = unsupported
;
352 Table
[RTLIB::MEMSET_ELEMENT_UNORDERED_ATOMIC_4
] = unsupported
;
353 Table
[RTLIB::MEMSET_ELEMENT_UNORDERED_ATOMIC_8
] = unsupported
;
354 Table
[RTLIB::MEMSET_ELEMENT_UNORDERED_ATOMIC_16
] = unsupported
;
356 // Atomic '__sync_*' libcalls.
357 // TODO: Fix these when we implement atomic support
358 Table
[RTLIB::SYNC_VAL_COMPARE_AND_SWAP_1
] = unsupported
;
359 Table
[RTLIB::SYNC_VAL_COMPARE_AND_SWAP_2
] = unsupported
;
360 Table
[RTLIB::SYNC_VAL_COMPARE_AND_SWAP_4
] = unsupported
;
361 Table
[RTLIB::SYNC_VAL_COMPARE_AND_SWAP_8
] = unsupported
;
362 Table
[RTLIB::SYNC_VAL_COMPARE_AND_SWAP_16
] = unsupported
;
363 Table
[RTLIB::SYNC_LOCK_TEST_AND_SET_1
] = unsupported
;
364 Table
[RTLIB::SYNC_LOCK_TEST_AND_SET_2
] = unsupported
;
365 Table
[RTLIB::SYNC_LOCK_TEST_AND_SET_4
] = unsupported
;
366 Table
[RTLIB::SYNC_LOCK_TEST_AND_SET_8
] = unsupported
;
367 Table
[RTLIB::SYNC_LOCK_TEST_AND_SET_16
] = unsupported
;
368 Table
[RTLIB::SYNC_FETCH_AND_ADD_1
] = unsupported
;
369 Table
[RTLIB::SYNC_FETCH_AND_ADD_2
] = unsupported
;
370 Table
[RTLIB::SYNC_FETCH_AND_ADD_4
] = unsupported
;
371 Table
[RTLIB::SYNC_FETCH_AND_ADD_8
] = unsupported
;
372 Table
[RTLIB::SYNC_FETCH_AND_ADD_16
] = unsupported
;
373 Table
[RTLIB::SYNC_FETCH_AND_SUB_1
] = unsupported
;
374 Table
[RTLIB::SYNC_FETCH_AND_SUB_2
] = unsupported
;
375 Table
[RTLIB::SYNC_FETCH_AND_SUB_4
] = unsupported
;
376 Table
[RTLIB::SYNC_FETCH_AND_SUB_8
] = unsupported
;
377 Table
[RTLIB::SYNC_FETCH_AND_SUB_16
] = unsupported
;
378 Table
[RTLIB::SYNC_FETCH_AND_AND_1
] = unsupported
;
379 Table
[RTLIB::SYNC_FETCH_AND_AND_2
] = unsupported
;
380 Table
[RTLIB::SYNC_FETCH_AND_AND_4
] = unsupported
;
381 Table
[RTLIB::SYNC_FETCH_AND_AND_8
] = unsupported
;
382 Table
[RTLIB::SYNC_FETCH_AND_AND_16
] = unsupported
;
383 Table
[RTLIB::SYNC_FETCH_AND_OR_1
] = unsupported
;
384 Table
[RTLIB::SYNC_FETCH_AND_OR_2
] = unsupported
;
385 Table
[RTLIB::SYNC_FETCH_AND_OR_4
] = unsupported
;
386 Table
[RTLIB::SYNC_FETCH_AND_OR_8
] = unsupported
;
387 Table
[RTLIB::SYNC_FETCH_AND_OR_16
] = unsupported
;
388 Table
[RTLIB::SYNC_FETCH_AND_XOR_1
] = unsupported
;
389 Table
[RTLIB::SYNC_FETCH_AND_XOR_2
] = unsupported
;
390 Table
[RTLIB::SYNC_FETCH_AND_XOR_4
] = unsupported
;
391 Table
[RTLIB::SYNC_FETCH_AND_XOR_8
] = unsupported
;
392 Table
[RTLIB::SYNC_FETCH_AND_XOR_16
] = unsupported
;
393 Table
[RTLIB::SYNC_FETCH_AND_NAND_1
] = unsupported
;
394 Table
[RTLIB::SYNC_FETCH_AND_NAND_2
] = unsupported
;
395 Table
[RTLIB::SYNC_FETCH_AND_NAND_4
] = unsupported
;
396 Table
[RTLIB::SYNC_FETCH_AND_NAND_8
] = unsupported
;
397 Table
[RTLIB::SYNC_FETCH_AND_NAND_16
] = unsupported
;
398 Table
[RTLIB::SYNC_FETCH_AND_MAX_1
] = unsupported
;
399 Table
[RTLIB::SYNC_FETCH_AND_MAX_2
] = unsupported
;
400 Table
[RTLIB::SYNC_FETCH_AND_MAX_4
] = unsupported
;
401 Table
[RTLIB::SYNC_FETCH_AND_MAX_8
] = unsupported
;
402 Table
[RTLIB::SYNC_FETCH_AND_MAX_16
] = unsupported
;
403 Table
[RTLIB::SYNC_FETCH_AND_UMAX_1
] = unsupported
;
404 Table
[RTLIB::SYNC_FETCH_AND_UMAX_2
] = unsupported
;
405 Table
[RTLIB::SYNC_FETCH_AND_UMAX_4
] = unsupported
;
406 Table
[RTLIB::SYNC_FETCH_AND_UMAX_8
] = unsupported
;
407 Table
[RTLIB::SYNC_FETCH_AND_UMAX_16
] = unsupported
;
408 Table
[RTLIB::SYNC_FETCH_AND_MIN_1
] = unsupported
;
409 Table
[RTLIB::SYNC_FETCH_AND_MIN_2
] = unsupported
;
410 Table
[RTLIB::SYNC_FETCH_AND_MIN_4
] = unsupported
;
411 Table
[RTLIB::SYNC_FETCH_AND_MIN_8
] = unsupported
;
412 Table
[RTLIB::SYNC_FETCH_AND_MIN_16
] = unsupported
;
413 Table
[RTLIB::SYNC_FETCH_AND_UMIN_1
] = unsupported
;
414 Table
[RTLIB::SYNC_FETCH_AND_UMIN_2
] = unsupported
;
415 Table
[RTLIB::SYNC_FETCH_AND_UMIN_4
] = unsupported
;
416 Table
[RTLIB::SYNC_FETCH_AND_UMIN_8
] = unsupported
;
417 Table
[RTLIB::SYNC_FETCH_AND_UMIN_16
] = unsupported
;
419 // Atomic '__atomic_*' libcalls.
420 // TODO: Fix these when we implement atomic support
421 Table
[RTLIB::ATOMIC_LOAD
] = unsupported
;
422 Table
[RTLIB::ATOMIC_LOAD_1
] = unsupported
;
423 Table
[RTLIB::ATOMIC_LOAD_2
] = unsupported
;
424 Table
[RTLIB::ATOMIC_LOAD_4
] = unsupported
;
425 Table
[RTLIB::ATOMIC_LOAD_8
] = unsupported
;
426 Table
[RTLIB::ATOMIC_LOAD_16
] = unsupported
;
428 Table
[RTLIB::ATOMIC_STORE
] = unsupported
;
429 Table
[RTLIB::ATOMIC_STORE_1
] = unsupported
;
430 Table
[RTLIB::ATOMIC_STORE_2
] = unsupported
;
431 Table
[RTLIB::ATOMIC_STORE_4
] = unsupported
;
432 Table
[RTLIB::ATOMIC_STORE_8
] = unsupported
;
433 Table
[RTLIB::ATOMIC_STORE_16
] = unsupported
;
435 Table
[RTLIB::ATOMIC_EXCHANGE
] = unsupported
;
436 Table
[RTLIB::ATOMIC_EXCHANGE_1
] = unsupported
;
437 Table
[RTLIB::ATOMIC_EXCHANGE_2
] = unsupported
;
438 Table
[RTLIB::ATOMIC_EXCHANGE_4
] = unsupported
;
439 Table
[RTLIB::ATOMIC_EXCHANGE_8
] = unsupported
;
440 Table
[RTLIB::ATOMIC_EXCHANGE_16
] = unsupported
;
442 Table
[RTLIB::ATOMIC_COMPARE_EXCHANGE
] = unsupported
;
443 Table
[RTLIB::ATOMIC_COMPARE_EXCHANGE_1
] = unsupported
;
444 Table
[RTLIB::ATOMIC_COMPARE_EXCHANGE_2
] = unsupported
;
445 Table
[RTLIB::ATOMIC_COMPARE_EXCHANGE_4
] = unsupported
;
446 Table
[RTLIB::ATOMIC_COMPARE_EXCHANGE_8
] = unsupported
;
447 Table
[RTLIB::ATOMIC_COMPARE_EXCHANGE_16
] = unsupported
;
449 Table
[RTLIB::ATOMIC_FETCH_ADD_1
] = unsupported
;
450 Table
[RTLIB::ATOMIC_FETCH_ADD_2
] = unsupported
;
451 Table
[RTLIB::ATOMIC_FETCH_ADD_4
] = unsupported
;
452 Table
[RTLIB::ATOMIC_FETCH_ADD_8
] = unsupported
;
453 Table
[RTLIB::ATOMIC_FETCH_ADD_16
] = unsupported
;
455 Table
[RTLIB::ATOMIC_FETCH_SUB_1
] = unsupported
;
456 Table
[RTLIB::ATOMIC_FETCH_SUB_2
] = unsupported
;
457 Table
[RTLIB::ATOMIC_FETCH_SUB_4
] = unsupported
;
458 Table
[RTLIB::ATOMIC_FETCH_SUB_8
] = unsupported
;
459 Table
[RTLIB::ATOMIC_FETCH_SUB_16
] = unsupported
;
461 Table
[RTLIB::ATOMIC_FETCH_AND_1
] = unsupported
;
462 Table
[RTLIB::ATOMIC_FETCH_AND_2
] = unsupported
;
463 Table
[RTLIB::ATOMIC_FETCH_AND_4
] = unsupported
;
464 Table
[RTLIB::ATOMIC_FETCH_AND_8
] = unsupported
;
465 Table
[RTLIB::ATOMIC_FETCH_AND_16
] = unsupported
;
467 Table
[RTLIB::ATOMIC_FETCH_OR_1
] = unsupported
;
468 Table
[RTLIB::ATOMIC_FETCH_OR_2
] = unsupported
;
469 Table
[RTLIB::ATOMIC_FETCH_OR_4
] = unsupported
;
470 Table
[RTLIB::ATOMIC_FETCH_OR_8
] = unsupported
;
471 Table
[RTLIB::ATOMIC_FETCH_OR_16
] = unsupported
;
473 Table
[RTLIB::ATOMIC_FETCH_XOR_1
] = unsupported
;
474 Table
[RTLIB::ATOMIC_FETCH_XOR_2
] = unsupported
;
475 Table
[RTLIB::ATOMIC_FETCH_XOR_4
] = unsupported
;
476 Table
[RTLIB::ATOMIC_FETCH_XOR_8
] = unsupported
;
477 Table
[RTLIB::ATOMIC_FETCH_XOR_16
] = unsupported
;
479 Table
[RTLIB::ATOMIC_FETCH_NAND_1
] = unsupported
;
480 Table
[RTLIB::ATOMIC_FETCH_NAND_2
] = unsupported
;
481 Table
[RTLIB::ATOMIC_FETCH_NAND_4
] = unsupported
;
482 Table
[RTLIB::ATOMIC_FETCH_NAND_8
] = unsupported
;
483 Table
[RTLIB::ATOMIC_FETCH_NAND_16
] = unsupported
;
487 ManagedStatic
<RuntimeLibcallSignatureTable
> RuntimeLibcallSignatures
;
489 // Maps libcall names to their RTLIB::Libcall number. Builds the map in a
490 // constructor for use with ManagedStatic
491 struct StaticLibcallNameMap
{
492 StringMap
<RTLIB::Libcall
> Map
;
493 StaticLibcallNameMap() {
494 static const std::pair
<const char *, RTLIB::Libcall
> NameLibcalls
[] = {
495 #define HANDLE_LIBCALL(code, name) {(const char *)name, RTLIB::code},
496 #include "llvm/IR/RuntimeLibcalls.def"
497 #undef HANDLE_LIBCALL
499 for (const auto &NameLibcall
: NameLibcalls
) {
500 if (NameLibcall
.first
!= nullptr &&
501 RuntimeLibcallSignatures
->Table
[NameLibcall
.second
] != unsupported
) {
502 assert(Map
.find(NameLibcall
.first
) == Map
.end() &&
503 "duplicate libcall names in name map");
504 Map
[NameLibcall
.first
] = NameLibcall
.second
;
507 // Override the __gnu_f2h_ieee/__gnu_h2f_ieee names so that the f32 name is
508 // consistent with the f64 and f128 names.
509 Map
["__extendhfsf2"] = RTLIB::FPEXT_F16_F32
;
510 Map
["__truncsfhf2"] = RTLIB::FPROUND_F32_F16
;
512 Map
["emscripten_return_address"] = RTLIB::RETURN_ADDRESS
;
516 } // end anonymous namespace
518 void llvm::getLibcallSignature(const WebAssemblySubtarget
&Subtarget
,
520 SmallVectorImpl
<wasm::ValType
> &Rets
,
521 SmallVectorImpl
<wasm::ValType
> &Params
) {
522 assert(Rets
.empty());
523 assert(Params
.empty());
525 wasm::ValType PtrTy
=
526 Subtarget
.hasAddr64() ? wasm::ValType::I64
: wasm::ValType::I32
;
528 auto &Table
= RuntimeLibcallSignatures
->Table
;
533 Rets
.push_back(wasm::ValType::F32
);
534 Params
.push_back(wasm::ValType::F32
);
537 Rets
.push_back(wasm::ValType::F32
);
538 Params
.push_back(wasm::ValType::F64
);
541 Rets
.push_back(wasm::ValType::F32
);
542 Params
.push_back(wasm::ValType::I32
);
545 Rets
.push_back(wasm::ValType::F32
);
546 Params
.push_back(wasm::ValType::I64
);
549 Rets
.push_back(wasm::ValType::F32
);
550 Params
.push_back(wasm::ValType::I32
);
553 Rets
.push_back(wasm::ValType::F64
);
554 Params
.push_back(wasm::ValType::F32
);
557 Rets
.push_back(wasm::ValType::F64
);
558 Params
.push_back(wasm::ValType::F64
);
561 Rets
.push_back(wasm::ValType::F64
);
562 Params
.push_back(wasm::ValType::I32
);
565 Rets
.push_back(wasm::ValType::F64
);
566 Params
.push_back(wasm::ValType::I64
);
569 Rets
.push_back(wasm::ValType::I32
);
570 Params
.push_back(wasm::ValType::F32
);
573 Rets
.push_back(wasm::ValType::I32
);
574 Params
.push_back(wasm::ValType::F64
);
577 Rets
.push_back(wasm::ValType::I32
);
578 Params
.push_back(wasm::ValType::I32
);
581 Rets
.push_back(wasm::ValType::I64
);
582 Params
.push_back(wasm::ValType::F32
);
585 Rets
.push_back(wasm::ValType::I64
);
586 Params
.push_back(wasm::ValType::F64
);
589 Rets
.push_back(wasm::ValType::I64
);
590 Params
.push_back(wasm::ValType::I64
);
592 case f32_func_f32_f32
:
593 Rets
.push_back(wasm::ValType::F32
);
594 Params
.push_back(wasm::ValType::F32
);
595 Params
.push_back(wasm::ValType::F32
);
597 case f32_func_f32_i32
:
598 Rets
.push_back(wasm::ValType::F32
);
599 Params
.push_back(wasm::ValType::F32
);
600 Params
.push_back(wasm::ValType::I32
);
602 case f32_func_i64_i64
:
603 Rets
.push_back(wasm::ValType::F32
);
604 Params
.push_back(wasm::ValType::I64
);
605 Params
.push_back(wasm::ValType::I64
);
607 case f64_func_f64_f64
:
608 Rets
.push_back(wasm::ValType::F64
);
609 Params
.push_back(wasm::ValType::F64
);
610 Params
.push_back(wasm::ValType::F64
);
612 case f64_func_f64_i32
:
613 Rets
.push_back(wasm::ValType::F64
);
614 Params
.push_back(wasm::ValType::F64
);
615 Params
.push_back(wasm::ValType::I32
);
617 case f64_func_i64_i64
:
618 Rets
.push_back(wasm::ValType::F64
);
619 Params
.push_back(wasm::ValType::I64
);
620 Params
.push_back(wasm::ValType::I64
);
623 Rets
.push_back(wasm::ValType::I32
);
624 Params
.push_back(wasm::ValType::F32
);
627 Rets
.push_back(wasm::ValType::I32
);
628 Params
.push_back(wasm::ValType::F64
);
630 case i16_func_i64_i64
:
631 Rets
.push_back(wasm::ValType::I32
);
632 Params
.push_back(wasm::ValType::I64
);
633 Params
.push_back(wasm::ValType::I64
);
636 Rets
.push_back(wasm::ValType::I32
);
637 Params
.push_back(wasm::ValType::I32
);
638 Params
.push_back(wasm::ValType::I32
);
640 case func_f32_iPTR_iPTR
:
641 Params
.push_back(wasm::ValType::F32
);
642 Params
.push_back(PtrTy
);
643 Params
.push_back(PtrTy
);
645 case func_f64_iPTR_iPTR
:
646 Params
.push_back(wasm::ValType::F64
);
647 Params
.push_back(PtrTy
);
648 Params
.push_back(PtrTy
);
650 case i16_func_i16_i16
:
651 Rets
.push_back(wasm::ValType::I32
);
652 Params
.push_back(wasm::ValType::I32
);
653 Params
.push_back(wasm::ValType::I32
);
655 case i32_func_f32_f32
:
656 Rets
.push_back(wasm::ValType::I32
);
657 Params
.push_back(wasm::ValType::F32
);
658 Params
.push_back(wasm::ValType::F32
);
660 case i32_func_f64_f64
:
661 Rets
.push_back(wasm::ValType::I32
);
662 Params
.push_back(wasm::ValType::F64
);
663 Params
.push_back(wasm::ValType::F64
);
665 case i32_func_i32_i32
:
666 Rets
.push_back(wasm::ValType::I32
);
667 Params
.push_back(wasm::ValType::I32
);
668 Params
.push_back(wasm::ValType::I32
);
670 case i32_func_i32_i32_iPTR
:
671 Rets
.push_back(wasm::ValType::I32
);
672 Params
.push_back(wasm::ValType::I32
);
673 Params
.push_back(wasm::ValType::I32
);
674 Params
.push_back(PtrTy
);
676 case i64_func_i64_i64
:
677 Rets
.push_back(wasm::ValType::I64
);
678 Params
.push_back(wasm::ValType::I64
);
679 Params
.push_back(wasm::ValType::I64
);
681 case i64_func_i64_i64_iPTR
:
682 Rets
.push_back(wasm::ValType::I64
);
683 Params
.push_back(wasm::ValType::I64
);
684 Params
.push_back(wasm::ValType::I64
);
685 Params
.push_back(PtrTy
);
687 case i64_i64_func_f32
:
688 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
689 Rets
.push_back(wasm::ValType::I64
);
690 Rets
.push_back(wasm::ValType::I64
);
692 Params
.push_back(PtrTy
);
694 Params
.push_back(wasm::ValType::F32
);
696 case i64_i64_func_f64
:
697 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
698 Rets
.push_back(wasm::ValType::I64
);
699 Rets
.push_back(wasm::ValType::I64
);
701 Params
.push_back(PtrTy
);
703 Params
.push_back(wasm::ValType::F64
);
705 case i16_i16_func_i16_i16
:
706 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
707 Rets
.push_back(wasm::ValType::I32
);
708 Rets
.push_back(wasm::ValType::I32
);
710 Params
.push_back(PtrTy
);
712 Params
.push_back(wasm::ValType::I32
);
713 Params
.push_back(wasm::ValType::I32
);
715 case i32_i32_func_i32_i32
:
716 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
717 Rets
.push_back(wasm::ValType::I32
);
718 Rets
.push_back(wasm::ValType::I32
);
720 Params
.push_back(PtrTy
);
722 Params
.push_back(wasm::ValType::I32
);
723 Params
.push_back(wasm::ValType::I32
);
725 case i64_i64_func_i64_i64
:
726 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
727 Rets
.push_back(wasm::ValType::I64
);
728 Rets
.push_back(wasm::ValType::I64
);
730 Params
.push_back(PtrTy
);
732 Params
.push_back(wasm::ValType::I64
);
733 Params
.push_back(wasm::ValType::I64
);
735 case i64_i64_func_i64_i64_i64_i64
:
736 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
737 Rets
.push_back(wasm::ValType::I64
);
738 Rets
.push_back(wasm::ValType::I64
);
740 Params
.push_back(PtrTy
);
742 Params
.push_back(wasm::ValType::I64
);
743 Params
.push_back(wasm::ValType::I64
);
744 Params
.push_back(wasm::ValType::I64
);
745 Params
.push_back(wasm::ValType::I64
);
747 case i64_i64_func_i64_i64_i64_i64_iPTR
:
748 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
749 Rets
.push_back(wasm::ValType::I64
);
750 Rets
.push_back(wasm::ValType::I64
);
752 Params
.push_back(PtrTy
);
754 Params
.push_back(wasm::ValType::I64
);
755 Params
.push_back(wasm::ValType::I64
);
756 Params
.push_back(wasm::ValType::I64
);
757 Params
.push_back(wasm::ValType::I64
);
758 Params
.push_back(PtrTy
);
760 case i64_i64_i64_i64_func_i64_i64_i64_i64
:
761 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
762 Rets
.push_back(wasm::ValType::I64
);
763 Rets
.push_back(wasm::ValType::I64
);
764 Rets
.push_back(wasm::ValType::I64
);
765 Rets
.push_back(wasm::ValType::I64
);
767 Params
.push_back(PtrTy
);
769 Params
.push_back(wasm::ValType::I64
);
770 Params
.push_back(wasm::ValType::I64
);
771 Params
.push_back(wasm::ValType::I64
);
772 Params
.push_back(wasm::ValType::I64
);
774 case i64_i64_func_i64_i64_i32
:
775 #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
776 Rets
.push_back(wasm::ValType::I64
);
777 Rets
.push_back(wasm::ValType::I64
);
778 Rets
.push_back(wasm::ValType::I64
);
779 Rets
.push_back(wasm::ValType::I64
);
781 Params
.push_back(PtrTy
);
783 Params
.push_back(wasm::ValType::I64
);
784 Params
.push_back(wasm::ValType::I64
);
785 Params
.push_back(wasm::ValType::I32
);
787 case iPTR_func_iPTR_i32_iPTR
:
788 Rets
.push_back(PtrTy
);
789 Params
.push_back(PtrTy
);
790 Params
.push_back(wasm::ValType::I32
);
791 Params
.push_back(PtrTy
);
793 case iPTR_func_iPTR_iPTR_iPTR
:
794 Rets
.push_back(PtrTy
);
795 Params
.push_back(PtrTy
);
796 Params
.push_back(PtrTy
);
797 Params
.push_back(PtrTy
);
799 case f32_func_f32_f32_f32
:
800 Rets
.push_back(wasm::ValType::F32
);
801 Params
.push_back(wasm::ValType::F32
);
802 Params
.push_back(wasm::ValType::F32
);
803 Params
.push_back(wasm::ValType::F32
);
805 case f64_func_f64_f64_f64
:
806 Rets
.push_back(wasm::ValType::F64
);
807 Params
.push_back(wasm::ValType::F64
);
808 Params
.push_back(wasm::ValType::F64
);
809 Params
.push_back(wasm::ValType::F64
);
811 case func_i64_i64_iPTR_iPTR
:
812 Params
.push_back(wasm::ValType::I64
);
813 Params
.push_back(wasm::ValType::I64
);
814 Params
.push_back(PtrTy
);
815 Params
.push_back(PtrTy
);
818 Params
.push_back(PtrTy
);
819 Params
.push_back(wasm::ValType::F32
);
822 Params
.push_back(PtrTy
);
823 Params
.push_back(wasm::ValType::F64
);
826 Params
.push_back(PtrTy
);
827 Params
.push_back(wasm::ValType::I32
);
830 Params
.push_back(PtrTy
);
831 Params
.push_back(wasm::ValType::I64
);
833 case func_iPTR_i64_i64
:
834 Params
.push_back(PtrTy
);
835 Params
.push_back(wasm::ValType::I64
);
836 Params
.push_back(wasm::ValType::I64
);
838 case func_iPTR_i64_i64_i64_i64
:
839 Params
.push_back(PtrTy
);
840 Params
.push_back(wasm::ValType::I64
);
841 Params
.push_back(wasm::ValType::I64
);
842 Params
.push_back(wasm::ValType::I64
);
843 Params
.push_back(wasm::ValType::I64
);
845 case func_iPTR_i64_i64_i64_i64_i64_i64
:
846 Params
.push_back(PtrTy
);
847 Params
.push_back(wasm::ValType::I64
);
848 Params
.push_back(wasm::ValType::I64
);
849 Params
.push_back(wasm::ValType::I64
);
850 Params
.push_back(wasm::ValType::I64
);
851 Params
.push_back(wasm::ValType::I64
);
852 Params
.push_back(wasm::ValType::I64
);
854 case i32_func_i64_i64
:
855 Rets
.push_back(wasm::ValType::I32
);
856 Params
.push_back(wasm::ValType::I64
);
857 Params
.push_back(wasm::ValType::I64
);
859 case i32_func_i64_i64_i64_i64
:
860 Rets
.push_back(wasm::ValType::I32
);
861 Params
.push_back(wasm::ValType::I64
);
862 Params
.push_back(wasm::ValType::I64
);
863 Params
.push_back(wasm::ValType::I64
);
864 Params
.push_back(wasm::ValType::I64
);
867 Rets
.push_back(PtrTy
);
868 Params
.push_back(wasm::ValType::F32
);
871 Rets
.push_back(PtrTy
);
872 Params
.push_back(wasm::ValType::F64
);
874 case iPTR_func_i64_i64
:
875 Rets
.push_back(PtrTy
);
876 Params
.push_back(wasm::ValType::I64
);
877 Params
.push_back(wasm::ValType::I64
);
880 llvm_unreachable("unsupported runtime library signature");
884 static ManagedStatic
<StaticLibcallNameMap
> LibcallNameMap
;
885 // TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unsed
886 // other than here, just roll its logic into this version.
887 void llvm::getLibcallSignature(const WebAssemblySubtarget
&Subtarget
,
889 SmallVectorImpl
<wasm::ValType
> &Rets
,
890 SmallVectorImpl
<wasm::ValType
> &Params
) {
891 auto &Map
= LibcallNameMap
->Map
;
892 auto Val
= Map
.find(Name
);
894 if (Val
== Map
.end()) {
895 auto message
= std::string("unexpected runtime library name: ") + Name
;
896 llvm_unreachable(message
.c_str());
899 return getLibcallSignature(Subtarget
, Val
->second
, Rets
, Params
);