Skip to content

Commit b60aeee

Browse files
committed
Remove @vector
1 parent 1bb30c5 commit b60aeee

File tree

6 files changed

+10
-87
lines changed

6 files changed

+10
-87
lines changed

src/all_types.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,6 @@ enum BuiltinFnId {
17871787
BuiltinFnIdIntToErr,
17881788
BuiltinFnIdEnumToInt,
17891789
BuiltinFnIdIntToEnum,
1790-
BuiltinFnIdVectorType,
17911790
BuiltinFnIdShuffle,
17921791
BuiltinFnIdSplat,
17931792
BuiltinFnIdSetCold,
@@ -2685,7 +2684,6 @@ enum IrInstSrcId {
26852684
IrInstSrcIdIntToFloat,
26862685
IrInstSrcIdFloatToInt,
26872686
IrInstSrcIdBoolToInt,
2688-
IrInstSrcIdVectorType,
26892687
IrInstSrcIdShuffleVector,
26902688
IrInstSrcIdSplat,
26912689
IrInstSrcIdBoolNot,
@@ -3705,13 +3703,6 @@ struct IrInstSrcBoolToInt {
37053703
IrInstSrc *target;
37063704
};
37073705

3708-
struct IrInstSrcVectorType {
3709-
IrInstSrc base;
3710-
3711-
IrInstSrc *len;
3712-
IrInstSrc *elem_type;
3713-
};
3714-
37153706
struct IrInstSrcBoolNot {
37163707
IrInstSrc base;
37173708

src/codegen.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8658,7 +8658,6 @@ static void define_builtin_fns(CodeGen *g) {
86588658
create_builtin_fn(g, BuiltinFnIdIntToEnum, "intToEnum", 2);
86598659
create_builtin_fn(g, BuiltinFnIdCompileErr, "compileError", 1);
86608660
create_builtin_fn(g, BuiltinFnIdCompileLog, "compileLog", SIZE_MAX);
8661-
create_builtin_fn(g, BuiltinFnIdVectorType, "Vector", 2);
86628661
create_builtin_fn(g, BuiltinFnIdShuffle, "shuffle", 4);
86638662
create_builtin_fn(g, BuiltinFnIdSplat, "splat", 2);
86648663
create_builtin_fn(g, BuiltinFnIdSetCold, "setCold", 1);

src/ir.cpp

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,6 @@ static void destroy_instruction_src(IrInstSrc *inst) {
415415
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFloatToInt *>(inst));
416416
case IrInstSrcIdBoolToInt:
417417
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBoolToInt *>(inst));
418-
case IrInstSrcIdVectorType:
419-
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcVectorType *>(inst));
420418
case IrInstSrcIdShuffleVector:
421419
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcShuffleVector *>(inst));
422420
case IrInstSrcIdSplat:
@@ -1336,10 +1334,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcBoolToInt *) {
13361334
return IrInstSrcIdBoolToInt;
13371335
}
13381336

1339-
static constexpr IrInstSrcId ir_inst_id(IrInstSrcVectorType *) {
1340-
return IrInstSrcIdVectorType;
1341-
}
1342-
13431337
static constexpr IrInstSrcId ir_inst_id(IrInstSrcShuffleVector *) {
13441338
return IrInstSrcIdShuffleVector;
13451339
}
@@ -3607,19 +3601,6 @@ static IrInstSrc *ir_build_bool_to_int(IrBuilderSrc *irb, Scope *scope, AstNode
36073601
return &instruction->base;
36083602
}
36093603

3610-
static IrInstSrc *ir_build_vector_type(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, IrInstSrc *len,
3611-
IrInstSrc *elem_type)
3612-
{
3613-
IrInstSrcVectorType *instruction = ir_build_instruction<IrInstSrcVectorType>(irb, scope, source_node);
3614-
instruction->len = len;
3615-
instruction->elem_type = elem_type;
3616-
3617-
ir_ref_instruction(len, irb->current_basic_block);
3618-
ir_ref_instruction(elem_type, irb->current_basic_block);
3619-
3620-
return &instruction->base;
3621-
}
3622-
36233604
static IrInstSrc *ir_build_shuffle_vector(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
36243605
IrInstSrc *scalar_type, IrInstSrc *a, IrInstSrc *b, IrInstSrc *mask)
36253606
{
@@ -6809,21 +6790,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod
68096790
IrInstSrc *result = ir_build_bool_to_int(irb, scope, node, arg0_value);
68106791
return ir_lval_wrap(irb, scope, result, lval, result_loc);
68116792
}
6812-
case BuiltinFnIdVectorType:
6813-
{
6814-
AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
6815-
IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
6816-
if (arg0_value == irb->codegen->invalid_inst_src)
6817-
return arg0_value;
6818-
6819-
AstNode *arg1_node = node->data.fn_call_expr.params.at(1);
6820-
IrInstSrc *arg1_value = ir_gen_node(irb, arg1_node, scope);
6821-
if (arg1_value == irb->codegen->invalid_inst_src)
6822-
return arg1_value;
6823-
6824-
IrInstSrc *vector_type = ir_build_vector_type(irb, scope, node, arg0_value, arg1_value);
6825-
return ir_lval_wrap(irb, scope, vector_type, lval, result_loc);
6826-
}
68276793
case BuiltinFnIdShuffle:
68286794
{
68296795
AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
@@ -27193,20 +27159,6 @@ static IrInstGen *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstSrcBo
2719327159
return ir_resolve_cast(ira, &instruction->base.base, target, u1_type, CastOpBoolToInt);
2719427160
}
2719527161

27196-
static IrInstGen *ir_analyze_instruction_vector_type(IrAnalyze *ira, IrInstSrcVectorType *instruction) {
27197-
uint64_t len;
27198-
if (!ir_resolve_unsigned(ira, instruction->len->child, ira->codegen->builtin_types.entry_u32, &len))
27199-
return ira->codegen->invalid_inst_gen;
27200-
27201-
ZigType *elem_type = ir_resolve_vector_elem_type(ira, instruction->elem_type->child);
27202-
if (type_is_invalid(elem_type))
27203-
return ira->codegen->invalid_inst_gen;
27204-
27205-
ZigType *vector_type = get_vector_type(ira->codegen, len, elem_type);
27206-
27207-
return ir_const_type(ira, &instruction->base.base, vector_type);
27208-
}
27209-
2721027162
static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr,
2721127163
ZigType *scalar_type, IrInstGen *a, IrInstGen *b, IrInstGen *mask)
2721227164
{
@@ -31656,8 +31608,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc
3165631608
return ir_analyze_instruction_float_to_int(ira, (IrInstSrcFloatToInt *)instruction);
3165731609
case IrInstSrcIdBoolToInt:
3165831610
return ir_analyze_instruction_bool_to_int(ira, (IrInstSrcBoolToInt *)instruction);
31659-
case IrInstSrcIdVectorType:
31660-
return ir_analyze_instruction_vector_type(ira, (IrInstSrcVectorType *)instruction);
3166131611
case IrInstSrcIdShuffleVector:
3166231612
return ir_analyze_instruction_shuffle_vector(ira, (IrInstSrcShuffleVector *)instruction);
3166331613
case IrInstSrcIdSplat:
@@ -32147,7 +32097,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) {
3214732097
case IrInstSrcIdRef:
3214832098
case IrInstSrcIdEmbedFile:
3214932099
case IrInstSrcIdTruncate:
32150-
case IrInstSrcIdVectorType:
3215132100
case IrInstSrcIdShuffleVector:
3215232101
case IrInstSrcIdSplat:
3215332102
case IrInstSrcIdBoolNot:

src/ir_print.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) {
212212
return "SrcFloatToInt";
213213
case IrInstSrcIdBoolToInt:
214214
return "SrcBoolToInt";
215-
case IrInstSrcIdVectorType:
216-
return "SrcVectorType";
217215
case IrInstSrcIdBoolNot:
218216
return "SrcBoolNot";
219217
case IrInstSrcIdMemset:
@@ -1662,14 +1660,6 @@ static void ir_print_bool_to_int(IrPrintSrc *irp, IrInstSrcBoolToInt *instructio
16621660
fprintf(irp->f, ")");
16631661
}
16641662

1665-
static void ir_print_vector_type(IrPrintSrc *irp, IrInstSrcVectorType *instruction) {
1666-
fprintf(irp->f, "@Vector(");
1667-
ir_print_other_inst_src(irp, instruction->len);
1668-
fprintf(irp->f, ", ");
1669-
ir_print_other_inst_src(irp, instruction->elem_type);
1670-
fprintf(irp->f, ")");
1671-
}
1672-
16731663
static void ir_print_shuffle_vector(IrPrintSrc *irp, IrInstSrcShuffleVector *instruction) {
16741664
fprintf(irp->f, "@shuffle(");
16751665
ir_print_other_inst_src(irp, instruction->scalar_type);
@@ -2776,9 +2766,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai
27762766
case IrInstSrcIdBoolToInt:
27772767
ir_print_bool_to_int(irp, (IrInstSrcBoolToInt *)instruction);
27782768
break;
2779-
case IrInstSrcIdVectorType:
2780-
ir_print_vector_type(irp, (IrInstSrcVectorType *)instruction);
2781-
break;
27822769
case IrInstSrcIdShuffleVector:
27832770
ir_print_shuffle_vector(irp, (IrInstSrcShuffleVector *)instruction);
27842771
break;

test/compile_errors.zig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7808,8 +7808,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
78087808
};
78097809
break :x tc;
78107810
});
7811-
78127811
cases.add("compare optional to non-optional with invalid types",
7812+
\\const Vector = @import("std").meta.Vector;
78137813
\\export fn inconsistentChildType() void {
78147814
\\ var x: ?i32 = undefined;
78157815
\\ const y: comptime_int = 10;
@@ -7823,8 +7823,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
78237823
\\}
78247824
\\
78257825
\\export fn optionalVector() void {
7826-
\\ var x: ?@Vector(10, i32) = undefined;
7827-
\\ var y: @Vector(10, i32) = undefined;
7826+
\\ var x: ?Vector(10, i32) = undefined;
7827+
\\ var y: Vector(10, i32) = undefined;
78287828
\\ _ = (x == y);
78297829
\\}
78307830
\\
@@ -7834,13 +7834,13 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
78347834
\\ _ = (x == y);
78357835
\\}
78367836
, &[_][]const u8{
7837-
":4:12: error: cannot compare types '?i32' and 'comptime_int'",
7838-
":4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'",
7839-
":10:12: error: cannot compare types '?i32' and '?i32'",
7840-
":10:12: note: optional to optional comparison is only supported for optional pointer types",
7841-
":16:12: error: TODO add comparison of optional vector",
7842-
":22:12: error: cannot compare types '?[3]i32' and '[3]i32'",
7843-
":22:12: note: operator not supported for type '[3]i32'",
7837+
"tmp.zig:5:12: error: cannot compare types '?i32' and 'comptime_int'",
7838+
"tmp.zig:5:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'",
7839+
"tmp.zig:11:12: error: cannot compare types '?i32' and '?i32'",
7840+
"tmp.zig:11:12: note: optional to optional comparison is only supported for optional pointer types",
7841+
"tmp.zig:17:12: error: TODO add comparison of optional vector",
7842+
"tmp.zig:23:12: error: cannot compare types '?[3]i32' and '[3]i32'",
7843+
"tmp.zig:23:12: note: operator not supported for type '[3]i32'",
78447844
});
78457845

78467846
cases.add("slice cannot have its bytes reinterpreted",

test/stage1/behavior/type.zig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ test "Type.Opaque" {
197197

198198
test "Type.Vector" {
199199
testTypes(&[_]type{
200-
@Vector(0, u8),
201-
@Vector(4, u8),
202-
@Vector(8, *u8),
203200
std.meta.Vector(0, u8),
204201
std.meta.Vector(4, u8),
205202
std.meta.Vector(8, *u8),

0 commit comments

Comments
 (0)