<div dir="ltr">Hi,<div><br></div><div>wasm64 is not supported in LLVM or anywhere else. It has not even been specified yet. The clang frontend's wasm64 triple dates back to when WebAssembly was an experimental target and hasn't been removed because we expect that wasm64 will eventually exist. I have patch up that adds a clear error when wasm64 is used for now. I will go back and finish that up.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 30, 2019 at 3:44 AM zh via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>I'm writing a wasm interpreter, aim to exposure native functions for wasm modules to call directly.</div><div>So the interpreter must share address space with the wasm module.</div><div><br></div><div>To produce a simple wasm module for testing, I tried these steps: </div><div>step 1. Compile a simple c file with clang, targeting host platform.</div><div>step 2. Use llc -march  wasm64 to generate a wasm module file.</div><div>But actually it does not work, even for a simple hello.c.</div><div><br></div><div>hello.c is the classical "hello world" C program: </div><div><br></div><div>#include <stdio.h></div><div><div>int main(){</div><div><span style="white-space:pre-wrap">    </span>printf("Hello world!\n");</div><div><span style="white-space:pre-wrap">      </span>return 0;</div><div>}</div></div><div><br></div><div>This produces the hello.ll :</div><div>clang -c -emit-llvm -S D:\hello.c</div><div><br></div><div>32-bit version works perfectly:</div><div>llc -march=wasm32 hello.ll</div><div><br></div><div>And this always fail:</div><div>llc -march=wasm64 hello.ll</div><div><br></div><div>The error message says:</div><div><br></div><div><div>LLVM ERROR: Cannot select: 0x17246d26200: ch = store<(store 8 into %ir.7)> 0x17246cbf638, 0x17246d25f28, 0x17246d26268, undef:i64</div><div>  0x17246d25f28: i64,ch = CopyFromReg 0x17246cbf638, Register:i64 %0</div><div>    0x17246d25ff8: i64 = Register %0</div><div>  0x17246d26268: i64,ch = CopyFromReg 0x17246cbf638, Register:i64 %16</div><div>    0x17246d260c8: i64 = Register %16</div><div>  0x17246d25e58: i64 = undef</div><div>In function: sprintf</div><div>Stack dump:</div><div>0.      Program arguments: llc -march=wasm64 hello.ll</div><div>1.      Running pass 'Function Pass Manager' on module 'hello.ll'.</div><div>2.      Running pass 'WebAssembly Instruction Selection' on function '@sprintf'</div></div><div><br></div><div>Is it a bug in LLVM's wasm64 CodeGen?</div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>