Skip to content

Commit a67707c

Browse files
committed
RuntimeLibcalls: Add small_printf functions to emscripten
1 parent 87e1210 commit a67707c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,6 +3457,7 @@ def SystemZZOSSystemLibrary
34573457
def emscripten_return_address : RuntimeLibcallImpl<RETURN_ADDRESS>;
34583458

34593459
def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
3460+
def isOSEmscripten : RuntimeLibcallPredicate<[{TT.isOSEmscripten()}]>;
34603461

34613462
// Define the emscripten name for return address helper.
34623463
// TODO: when implementing other Wasm backends, make this generic or only do
@@ -3468,6 +3469,9 @@ def WasmSystemLibrary
34683469
exp10f, exp10,
34693470
_Unwind_CallPersonality,
34703471
emscripten_return_address,
3472+
LibcallImpls<(add __small_printf,
3473+
__small_sprintf,
3474+
__small_fprintf), isOSEmscripten>,
34713475
__stack_chk_fail, __stack_chk_guard)>;
34723476

34733477
//===----------------------------------------------------------------------===//
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; REQUIRES: webassembly-registered-target
2+
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=wasm64-unknown-emscripten < %s | FileCheck %s
3+
4+
; CHECK: declare void @__small_fprintf(...)
5+
; CHECK: declare void @__small_printf(...)
6+
; CHECK: declare void @__small_sprintf(...)

0 commit comments

Comments
 (0)