docs: update LLVM_HARNESS.md and selfhost-pilot for ny-llvmc exe; add tools/crate_exe_smoke.sh
This commit is contained in:
@ -19,8 +19,11 @@ Protocol
|
|||||||
CLI(crate)
|
CLI(crate)
|
||||||
- `crates/nyash-llvm-compiler` 提供の `ny-llvmc` は llvmlite ハーネスの薄ラッパーだよ。
|
- `crates/nyash-llvm-compiler` 提供の `ny-llvmc` は llvmlite ハーネスの薄ラッパーだよ。
|
||||||
- ダミー: `./target/release/ny-llvmc --dummy --out /tmp/dummy.o`
|
- ダミー: `./target/release/ny-llvmc --dummy --out /tmp/dummy.o`
|
||||||
- JSON から: `./target/release/ny-llvmc --in mir.json --out out.o`
|
- JSON→.o: `./target/release/ny-llvmc --in mir.json --out out.o`
|
||||||
- 既定のハーネスパスは `tools/llvmlite_harness.py`。変更は `--harness <path>` で上書き可。
|
- JSON→EXE(新規): `./target/release/ny-llvmc --in mir.json --emit exe --nyrt target/release --out app`
|
||||||
|
- `--nyrt <dir>` で `libnyrt.a` の位置を指定(省略時は `target/release`→`crates/nyrt/target/release` の順に探索)
|
||||||
|
- 追加フラグは `--libs "<flags>"` で渡せる(例: `--libs "-static"`)
|
||||||
|
- 既定のハーネススクリプトは `tools/llvmlite_harness.py`(`--harness` で上書き可)。
|
||||||
|
|
||||||
Quick Start
|
Quick Start
|
||||||
- 依存: `python3 -m pip install llvmlite`
|
- 依存: `python3 -m pip install llvmlite`
|
||||||
@ -34,6 +37,10 @@ Wiring(Rust 側)
|
|||||||
2) `python3 tools/llvmlite_harness.py --in <mir.json> --out <obj.o>` を起動
|
2) `python3 tools/llvmlite_harness.py --in <mir.json> --out <obj.o>` を起動
|
||||||
3) 成功後は通常のリンク手順(NyRT とリンク)
|
3) 成功後は通常のリンク手順(NyRT とリンク)
|
||||||
|
|
||||||
|
Tools(統合フロー)
|
||||||
|
- crate 直結の EXE 出力: `NYASH_LLVM_COMPILER=crate NYASH_LLVM_EMIT=exe tools/build_llvm.sh apps/tests/ternary_basic.nyash -o app`
|
||||||
|
- 環境変数 `NYASH_LLVM_NYRT` で NyRT の場所を、`NYASH_LLVM_LIBS` で追加フラグを指定できる。
|
||||||
|
|
||||||
Scope(Phase 15)
|
Scope(Phase 15)
|
||||||
- 最小命令: Const/BinOp/Compare/Phi/Branch/Jump/Return
|
- 最小命令: Const/BinOp/Compare/Phi/Branch/Jump/Return
|
||||||
- 文字列: NyRT Shim(`nyash.string.len_h`, `charCodeAt_h`, `concat_hh`, `eq_hh`)を declare → call
|
- 文字列: NyRT Shim(`nyash.string.len_h`, `charCodeAt_h`, `concat_hh`, `eq_hh`)を declare → call
|
||||||
|
|||||||
@ -13,7 +13,13 @@ Recommended Flows
|
|||||||
CI Workflows
|
CI Workflows
|
||||||
- Selfhost Bootstrap (always): `.github/workflows/selfhost-bootstrap.yml`
|
- Selfhost Bootstrap (always): `.github/workflows/selfhost-bootstrap.yml`
|
||||||
- Builds nyash (`cranelift-jit`) and runs `tools/bootstrap_selfhost_smoke.sh`.
|
- Builds nyash (`cranelift-jit`) and runs `tools/bootstrap_selfhost_smoke.sh`.
|
||||||
- Selfhost EXE‑first (optional): `.github/workflows/selfhost-exe-first.yml`
|
- Selfhost EXE‑first(optional)
|
||||||
|
- crate 直結(ny-llvmc)で JSON→EXE→実行までを最短経路で確認できるよ。
|
||||||
|
- 手順(ローカル):
|
||||||
|
1) MIR(JSON) を出力: `./target/release/nyash --emit-mir-json tmp/app.json --backend mir apps/tests/ternary_basic.nyash`
|
||||||
|
2) EXE 生成: `./target/release/ny-llvmc --in tmp/app.json --emit exe --nyrt target/release --out tmp/app`
|
||||||
|
3) 実行: `./tmp/app`(戻り値が exit code)
|
||||||
|
- ワンコマンドスモーク: `bash tools/crate_exe_smoke.sh apps/tests/ternary_basic.nyash`
|
||||||
- Installs LLVM 18 + llvmlite, then runs `tools/exe_first_smoke.sh`.
|
- Installs LLVM 18 + llvmlite, then runs `tools/exe_first_smoke.sh`.
|
||||||
|
|
||||||
Useful Env Flags
|
Useful Env Flags
|
||||||
|
|||||||
Reference in New Issue
Block a user