Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Introduce a structured, interned HIR type system

Abierto
#31 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
cpp
Área
compilers

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
0
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de CrossGL/compiler

Todos los issues de CrossGL/compiler

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.