| author | |
| committer | |
| log | 5466e87fce581f2ef90ac23bb80b1dbc05836fc6 |
| tree | 76924d4c30f3dfbd0e01ce8a7b3d8132bb4538b8 |
| parent | 397e055ddd944b2a730458b70c389f1c6588c058 |
* zig_clang is fully updated
* zig_llvm is fully updated
Some initial work on codegen.cpp is in place for upgrading to LLVM's
new opaque pointers. However there is much more to be done.
A few of zig llvm bindings for deprecated functions have been updated;
more need to be updated.9 files changed, 83 insertions(+), 76 deletions(-)
lib/std/target.zig+2-2| ... | @@ -804,6 +804,8 @@ pub const Target = struct { | ... | @@ -804,6 +804,8 @@ pub const Target = struct { |
| 804 | hsail64, | 804 | hsail64, |
| 805 | spir, | 805 | spir, |
| 806 | spir64, | 806 | spir64, |
| 807 | spirv32, | ||
| 808 | spirv64, | ||
| 807 | kalimba, | 809 | kalimba, |
| 808 | shave, | 810 | shave, |
| 809 | lanai, | 811 | lanai, |
| ... | @@ -815,8 +817,6 @@ pub const Target = struct { | ... | @@ -815,8 +817,6 @@ pub const Target = struct { |
| 815 | // Stage1 currently assumes that architectures above this comment | 817 | // Stage1 currently assumes that architectures above this comment |
| 816 | // map one-to-one with the ZigLLVM_ArchType enum. | 818 | // map one-to-one with the ZigLLVM_ArchType enum. |
| 817 | spu_2, | 819 | spu_2, |
| 818 | spirv32, | ||
| 819 | spirv64, | ||
| 820 | 820 | ||
| 821 | pub fn isX86(arch: Arch) bool { | 821 | pub fn isX86(arch: Arch) bool { |
| 822 | return switch (arch) { | 822 | return switch (arch) { |
src/clang.zig+6-2| ... | @@ -1104,6 +1104,7 @@ pub const TypeClass = enum(c_int) { | ... | @@ -1104,6 +1104,7 @@ pub const TypeClass = enum(c_int) { |
| 1104 | VariableArray, | 1104 | VariableArray, |
| 1105 | Atomic, | 1105 | Atomic, |
| 1106 | Attributed, | 1106 | Attributed, |
| 1107 | BitInt, | ||
| 1107 | BlockPointer, | 1108 | BlockPointer, |
| 1108 | Builtin, | 1109 | Builtin, |
| 1109 | Complex, | 1110 | Complex, |
| ... | @@ -1111,13 +1112,12 @@ pub const TypeClass = enum(c_int) { | ... | @@ -1111,13 +1112,12 @@ pub const TypeClass = enum(c_int) { |
| 1111 | Auto, | 1112 | Auto, |
| 1112 | DeducedTemplateSpecialization, | 1113 | DeducedTemplateSpecialization, |
| 1113 | DependentAddressSpace, | 1114 | DependentAddressSpace, |
| 1114 | DependentExtInt, | 1115 | DependentBitInt, |
| 1115 | DependentName, | 1116 | DependentName, |
| 1116 | DependentSizedExtVector, | 1117 | DependentSizedExtVector, |
| 1117 | DependentTemplateSpecialization, | 1118 | DependentTemplateSpecialization, |
| 1118 | DependentVector, | 1119 | DependentVector, |
| 1119 | Elaborated, | 1120 | Elaborated, |
| 1120 | ExtInt, | ||
| 1121 | FunctionNoProto, | 1121 | FunctionNoProto, |
| 1122 | FunctionProto, | 1122 | FunctionProto, |
| 1123 | InjectedClassName, | 1123 | InjectedClassName, |
| ... | @@ -1146,6 +1146,7 @@ pub const TypeClass = enum(c_int) { | ... | @@ -1146,6 +1146,7 @@ pub const TypeClass = enum(c_int) { |
| 1146 | Typedef, | 1146 | Typedef, |
| 1147 | UnaryTransform, | 1147 | UnaryTransform, |
| 1148 | UnresolvedUsing, | 1148 | UnresolvedUsing, |
| 1149 | Using, | ||
| 1149 | Vector, | 1150 | Vector, |
| 1150 | ExtVector, | 1151 | ExtVector, |
| 1151 | }; | 1152 | }; |
| ... | @@ -1187,6 +1188,7 @@ const StmtClass = enum(c_int) { | ... | @@ -1187,6 +1188,7 @@ const StmtClass = enum(c_int) { |
| 1187 | OMPDistributeSimdDirectiveClass, | 1188 | OMPDistributeSimdDirectiveClass, |
| 1188 | OMPForDirectiveClass, | 1189 | OMPForDirectiveClass, |
| 1189 | OMPForSimdDirectiveClass, | 1190 | OMPForSimdDirectiveClass, |
| 1191 | OMPGenericLoopDirectiveClass, | ||
| 1190 | OMPMasterTaskLoopDirectiveClass, | 1192 | OMPMasterTaskLoopDirectiveClass, |
| 1191 | OMPMasterTaskLoopSimdDirectiveClass, | 1193 | OMPMasterTaskLoopSimdDirectiveClass, |
| 1192 | OMPParallelForDirectiveClass, | 1194 | OMPParallelForDirectiveClass, |
| ... | @@ -1210,6 +1212,7 @@ const StmtClass = enum(c_int) { | ... | @@ -1210,6 +1212,7 @@ const StmtClass = enum(c_int) { |
| 1210 | OMPUnrollDirectiveClass, | 1212 | OMPUnrollDirectiveClass, |
| 1211 | OMPMaskedDirectiveClass, | 1213 | OMPMaskedDirectiveClass, |
| 1212 | OMPMasterDirectiveClass, | 1214 | OMPMasterDirectiveClass, |
| 1215 | OMPMetaDirectiveClass, | ||
| 1213 | OMPOrderedDirectiveClass, | 1216 | OMPOrderedDirectiveClass, |
| 1214 | OMPParallelDirectiveClass, | 1217 | OMPParallelDirectiveClass, |
| 1215 | OMPParallelMasterDirectiveClass, | 1218 | OMPParallelMasterDirectiveClass, |
| ... | @@ -1746,6 +1749,7 @@ pub const BuiltinTypeKind = enum(c_int) { | ... | @@ -1746,6 +1749,7 @@ pub const BuiltinTypeKind = enum(c_int) { |
| 1746 | Float16, | 1749 | Float16, |
| 1747 | BFloat16, | 1750 | BFloat16, |
| 1748 | Float128, | 1751 | Float128, |
| 1752 | Ibm128, | ||
| 1749 | NullPtr, | 1753 | NullPtr, |
| 1750 | ObjCId, | 1754 | ObjCId, |
| 1751 | ObjCClass, | 1755 | ObjCClass, |
src/codegen/llvm/bindings.zig+8-7| ... | @@ -331,10 +331,11 @@ pub const Module = opaque { | ... | @@ -331,10 +331,11 @@ pub const Module = opaque { |
| 331 | pub const getLastGlobalAlias = LLVMGetLastGlobalAlias; | 331 | pub const getLastGlobalAlias = LLVMGetLastGlobalAlias; |
| 332 | extern fn LLVMGetLastGlobalAlias(M: *const Module) *const Value; | 332 | extern fn LLVMGetLastGlobalAlias(M: *const Module) *const Value; |
| 333 | 333 | ||
| 334 | pub const addAlias = LLVMAddAlias; | 334 | pub const addAlias = LLVMAddAlias2; |
| 335 | extern fn LLVMAddAlias( | 335 | extern fn LLVMAddAlias2( |
| 336 | M: *const Module, | 336 | M: *const Module, |
| 337 | Ty: *const Type, | 337 | Ty: *const Type, |
| 338 | AddrSpace: c_uint, | ||
| 338 | Aliasee: *const Value, | 339 | Aliasee: *const Value, |
| 339 | Name: [*:0]const u8, | 340 | Name: [*:0]const u8, |
| 340 | ) *const Value; | 341 | ) *const Value; |
| ... | @@ -458,8 +459,8 @@ pub const Builder = opaque { | ... | @@ -458,8 +459,8 @@ pub const Builder = opaque { |
| 458 | pub const buildStore = LLVMBuildStore; | 459 | pub const buildStore = LLVMBuildStore; |
| 459 | extern fn LLVMBuildStore(*const Builder, Val: *const Value, Ptr: *const Value) *const Value; | 460 | extern fn LLVMBuildStore(*const Builder, Val: *const Value, Ptr: *const Value) *const Value; |
| 460 | 461 | ||
| 461 | pub const buildLoad = LLVMBuildLoad; | 462 | pub const buildLoad = LLVMBuildLoad2; |
| 462 | extern fn LLVMBuildLoad(*const Builder, PointerVal: *const Value, Name: [*:0]const u8) *const Value; | 463 | extern fn LLVMBuildLoad2(*const Builder, Ty: *const Type, PointerVal: *const Value, Name: [*:0]const u8) *const Value; |
| 463 | 464 | ||
| 464 | pub const buildNeg = LLVMBuildNeg; | 465 | pub const buildNeg = LLVMBuildNeg; |
| 465 | extern fn LLVMBuildNeg(*const Builder, V: *const Value, Name: [*:0]const u8) *const Value; | 466 | extern fn LLVMBuildNeg(*const Builder, V: *const Value, Name: [*:0]const u8) *const Value; |
| ... | @@ -1067,9 +1068,9 @@ pub extern fn LLVMInitializeM68kAsmParser() void; | ... | @@ -1067,9 +1068,9 @@ pub extern fn LLVMInitializeM68kAsmParser() void; |
| 1067 | pub extern fn LLVMInitializeCSKYAsmParser() void; | 1068 | pub extern fn LLVMInitializeCSKYAsmParser() void; |
| 1068 | pub extern fn LLVMInitializeVEAsmParser() void; | 1069 | pub extern fn LLVMInitializeVEAsmParser() void; |
| 1069 | 1070 | ||
| 1070 | extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int; | 1071 | extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) c_int; |
| 1071 | extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int; | 1072 | extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) c_int; |
| 1072 | extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int; | 1073 | extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) c_int; |
| 1073 | 1074 | ||
| 1074 | pub const LinkCOFF = ZigLLDLinkCOFF; | 1075 | pub const LinkCOFF = ZigLLDLinkCOFF; |
| 1075 | pub const LinkELF = ZigLLDLinkELF; | 1076 | pub const LinkELF = ZigLLDLinkELF; |
src/stage1/codegen.cpp+12-9| ... | @@ -490,7 +490,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { | ... | @@ -490,7 +490,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 490 | 490 | ||
| 491 | for (size_t i = 1; i < fn->export_list.length; i += 1) { | 491 | for (size_t i = 1; i < fn->export_list.length; i += 1) { |
| 492 | GlobalExport *fn_export = &fn->export_list.items[i]; | 492 | GlobalExport *fn_export = &fn->export_list.items[i]; |
| 493 | LLVMAddAlias(g->module, LLVMTypeOf(llvm_fn), llvm_fn, buf_ptr(&fn_export->name)); | 493 | LLVMAddAlias2(g->module, LLVMTypeOf(llvm_fn), 0, llvm_fn, buf_ptr(&fn_export->name)); |
| 494 | } | 494 | } |
| 495 | } | 495 | } |
| 496 | 496 | ||
| ... | @@ -901,10 +901,10 @@ static LLVMValueRef gen_store(CodeGen *g, LLVMValueRef value, LLVMValueRef ptr, | ... | @@ -901,10 +901,10 @@ static LLVMValueRef gen_store(CodeGen *g, LLVMValueRef value, LLVMValueRef ptr, |
| 901 | return gen_store_untyped(g, value, ptr, alignment, ptr_type->data.pointer.is_volatile); | 901 | return gen_store_untyped(g, value, ptr, alignment, ptr_type->data.pointer.is_volatile); |
| 902 | } | 902 | } |
| 903 | 903 | ||
| 904 | static LLVMValueRef gen_load_untyped(CodeGen *g, LLVMValueRef ptr, uint32_t alignment, bool is_volatile, | 904 | static LLVMValueRef gen_load_untyped(CodeGen *g, LLVMTypeRef elem_type, LLVMValueRef ptr, |
| 905 | const char *name) | 905 | uint32_t alignment, bool is_volatile, const char *name) |
| 906 | { | 906 | { |
| 907 | LLVMValueRef result = LLVMBuildLoad(g->builder, ptr, name); | 907 | LLVMValueRef result = LLVMBuildLoad2(g->builder, elem_type, ptr, name); |
| 908 | if (is_volatile) LLVMSetVolatile(result, true); | 908 | if (is_volatile) LLVMSetVolatile(result, true); |
| 909 | if (alignment == 0) { | 909 | if (alignment == 0) { |
| 910 | LLVMSetAlignment(result, LLVMABIAlignmentOfType(g->target_data_ref, LLVMGetElementType(LLVMTypeOf(ptr)))); | 910 | LLVMSetAlignment(result, LLVMABIAlignmentOfType(g->target_data_ref, LLVMGetElementType(LLVMTypeOf(ptr)))); |
| ... | @@ -916,8 +916,10 @@ static LLVMValueRef gen_load_untyped(CodeGen *g, LLVMValueRef ptr, uint32_t alig | ... | @@ -916,8 +916,10 @@ static LLVMValueRef gen_load_untyped(CodeGen *g, LLVMValueRef ptr, uint32_t alig |
| 916 | 916 | ||
| 917 | static LLVMValueRef gen_load(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, const char *name) { | 917 | static LLVMValueRef gen_load(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, const char *name) { |
| 918 | assert(ptr_type->id == ZigTypeIdPointer); | 918 | assert(ptr_type->id == ZigTypeIdPointer); |
| 919 | ZigType *elem_type = ptr_type->data.pointer.child_type; | ||
| 919 | uint32_t alignment = get_ptr_align(g, ptr_type); | 920 | uint32_t alignment = get_ptr_align(g, ptr_type); |
| 920 | return gen_load_untyped(g, ptr, alignment, ptr_type->data.pointer.is_volatile, name); | 921 | return gen_load_untyped(g, get_llvm_type(g, elem_type), ptr, alignment, |
| 922 | ptr_type->data.pointer.is_volatile, name); | ||
| 921 | } | 923 | } |
| 922 | 924 | ||
| 923 | static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, ZigType *type, ZigType *ptr_type) { | 925 | static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, ZigType *type, ZigType *ptr_type) { |
| ... | @@ -1265,15 +1267,16 @@ static LLVMValueRef get_add_error_return_trace_addr_fn(CodeGen *g) { | ... | @@ -1265,15 +1267,16 @@ static LLVMValueRef get_add_error_return_trace_addr_fn(CodeGen *g) { |
| 1265 | size_t len_field_index = slice_type->data.structure.fields[slice_len_index]->gen_index; | 1267 | size_t len_field_index = slice_type->data.structure.fields[slice_len_index]->gen_index; |
| 1266 | LLVMValueRef len_field_ptr = LLVMBuildStructGEP(g->builder, addresses_field_ptr, (unsigned)len_field_index, ""); | 1268 | LLVMValueRef len_field_ptr = LLVMBuildStructGEP(g->builder, addresses_field_ptr, (unsigned)len_field_index, ""); |
| 1267 | 1269 | ||
| 1268 | LLVMValueRef len_value = gen_load_untyped(g, len_field_ptr, 0, false, ""); | 1270 | LLVMValueRef len_value = gen_load_untyped(g, usize_type_ref, len_field_ptr, 0, false, ""); |
| 1269 | LLVMValueRef index_val = gen_load_untyped(g, index_field_ptr, 0, false, ""); | 1271 | LLVMValueRef index_val = gen_load_untyped(g, usize_type_ref, index_field_ptr, 0, false, ""); |
| 1270 | LLVMValueRef len_val_minus_one = LLVMBuildSub(g->builder, len_value, LLVMConstInt(usize_type_ref, 1, false), ""); | 1272 | LLVMValueRef len_val_minus_one = LLVMBuildSub(g->builder, len_value, LLVMConstInt(usize_type_ref, 1, false), ""); |
| 1271 | LLVMValueRef masked_val = LLVMBuildAnd(g->builder, index_val, len_val_minus_one, ""); | 1273 | LLVMValueRef masked_val = LLVMBuildAnd(g->builder, index_val, len_val_minus_one, ""); |
| 1272 | LLVMValueRef address_indices[] = { | 1274 | LLVMValueRef address_indices[] = { |
| 1273 | masked_val, | 1275 | masked_val, |
| 1274 | }; | 1276 | }; |
| 1275 | 1277 | ||
| 1276 | LLVMValueRef ptr_value = gen_load_untyped(g, ptr_field_ptr, 0, false, ""); | 1278 | LLVMTypeRef ptr_to_usize = LLVMPointerType(usize_type_ref, 0); |
| 1279 | LLVMValueRef ptr_value = gen_load_untyped(g, ptr_to_usize, ptr_field_ptr, 0, false, ""); | ||
| 1277 | LLVMValueRef address_slot = LLVMBuildInBoundsGEP(g->builder, ptr_value, address_indices, 1, ""); | 1280 | LLVMValueRef address_slot = LLVMBuildInBoundsGEP(g->builder, ptr_value, address_indices, 1, ""); |
| 1278 | 1281 | ||
| 1279 | gen_store_untyped(g, address_value, address_slot, 0, false); | 1282 | gen_store_untyped(g, address_value, address_slot, 0, false); |
| ... | @@ -8802,7 +8805,7 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -8802,7 +8805,7 @@ static void do_code_gen(CodeGen *g) { |
| 8802 | 8805 | ||
| 8803 | for (size_t export_i = 1; export_i < var->export_list.length; export_i += 1) { | 8806 | for (size_t export_i = 1; export_i < var->export_list.length; export_i += 1) { |
| 8804 | GlobalExport *global_export = &var->export_list.items[export_i]; | 8807 | GlobalExport *global_export = &var->export_list.items[export_i]; |
| 8805 | LLVMAddAlias(g->module, LLVMTypeOf(var->value_ref), var->value_ref, buf_ptr(&global_export->name)); | 8808 | LLVMAddAlias2(g->module, LLVMTypeOf(var->value_ref), 0, var->value_ref, buf_ptr(&global_export->name)); |
| 8806 | } | 8809 | } |
| 8807 | } | 8810 | } |
| 8808 | 8811 |
src/stage1/target.cpp+2| ... | @@ -60,6 +60,8 @@ static const ZigLLVM_ArchType arch_list[] = { | ... | @@ -60,6 +60,8 @@ static const ZigLLVM_ArchType arch_list[] = { |
| 60 | ZigLLVM_hsail64, // AMD HSAIL with 64-bit pointers | 60 | ZigLLVM_hsail64, // AMD HSAIL with 64-bit pointers |
| 61 | ZigLLVM_spir, // SPIR: standard portable IR for OpenCL 32-bit version | 61 | ZigLLVM_spir, // SPIR: standard portable IR for OpenCL 32-bit version |
| 62 | ZigLLVM_spir64, // SPIR: standard portable IR for OpenCL 64-bit version | 62 | ZigLLVM_spir64, // SPIR: standard portable IR for OpenCL 64-bit version |
| 63 | ZigLLVM_spirv32, // SPIR-V with 32-bit pointers | ||
| 64 | ZigLLVM_spirv64, // SPIR-V with 64-bit pointers | ||
| 63 | ZigLLVM_kalimba, // Kalimba: generic kalimba | 65 | ZigLLVM_kalimba, // Kalimba: generic kalimba |
| 64 | ZigLLVM_shave, // SHAVE: Movidius vector VLIW processors | 66 | ZigLLVM_shave, // SHAVE: Movidius vector VLIW processors |
| 65 | ZigLLVM_lanai, // Lanai: Lanai 32-bit | 67 | ZigLLVM_lanai, // Lanai: Lanai 32-bit |
src/zig_clang.cpp+12-4| ... | @@ -294,13 +294,14 @@ void ZigClang_detect_enum_TypeClass(clang::Type::TypeClass ty) { | ... | @@ -294,13 +294,14 @@ void ZigClang_detect_enum_TypeClass(clang::Type::TypeClass ty) { |
| 294 | case clang::Type::DependentSizedArray: | 294 | case clang::Type::DependentSizedArray: |
| 295 | case clang::Type::DependentSizedExtVector: | 295 | case clang::Type::DependentSizedExtVector: |
| 296 | case clang::Type::DependentAddressSpace: | 296 | case clang::Type::DependentAddressSpace: |
| 297 | case clang::Type::DependentExtInt: | 297 | case clang::Type::DependentBitInt: |
| 298 | case clang::Type::Vector: | 298 | case clang::Type::Vector: |
| 299 | case clang::Type::DependentVector: | 299 | case clang::Type::DependentVector: |
| 300 | case clang::Type::ExtVector: | 300 | case clang::Type::ExtVector: |
| 301 | case clang::Type::FunctionProto: | 301 | case clang::Type::FunctionProto: |
| 302 | case clang::Type::FunctionNoProto: | 302 | case clang::Type::FunctionNoProto: |
| 303 | case clang::Type::UnresolvedUsing: | 303 | case clang::Type::UnresolvedUsing: |
| 304 | case clang::Type::Using: | ||
| 304 | case clang::Type::Paren: | 305 | case clang::Type::Paren: |
| 305 | case clang::Type::Typedef: | 306 | case clang::Type::Typedef: |
| 306 | case clang::Type::MacroQualified: | 307 | case clang::Type::MacroQualified: |
| ... | @@ -315,8 +316,8 @@ void ZigClang_detect_enum_TypeClass(clang::Type::TypeClass ty) { | ... | @@ -315,8 +316,8 @@ void ZigClang_detect_enum_TypeClass(clang::Type::TypeClass ty) { |
| 315 | case clang::Type::Record: | 316 | case clang::Type::Record: |
| 316 | case clang::Type::Enum: | 317 | case clang::Type::Enum: |
| 317 | case clang::Type::Elaborated: | 318 | case clang::Type::Elaborated: |
| 318 | case clang::Type::ExtInt: | ||
| 319 | case clang::Type::Attributed: | 319 | case clang::Type::Attributed: |
| 320 | case clang::Type::BitInt: | ||
| 320 | case clang::Type::TemplateTypeParm: | 321 | case clang::Type::TemplateTypeParm: |
| 321 | case clang::Type::SubstTemplateTypeParm: | 322 | case clang::Type::SubstTemplateTypeParm: |
| 322 | case clang::Type::SubstTemplateTypeParmPack: | 323 | case clang::Type::SubstTemplateTypeParmPack: |
| ... | @@ -345,6 +346,7 @@ static_assert((clang::Type::TypeClass)ZigClangType_IncompleteArray == clang::Typ | ... | @@ -345,6 +346,7 @@ static_assert((clang::Type::TypeClass)ZigClangType_IncompleteArray == clang::Typ |
| 345 | static_assert((clang::Type::TypeClass)ZigClangType_VariableArray == clang::Type::VariableArray, ""); | 346 | static_assert((clang::Type::TypeClass)ZigClangType_VariableArray == clang::Type::VariableArray, ""); |
| 346 | static_assert((clang::Type::TypeClass)ZigClangType_Atomic == clang::Type::Atomic, ""); | 347 | static_assert((clang::Type::TypeClass)ZigClangType_Atomic == clang::Type::Atomic, ""); |
| 347 | static_assert((clang::Type::TypeClass)ZigClangType_Attributed == clang::Type::Attributed, ""); | 348 | static_assert((clang::Type::TypeClass)ZigClangType_Attributed == clang::Type::Attributed, ""); |
| 349 | static_assert((clang::Type::TypeClass)ZigClangType_BitInt == clang::Type::BitInt, ""); | ||
| 348 | static_assert((clang::Type::TypeClass)ZigClangType_BlockPointer == clang::Type::BlockPointer, ""); | 350 | static_assert((clang::Type::TypeClass)ZigClangType_BlockPointer == clang::Type::BlockPointer, ""); |
| 349 | static_assert((clang::Type::TypeClass)ZigClangType_Builtin == clang::Type::Builtin, ""); | 351 | static_assert((clang::Type::TypeClass)ZigClangType_Builtin == clang::Type::Builtin, ""); |
| 350 | static_assert((clang::Type::TypeClass)ZigClangType_Complex == clang::Type::Complex, ""); | 352 | static_assert((clang::Type::TypeClass)ZigClangType_Complex == clang::Type::Complex, ""); |
| ... | @@ -352,13 +354,12 @@ static_assert((clang::Type::TypeClass)ZigClangType_Decltype == clang::Type::Decl | ... | @@ -352,13 +354,12 @@ static_assert((clang::Type::TypeClass)ZigClangType_Decltype == clang::Type::Decl |
| 352 | static_assert((clang::Type::TypeClass)ZigClangType_Auto == clang::Type::Auto, ""); | 354 | static_assert((clang::Type::TypeClass)ZigClangType_Auto == clang::Type::Auto, ""); |
| 353 | static_assert((clang::Type::TypeClass)ZigClangType_DeducedTemplateSpecialization == clang::Type::DeducedTemplateSpecialization, ""); | 355 | static_assert((clang::Type::TypeClass)ZigClangType_DeducedTemplateSpecialization == clang::Type::DeducedTemplateSpecialization, ""); |
| 354 | static_assert((clang::Type::TypeClass)ZigClangType_DependentAddressSpace == clang::Type::DependentAddressSpace, ""); | 356 | static_assert((clang::Type::TypeClass)ZigClangType_DependentAddressSpace == clang::Type::DependentAddressSpace, ""); |
| 355 | static_assert((clang::Type::TypeClass)ZigClangType_DependentExtInt == clang::Type::DependentExtInt, ""); | 357 | static_assert((clang::Type::TypeClass)ZigClangType_DependentBitInt == clang::Type::DependentBitInt, ""); |
| 356 | static_assert((clang::Type::TypeClass)ZigClangType_DependentName == clang::Type::DependentName, ""); | 358 | static_assert((clang::Type::TypeClass)ZigClangType_DependentName == clang::Type::DependentName, ""); |
| 357 | static_assert((clang::Type::TypeClass)ZigClangType_DependentSizedExtVector == clang::Type::DependentSizedExtVector, ""); | 359 | static_assert((clang::Type::TypeClass)ZigClangType_DependentSizedExtVector == clang::Type::DependentSizedExtVector, ""); |
| 358 | static_assert((clang::Type::TypeClass)ZigClangType_DependentTemplateSpecialization == clang::Type::DependentTemplateSpecialization, ""); | 360 | static_assert((clang::Type::TypeClass)ZigClangType_DependentTemplateSpecialization == clang::Type::DependentTemplateSpecialization, ""); |
| 359 | static_assert((clang::Type::TypeClass)ZigClangType_DependentVector == clang::Type::DependentVector, ""); | 361 | static_assert((clang::Type::TypeClass)ZigClangType_DependentVector == clang::Type::DependentVector, ""); |
| 360 | static_assert((clang::Type::TypeClass)ZigClangType_Elaborated == clang::Type::Elaborated, ""); | 362 | static_assert((clang::Type::TypeClass)ZigClangType_Elaborated == clang::Type::Elaborated, ""); |
| 361 | static_assert((clang::Type::TypeClass)ZigClangType_ExtInt == clang::Type::ExtInt, ""); | ||
| 362 | static_assert((clang::Type::TypeClass)ZigClangType_FunctionNoProto == clang::Type::FunctionNoProto, ""); | 363 | static_assert((clang::Type::TypeClass)ZigClangType_FunctionNoProto == clang::Type::FunctionNoProto, ""); |
| 363 | static_assert((clang::Type::TypeClass)ZigClangType_FunctionProto == clang::Type::FunctionProto, ""); | 364 | static_assert((clang::Type::TypeClass)ZigClangType_FunctionProto == clang::Type::FunctionProto, ""); |
| 364 | static_assert((clang::Type::TypeClass)ZigClangType_InjectedClassName == clang::Type::InjectedClassName, ""); | 365 | static_assert((clang::Type::TypeClass)ZigClangType_InjectedClassName == clang::Type::InjectedClassName, ""); |
| ... | @@ -387,6 +388,7 @@ static_assert((clang::Type::TypeClass)ZigClangType_TypeOf == clang::Type::TypeOf | ... | @@ -387,6 +388,7 @@ static_assert((clang::Type::TypeClass)ZigClangType_TypeOf == clang::Type::TypeOf |
| 387 | static_assert((clang::Type::TypeClass)ZigClangType_Typedef == clang::Type::Typedef, ""); | 388 | static_assert((clang::Type::TypeClass)ZigClangType_Typedef == clang::Type::Typedef, ""); |
| 388 | static_assert((clang::Type::TypeClass)ZigClangType_UnaryTransform == clang::Type::UnaryTransform, ""); | 389 | static_assert((clang::Type::TypeClass)ZigClangType_UnaryTransform == clang::Type::UnaryTransform, ""); |
| 389 | static_assert((clang::Type::TypeClass)ZigClangType_UnresolvedUsing == clang::Type::UnresolvedUsing, ""); | 390 | static_assert((clang::Type::TypeClass)ZigClangType_UnresolvedUsing == clang::Type::UnresolvedUsing, ""); |
| 391 | static_assert((clang::Type::TypeClass)ZigClangType_Using == clang::Type::Using, ""); | ||
| 390 | static_assert((clang::Type::TypeClass)ZigClangType_Vector == clang::Type::Vector, ""); | 392 | static_assert((clang::Type::TypeClass)ZigClangType_Vector == clang::Type::Vector, ""); |
| 391 | static_assert((clang::Type::TypeClass)ZigClangType_ExtVector == clang::Type::ExtVector, ""); | 393 | static_assert((clang::Type::TypeClass)ZigClangType_ExtVector == clang::Type::ExtVector, ""); |
| 392 | 394 | ||
| ... | @@ -429,6 +431,7 @@ void ZigClang_detect_enum_StmtClass(clang::Stmt::StmtClass x) { | ... | @@ -429,6 +431,7 @@ void ZigClang_detect_enum_StmtClass(clang::Stmt::StmtClass x) { |
| 429 | case clang::Stmt::OMPDistributeSimdDirectiveClass: | 431 | case clang::Stmt::OMPDistributeSimdDirectiveClass: |
| 430 | case clang::Stmt::OMPForDirectiveClass: | 432 | case clang::Stmt::OMPForDirectiveClass: |
| 431 | case clang::Stmt::OMPForSimdDirectiveClass: | 433 | case clang::Stmt::OMPForSimdDirectiveClass: |
| 434 | case clang::Stmt::OMPGenericLoopDirectiveClass: | ||
| 432 | case clang::Stmt::OMPMasterTaskLoopDirectiveClass: | 435 | case clang::Stmt::OMPMasterTaskLoopDirectiveClass: |
| 433 | case clang::Stmt::OMPMasterTaskLoopSimdDirectiveClass: | 436 | case clang::Stmt::OMPMasterTaskLoopSimdDirectiveClass: |
| 434 | case clang::Stmt::OMPParallelForDirectiveClass: | 437 | case clang::Stmt::OMPParallelForDirectiveClass: |
| ... | @@ -452,6 +455,7 @@ void ZigClang_detect_enum_StmtClass(clang::Stmt::StmtClass x) { | ... | @@ -452,6 +455,7 @@ void ZigClang_detect_enum_StmtClass(clang::Stmt::StmtClass x) { |
| 452 | case clang::Stmt::OMPUnrollDirectiveClass: | 455 | case clang::Stmt::OMPUnrollDirectiveClass: |
| 453 | case clang::Stmt::OMPMaskedDirectiveClass: | 456 | case clang::Stmt::OMPMaskedDirectiveClass: |
| 454 | case clang::Stmt::OMPMasterDirectiveClass: | 457 | case clang::Stmt::OMPMasterDirectiveClass: |
| 458 | case clang::Stmt::OMPMetaDirectiveClass: | ||
| 455 | case clang::Stmt::OMPOrderedDirectiveClass: | 459 | case clang::Stmt::OMPOrderedDirectiveClass: |
| 456 | case clang::Stmt::OMPParallelDirectiveClass: | 460 | case clang::Stmt::OMPParallelDirectiveClass: |
| 457 | case clang::Stmt::OMPParallelMasterDirectiveClass: | 461 | case clang::Stmt::OMPParallelMasterDirectiveClass: |
| ... | @@ -654,6 +658,7 @@ static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPDistributeParallelForSimdD | ... | @@ -654,6 +658,7 @@ static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPDistributeParallelForSimdD |
| 654 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPDistributeSimdDirectiveClass == clang::Stmt::OMPDistributeSimdDirectiveClass, ""); | 658 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPDistributeSimdDirectiveClass == clang::Stmt::OMPDistributeSimdDirectiveClass, ""); |
| 655 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPForDirectiveClass == clang::Stmt::OMPForDirectiveClass, ""); | 659 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPForDirectiveClass == clang::Stmt::OMPForDirectiveClass, ""); |
| 656 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPForSimdDirectiveClass == clang::Stmt::OMPForSimdDirectiveClass, ""); | 660 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPForSimdDirectiveClass == clang::Stmt::OMPForSimdDirectiveClass, ""); |
| 661 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPGenericLoopDirectiveClass == clang::Stmt::OMPGenericLoopDirectiveClass, ""); | ||
| 657 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMasterTaskLoopDirectiveClass == clang::Stmt::OMPMasterTaskLoopDirectiveClass, ""); | 662 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMasterTaskLoopDirectiveClass == clang::Stmt::OMPMasterTaskLoopDirectiveClass, ""); |
| 658 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMasterTaskLoopSimdDirectiveClass == clang::Stmt::OMPMasterTaskLoopSimdDirectiveClass, ""); | 663 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMasterTaskLoopSimdDirectiveClass == clang::Stmt::OMPMasterTaskLoopSimdDirectiveClass, ""); |
| 659 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPParallelForDirectiveClass == clang::Stmt::OMPParallelForDirectiveClass, ""); | 664 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPParallelForDirectiveClass == clang::Stmt::OMPParallelForDirectiveClass, ""); |
| ... | @@ -677,6 +682,7 @@ static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPTileDirectiveClass == clan | ... | @@ -677,6 +682,7 @@ static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPTileDirectiveClass == clan |
| 677 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPUnrollDirectiveClass == clang::Stmt::OMPUnrollDirectiveClass, ""); | 682 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPUnrollDirectiveClass == clang::Stmt::OMPUnrollDirectiveClass, ""); |
| 678 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMaskedDirectiveClass == clang::Stmt::OMPMaskedDirectiveClass, ""); | 683 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMaskedDirectiveClass == clang::Stmt::OMPMaskedDirectiveClass, ""); |
| 679 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMasterDirectiveClass == clang::Stmt::OMPMasterDirectiveClass, ""); | 684 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMasterDirectiveClass == clang::Stmt::OMPMasterDirectiveClass, ""); |
| 685 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPMetaDirectiveClass == clang::Stmt::OMPMetaDirectiveClass, ""); | ||
| 680 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPOrderedDirectiveClass == clang::Stmt::OMPOrderedDirectiveClass, ""); | 686 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPOrderedDirectiveClass == clang::Stmt::OMPOrderedDirectiveClass, ""); |
| 681 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPParallelDirectiveClass == clang::Stmt::OMPParallelDirectiveClass, ""); | 687 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPParallelDirectiveClass == clang::Stmt::OMPParallelDirectiveClass, ""); |
| 682 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPParallelMasterDirectiveClass == clang::Stmt::OMPParallelMasterDirectiveClass, ""); | 688 | static_assert((clang::Stmt::StmtClass)ZigClangStmt_OMPParallelMasterDirectiveClass == clang::Stmt::OMPParallelMasterDirectiveClass, ""); |
| ... | @@ -1269,6 +1275,7 @@ void ZigClang_detect_enum_BuiltinTypeKind(clang::BuiltinType::Kind x) { | ... | @@ -1269,6 +1275,7 @@ void ZigClang_detect_enum_BuiltinTypeKind(clang::BuiltinType::Kind x) { |
| 1269 | case clang::BuiltinType::Float16: | 1275 | case clang::BuiltinType::Float16: |
| 1270 | case clang::BuiltinType::BFloat16: | 1276 | case clang::BuiltinType::BFloat16: |
| 1271 | case clang::BuiltinType::Float128: | 1277 | case clang::BuiltinType::Float128: |
| 1278 | case clang::BuiltinType::Ibm128: | ||
| 1272 | case clang::BuiltinType::NullPtr: | 1279 | case clang::BuiltinType::NullPtr: |
| 1273 | case clang::BuiltinType::ObjCId: | 1280 | case clang::BuiltinType::ObjCId: |
| 1274 | case clang::BuiltinType::ObjCClass: | 1281 | case clang::BuiltinType::ObjCClass: |
| ... | @@ -1510,6 +1517,7 @@ static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeLongDouble == clang:: | ... | @@ -1510,6 +1517,7 @@ static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeLongDouble == clang:: |
| 1510 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeFloat16 == clang::BuiltinType::Float16, ""); | 1517 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeFloat16 == clang::BuiltinType::Float16, ""); |
| 1511 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeBFloat16 == clang::BuiltinType::BFloat16, ""); | 1518 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeBFloat16 == clang::BuiltinType::BFloat16, ""); |
| 1512 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeFloat128 == clang::BuiltinType::Float128, ""); | 1519 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeFloat128 == clang::BuiltinType::Float128, ""); |
| 1520 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeIbm128 == clang::BuiltinType::Ibm128, ""); | ||
| 1513 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeNullPtr == clang::BuiltinType::NullPtr, ""); | 1521 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeNullPtr == clang::BuiltinType::NullPtr, ""); |
| 1514 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeObjCId == clang::BuiltinType::ObjCId, ""); | 1522 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeObjCId == clang::BuiltinType::ObjCId, ""); |
| 1515 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeObjCClass == clang::BuiltinType::ObjCClass, ""); | 1523 | static_assert((clang::BuiltinType::Kind)ZigClangBuiltinTypeObjCClass == clang::BuiltinType::ObjCClass, ""); |
src/zig_clang.h+6-2| ... | @@ -251,6 +251,7 @@ enum ZigClangTypeClass { | ... | @@ -251,6 +251,7 @@ enum ZigClangTypeClass { |
| 251 | ZigClangType_VariableArray, | 251 | ZigClangType_VariableArray, |
| 252 | ZigClangType_Atomic, | 252 | ZigClangType_Atomic, |
| 253 | ZigClangType_Attributed, | 253 | ZigClangType_Attributed, |
| 254 | ZigClangType_BitInt, | ||
| 254 | ZigClangType_BlockPointer, | 255 | ZigClangType_BlockPointer, |
| 255 | ZigClangType_Builtin, | 256 | ZigClangType_Builtin, |
| 256 | ZigClangType_Complex, | 257 | ZigClangType_Complex, |
| ... | @@ -258,13 +259,12 @@ enum ZigClangTypeClass { | ... | @@ -258,13 +259,12 @@ enum ZigClangTypeClass { |
| 258 | ZigClangType_Auto, | 259 | ZigClangType_Auto, |
| 259 | ZigClangType_DeducedTemplateSpecialization, | 260 | ZigClangType_DeducedTemplateSpecialization, |
| 260 | ZigClangType_DependentAddressSpace, | 261 | ZigClangType_DependentAddressSpace, |
| 261 | ZigClangType_DependentExtInt, | 262 | ZigClangType_DependentBitInt, |
| 262 | ZigClangType_DependentName, | 263 | ZigClangType_DependentName, |
| 263 | ZigClangType_DependentSizedExtVector, | 264 | ZigClangType_DependentSizedExtVector, |
| 264 | ZigClangType_DependentTemplateSpecialization, | 265 | ZigClangType_DependentTemplateSpecialization, |
| 265 | ZigClangType_DependentVector, | 266 | ZigClangType_DependentVector, |
| 266 | ZigClangType_Elaborated, | 267 | ZigClangType_Elaborated, |
| 267 | ZigClangType_ExtInt, | ||
| 268 | ZigClangType_FunctionNoProto, | 268 | ZigClangType_FunctionNoProto, |
| 269 | ZigClangType_FunctionProto, | 269 | ZigClangType_FunctionProto, |
| 270 | ZigClangType_InjectedClassName, | 270 | ZigClangType_InjectedClassName, |
| ... | @@ -293,6 +293,7 @@ enum ZigClangTypeClass { | ... | @@ -293,6 +293,7 @@ enum ZigClangTypeClass { |
| 293 | ZigClangType_Typedef, | 293 | ZigClangType_Typedef, |
| 294 | ZigClangType_UnaryTransform, | 294 | ZigClangType_UnaryTransform, |
| 295 | ZigClangType_UnresolvedUsing, | 295 | ZigClangType_UnresolvedUsing, |
| 296 | ZigClangType_Using, | ||
| 296 | ZigClangType_Vector, | 297 | ZigClangType_Vector, |
| 297 | ZigClangType_ExtVector, | 298 | ZigClangType_ExtVector, |
| 298 | }; | 299 | }; |
| ... | @@ -334,6 +335,7 @@ enum ZigClangStmtClass { | ... | @@ -334,6 +335,7 @@ enum ZigClangStmtClass { |
| 334 | ZigClangStmt_OMPDistributeSimdDirectiveClass, | 335 | ZigClangStmt_OMPDistributeSimdDirectiveClass, |
| 335 | ZigClangStmt_OMPForDirectiveClass, | 336 | ZigClangStmt_OMPForDirectiveClass, |
| 336 | ZigClangStmt_OMPForSimdDirectiveClass, | 337 | ZigClangStmt_OMPForSimdDirectiveClass, |
| 338 | ZigClangStmt_OMPGenericLoopDirectiveClass, | ||
| 337 | ZigClangStmt_OMPMasterTaskLoopDirectiveClass, | 339 | ZigClangStmt_OMPMasterTaskLoopDirectiveClass, |
| 338 | ZigClangStmt_OMPMasterTaskLoopSimdDirectiveClass, | 340 | ZigClangStmt_OMPMasterTaskLoopSimdDirectiveClass, |
| 339 | ZigClangStmt_OMPParallelForDirectiveClass, | 341 | ZigClangStmt_OMPParallelForDirectiveClass, |
| ... | @@ -357,6 +359,7 @@ enum ZigClangStmtClass { | ... | @@ -357,6 +359,7 @@ enum ZigClangStmtClass { |
| 357 | ZigClangStmt_OMPUnrollDirectiveClass, | 359 | ZigClangStmt_OMPUnrollDirectiveClass, |
| 358 | ZigClangStmt_OMPMaskedDirectiveClass, | 360 | ZigClangStmt_OMPMaskedDirectiveClass, |
| 359 | ZigClangStmt_OMPMasterDirectiveClass, | 361 | ZigClangStmt_OMPMasterDirectiveClass, |
| 362 | ZigClangStmt_OMPMetaDirectiveClass, | ||
| 360 | ZigClangStmt_OMPOrderedDirectiveClass, | 363 | ZigClangStmt_OMPOrderedDirectiveClass, |
| 361 | ZigClangStmt_OMPParallelDirectiveClass, | 364 | ZigClangStmt_OMPParallelDirectiveClass, |
| 362 | ZigClangStmt_OMPParallelMasterDirectiveClass, | 365 | ZigClangStmt_OMPParallelMasterDirectiveClass, |
| ... | @@ -893,6 +896,7 @@ enum ZigClangBuiltinTypeKind { | ... | @@ -893,6 +896,7 @@ enum ZigClangBuiltinTypeKind { |
| 893 | ZigClangBuiltinTypeFloat16, | 896 | ZigClangBuiltinTypeFloat16, |
| 894 | ZigClangBuiltinTypeBFloat16, | 897 | ZigClangBuiltinTypeBFloat16, |
| 895 | ZigClangBuiltinTypeFloat128, | 898 | ZigClangBuiltinTypeFloat128, |
| 899 | ZigClangBuiltinTypeIbm128, | ||
| 896 | ZigClangBuiltinTypeNullPtr, | 900 | ZigClangBuiltinTypeNullPtr, |
| 897 | ZigClangBuiltinTypeObjCId, | 901 | ZigClangBuiltinTypeObjCId, |
| 898 | ZigClangBuiltinTypeObjCClass, | 902 | ZigClangBuiltinTypeObjCClass, |
src/zig_llvm.cpp+30-47| ... | @@ -35,6 +35,8 @@ | ... | @@ -35,6 +35,8 @@ |
| 35 | #include <llvm/IR/Verifier.h> | 35 | #include <llvm/IR/Verifier.h> |
| 36 | #include <llvm/InitializePasses.h> | 36 | #include <llvm/InitializePasses.h> |
| 37 | #include <llvm/MC/SubtargetFeature.h> | 37 | #include <llvm/MC/SubtargetFeature.h> |
| 38 | #include <llvm/MC/TargetRegistry.h> | ||
| 39 | #include <llvm/Passes/OptimizationLevel.h> | ||
| 38 | #include <llvm/Passes/PassBuilder.h> | 40 | #include <llvm/Passes/PassBuilder.h> |
| 39 | #include <llvm/Passes/StandardInstrumentations.h> | 41 | #include <llvm/Passes/StandardInstrumentations.h> |
| 40 | #include <llvm/Object/Archive.h> | 42 | #include <llvm/Object/Archive.h> |
| ... | @@ -51,7 +53,6 @@ | ... | @@ -51,7 +53,6 @@ |
| 51 | #include <llvm/Support/TimeProfiler.h> | 53 | #include <llvm/Support/TimeProfiler.h> |
| 52 | #include <llvm/Support/Timer.h> | 54 | #include <llvm/Support/Timer.h> |
| 53 | #include <llvm/Support/raw_ostream.h> | 55 | #include <llvm/Support/raw_ostream.h> |
| 54 | #include <llvm/Support/TargetRegistry.h> | ||
| 55 | #include <llvm/Target/TargetMachine.h> | 56 | #include <llvm/Target/TargetMachine.h> |
| 56 | #include <llvm/Target/CodeGenCWrappers.h> | 57 | #include <llvm/Target/CodeGenCWrappers.h> |
| 57 | #include <llvm/Transforms/IPO.h> | 58 | #include <llvm/Transforms/IPO.h> |
| ... | @@ -273,7 +274,7 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -273,7 +274,7 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 273 | TargetMachine &target_machine = *reinterpret_cast<TargetMachine*>(targ_machine_ref); | 274 | TargetMachine &target_machine = *reinterpret_cast<TargetMachine*>(targ_machine_ref); |
| 274 | target_machine.setO0WantsFastISel(true); | 275 | target_machine.setO0WantsFastISel(true); |
| 275 | 276 | ||
| 276 | Module &module = *unwrap(module_ref); | 277 | Module &llvm_module = *unwrap(module_ref); |
| 277 | 278 | ||
| 278 | // Pipeline configurations | 279 | // Pipeline configurations |
| 279 | PipelineTuningOptions pipeline_opts; | 280 | PipelineTuningOptions pipeline_opts; |
| ... | @@ -290,7 +291,6 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -290,7 +291,6 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 290 | 291 | ||
| 291 | PassBuilder pass_builder(&target_machine, pipeline_opts, | 292 | PassBuilder pass_builder(&target_machine, pipeline_opts, |
| 292 | None, &instr_callbacks); | 293 | None, &instr_callbacks); |
| 293 | using OptimizationLevel = typename PassBuilder::OptimizationLevel; | ||
| 294 | 294 | ||
| 295 | LoopAnalysisManager loop_am; | 295 | LoopAnalysisManager loop_am; |
| 296 | FunctionAnalysisManager function_am; | 296 | FunctionAnalysisManager function_am; |
| ... | @@ -302,7 +302,7 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -302,7 +302,7 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 302 | return pass_builder.buildDefaultAAPipeline(); | 302 | return pass_builder.buildDefaultAAPipeline(); |
| 303 | }); | 303 | }); |
| 304 | 304 | ||
| 305 | Triple target_triple(module.getTargetTriple()); | 305 | Triple target_triple(llvm_module.getTargetTriple()); |
| 306 | auto tlii = std::make_unique<TargetLibraryInfoImpl>(target_triple); | 306 | auto tlii = std::make_unique<TargetLibraryInfoImpl>(target_triple); |
| 307 | function_am.registerPass([&] { return TargetLibraryAnalysis(*tlii); }); | 307 | function_am.registerPass([&] { return TargetLibraryAnalysis(*tlii); }); |
| 308 | 308 | ||
| ... | @@ -339,9 +339,9 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -339,9 +339,9 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 339 | 339 | ||
| 340 | // Thread sanitizer | 340 | // Thread sanitizer |
| 341 | if (tsan) { | 341 | if (tsan) { |
| 342 | pass_builder.registerOptimizerLastEPCallback( | 342 | pass_builder.registerOptimizerLastEPCallback([](ModulePassManager &module_pm, OptimizationLevel level) { |
| 343 | [](ModulePassManager &module_pm, OptimizationLevel level) { | 343 | module_pm.addPass(ModuleThreadSanitizerPass()); |
| 344 | module_pm.addPass(ThreadSanitizerPass()); | 344 | module_pm.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); |
| 345 | }); | 345 | }); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| ... | @@ -383,10 +383,10 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -383,10 +383,10 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | // Optimization phase | 385 | // Optimization phase |
| 386 | module_pm.run(module, module_am); | 386 | module_pm.run(llvm_module, module_am); |
| 387 | 387 | ||
| 388 | // Code generation phase | 388 | // Code generation phase |
| 389 | codegen_pm.run(module); | 389 | codegen_pm.run(llvm_module); |
| 390 | 390 | ||
| 391 | if (llvm_ir_filename) { | 391 | if (llvm_ir_filename) { |
| 392 | if (LLVMPrintModuleToFile(module_ref, llvm_ir_filename, error_message)) { | 392 | if (LLVMPrintModuleToFile(module_ref, llvm_ir_filename, error_message)) { |
| ... | @@ -395,10 +395,10 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -395,10 +395,10 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | if (dest_bin && lto) { | 397 | if (dest_bin && lto) { |
| 398 | WriteBitcodeToFile(module, *dest_bin); | 398 | WriteBitcodeToFile(llvm_module, *dest_bin); |
| 399 | } | 399 | } |
| 400 | if (dest_bitcode) { | 400 | if (dest_bitcode) { |
| 401 | WriteBitcodeToFile(module, *dest_bitcode); | 401 | WriteBitcodeToFile(llvm_module, *dest_bitcode); |
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | if (time_report) { | 404 | if (time_report) { |
| ... | @@ -421,7 +421,7 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A | ... | @@ -421,7 +421,7 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A |
| 421 | unsigned NumArgs, ZigLLVM_CallingConv CC, ZigLLVM_CallAttr attr, const char *Name) | 421 | unsigned NumArgs, ZigLLVM_CallingConv CC, ZigLLVM_CallAttr attr, const char *Name) |
| 422 | { | 422 | { |
| 423 | Value *V = unwrap(Fn); | 423 | Value *V = unwrap(Fn); |
| 424 | FunctionType *FnT = cast<FunctionType>(cast<PointerType>(V->getType())->getElementType()); | 424 | FunctionType *FnT = cast<FunctionType>(V->getType()->getNonOpaquePointerElementType()); |
| 425 | CallInst *call_inst = CallInst::Create(FnT, V, makeArrayRef(unwrap(Args), NumArgs), Name); | 425 | CallInst *call_inst = CallInst::Create(FnT, V, makeArrayRef(unwrap(Args), NumArgs), Name); |
| 426 | call_inst->setCallingConv(static_cast<CallingConv::ID>(CC)); | 426 | call_inst->setCallingConv(static_cast<CallingConv::ID>(CC)); |
| 427 | switch (attr) { | 427 | switch (attr) { |
| ... | @@ -431,13 +431,13 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A | ... | @@ -431,13 +431,13 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A |
| 431 | call_inst->setTailCallKind(CallInst::TCK_NoTail); | 431 | call_inst->setTailCallKind(CallInst::TCK_NoTail); |
| 432 | break; | 432 | break; |
| 433 | case ZigLLVM_CallAttrNeverInline: | 433 | case ZigLLVM_CallAttrNeverInline: |
| 434 | call_inst->addAttribute(AttributeList::FunctionIndex, Attribute::NoInline); | 434 | call_inst->addFnAttr(Attribute::NoInline); |
| 435 | break; | 435 | break; |
| 436 | case ZigLLVM_CallAttrAlwaysTail: | 436 | case ZigLLVM_CallAttrAlwaysTail: |
| 437 | call_inst->setTailCallKind(CallInst::TCK_MustTail); | 437 | call_inst->setTailCallKind(CallInst::TCK_MustTail); |
| 438 | break; | 438 | break; |
| 439 | case ZigLLVM_CallAttrAlwaysInline: | 439 | case ZigLLVM_CallAttrAlwaysInline: |
| 440 | call_inst->addAttribute(AttributeList::FunctionIndex, Attribute::AlwaysInline); | 440 | call_inst->addFnAttr(Attribute::AlwaysInline); |
| 441 | break; | 441 | break; |
| 442 | } | 442 | } |
| 443 | return wrap(unwrap(B)->Insert(call_inst)); | 443 | return wrap(unwrap(B)->Insert(call_inst)); |
| ... | @@ -972,44 +972,28 @@ void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) { | ... | @@ -972,44 +972,28 @@ void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) { |
| 972 | 972 | ||
| 973 | void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val) { | 973 | void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val) { |
| 974 | Function *func = unwrap<Function>(fn_ref); | 974 | Function *func = unwrap<Function>(fn_ref); |
| 975 | const AttributeList attr_set = func->getAttributes(); | 975 | AttrBuilder attr_builder(func->getContext()); |
| 976 | AttrBuilder attr_builder; | ||
| 977 | Type *llvm_type = unwrap<Type>(type_val); | 976 | Type *llvm_type = unwrap<Type>(type_val); |
| 978 | attr_builder.addByValAttr(llvm_type); | 977 | attr_builder.addByValAttr(llvm_type); |
| 979 | const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), ArgNo + 1, attr_builder); | 978 | func->addParamAttrs(ArgNo + 1, attr_builder); |
| 980 | func->setAttributes(new_attr_set); | ||
| 981 | } | 979 | } |
| 982 | 980 | ||
| 983 | void ZigLLVMAddSretAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val) { | 981 | void ZigLLVMAddSretAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val) { |
| 984 | Function *func = unwrap<Function>(fn_ref); | 982 | Function *func = unwrap<Function>(fn_ref); |
| 985 | const AttributeList attr_set = func->getAttributes(); | 983 | AttrBuilder attr_builder(func->getContext()); |
| 986 | AttrBuilder attr_builder; | ||
| 987 | Type *llvm_type = unwrap<Type>(type_val); | 984 | Type *llvm_type = unwrap<Type>(type_val); |
| 988 | attr_builder.addStructRetAttr(llvm_type); | 985 | attr_builder.addStructRetAttr(llvm_type); |
| 989 | const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), ArgNo + 1, attr_builder); | 986 | func->addParamAttrs(ArgNo + 1, attr_builder); |
| 990 | func->setAttributes(new_attr_set); | ||
| 991 | } | 987 | } |
| 992 | 988 | ||
| 993 | void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const char *attr_value) { | 989 | void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const char *attr_value) { |
| 994 | Function *func = unwrap<Function>(fn_ref); | 990 | Function *func = unwrap<Function>(fn_ref); |
| 995 | const AttributeList attr_set = func->getAttributes(); | 991 | func->addFnAttr(attr_name, attr_value); |
| 996 | AttrBuilder attr_builder; | ||
| 997 | if (attr_value) { | ||
| 998 | attr_builder.addAttribute(attr_name, attr_value); | ||
| 999 | } else { | ||
| 1000 | attr_builder.addAttribute(attr_name); | ||
| 1001 | } | ||
| 1002 | const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), | ||
| 1003 | AttributeList::FunctionIndex, attr_builder); | ||
| 1004 | func->setAttributes(new_attr_set); | ||
| 1005 | } | 992 | } |
| 1006 | 993 | ||
| 1007 | void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn_ref) { | 994 | void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn_ref) { |
| 1008 | Function *func = unwrap<Function>(fn_ref); | 995 | Function *func = unwrap<Function>(fn_ref); |
| 1009 | const AttributeList attr_set = func->getAttributes(); | 996 | func->addFnAttr(Attribute::Cold); |
| 1010 | const AttributeList new_attr_set = attr_set.addAttribute(func->getContext(), AttributeList::FunctionIndex, | ||
| 1011 | Attribute::Cold); | ||
| 1012 | func->setAttributes(new_attr_set); | ||
| 1013 | } | 997 | } |
| 1014 | 998 | ||
| 1015 | void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv) { | 999 | void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv) { |
| ... | @@ -1102,12 +1086,9 @@ void ZigLLVMSetTailCall(LLVMValueRef Call) { | ... | @@ -1102,12 +1086,9 @@ void ZigLLVMSetTailCall(LLVMValueRef Call) { |
| 1102 | } | 1086 | } |
| 1103 | 1087 | ||
| 1104 | void ZigLLVMSetCallSret(LLVMValueRef Call, LLVMTypeRef return_type) { | 1088 | void ZigLLVMSetCallSret(LLVMValueRef Call, LLVMTypeRef return_type) { |
| 1105 | const AttributeList attr_set = unwrap<CallInst>(Call)->getAttributes(); | 1089 | CallInst *call_inst = unwrap<CallInst>(Call); |
| 1106 | AttrBuilder attr_builder; | ||
| 1107 | Type *llvm_type = unwrap<Type>(return_type); | 1090 | Type *llvm_type = unwrap<Type>(return_type); |
| 1108 | attr_builder.addStructRetAttr(llvm_type); | 1091 | call_inst->addParamAttr(1, Attribute::getWithStructRetType(call_inst->getContext(), llvm_type)); |
| 1109 | const AttributeList new_attr_set = attr_set.addAttributes(unwrap<CallInst>(Call)->getContext(), 1, attr_builder); | ||
| 1110 | unwrap<CallInst>(Call)->setAttributes(new_attr_set); | ||
| 1111 | } | 1092 | } |
| 1112 | 1093 | ||
| 1113 | void ZigLLVMFunctionSetPrefixData(LLVMValueRef function, LLVMValueRef data) { | 1094 | void ZigLLVMFunctionSetPrefixData(LLVMValueRef function, LLVMValueRef data) { |
| ... | @@ -1252,19 +1233,19 @@ bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size | ... | @@ -1252,19 +1233,19 @@ bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size |
| 1252 | return false; | 1233 | return false; |
| 1253 | } | 1234 | } |
| 1254 | 1235 | ||
| 1255 | int ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early) { | 1236 | int ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output) { |
| 1256 | std::vector<const char *> args(argv, argv + argc); | 1237 | std::vector<const char *> args(argv, argv + argc); |
| 1257 | return lld::coff::link(args, can_exit_early, llvm::outs(), llvm::errs()); | 1238 | return lld::coff::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output); |
| 1258 | } | 1239 | } |
| 1259 | 1240 | ||
| 1260 | int ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early) { | 1241 | int ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early, bool disable_output) { |
| 1261 | std::vector<const char *> args(argv, argv + argc); | 1242 | std::vector<const char *> args(argv, argv + argc); |
| 1262 | return lld::elf::link(args, can_exit_early, llvm::outs(), llvm::errs()); | 1243 | return lld::elf::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output); |
| 1263 | } | 1244 | } |
| 1264 | 1245 | ||
| 1265 | int ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early) { | 1246 | int ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early, bool disable_output) { |
| 1266 | std::vector<const char *> args(argv, argv + argc); | 1247 | std::vector<const char *> args(argv, argv + argc); |
| 1267 | return lld::wasm::link(args, can_exit_early, llvm::outs(), llvm::errs()); | 1248 | return lld::wasm::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output); |
| 1268 | } | 1249 | } |
| 1269 | 1250 | ||
| 1270 | inline LLVMAttributeRef wrap(Attribute Attr) { | 1251 | inline LLVMAttributeRef wrap(Attribute Attr) { |
| ... | @@ -1370,6 +1351,8 @@ static_assert((Triple::ArchType)ZigLLVM_hsail == Triple::hsail, ""); | ... | @@ -1370,6 +1351,8 @@ static_assert((Triple::ArchType)ZigLLVM_hsail == Triple::hsail, ""); |
| 1370 | static_assert((Triple::ArchType)ZigLLVM_hsail64 == Triple::hsail64, ""); | 1351 | static_assert((Triple::ArchType)ZigLLVM_hsail64 == Triple::hsail64, ""); |
| 1371 | static_assert((Triple::ArchType)ZigLLVM_spir == Triple::spir, ""); | 1352 | static_assert((Triple::ArchType)ZigLLVM_spir == Triple::spir, ""); |
| 1372 | static_assert((Triple::ArchType)ZigLLVM_spir64 == Triple::spir64, ""); | 1353 | static_assert((Triple::ArchType)ZigLLVM_spir64 == Triple::spir64, ""); |
| 1354 | static_assert((Triple::ArchType)ZigLLVM_spirv32 == Triple::spirv32, ""); | ||
| 1355 | static_assert((Triple::ArchType)ZigLLVM_spirv64 == Triple::spirv64, ""); | ||
| 1373 | static_assert((Triple::ArchType)ZigLLVM_kalimba == Triple::kalimba, ""); | 1356 | static_assert((Triple::ArchType)ZigLLVM_kalimba == Triple::kalimba, ""); |
| 1374 | static_assert((Triple::ArchType)ZigLLVM_shave == Triple::shave, ""); | 1357 | static_assert((Triple::ArchType)ZigLLVM_shave == Triple::shave, ""); |
| 1375 | static_assert((Triple::ArchType)ZigLLVM_lanai == Triple::lanai, ""); | 1358 | static_assert((Triple::ArchType)ZigLLVM_lanai == Triple::lanai, ""); |
src/zig_llvm.h+5-3| ... | @@ -346,6 +346,8 @@ enum ZigLLVM_ArchType { | ... | @@ -346,6 +346,8 @@ enum ZigLLVM_ArchType { |
| 346 | ZigLLVM_hsail64, // AMD HSAIL with 64-bit pointers | 346 | ZigLLVM_hsail64, // AMD HSAIL with 64-bit pointers |
| 347 | ZigLLVM_spir, // SPIR: standard portable IR for OpenCL 32-bit version | 347 | ZigLLVM_spir, // SPIR: standard portable IR for OpenCL 32-bit version |
| 348 | ZigLLVM_spir64, // SPIR: standard portable IR for OpenCL 64-bit version | 348 | ZigLLVM_spir64, // SPIR: standard portable IR for OpenCL 64-bit version |
| 349 | ZigLLVM_spirv32, // SPIR-V with 32-bit pointers | ||
| 350 | ZigLLVM_spirv64, // SPIR-V with 64-bit pointers | ||
| 349 | ZigLLVM_kalimba, // Kalimba: generic kalimba | 351 | ZigLLVM_kalimba, // Kalimba: generic kalimba |
| 350 | ZigLLVM_shave, // SHAVE: Movidius vector VLIW processors | 352 | ZigLLVM_shave, // SHAVE: Movidius vector VLIW processors |
| 351 | ZigLLVM_lanai, // Lanai: Lanai 32-bit | 353 | ZigLLVM_lanai, // Lanai: Lanai 32-bit |
| ... | @@ -512,9 +514,9 @@ ZIG_EXTERN_C const char *ZigLLVMGetVendorTypeName(enum ZigLLVM_VendorType vendor | ... | @@ -512,9 +514,9 @@ ZIG_EXTERN_C const char *ZigLLVMGetVendorTypeName(enum ZigLLVM_VendorType vendor |
| 512 | ZIG_EXTERN_C const char *ZigLLVMGetOSTypeName(enum ZigLLVM_OSType os); | 514 | ZIG_EXTERN_C const char *ZigLLVMGetOSTypeName(enum ZigLLVM_OSType os); |
| 513 | ZIG_EXTERN_C const char *ZigLLVMGetEnvironmentTypeName(enum ZigLLVM_EnvironmentType abi); | 515 | ZIG_EXTERN_C const char *ZigLLVMGetEnvironmentTypeName(enum ZigLLVM_EnvironmentType abi); |
| 514 | 516 | ||
| 515 | ZIG_EXTERN_C int ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early); | 517 | ZIG_EXTERN_C int ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output); |
| 516 | ZIG_EXTERN_C int ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early); | 518 | ZIG_EXTERN_C int ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early, bool disable_output); |
| 517 | ZIG_EXTERN_C int ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early); | 519 | ZIG_EXTERN_C int ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early, bool disable_output); |
| 518 | 520 | ||
| 519 | ZIG_EXTERN_C bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size_t file_name_count, | 521 | ZIG_EXTERN_C bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size_t file_name_count, |
| 520 | enum ZigLLVM_OSType os_type); | 522 | enum ZigLLVM_OSType os_type); |