| ... | @@ -4264,7 +4264,7 @@ pub const Function = struct { | ... | @@ -4264,7 +4264,7 @@ pub const Function = struct { |
| 4264 | => wip.builder.structTypeAssumeCapacity(.normal, &.{ | 4264 | => wip.builder.structTypeAssumeCapacity(.normal, &.{ |
| 4265 | wip.extraData(CmpXchg, instruction.data).cmp.typeOfWip(wip), | 4265 | wip.extraData(CmpXchg, instruction.data).cmp.typeOfWip(wip), |
| 4266 | .i1, | 4266 | .i1, |
| 4267 | }) catch unreachable, | 4267 | }), |
| 4268 | .extractelement => wip.extraData(ExtractElement, instruction.data) | 4268 | .extractelement => wip.extraData(ExtractElement, instruction.data) |
| 4269 | .val.typeOfWip(wip).childType(wip.builder), | 4269 | .val.typeOfWip(wip).childType(wip.builder), |
| 4270 | .extractvalue => { | 4270 | .extractvalue => { |
| ... | @@ -4451,7 +4451,7 @@ pub const Function = struct { | ... | @@ -4451,7 +4451,7 @@ pub const Function = struct { |
| 4451 | function.extraData(CmpXchg, instruction.data) | 4451 | function.extraData(CmpXchg, instruction.data) |
| 4452 | .cmp.typeOf(function_index, builder), | 4452 | .cmp.typeOf(function_index, builder), |
| 4453 | .i1, | 4453 | .i1, |
| 4454 | }) catch unreachable, | 4454 | }), |
| 4455 | .extractelement => function.extraData(ExtractElement, instruction.data) | 4455 | .extractelement => function.extraData(ExtractElement, instruction.data) |
| 4456 | .val.typeOf(function_index, builder).childType(builder), | 4456 | .val.typeOf(function_index, builder).childType(builder), |
| 4457 | .extractvalue => { | 4457 | .extractvalue => { |
| ... | @@ -4840,6 +4840,44 @@ pub const DebugLocation = struct { | ... | @@ -4840,6 +4840,44 @@ pub const DebugLocation = struct { |
| 4840 | inlined_at: Metadata, | 4840 | inlined_at: Metadata, |
| 4841 | }; | 4841 | }; |
| 4842 | | 4842 | |
| | 4843 | pub const DIFlags = opaque { |
| | 4844 | pub const Zero = 0; |
| | 4845 | pub const Private = 1; |
| | 4846 | pub const Protected = 2; |
| | 4847 | pub const Public = 3; |
| | 4848 | |
| | 4849 | pub const FwdDecl = 1 << 2; |
| | 4850 | pub const AppleBlock = 1 << 3; |
| | 4851 | pub const BlockByrefStruct = 1 << 4; |
| | 4852 | pub const Virtual = 1 << 5; |
| | 4853 | pub const Artificial = 1 << 6; |
| | 4854 | pub const Explicit = 1 << 7; |
| | 4855 | pub const Prototyped = 1 << 8; |
| | 4856 | pub const ObjcClassComplete = 1 << 9; |
| | 4857 | pub const ObjectPointer = 1 << 10; |
| | 4858 | pub const Vector = 1 << 11; |
| | 4859 | pub const StaticMember = 1 << 12; |
| | 4860 | pub const LValueReference = 1 << 13; |
| | 4861 | pub const RValueReference = 1 << 14; |
| | 4862 | pub const Reserved = 1 << 15; |
| | 4863 | |
| | 4864 | pub const SingleInheritance = 1 << 16; |
| | 4865 | pub const MultipleInheritance = 2 << 16; |
| | 4866 | pub const VirtualInheritance = 3 << 16; |
| | 4867 | |
| | 4868 | pub const IntroducedVirtual = 1 << 18; |
| | 4869 | pub const BitField = 1 << 19; |
| | 4870 | pub const NoReturn = 1 << 20; |
| | 4871 | pub const TypePassByValue = 1 << 22; |
| | 4872 | pub const TypePassByReference = 1 << 23; |
| | 4873 | pub const EnumClass = 1 << 24; |
| | 4874 | pub const Thunk = 1 << 25; |
| | 4875 | pub const NonTrivial = 1 << 26; |
| | 4876 | pub const BigEndian = 1 << 27; |
| | 4877 | pub const LittleEndian = 1 << 28; |
| | 4878 | pub const AllCallsDescribed = 1 << 29; |
| | 4879 | }; |
| | 4880 | |
| 4843 | pub const WipFunction = struct { | 4881 | pub const WipFunction = struct { |
| 4844 | builder: *Builder, | 4882 | builder: *Builder, |
| 4845 | function: Function.Index, | 4883 | function: Function.Index, |
| ... | @@ -5610,7 +5648,7 @@ pub const WipFunction = struct { | ... | @@ -5610,7 +5648,7 @@ pub const WipFunction = struct { |
| 5610 | vals: []const Value, | 5648 | vals: []const Value, |
| 5611 | blocks: []const Block.Index, | 5649 | blocks: []const Block.Index, |
| 5612 | wip: *WipFunction, | 5650 | wip: *WipFunction, |
| 5613 | ) (if (build_options.have_llvm) Allocator.Error else error{})!void { | 5651 | ) void { |
| 5614 | const incoming_len = self.block.ptrConst(wip).incoming; | 5652 | const incoming_len = self.block.ptrConst(wip).incoming; |
| 5615 | assert(vals.len == incoming_len and blocks.len == incoming_len); | 5653 | assert(vals.len == incoming_len and blocks.len == incoming_len); |
| 5616 | const instruction = wip.instructions.get(@intFromEnum(self.instruction)); | 5654 | const instruction = wip.instructions.get(@intFromEnum(self.instruction)); |
| ... | @@ -8007,7 +8045,7 @@ pub fn namedTypeSetBody( | ... | @@ -8007,7 +8045,7 @@ pub fn namedTypeSetBody( |
| 8007 | self: *Builder, | 8045 | self: *Builder, |
| 8008 | named_type: Type, | 8046 | named_type: Type, |
| 8009 | body_type: Type, | 8047 | body_type: Type, |
| 8010 | ) (if (build_options.have_llvm) Allocator.Error else error{})!void { | 8048 | ) void { |
| 8011 | const named_item = self.type_items.items[@intFromEnum(named_type)]; | 8049 | const named_item = self.type_items.items[@intFromEnum(named_type)]; |
| 8012 | self.type_extra.items[named_item.data + std.meta.fieldIndex(Type.NamedStructure, "body").?] = | 8050 | self.type_extra.items[named_item.data + std.meta.fieldIndex(Type.NamedStructure, "body").?] = |
| 8013 | @intFromEnum(body_type); | 8051 | @intFromEnum(body_type); |
| ... | @@ -9372,7 +9410,7 @@ fn fnTypeAssumeCapacity( | ... | @@ -9372,7 +9410,7 @@ fn fnTypeAssumeCapacity( |
| 9372 | ret: Type, | 9410 | ret: Type, |
| 9373 | params: []const Type, | 9411 | params: []const Type, |
| 9374 | comptime kind: Type.Function.Kind, | 9412 | comptime kind: Type.Function.Kind, |
| 9375 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Type { | 9413 | ) Type { |
| 9376 | const tag: Type.Tag = switch (kind) { | 9414 | const tag: Type.Tag = switch (kind) { |
| 9377 | .normal => .function, | 9415 | .normal => .function, |
| 9378 | .vararg => .vararg_function, | 9416 | .vararg => .vararg_function, |
| ... | @@ -9528,7 +9566,7 @@ fn structTypeAssumeCapacity( | ... | @@ -9528,7 +9566,7 @@ fn structTypeAssumeCapacity( |
| 9528 | self: *Builder, | 9566 | self: *Builder, |
| 9529 | comptime kind: Type.Structure.Kind, | 9567 | comptime kind: Type.Structure.Kind, |
| 9530 | fields: []const Type, | 9568 | fields: []const Type, |
| 9531 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Type { | 9569 | ) Type { |
| 9532 | const tag: Type.Tag = switch (kind) { | 9570 | const tag: Type.Tag = switch (kind) { |
| 9533 | .normal => .structure, | 9571 | .normal => .structure, |
| 9534 | .@"packed" => .packed_structure, | 9572 | .@"packed" => .packed_structure, |
| ... | @@ -9739,10 +9777,7 @@ fn bigIntConstAssumeCapacity( | ... | @@ -9739,10 +9777,7 @@ fn bigIntConstAssumeCapacity( |
| 9739 | assert(type_item.tag == .integer); | 9777 | assert(type_item.tag == .integer); |
| 9740 | const bits = type_item.data; | 9778 | const bits = type_item.data; |
| 9741 | | 9779 | |
| 9742 | const ExpectedContents = extern struct { | 9780 | const ExpectedContents = [64 / @sizeOf(std.math.big.Limb)]std.math.big.Limb; |
| 9743 | limbs: [64 / @sizeOf(std.math.big.Limb)]std.math.big.Limb, | | |
| 9744 | llvm_limbs: if (build_options.have_llvm) [64 / @sizeOf(u64)]u64 else void, | | |
| 9745 | }; | | |
| 9746 | var stack align(@alignOf(ExpectedContents)) = | 9781 | var stack align(@alignOf(ExpectedContents)) = |
| 9747 | std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa); | 9782 | std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa); |
| 9748 | const allocator = stack.get(); | 9783 | const allocator = stack.get(); |
| ... | @@ -9973,11 +10008,7 @@ fn noneConstAssumeCapacity(self: *Builder, ty: Type) Constant { | ... | @@ -9973,11 +10008,7 @@ fn noneConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 9973 | return result.constant; | 10008 | return result.constant; |
| 9974 | } | 10009 | } |
| 9975 | | 10010 | |
| 9976 | fn structConstAssumeCapacity( | 10011 | fn structConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { |
| 9977 | self: *Builder, | | |
| 9978 | ty: Type, | | |
| 9979 | vals: []const Constant, | | |
| 9980 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Constant { | | |
| 9981 | const type_item = self.type_items.items[@intFromEnum(ty)]; | 10012 | const type_item = self.type_items.items[@intFromEnum(ty)]; |
| 9982 | var extra = self.typeExtraDataTrail(Type.Structure, switch (type_item.tag) { | 10013 | var extra = self.typeExtraDataTrail(Type.Structure, switch (type_item.tag) { |
| 9983 | .structure, .packed_structure => type_item.data, | 10014 | .structure, .packed_structure => type_item.data, |
| ... | @@ -10007,11 +10038,7 @@ fn structConstAssumeCapacity( | ... | @@ -10007,11 +10038,7 @@ fn structConstAssumeCapacity( |
| 10007 | return result.constant; | 10038 | return result.constant; |
| 10008 | } | 10039 | } |
| 10009 | | 10040 | |
| 10010 | fn arrayConstAssumeCapacity( | 10041 | fn arrayConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { |
| 10011 | self: *Builder, | | |
| 10012 | ty: Type, | | |
| 10013 | vals: []const Constant, | | |
| 10014 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Constant { | | |
| 10015 | const type_item = self.type_items.items[@intFromEnum(ty)]; | 10042 | const type_item = self.type_items.items[@intFromEnum(ty)]; |
| 10016 | const type_extra: struct { len: u64, child: Type } = switch (type_item.tag) { | 10043 | const type_extra: struct { len: u64, child: Type } = switch (type_item.tag) { |
| 10017 | inline .small_array, .array => |kind| extra: { | 10044 | inline .small_array, .array => |kind| extra: { |
| ... | @@ -10055,11 +10082,7 @@ fn stringNullConstAssumeCapacity(self: *Builder, val: String) Constant { | ... | @@ -10055,11 +10082,7 @@ fn stringNullConstAssumeCapacity(self: *Builder, val: String) Constant { |
| 10055 | return result.constant; | 10082 | return result.constant; |
| 10056 | } | 10083 | } |
| 10057 | | 10084 | |
| 10058 | fn vectorConstAssumeCapacity( | 10085 | fn vectorConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { |
| 10059 | self: *Builder, | | |
| 10060 | ty: Type, | | |
| 10061 | vals: []const Constant, | | |
| 10062 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Constant { | | |
| 10063 | assert(ty.isVector(self)); | 10086 | assert(ty.isVector(self)); |
| 10064 | assert(ty.vectorLen(self) == vals.len); | 10087 | assert(ty.vectorLen(self) == vals.len); |
| 10065 | for (vals) |val| assert(ty.childType(self) == val.typeOf(self)); | 10088 | for (vals) |val| assert(ty.childType(self) == val.typeOf(self)); |
| ... | @@ -10075,11 +10098,7 @@ fn vectorConstAssumeCapacity( | ... | @@ -10075,11 +10098,7 @@ fn vectorConstAssumeCapacity( |
| 10075 | return result.constant; | 10098 | return result.constant; |
| 10076 | } | 10099 | } |
| 10077 | | 10100 | |
| 10078 | fn splatConstAssumeCapacity( | 10101 | fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { |
| 10079 | self: *Builder, | | |
| 10080 | ty: Type, | | |
| 10081 | val: Constant, | | |
| 10082 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Constant { | | |
| 10083 | assert(ty.scalarType(self) == val.typeOf(self)); | 10102 | assert(ty.scalarType(self) == val.typeOf(self)); |
| 10084 | | 10103 | |
| 10085 | if (!ty.isVector(self)) return val; | 10104 | if (!ty.isVector(self)) return val; |
| ... | @@ -10327,7 +10346,7 @@ fn gepConstAssumeCapacity( | ... | @@ -10327,7 +10346,7 @@ fn gepConstAssumeCapacity( |
| 10327 | base: Constant, | 10346 | base: Constant, |
| 10328 | inrange: ?u16, | 10347 | inrange: ?u16, |
| 10329 | indices: []const Constant, | 10348 | indices: []const Constant, |
| 10330 | ) (if (build_options.have_llvm) Allocator.Error else error{})!Constant { | 10349 | ) Constant { |
| 10331 | const tag: Constant.Tag = switch (kind) { | 10350 | const tag: Constant.Tag = switch (kind) { |
| 10332 | .normal => .getelementptr, | 10351 | .normal => .getelementptr, |
| 10333 | .inbounds => .@"getelementptr inbounds", | 10352 | .inbounds => .@"getelementptr inbounds", |