mirror of
https://github.com/RPCSX/llvm.git
synced 2026-01-31 01:05:23 +01:00
C/C++ code can declare an extern function, which will show up as an import in WebAssembly's output. It's expected that the linker will resolve these, and mark unresolved imports as call_import (I have a patch which does this in wasmate). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250875 91177308-0d34-0410-b5e6-96231b3b80d8
22 lines
607 B
LLVM
22 lines
607 B
LLVM
; RUN: llc < %s -asm-verbose=false | FileCheck %s
|
|
|
|
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
; CHECK-LABEL: .text
|
|
; CHECK-LABEL: f:
|
|
define void @f(i32 %a, float %b) {
|
|
tail call i32 @printi(i32 %a)
|
|
tail call float @printf(float %b)
|
|
tail call void @printv()
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: .imports
|
|
; CHECK-NEXT: .import $printi "" "printi" (param i32) (result i32)
|
|
; CHECK-NEXT: .import $printf "" "printf" (param f32) (result f32)
|
|
; CHECK-NEXT: .import $printv "" "printv"
|
|
declare i32 @printi(i32)
|
|
declare float @printf(float)
|
|
declare void @printv()
|