Skip to content

1-layout/lower/rwir 按 kind 特化 - #8

Merged
miaobyte merged 4 commits into
masterfrom
issue-6-kind-specialize
Aug 16, 2026
Merged

miaobyte merged 4 commits into
masterfrom
issue-6-kind-specialize

Conversation

@miaobyte

Copy link
Copy Markdown
Contributor

概览

实现 issue #6「1-layout/lower/rwir 按 kind 特化」:多态数值 op(add/+、eq/==、pow、sqrt、abs、min/max 等)在 layout 期按读参类型特化为 /lib/{kind}.{op}(如 int64.addfloat64.sqrt)。

Closes #6

主要变更

kind 特化(#6

  • 新增 rwir/builtin/num.goregisterKinds 按 kind 集合批量注册 op,NumOp/IsNumKind/WiderNumKind/OpKind 辅助
  • 新增 lower/specialize.goSpecialize 在 layout 期把多态 opcode 重写为 {kind}.{op}
  • rwir/builtin/{arith,bit,cmp,coerce,math}.go:改用 registerKinds 逐 kind 注册
  • lower/infer.go:扩展类型推断(string./random./数学 op 返回类型、kvat/set 元素类型)
  • parser/parser.go:移除 num 类型类(op 改为逐 kind 特化,不再靠 num 多态)
  • layout/layout.goWriteFunc 调用 lower.Specialize
  • stdlib/math.kv:移除 abs/sign/max/min rwfunc(下沉为 native 逐 kind op)

rwir 命名空间 /rwir/lib(相关 #5

  • keytree/{const,sys}.goRwirRoot = LibRoot,rwir 签名与 rwfunc 同根 /lib,靠 kind 区分
  • 同步更新 deepx-design 子模块(runtime篇-05 文档)

工作流基建

  • 新增 .github/ISSUE_TEMPLATE/issue.md(issue 驱动模板)

验证

  • go build ./...go vet ./... 通过

🤖 Generated with Claude Code

miaobyte and others added 4 commits August 16, 2026 04:48
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@miaobyte
miaobyte merged commit eaaabf1 into master Aug 16, 2026
1 of 4 checks passed
@miaobyte
miaobyte deleted the issue-6-kind-specialize branch August 16, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1-layout/lower/rwir按kind特化

1 participant