Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Introduce a structured, interned HIR type system

オープン
#31 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
cpp
領域
compilers

調査の方向性

Start with include/crossgl/HIR/HIR.h, TypeSemantics.h, and docs/architecture/ARCHITECTURE_V2.md. For the first staged foundation, trace the existing HIRType parsing and the three array splitters, then inspect the .cgl fixture corpus and unit-test type set. Done means round-trip and differential tests preserve type spellings and formatType/typeToIR output without golden changes.

索引モデルが issue の本文から書いたものです。

説明

Problem

HIRType is string-based (include/crossgl/HIR/HIR.h): a single name string overloads the base spelling, qualifier prefixes (buffer /uniform /shared ), pointer suffixes (*), and generics (atomic<int>), while arraySize is a second ][-joined mini-grammar. Type meaning is decoded by re-parsing these strings at ~300 sites across ~38 files, with duplicated isVector/isScalar/isMatrix predicates in several backends and three separate ][ array splitters. This string-typed core caps the optimizer, the HIR verifier, target legalization, and any future native binary backend, and is the single biggest obstacle to a best-in-class typed IR.

Goal

Replace the string-typed HIRType with a structured, interned type model (Type / TypeKind / TypeContext) — scalar class + lane count, matrix shape, qualifier, pointer depth, array dimensions, struct/resource payloads — with O(1) interned equality and one canonical decoder. Enforce strict typing (no implicit int/float, signed/unsigned, vector-width, or address-space conversion) per docs/architecture/ARCHITECTURE_V2.md.

Staged plan (incremental, behind the TypeSemantics.h seam; no big-bang)

  1. This PR — foundation, off the hot path: add Type / TypeKind / TypeContext, internType(const HIRType&) (the single parser, centralizing baseTypeName / stripTypeQualifier / vector-width / array-element logic and the three ][ splitters) and toLegacyHIRType(const Type&) (re-serialize). HIRType storage is unchanged. Proven by a differential round-trip test over the full .cgl fixture corpus + the unit-test type set: toLegacyHIRType(internType(t)) == t, with identical formatType/typeToIR output. Zero golden movement.
  2. Reimplement the TypeSemantics.h predicates on top of Type (same signatures); delete the divergent duplicate predicates.
  3. Migrate HIRType to carry an interned Type handle (string fields become lazy accessors for one release).
  4. Convert the four backend type mappers + typeToIR to switch on TypeKind; rekey the SPIR-V type caches on the handle; remove the legacy string fields.

The compiler keeps accepting the same CrossGL language as the crosstl translator (cross-repo language contract); this is an internal-representation refactor — accepted source and emitted/reflected type spellings are preserved and pinned by the differential tests.

主要言語
C++
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CrossGL/compiler のほかの issue

CrossGL/compiler の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。