- How to Cross Compile LLVM: https://llvm.org/docs/HowToCrossCompileLLVM.html
- Building LLVM with CMake: https://llvm.org/docs/CMake.html
- Hints from wasi-sdk Makefile: https://github.com/CraneStation/wasi-sdk/blob/master/Makefile
- Try compiling natively (needed for llvm-tblgen and clang-tblgen)
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;WebAssembly" -DLLVM_ENABLE_PROJECTS="lld;clang" ../llvm
- Try building LLVM with WASI:
- cmake -G Ninja -DCMAKE_AR=”/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-ar” -DCMAKE_RANLIB=”/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-ranlib” -DCMAKE_C_COMPILER="/usr/local/google/home/binji/dev/wasi-sdk-5.0/opt/wasi-sdk/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/google/home/binji/dev/wasi-sdk-5.0/opt/wasi-sdk/bin/clang++" -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/usr/local/google/home/binji/dev/wasi-clang -DLLVM_TABLEGEN=/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "common.h" | |
#include "options.h" | |
#include "vec.h" | |
#include "third_party/json.h" | |
#define HOOK(name, ...) | |
#define DEBUG(...) (void)0 | |
// See s_opcode_bits below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import "env" "memory" (memory 1)) | |
(import "env" "text" (func $text (param i32 i32 i32))) | |
;; The current game mode. 0: init, 1: wait, 2: reset, 3:game, 4:winning | |
(global $mode (mut i32) (i32.const 0)) | |
;; The mode timer, in frames. | |
(global $mode-timer (mut i32) (i32.const 60)) | |
;; The maximum wall to render or collide against. Used to clear the maze. | |
(global $max-wall-addr (mut i32) (i32.const 0x2778)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Memory map: | |
;; | |
;; [0x19a3 .. 0x019a4] x, y mouse click position | |
;; [0x1a60 .. 0x01aa0] 16 RGBA colors u32[16] | |
;; [0x1aa0 .. 0x01ea0] 16x16 emojis 4bpp u8[8][128] | |
;; [0x1ea0 .. 0x01ef0] 8x8 digits 1bpp u8[10][8] | |
;; [0x1ef0 .. 0x01f18] gameover 1bpp u8[5][8] | |
;; [0x1f18 .. 0x01f60] 18 match patterns u32[18] | |
;; [0x1f60 .. 0x01ff0] 18 shift masks u64[18] | |
;; [0x20a0 .. 0x020e0] 8x8 grid bitmap u64[8] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in | |
all copies or substantial portions of the Software. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(func (export "4x_i32") (param i32 i32 i32 i32) | |
(local $temp i32) | |
(local $i i32) | |
local.get 0 | |
i32.const 16 | |
i32.ge_s | |
if | |
loop | |
local.get 2 | |
local.get $i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export memory mem(initial: 1, max: 0); | |
global g_a:int = 512; | |
global g_b:int = 144; | |
global g_c:int = 0; | |
global g_d:int = 0; | |
global g_e:int = 0; | |
data d_pPpPPPP(offset: 0) = | |
"\f0\90\90\90\f0` p\f0\10\f0\80\f0\f0\10\f0\10\f0\a0\a0\f0 \f0\80\f0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emcc test.c -o test.js -s EXPORTED_FUNCTIONS='["_get", "_increment"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r -u spec/document/core/appendix/index-instructions.rst sign-extension-ops/document/core/appendix/index-instructions.rst | |
--- spec/document/core/appendix/index-instructions.rst 2019-03-30 12:56:50.472907052 -0700 | |
+++ sign-extension-ops/document/core/appendix/index-instructions.rst 2020-01-16 10:29:11.379288914 -0800 | |
@@ -199,4 +199,10 @@ | |
:math:`\I64.\REINTERPRET\K{\_}\F64` :math:`\hex{BD}` :math:`[\F64] \to [\I64]` :ref:`validation <valid-cvtop>` :ref:`execution <exec-cvtop>`, :ref:`operator <op-reinterpret>` | |
:math:`\F32.\REINTERPRET\K{\_}\I32` :math:`\hex{BE}` :math:`[\I32] \to [\F32]` :ref:`validation <valid-cvtop>` :ref:`execution <exec-cvtop>`, :ref:`operator <op-reinterpret>` | |
:math:`\F64.\REINTERPRET\K{\_}\I64` :math:`\hex{BF}` :math:`[\I64] \to [\F64]` :ref:`validation <valid-cvtop>` :ref:`execution <exec-cvtop>`, :ref:`operator <op-reinterpret>` | |
+:math:`\I32.\EXTEND\K{8\_s}` :math:`\hex{C0} |
NewerOlder