[llvm] d128d90 - RuntimeLibcalls: Add small_printf functions to emscripten (#167087)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 05:42:37 PST 2025
Author: Matt Arsenault
Date: 2025-11-27T08:42:32-05:00
New Revision: d128d90e71146cf099a31a967fdeb2591d30514d
URL: https://github.com/llvm/llvm-project/commit/d128d90e71146cf099a31a967fdeb2591d30514d
DIFF: https://github.com/llvm/llvm-project/commit/d128d90e71146cf099a31a967fdeb2591d30514d.diff
LOG: RuntimeLibcalls: Add small_printf functions to emscripten (#167087)
Added:
llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
Modified:
llvm/include/llvm/IR/RuntimeLibcalls.td
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 50fbc8d48450a..671d0f315f5fb 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -3457,6 +3457,7 @@ def SystemZZOSSystemLibrary
def emscripten_return_address : RuntimeLibcallImpl<RETURN_ADDRESS>;
def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
+def isOSEmscripten : RuntimeLibcallPredicate<[{TT.isOSEmscripten()}]>;
// Define the emscripten name for return address helper.
// TODO: when implementing other Wasm backends, make this generic or only do
@@ -3468,6 +3469,9 @@ def WasmSystemLibrary
exp10f, exp10,
_Unwind_CallPersonality,
emscripten_return_address,
+ LibcallImpls<(add __small_printf,
+ __small_sprintf,
+ __small_fprintf), isOSEmscripten>,
__stack_chk_fail, __stack_chk_guard)>;
//===----------------------------------------------------------------------===//
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
new file mode 100644
index 0000000000000..f92f0fe2a189f
--- /dev/null
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
@@ -0,0 +1,6 @@
+; REQUIRES: webassembly-registered-target
+; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=wasm64-unknown-emscripten < %s | FileCheck %s
+
+; CHECK: declare void @__small_fprintf(...)
+; CHECK: declare void @__small_printf(...)
+; CHECK: declare void @__small_sprintf(...)
More information about the llvm-commits
mailing list