JF Bastien 1a59c6b2c9 WebAssembly: support imports
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).

llvm-svn: 250875
2015-10-21 02:23:09 +00:00

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()