Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way vector types work in Thorin current matches LLVM: pointers and primitive types can be widened by setting a
length
field to a value other than1
. I believe this design is problematic and instead I suggest using vector type constructors (ie:vector_type(prim_type(i32), 4)
).Lots of code in Thorin is written with a questionable attention to flattened vector types, and patterns-match
PrimType(i32, ...)
as "a signed 32-bit integer" when it could in fact be a vector. By making the vector types use another constructor, there are no more risks of making this mistake. Making our type system syntax-directed prevents such oversights and better matches how the other backends deal with vectors (C, Shady, SPIR-V).The new
VectorType
takes aScalarType
as a base. OnlyPrimType
andPtrType
inherit fromScalarType
, matching the classic Thorin/LLVM behavior. For convenience, I addeddeconstruct_vector
and a few more helper methods to be able to treatScalarType
andVectorType
more or less as the oldVectorType
.