| author | |
| committer | |
| log | cd31f875a68fba0519f20c561b11b5dfb9524a8b |
| tree | 2ec16185cd997c6e18ef04875ed654840480f732 |
| parent | 47f267d25fcf1a85b983e6f059c18e6163324897 |
9 files changed, 219 insertions(+), 207 deletions(-)
README.md+2-2| ... | @@ -87,8 +87,8 @@ the Zig compiler itself: | ... | @@ -87,8 +87,8 @@ the Zig compiler itself: |
| 87 | These libraries must be installed on your system, with the development files | 87 | These libraries must be installed on your system, with the development files |
| 88 | available. The Zig compiler dynamically links against them. | 88 | available. The Zig compiler dynamically links against them. |
| 89 | 89 | ||
| 90 | * LLVM == 3.9.x | 90 | * LLVM == 4.x |
| 91 | * libclang == 3.9.x | 91 | * libclang == 4.x |
| 92 | 92 | ||
| 93 | ### Debug / Development Build | 93 | ### Debug / Development Build |
| 94 | 94 |
cmake/Findclang.cmake+2-2| ... | @@ -8,14 +8,14 @@ | ... | @@ -8,14 +8,14 @@ |
| 8 | 8 | ||
| 9 | find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h | 9 | find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h |
| 10 | PATHS | 10 | PATHS |
| 11 | /usr/lib/llvm-3.9/include | 11 | /usr/lib/llvm-4/include |
| 12 | /mingw64/include) | 12 | /mingw64/include) |
| 13 | 13 | ||
| 14 | macro(FIND_AND_ADD_CLANG_LIB _libname_) | 14 | macro(FIND_AND_ADD_CLANG_LIB _libname_) |
| 15 | string(TOUPPER ${_libname_} _prettylibname_) | 15 | string(TOUPPER ${_libname_} _prettylibname_) |
| 16 | find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_} | 16 | find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_} |
| 17 | PATHS | 17 | PATHS |
| 18 | /usr/lib/llvm-3.9/lib | 18 | /usr/lib/llvm-4/lib |
| 19 | /mingw64/lib) | 19 | /mingw64/lib) |
| 20 | if(CLANG_${_prettylibname_}_LIB) | 20 | if(CLANG_${_prettylibname_}_LIB) |
| 21 | set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_${_prettylibname_}_LIB}) | 21 | set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_${_prettylibname_}_LIB}) |
cmake/Findllvm.cmake+1-1| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | # LLVM_LIBRARIES | 7 | # LLVM_LIBRARIES |
| 8 | # LLVM_LIBDIRS | 8 | # LLVM_LIBDIRS |
| 9 | 9 | ||
| 10 | find_program(LLVM_CONFIG_EXE NAMES llvm-config llvm-config-3.9) | 10 | find_program(LLVM_CONFIG_EXE NAMES llvm-config llvm-config-4) |
| 11 | 11 | ||
| 12 | execute_process( | 12 | execute_process( |
| 13 | COMMAND ${LLVM_CONFIG_EXE} --libs | 13 | COMMAND ${LLVM_CONFIG_EXE} --libs |
src/analyze.cpp+1-3| ... | @@ -3950,9 +3950,7 @@ TypeTableEntry *make_int_type(CodeGen *g, bool is_signed, size_t size_in_bits) { | ... | @@ -3950,9 +3950,7 @@ TypeTableEntry *make_int_type(CodeGen *g, bool is_signed, size_t size_in_bits) { |
| 3950 | } | 3950 | } |
| 3951 | 3951 | ||
| 3952 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3952 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3953 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | 3953 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), debug_size_in_bits, dwarf_tag); |
| 3954 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | ||
| 3955 | debug_size_in_bits, debug_align_in_bits, dwarf_tag); | ||
| 3956 | entry->data.integral.is_signed = is_signed; | 3954 | entry->data.integral.is_signed = is_signed; |
| 3957 | entry->data.integral.bit_count = size_in_bits; | 3955 | entry->data.integral.bit_count = size_in_bits; |
| 3958 | return entry; | 3956 | return entry; |
src/codegen.cpp+34-33| ... | @@ -236,6 +236,21 @@ static void render_const_val(CodeGen *g, ConstExprValue *const_val); | ... | @@ -236,6 +236,21 @@ static void render_const_val(CodeGen *g, ConstExprValue *const_val); |
| 236 | static void render_const_val_global(CodeGen *g, ConstExprValue *const_val, const char *name); | 236 | static void render_const_val_global(CodeGen *g, ConstExprValue *const_val, const char *name); |
| 237 | static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val); | 237 | static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val); |
| 238 | 238 | ||
| 239 | static void addLLVMAttr(LLVMValueRef val, LLVMAttributeIndex attr_index, const char *attr_name) { | ||
| 240 | unsigned kind_id = LLVMGetEnumAttributeKindForName(attr_name, strlen(attr_name)); | ||
| 241 | assert(kind_id != 0); | ||
| 242 | LLVMAttributeRef llvm_attr = LLVMCreateEnumAttribute(LLVMGetGlobalContext(), kind_id, 0); | ||
| 243 | LLVMAddAttributeAtIndex(val, attr_index, llvm_attr); | ||
| 244 | } | ||
| 245 | |||
| 246 | static void addLLVMFnAttr(LLVMValueRef fn_val, const char *attr_name) { | ||
| 247 | return addLLVMAttr(fn_val, -1, attr_name); | ||
| 248 | } | ||
| 249 | |||
| 250 | static void addLLVMArgAttr(LLVMValueRef arg_val, unsigned param_index, const char *attr_name) { | ||
| 251 | return addLLVMAttr(arg_val, param_index + 1, attr_name); | ||
| 252 | } | ||
| 253 | |||
| 239 | static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { | 254 | static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 240 | if (fn_table_entry->llvm_value) | 255 | if (fn_table_entry->llvm_value) |
| 241 | return fn_table_entry->llvm_value; | 256 | return fn_table_entry->llvm_value; |
| ... | @@ -252,29 +267,29 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { | ... | @@ -252,29 +267,29 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 252 | 267 | ||
| 253 | switch (fn_table_entry->fn_inline) { | 268 | switch (fn_table_entry->fn_inline) { |
| 254 | case FnInlineAlways: | 269 | case FnInlineAlways: |
| 255 | LLVMAddFunctionAttr(fn_table_entry->llvm_value, LLVMAlwaysInlineAttribute); | 270 | addLLVMFnAttr(fn_table_entry->llvm_value, "alwaysinline"); |
| 256 | break; | 271 | break; |
| 257 | case FnInlineNever: | 272 | case FnInlineNever: |
| 258 | LLVMAddFunctionAttr(fn_table_entry->llvm_value, LLVMNoInlineAttribute); | 273 | addLLVMFnAttr(fn_table_entry->llvm_value, "noinline"); |
| 259 | break; | 274 | break; |
| 260 | case FnInlineAuto: | 275 | case FnInlineAuto: |
| 261 | break; | 276 | break; |
| 262 | } | 277 | } |
| 263 | if (fn_type->data.fn.fn_type_id.is_naked) { | 278 | if (fn_type->data.fn.fn_type_id.is_naked) { |
| 264 | LLVMAddFunctionAttr(fn_table_entry->llvm_value, LLVMNakedAttribute); | 279 | addLLVMFnAttr(fn_table_entry->llvm_value, "naked"); |
| 265 | } | 280 | } |
| 266 | 281 | ||
| 267 | LLVMSetLinkage(fn_table_entry->llvm_value, fn_table_entry->internal_linkage ? | 282 | LLVMSetLinkage(fn_table_entry->llvm_value, fn_table_entry->internal_linkage ? |
| 268 | LLVMInternalLinkage : LLVMExternalLinkage); | 283 | LLVMInternalLinkage : LLVMExternalLinkage); |
| 269 | 284 | ||
| 270 | if (fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdUnreachable) { | 285 | if (fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdUnreachable) { |
| 271 | LLVMAddFunctionAttr(fn_table_entry->llvm_value, LLVMNoReturnAttribute); | 286 | addLLVMFnAttr(fn_table_entry->llvm_value, "noreturn"); |
| 272 | } | 287 | } |
| 273 | LLVMSetFunctionCallConv(fn_table_entry->llvm_value, fn_type->data.fn.calling_convention); | 288 | LLVMSetFunctionCallConv(fn_table_entry->llvm_value, fn_type->data.fn.calling_convention); |
| 274 | if (fn_type->data.fn.fn_type_id.is_cold) { | 289 | if (fn_type->data.fn.fn_type_id.is_cold) { |
| 275 | ZigLLVMAddFunctionAttrCold(fn_table_entry->llvm_value); | 290 | ZigLLVMAddFunctionAttrCold(fn_table_entry->llvm_value); |
| 276 | } | 291 | } |
| 277 | LLVMAddFunctionAttr(fn_table_entry->llvm_value, LLVMNoUnwindAttribute); | 292 | addLLVMFnAttr(fn_table_entry->llvm_value, "nounwind"); |
| 278 | if (!g->is_release_build && fn_table_entry->fn_inline != FnInlineAlways) { | 293 | if (!g->is_release_build && fn_table_entry->fn_inline != FnInlineAlways) { |
| 279 | ZigLLVMAddFunctionAttr(fn_table_entry->llvm_value, "no-frame-pointer-elim", "true"); | 294 | ZigLLVMAddFunctionAttr(fn_table_entry->llvm_value, "no-frame-pointer-elim", "true"); |
| 280 | ZigLLVMAddFunctionAttr(fn_table_entry->llvm_value, "no-frame-pointer-elim-non-leaf", nullptr); | 295 | ZigLLVMAddFunctionAttr(fn_table_entry->llvm_value, "no-frame-pointer-elim-non-leaf", nullptr); |
| ... | @@ -891,7 +906,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_debug_safety, LLVMValueRef val | ... | @@ -891,7 +906,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_debug_safety, LLVMValueRef val |
| 891 | if (type_entry->data.integral.is_signed) { | 906 | if (type_entry->data.integral.is_signed) { |
| 892 | return LLVMBuildExactSDiv(g->builder, val1, val2, ""); | 907 | return LLVMBuildExactSDiv(g->builder, val1, val2, ""); |
| 893 | } else { | 908 | } else { |
| 894 | return ZigLLVMBuildExactUDiv(g->builder, val1, val2, ""); | 909 | return LLVMBuildExactUDiv(g->builder, val1, val2, ""); |
| 895 | } | 910 | } |
| 896 | } else { | 911 | } else { |
| 897 | if (type_entry->data.integral.is_signed) { | 912 | if (type_entry->data.integral.is_signed) { |
| ... | @@ -1125,7 +1140,7 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable, | ... | @@ -1125,7 +1140,7 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable, |
| 1125 | 1140 | ||
| 1126 | LLVMPositionBuilderAtEnd(g->builder, ok_block); | 1141 | LLVMPositionBuilderAtEnd(g->builder, ok_block); |
| 1127 | } | 1142 | } |
| 1128 | new_len = ZigLLVMBuildExactUDiv(g->builder, src_len, dest_size_val, ""); | 1143 | new_len = LLVMBuildExactUDiv(g->builder, src_len, dest_size_val, ""); |
| 1129 | } else { | 1144 | } else { |
| 1130 | zig_unreachable(); | 1145 | zig_unreachable(); |
| 1131 | } | 1146 | } |
| ... | @@ -3183,7 +3198,8 @@ static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef ini | ... | @@ -3183,7 +3198,8 @@ static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef ini |
| 3183 | bool is_local_to_unit = true; | 3198 | bool is_local_to_unit = true; |
| 3184 | ZigLLVMCreateGlobalVariable(g->dbuilder, get_di_scope(g, var->parent_scope), buf_ptr(&var->name), | 3199 | ZigLLVMCreateGlobalVariable(g->dbuilder, get_di_scope(g, var->parent_scope), buf_ptr(&var->name), |
| 3185 | buf_ptr(&var->name), import->di_file, var->decl_node->line + 1, | 3200 | buf_ptr(&var->name), import->di_file, var->decl_node->line + 1, |
| 3186 | type_entry->di_type, is_local_to_unit, init_val); | 3201 | type_entry->di_type, is_local_to_unit); |
| 3202 | // TODO ^^ make an actual global variable | ||
| 3187 | } | 3203 | } |
| 3188 | 3204 | ||
| 3189 | static LLVMValueRef build_alloca(CodeGen *g, TypeTableEntry *type_entry, const char *name) { | 3205 | static LLVMValueRef build_alloca(CodeGen *g, TypeTableEntry *type_entry, const char *name) { |
| ... | @@ -3284,13 +3300,12 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -3284,13 +3300,12 @@ static void do_code_gen(CodeGen *g) { |
| 3284 | } else if (fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdPointer || | 3300 | } else if (fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdPointer || |
| 3285 | fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdFn) | 3301 | fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdFn) |
| 3286 | { | 3302 | { |
| 3287 | ZigLLVMAddNonNullAttr(fn_val, 0); | 3303 | addLLVMAttr(fn_val, 0, "nonnull"); |
| 3288 | } else if (handle_is_ptr(fn_type->data.fn.fn_type_id.return_type) && | 3304 | } else if (handle_is_ptr(fn_type->data.fn.fn_type_id.return_type) && |
| 3289 | !fn_type->data.fn.fn_type_id.is_extern) | 3305 | !fn_type->data.fn.fn_type_id.is_extern) |
| 3290 | { | 3306 | { |
| 3291 | LLVMValueRef first_arg = LLVMGetParam(fn_val, 0); | 3307 | addLLVMArgAttr(fn_val, 0, "sret"); |
| 3292 | LLVMAddAttribute(first_arg, LLVMStructRetAttribute); | 3308 | addLLVMArgAttr(fn_val, 0, "nonnull"); |
| 3293 | ZigLLVMAddNonNullAttr(fn_val, 1); | ||
| 3294 | } | 3309 | } |
| 3295 | 3310 | ||
| 3296 | 3311 | ||
| ... | @@ -3307,19 +3322,17 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -3307,19 +3322,17 @@ static void do_code_gen(CodeGen *g) { |
| 3307 | FnTypeParamInfo *param_info = &fn_type_id->param_info[param_i]; | 3322 | FnTypeParamInfo *param_info = &fn_type_id->param_info[param_i]; |
| 3308 | 3323 | ||
| 3309 | TypeTableEntry *param_type = gen_info->type; | 3324 | TypeTableEntry *param_type = gen_info->type; |
| 3310 | LLVMValueRef argument_val = LLVMGetParam(fn_val, gen_index); | ||
| 3311 | if (param_info->is_noalias) { | 3325 | if (param_info->is_noalias) { |
| 3312 | LLVMAddAttribute(argument_val, LLVMNoAliasAttribute); | 3326 | addLLVMArgAttr(fn_val, gen_index, "noalias"); |
| 3313 | } | 3327 | } |
| 3314 | if ((param_type->id == TypeTableEntryIdPointer && param_type->data.pointer.is_const) || is_byval) { | 3328 | if ((param_type->id == TypeTableEntryIdPointer && param_type->data.pointer.is_const) || is_byval) { |
| 3315 | LLVMAddAttribute(argument_val, LLVMReadOnlyAttribute); | 3329 | addLLVMArgAttr(fn_val, gen_index, "readonly"); |
| 3316 | } | 3330 | } |
| 3317 | if (param_type->id == TypeTableEntryIdPointer) { | 3331 | if (param_type->id == TypeTableEntryIdPointer) { |
| 3318 | ZigLLVMAddNonNullAttr(fn_val, gen_index + 1); | 3332 | addLLVMArgAttr(fn_val, gen_index, "nonnull"); |
| 3319 | } | 3333 | } |
| 3320 | if (is_byval) { | 3334 | if (is_byval) { |
| 3321 | // TODO | 3335 | // TODO add byval attr? |
| 3322 | //LLVMAddAttribute(argument_val, LLVMByValAttribute); | ||
| 3323 | } | 3336 | } |
| 3324 | } | 3337 | } |
| 3325 | 3338 | ||
| ... | @@ -3613,10 +3626,8 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3613,10 +3626,8 @@ static void define_builtin_types(CodeGen *g) { |
| 3613 | buf_init_from_str(&entry->name, info->name); | 3626 | buf_init_from_str(&entry->name, info->name); |
| 3614 | 3627 | ||
| 3615 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3628 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3616 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | ||
| 3617 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3629 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3618 | debug_size_in_bits, | 3630 | debug_size_in_bits, |
| 3619 | debug_align_in_bits, | ||
| 3620 | is_signed ? ZigLLVMEncoding_DW_ATE_signed() : ZigLLVMEncoding_DW_ATE_unsigned()); | 3631 | is_signed ? ZigLLVMEncoding_DW_ATE_signed() : ZigLLVMEncoding_DW_ATE_unsigned()); |
| 3621 | entry->data.integral.is_signed = is_signed; | 3632 | entry->data.integral.is_signed = is_signed; |
| 3622 | entry->data.integral.bit_count = size_in_bits; | 3633 | entry->data.integral.bit_count = size_in_bits; |
| ... | @@ -3630,10 +3641,8 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3630,10 +3641,8 @@ static void define_builtin_types(CodeGen *g) { |
| 3630 | entry->type_ref = LLVMInt1Type(); | 3641 | entry->type_ref = LLVMInt1Type(); |
| 3631 | buf_init_from_str(&entry->name, "bool"); | 3642 | buf_init_from_str(&entry->name, "bool"); |
| 3632 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3643 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3633 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | ||
| 3634 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3644 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3635 | debug_size_in_bits, | 3645 | debug_size_in_bits, |
| 3636 | debug_align_in_bits, | ||
| 3637 | ZigLLVMEncoding_DW_ATE_boolean()); | 3646 | ZigLLVMEncoding_DW_ATE_boolean()); |
| 3638 | g->builtin_types.entry_bool = entry; | 3647 | g->builtin_types.entry_bool = entry; |
| 3639 | g->primitive_type_table.put(&entry->name, entry); | 3648 | g->primitive_type_table.put(&entry->name, entry); |
| ... | @@ -3653,10 +3662,8 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3653,10 +3662,8 @@ static void define_builtin_types(CodeGen *g) { |
| 3653 | entry->data.integral.bit_count = g->pointer_size_bytes * 8; | 3662 | entry->data.integral.bit_count = g->pointer_size_bytes * 8; |
| 3654 | 3663 | ||
| 3655 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3664 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3656 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | ||
| 3657 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3665 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3658 | debug_size_in_bits, | 3666 | debug_size_in_bits, |
| 3659 | debug_align_in_bits, | ||
| 3660 | is_signed ? ZigLLVMEncoding_DW_ATE_signed() : ZigLLVMEncoding_DW_ATE_unsigned()); | 3667 | is_signed ? ZigLLVMEncoding_DW_ATE_signed() : ZigLLVMEncoding_DW_ATE_unsigned()); |
| 3661 | g->primitive_type_table.put(&entry->name, entry); | 3668 | g->primitive_type_table.put(&entry->name, entry); |
| 3662 | 3669 | ||
| ... | @@ -3673,10 +3680,8 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3673,10 +3680,8 @@ static void define_builtin_types(CodeGen *g) { |
| 3673 | entry->data.floating.bit_count = 32; | 3680 | entry->data.floating.bit_count = 32; |
| 3674 | 3681 | ||
| 3675 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3682 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3676 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | ||
| 3677 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3683 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3678 | debug_size_in_bits, | 3684 | debug_size_in_bits, |
| 3679 | debug_align_in_bits, | ||
| 3680 | ZigLLVMEncoding_DW_ATE_float()); | 3685 | ZigLLVMEncoding_DW_ATE_float()); |
| 3681 | g->builtin_types.entry_f32 = entry; | 3686 | g->builtin_types.entry_f32 = entry; |
| 3682 | g->primitive_type_table.put(&entry->name, entry); | 3687 | g->primitive_type_table.put(&entry->name, entry); |
| ... | @@ -3688,10 +3693,8 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3688,10 +3693,8 @@ static void define_builtin_types(CodeGen *g) { |
| 3688 | entry->data.floating.bit_count = 64; | 3693 | entry->data.floating.bit_count = 64; |
| 3689 | 3694 | ||
| 3690 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3695 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3691 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | ||
| 3692 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3696 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3693 | debug_size_in_bits, | 3697 | debug_size_in_bits, |
| 3694 | debug_align_in_bits, | ||
| 3695 | ZigLLVMEncoding_DW_ATE_float()); | 3698 | ZigLLVMEncoding_DW_ATE_float()); |
| 3696 | g->builtin_types.entry_f64 = entry; | 3699 | g->builtin_types.entry_f64 = entry; |
| 3697 | g->primitive_type_table.put(&entry->name, entry); | 3700 | g->primitive_type_table.put(&entry->name, entry); |
| ... | @@ -3703,10 +3706,8 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3703,10 +3706,8 @@ static void define_builtin_types(CodeGen *g) { |
| 3703 | entry->data.floating.bit_count = 80; | 3706 | entry->data.floating.bit_count = 80; |
| 3704 | 3707 | ||
| 3705 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 3708 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 3706 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | ||
| 3707 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3709 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3708 | debug_size_in_bits, | 3710 | debug_size_in_bits, |
| 3709 | debug_align_in_bits, | ||
| 3710 | ZigLLVMEncoding_DW_ATE_float()); | 3711 | ZigLLVMEncoding_DW_ATE_float()); |
| 3711 | g->builtin_types.entry_c_long_double = entry; | 3712 | g->builtin_types.entry_c_long_double = entry; |
| 3712 | g->primitive_type_table.put(&entry->name, entry); | 3713 | g->primitive_type_table.put(&entry->name, entry); |
| ... | @@ -3717,7 +3718,6 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -3717,7 +3718,6 @@ static void define_builtin_types(CodeGen *g) { |
| 3717 | entry->zero_bits = true; | 3718 | entry->zero_bits = true; |
| 3718 | buf_init_from_str(&entry->name, "void"); | 3719 | buf_init_from_str(&entry->name, "void"); |
| 3719 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 3720 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 3720 | 0, | ||
| 3721 | 0, | 3721 | 0, |
| 3722 | ZigLLVMEncoding_DW_ATE_unsigned()); | 3722 | ZigLLVMEncoding_DW_ATE_unsigned()); |
| 3723 | g->builtin_types.entry_void = entry; | 3723 | g->builtin_types.entry_void = entry; |
| ... | @@ -4098,9 +4098,10 @@ static void init(CodeGen *g, Buf *source_path) { | ... | @@ -4098,9 +4098,10 @@ static void init(CodeGen *g, Buf *source_path) { |
| 4098 | bool is_optimized = g->is_release_build; | 4098 | bool is_optimized = g->is_release_build; |
| 4099 | const char *flags = ""; | 4099 | const char *flags = ""; |
| 4100 | unsigned runtime_version = 0; | 4100 | unsigned runtime_version = 0; |
| 4101 | ZigLLVMDIFile *compile_unit_file = ZigLLVMCreateFile(g->dbuilder, buf_ptr(source_path), | ||
| 4102 | buf_ptr(&g->root_package->root_src_dir)); | ||
| 4101 | g->compile_unit = ZigLLVMCreateCompileUnit(g->dbuilder, ZigLLVMLang_DW_LANG_C99(), | 4103 | g->compile_unit = ZigLLVMCreateCompileUnit(g->dbuilder, ZigLLVMLang_DW_LANG_C99(), |
| 4102 | buf_ptr(source_path), buf_ptr(&g->root_package->root_src_dir), | 4104 | compile_unit_file, buf_ptr(producer), is_optimized, flags, runtime_version, |
| 4103 | buf_ptr(producer), is_optimized, flags, runtime_version, | ||
| 4104 | "", 0, !g->strip_debug_symbols); | 4105 | "", 0, !g->strip_debug_symbols); |
| 4105 | 4106 | ||
| 4106 | // This is for debug stuff that doesn't have a real file. | 4107 | // This is for debug stuff that doesn't have a real file. |
src/parseh.cpp+4| ... | @@ -466,6 +466,9 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -466,6 +466,9 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 466 | case CC_X86_64SysV: // __attribute__((sysv_abi)) | 466 | case CC_X86_64SysV: // __attribute__((sysv_abi)) |
| 467 | emit_warning(c, decl, "function type has x86 64sysv calling convention"); | 467 | emit_warning(c, decl, "function type has x86 64sysv calling convention"); |
| 468 | return c->codegen->builtin_types.entry_invalid; | 468 | return c->codegen->builtin_types.entry_invalid; |
| 469 | case CC_X86RegCall: | ||
| 470 | emit_warning(c, decl, "function type has x86 reg calling convention"); | ||
| 471 | return c->codegen->builtin_types.entry_invalid; | ||
| 469 | case CC_AAPCS: // __attribute__((pcs("aapcs"))) | 472 | case CC_AAPCS: // __attribute__((pcs("aapcs"))) |
| 470 | emit_warning(c, decl, "function type has aapcs calling convention"); | 473 | emit_warning(c, decl, "function type has aapcs calling convention"); |
| 471 | return c->codegen->builtin_types.entry_invalid; | 474 | return c->codegen->builtin_types.entry_invalid; |
| ... | @@ -598,6 +601,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -598,6 +601,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 598 | case Type::ObjCObjectPointer: | 601 | case Type::ObjCObjectPointer: |
| 599 | case Type::Atomic: | 602 | case Type::Atomic: |
| 600 | case Type::Pipe: | 603 | case Type::Pipe: |
| 604 | case Type::ObjCTypeParam: | ||
| 601 | emit_warning(c, decl, "missed a '%s' type", ty->getTypeClassName()); | 605 | emit_warning(c, decl, "missed a '%s' type", ty->getTypeClassName()); |
| 602 | return c->codegen->builtin_types.entry_invalid; | 606 | return c->codegen->builtin_types.entry_invalid; |
| 603 | } | 607 | } |
src/target.cpp+8| ... | @@ -351,6 +351,8 @@ void resolve_target_object_format(ZigTarget *target) { | ... | @@ -351,6 +351,8 @@ void resolve_target_object_format(ZigTarget *target) { |
| 351 | case ZigLLVM_r600: | 351 | case ZigLLVM_r600: |
| 352 | case ZigLLVM_renderscript32: | 352 | case ZigLLVM_renderscript32: |
| 353 | case ZigLLVM_renderscript64: | 353 | case ZigLLVM_renderscript64: |
| 354 | case ZigLLVM_riscv32: | ||
| 355 | case ZigLLVM_riscv64: | ||
| 354 | case ZigLLVM_shave: | 356 | case ZigLLVM_shave: |
| 355 | case ZigLLVM_sparc: | 357 | case ZigLLVM_sparc: |
| 356 | case ZigLLVM_sparcel: | 358 | case ZigLLVM_sparcel: |
| ... | @@ -359,6 +361,7 @@ void resolve_target_object_format(ZigTarget *target) { | ... | @@ -359,6 +361,7 @@ void resolve_target_object_format(ZigTarget *target) { |
| 359 | case ZigLLVM_spir64: | 361 | case ZigLLVM_spir64: |
| 360 | case ZigLLVM_systemz: | 362 | case ZigLLVM_systemz: |
| 361 | case ZigLLVM_tce: | 363 | case ZigLLVM_tce: |
| 364 | case ZigLLVM_tcele: | ||
| 362 | case ZigLLVM_thumbeb: | 365 | case ZigLLVM_thumbeb: |
| 363 | case ZigLLVM_wasm32: | 366 | case ZigLLVM_wasm32: |
| 364 | case ZigLLVM_wasm64: | 367 | case ZigLLVM_wasm64: |
| ... | @@ -396,9 +399,11 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) { | ... | @@ -396,9 +399,11 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) { |
| 396 | case ZigLLVM_nvptx: | 399 | case ZigLLVM_nvptx: |
| 397 | case ZigLLVM_ppc: | 400 | case ZigLLVM_ppc: |
| 398 | case ZigLLVM_r600: | 401 | case ZigLLVM_r600: |
| 402 | case ZigLLVM_riscv32: | ||
| 399 | case ZigLLVM_sparc: | 403 | case ZigLLVM_sparc: |
| 400 | case ZigLLVM_sparcel: | 404 | case ZigLLVM_sparcel: |
| 401 | case ZigLLVM_tce: | 405 | case ZigLLVM_tce: |
| 406 | case ZigLLVM_tcele: | ||
| 402 | case ZigLLVM_thumb: | 407 | case ZigLLVM_thumb: |
| 403 | case ZigLLVM_thumbeb: | 408 | case ZigLLVM_thumbeb: |
| 404 | case ZigLLVM_x86: | 409 | case ZigLLVM_x86: |
| ... | @@ -424,6 +429,7 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) { | ... | @@ -424,6 +429,7 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) { |
| 424 | case ZigLLVM_nvptx64: | 429 | case ZigLLVM_nvptx64: |
| 425 | case ZigLLVM_ppc64: | 430 | case ZigLLVM_ppc64: |
| 426 | case ZigLLVM_ppc64le: | 431 | case ZigLLVM_ppc64le: |
| 432 | case ZigLLVM_riscv64: | ||
| 427 | case ZigLLVM_sparcv9: | 433 | case ZigLLVM_sparcv9: |
| 428 | case ZigLLVM_systemz: | 434 | case ZigLLVM_systemz: |
| 429 | case ZigLLVM_x86_64: | 435 | case ZigLLVM_x86_64: |
| ... | @@ -515,6 +521,8 @@ int get_c_type_size_in_bits(const ZigTarget *target, CIntType id) { | ... | @@ -515,6 +521,8 @@ int get_c_type_size_in_bits(const ZigTarget *target, CIntType id) { |
| 515 | case ZigLLVM_TvOS: | 521 | case ZigLLVM_TvOS: |
| 516 | case ZigLLVM_WatchOS: | 522 | case ZigLLVM_WatchOS: |
| 517 | case ZigLLVM_Mesa3D: | 523 | case ZigLLVM_Mesa3D: |
| 524 | case ZigLLVM_Fuchsia: | ||
| 525 | case ZigLLVM_Contiki: | ||
| 518 | zig_panic("TODO c type size in bits for this target"); | 526 | zig_panic("TODO c type size in bits for this target"); |
| 519 | } | 527 | } |
| 520 | zig_unreachable(); | 528 | zig_unreachable(); |
src/zig_llvm.cpp+31-36| ... | @@ -137,15 +137,6 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A | ... | @@ -137,15 +137,6 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A |
| 137 | return wrap(unwrap(B)->Insert(call_inst)); | 137 | return wrap(unwrap(B)->Insert(call_inst)); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | void ZigLLVMAddNonNullAttr(LLVMValueRef fn, unsigned i) | ||
| 141 | { | ||
| 142 | assert( isa<Function>(unwrap(fn)) ); | ||
| 143 | |||
| 144 | Function *unwrapped_function = reinterpret_cast<Function*>(unwrap(fn)); | ||
| 145 | |||
| 146 | unwrapped_function->addAttribute(i, Attribute::NonNull); | ||
| 147 | } | ||
| 148 | |||
| 149 | void ZigLLVMFnSetSubprogram(LLVMValueRef fn, ZigLLVMDISubprogram *subprogram) { | 140 | void ZigLLVMFnSetSubprogram(LLVMValueRef fn, ZigLLVMDISubprogram *subprogram) { |
| 150 | assert( isa<Function>(unwrap(fn)) ); | 141 | assert( isa<Function>(unwrap(fn)) ); |
| 151 | Function *unwrapped_function = reinterpret_cast<Function*>(unwrap(fn)); | 142 | Function *unwrapped_function = reinterpret_cast<Function*>(unwrap(fn)); |
| ... | @@ -162,10 +153,10 @@ ZigLLVMDIType *ZigLLVMCreateDebugPointerType(ZigLLVMDIBuilder *dibuilder, ZigLLV | ... | @@ -162,10 +153,10 @@ ZigLLVMDIType *ZigLLVMCreateDebugPointerType(ZigLLVMDIBuilder *dibuilder, ZigLLV |
| 162 | } | 153 | } |
| 163 | 154 | ||
| 164 | ZigLLVMDIType *ZigLLVMCreateDebugBasicType(ZigLLVMDIBuilder *dibuilder, const char *name, | 155 | ZigLLVMDIType *ZigLLVMCreateDebugBasicType(ZigLLVMDIBuilder *dibuilder, const char *name, |
| 165 | uint64_t size_in_bits, uint64_t align_in_bits, unsigned encoding) | 156 | uint64_t size_in_bits, unsigned encoding) |
| 166 | { | 157 | { |
| 167 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createBasicType( | 158 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createBasicType( |
| 168 | name, size_in_bits, align_in_bits, encoding); | 159 | name, size_in_bits, encoding); |
| 169 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | 160 | return reinterpret_cast<ZigLLVMDIType*>(di_type); |
| 170 | } | 161 | } |
| 171 | 162 | ||
| ... | @@ -211,11 +202,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVM | ... | @@ -211,11 +202,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVM |
| 211 | const char *name, ZigLLVMDIFile *file, unsigned line, uint64_t size_in_bits, | 202 | const char *name, ZigLLVMDIFile *file, unsigned line, uint64_t size_in_bits, |
| 212 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, ZigLLVMDIType *type) | 203 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, ZigLLVMDIType *type) |
| 213 | { | 204 | { |
| 205 | assert(flags == 0); | ||
| 214 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createMemberType( | 206 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createMemberType( |
| 215 | reinterpret_cast<DIScope*>(scope), | 207 | reinterpret_cast<DIScope*>(scope), |
| 216 | name, | 208 | name, |
| 217 | reinterpret_cast<DIFile*>(file), | 209 | reinterpret_cast<DIFile*>(file), |
| 218 | line, size_in_bits, align_in_bits, offset_in_bits, flags, | 210 | line, size_in_bits, align_in_bits, offset_in_bits, DINode::FlagZero, |
| 219 | reinterpret_cast<DIType*>(type)); | 211 | reinterpret_cast<DIType*>(type)); |
| 220 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | 212 | return reinterpret_cast<ZigLLVMDIType*>(di_type); |
| 221 | } | 213 | } |
| ... | @@ -230,11 +222,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMD | ... | @@ -230,11 +222,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMD |
| 230 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); | 222 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); |
| 231 | fields.push_back(ditype); | 223 | fields.push_back(ditype); |
| 232 | } | 224 | } |
| 225 | assert(flags == 0); | ||
| 233 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createUnionType( | 226 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createUnionType( |
| 234 | reinterpret_cast<DIScope*>(scope), | 227 | reinterpret_cast<DIScope*>(scope), |
| 235 | name, | 228 | name, |
| 236 | reinterpret_cast<DIFile*>(file), | 229 | reinterpret_cast<DIFile*>(file), |
| 237 | line_number, size_in_bits, align_in_bits, flags, | 230 | line_number, size_in_bits, align_in_bits, DINode::FlagZero, |
| 238 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), | 231 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), |
| 239 | run_time_lang, unique_id); | 232 | run_time_lang, unique_id); |
| 240 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | 233 | return reinterpret_cast<ZigLLVMDIType*>(di_type); |
| ... | @@ -251,11 +244,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVM | ... | @@ -251,11 +244,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVM |
| 251 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); | 244 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); |
| 252 | fields.push_back(ditype); | 245 | fields.push_back(ditype); |
| 253 | } | 246 | } |
| 247 | assert(flags == 0); | ||
| 254 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createStructType( | 248 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createStructType( |
| 255 | reinterpret_cast<DIScope*>(scope), | 249 | reinterpret_cast<DIScope*>(scope), |
| 256 | name, | 250 | name, |
| 257 | reinterpret_cast<DIFile*>(file), | 251 | reinterpret_cast<DIFile*>(file), |
| 258 | line_number, size_in_bits, align_in_bits, flags, | 252 | line_number, size_in_bits, align_in_bits, DINode::FlagZero, |
| 259 | reinterpret_cast<DIType*>(derived_from), | 253 | reinterpret_cast<DIType*>(derived_from), |
| 260 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), | 254 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), |
| 261 | run_time_lang, | 255 | run_time_lang, |
| ... | @@ -316,10 +310,11 @@ ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, | ... | @@ -316,10 +310,11 @@ ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, |
| 316 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); | 310 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); |
| 317 | types.push_back(ditype); | 311 | types.push_back(ditype); |
| 318 | } | 312 | } |
| 313 | assert(flags == 0); | ||
| 319 | DIBuilder *dibuilder = reinterpret_cast<DIBuilder*>(dibuilder_wrapped); | 314 | DIBuilder *dibuilder = reinterpret_cast<DIBuilder*>(dibuilder_wrapped); |
| 320 | DISubroutineType *subroutine_type = dibuilder->createSubroutineType( | 315 | DISubroutineType *subroutine_type = dibuilder->createSubroutineType( |
| 321 | dibuilder->getOrCreateTypeArray(types), | 316 | dibuilder->getOrCreateTypeArray(types), |
| 322 | flags); | 317 | DINode::FlagZero); |
| 323 | DIType *ditype = subroutine_type; | 318 | DIType *ditype = subroutine_type; |
| 324 | return reinterpret_cast<ZigLLVMDIType*>(ditype); | 319 | return reinterpret_cast<ZigLLVMDIType*>(ditype); |
| 325 | } | 320 | } |
| ... | @@ -390,6 +385,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | ... | @@ -390,6 +385,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, |
| 390 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | 385 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, |
| 391 | ZigLLVMDIType *type, bool always_preserve, unsigned flags) | 386 | ZigLLVMDIType *type, bool always_preserve, unsigned flags) |
| 392 | { | 387 | { |
| 388 | assert(flags == 0); | ||
| 393 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createAutoVariable( | 389 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createAutoVariable( |
| 394 | reinterpret_cast<DIScope*>(scope), | 390 | reinterpret_cast<DIScope*>(scope), |
| 395 | name, | 391 | name, |
| ... | @@ -397,23 +393,22 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | ... | @@ -397,23 +393,22 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, |
| 397 | line_no, | 393 | line_no, |
| 398 | reinterpret_cast<DIType*>(type), | 394 | reinterpret_cast<DIType*>(type), |
| 399 | always_preserve, | 395 | always_preserve, |
| 400 | flags); | 396 | DINode::FlagZero); |
| 401 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); | 397 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); |
| 402 | } | 398 | } |
| 403 | 399 | ||
| 404 | ZigLLVMDIGlobalVariable *ZigLLVMCreateGlobalVariable(ZigLLVMDIBuilder *dbuilder, | 400 | ZigLLVMDIGlobalVariable *ZigLLVMCreateGlobalVariable(ZigLLVMDIBuilder *dbuilder, |
| 405 | ZigLLVMDIScope *scope, const char *name, const char *linkage_name, ZigLLVMDIFile *file, | 401 | ZigLLVMDIScope *scope, const char *name, const char *linkage_name, ZigLLVMDIFile *file, |
| 406 | unsigned line_no, ZigLLVMDIType *di_type, bool is_local_to_unit, LLVMValueRef constant_val) | 402 | unsigned line_no, ZigLLVMDIType *di_type, bool is_local_to_unit) |
| 407 | { | 403 | { |
| 408 | DIGlobalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createGlobalVariable( | 404 | DIGlobalVariableExpression *result = reinterpret_cast<DIBuilder*>(dbuilder)->createGlobalVariableExpression( |
| 409 | reinterpret_cast<DIScope*>(scope), | 405 | reinterpret_cast<DIScope*>(scope), |
| 410 | name, | 406 | name, |
| 411 | linkage_name, | 407 | linkage_name, |
| 412 | reinterpret_cast<DIFile*>(file), | 408 | reinterpret_cast<DIFile*>(file), |
| 413 | line_no, | 409 | line_no, |
| 414 | reinterpret_cast<DIType*>(di_type), | 410 | reinterpret_cast<DIType*>(di_type), |
| 415 | is_local_to_unit, | 411 | is_local_to_unit); |
| 416 | reinterpret_cast<llvm::Constant *>(constant_val)); | ||
| 417 | return reinterpret_cast<ZigLLVMDIGlobalVariable*>(result); | 412 | return reinterpret_cast<ZigLLVMDIGlobalVariable*>(result); |
| 418 | } | 413 | } |
| 419 | 414 | ||
| ... | @@ -421,6 +416,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde | ... | @@ -421,6 +416,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde |
| 421 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | 416 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, |
| 422 | ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) | 417 | ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) |
| 423 | { | 418 | { |
| 419 | assert(flags == 0); | ||
| 424 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createParameterVariable( | 420 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createParameterVariable( |
| 425 | reinterpret_cast<DIScope*>(scope), | 421 | reinterpret_cast<DIScope*>(scope), |
| 426 | name, | 422 | name, |
| ... | @@ -429,7 +425,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde | ... | @@ -429,7 +425,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde |
| 429 | line_no, | 425 | line_no, |
| 430 | reinterpret_cast<DIType*>(type), | 426 | reinterpret_cast<DIType*>(type), |
| 431 | always_preserve, | 427 | always_preserve, |
| 432 | flags); | 428 | DINode::FlagZero); |
| 433 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); | 429 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); |
| 434 | } | 430 | } |
| 435 | 431 | ||
| ... | @@ -459,12 +455,16 @@ ZigLLVMDIScope *ZigLLVMTypeToScope(ZigLLVMDIType *type) { | ... | @@ -459,12 +455,16 @@ ZigLLVMDIScope *ZigLLVMTypeToScope(ZigLLVMDIType *type) { |
| 459 | } | 455 | } |
| 460 | 456 | ||
| 461 | ZigLLVMDICompileUnit *ZigLLVMCreateCompileUnit(ZigLLVMDIBuilder *dibuilder, | 457 | ZigLLVMDICompileUnit *ZigLLVMCreateCompileUnit(ZigLLVMDIBuilder *dibuilder, |
| 462 | unsigned lang, const char *file, const char *dir, const char *producer, | 458 | unsigned lang, ZigLLVMDIFile *difile, const char *producer, |
| 463 | bool is_optimized, const char *flags, unsigned runtime_version, const char *split_name, | 459 | bool is_optimized, const char *flags, unsigned runtime_version, const char *split_name, |
| 464 | uint64_t dwo_id, bool emit_debug_info) | 460 | uint64_t dwo_id, bool emit_debug_info) |
| 465 | { | 461 | { |
| 466 | DICompileUnit *result = reinterpret_cast<DIBuilder*>(dibuilder)->createCompileUnit( | 462 | DICompileUnit *result = reinterpret_cast<DIBuilder*>(dibuilder)->createCompileUnit( |
| 467 | lang, file, dir, producer, is_optimized, flags, runtime_version, split_name); | 463 | lang, |
| 464 | reinterpret_cast<DIFile*>(difile), | ||
| 465 | producer, is_optimized, flags, runtime_version, split_name, | ||
| 466 | (emit_debug_info ? DICompileUnit::DebugEmissionKind::FullDebug : DICompileUnit::DebugEmissionKind::NoDebug), | ||
| 467 | dwo_id); | ||
| 468 | return reinterpret_cast<ZigLLVMDICompileUnit*>(result); | 468 | return reinterpret_cast<ZigLLVMDICompileUnit*>(result); |
| 469 | } | 469 | } |
| 470 | 470 | ||
| ... | @@ -480,13 +480,14 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD | ... | @@ -480,13 +480,14 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD |
| 480 | unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram) | 480 | unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram) |
| 481 | { | 481 | { |
| 482 | DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type)); | 482 | DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type)); |
| 483 | assert(flags == 0); | ||
| 483 | DISubprogram *result = reinterpret_cast<DIBuilder*>(dibuilder)->createFunction( | 484 | DISubprogram *result = reinterpret_cast<DIBuilder*>(dibuilder)->createFunction( |
| 484 | reinterpret_cast<DIScope*>(scope), | 485 | reinterpret_cast<DIScope*>(scope), |
| 485 | name, linkage_name, | 486 | name, linkage_name, |
| 486 | reinterpret_cast<DIFile*>(file), | 487 | reinterpret_cast<DIFile*>(file), |
| 487 | lineno, | 488 | lineno, |
| 488 | di_sub_type, | 489 | di_sub_type, |
| 489 | is_local_to_unit, is_definition, scope_line, flags, is_optimized, | 490 | is_local_to_unit, is_definition, scope_line, DINode::FlagZero, is_optimized, |
| 490 | nullptr, | 491 | nullptr, |
| 491 | reinterpret_cast<DISubprogram *>(decl_subprogram)); | 492 | reinterpret_cast<DISubprogram *>(decl_subprogram)); |
| 492 | return reinterpret_cast<ZigLLVMDISubprogram*>(result); | 493 | return reinterpret_cast<ZigLLVMDISubprogram*>(result); |
| ... | @@ -581,19 +582,19 @@ static_assert((Triple::ObjectFormatType)ZigLLVM_ELF == Triple::ELF, ""); | ... | @@ -581,19 +582,19 @@ static_assert((Triple::ObjectFormatType)ZigLLVM_ELF == Triple::ELF, ""); |
| 581 | static_assert((Triple::ObjectFormatType)ZigLLVM_MachO == Triple::MachO, ""); | 582 | static_assert((Triple::ObjectFormatType)ZigLLVM_MachO == Triple::MachO, ""); |
| 582 | 583 | ||
| 583 | const char *ZigLLVMGetArchTypeName(ZigLLVM_ArchType arch) { | 584 | const char *ZigLLVMGetArchTypeName(ZigLLVM_ArchType arch) { |
| 584 | return Triple::getArchTypeName((Triple::ArchType)arch); | 585 | return (const char*)Triple::getArchTypeName((Triple::ArchType)arch).bytes_begin(); |
| 585 | } | 586 | } |
| 586 | 587 | ||
| 587 | const char *ZigLLVMGetVendorTypeName(ZigLLVM_VendorType vendor) { | 588 | const char *ZigLLVMGetVendorTypeName(ZigLLVM_VendorType vendor) { |
| 588 | return Triple::getVendorTypeName((Triple::VendorType)vendor); | 589 | return (const char*)Triple::getVendorTypeName((Triple::VendorType)vendor).bytes_begin(); |
| 589 | } | 590 | } |
| 590 | 591 | ||
| 591 | const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os) { | 592 | const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os) { |
| 592 | return Triple::getOSTypeName((Triple::OSType)os); | 593 | return (const char*)Triple::getOSTypeName((Triple::OSType)os).bytes_begin(); |
| 593 | } | 594 | } |
| 594 | 595 | ||
| 595 | const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type) { | 596 | const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type) { |
| 596 | return Triple::getEnvironmentTypeName((Triple::EnvironmentType)env_type); | 597 | return (const char*)Triple::getEnvironmentTypeName((Triple::EnvironmentType)env_type).bytes_begin(); |
| 597 | } | 598 | } |
| 598 | 599 | ||
| 599 | void ZigLLVMGetNativeTarget(ZigLLVM_ArchType *arch_type, ZigLLVM_SubArchType *sub_arch_type, | 600 | void ZigLLVMGetNativeTarget(ZigLLVM_ArchType *arch_type, ZigLLVM_SubArchType *sub_arch_type, |
| ... | @@ -623,6 +624,8 @@ const char *ZigLLVMGetSubArchTypeName(ZigLLVM_SubArchType sub_arch) { | ... | @@ -623,6 +624,8 @@ const char *ZigLLVMGetSubArchTypeName(ZigLLVM_SubArchType sub_arch) { |
| 623 | return "v8_1a"; | 624 | return "v8_1a"; |
| 624 | case ZigLLVM_ARMSubArch_v8: | 625 | case ZigLLVM_ARMSubArch_v8: |
| 625 | return "v8"; | 626 | return "v8"; |
| 627 | case ZigLLVM_ARMSubArch_v8r: | ||
| 628 | return "v8r"; | ||
| 626 | case ZigLLVM_ARMSubArch_v8m_baseline: | 629 | case ZigLLVM_ARMSubArch_v8m_baseline: |
| 627 | return "v8m_baseline"; | 630 | return "v8m_baseline"; |
| 628 | case ZigLLVM_ARMSubArch_v8m_mainline: | 631 | case ZigLLVM_ARMSubArch_v8m_mainline: |
| ... | @@ -704,14 +707,6 @@ LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMVa | ... | @@ -704,14 +707,6 @@ LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMVa |
| 704 | return wrap(unwrap(builder)->CreateShl(unwrap(LHS), unwrap(RHS), name, false, true)); | 707 | return wrap(unwrap(builder)->CreateShl(unwrap(LHS), unwrap(RHS), name, false, true)); |
| 705 | } | 708 | } |
| 706 | 709 | ||
| 707 | LLVMValueRef ZigLLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, | ||
| 708 | LLVMValueRef RHS, const char *Name) | ||
| 709 | { | ||
| 710 | return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name)); | ||
| 711 | } | ||
| 712 | |||
| 713 | |||
| 714 | |||
| 715 | //------------------------------------ | 710 | //------------------------------------ |
| 716 | 711 | ||
| 717 | #include "buffer.hpp" | 712 | #include "buffer.hpp" |
src/zig_llvm.hpp+136-130| ... | @@ -47,17 +47,12 @@ LLVMValueRef ZigLLVMBuildNSWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMVa | ... | @@ -47,17 +47,12 @@ LLVMValueRef ZigLLVMBuildNSWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMVa |
| 47 | const char *name); | 47 | const char *name); |
| 48 | LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS, | 48 | LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS, |
| 49 | const char *name); | 49 | const char *name); |
| 50 | LLVMValueRef ZigLLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, | ||
| 51 | LLVMValueRef RHS, const char *Name); | ||
| 52 | |||
| 53 | // 0 is return value, 1 is first arg | ||
| 54 | void ZigLLVMAddNonNullAttr(LLVMValueRef fn, unsigned i); | ||
| 55 | 50 | ||
| 56 | ZigLLVMDIType *ZigLLVMCreateDebugPointerType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *pointee_type, | 51 | ZigLLVMDIType *ZigLLVMCreateDebugPointerType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *pointee_type, |
| 57 | uint64_t size_in_bits, uint64_t align_in_bits, const char *name); | 52 | uint64_t size_in_bits, uint64_t align_in_bits, const char *name); |
| 58 | 53 | ||
| 59 | ZigLLVMDIType *ZigLLVMCreateDebugBasicType(ZigLLVMDIBuilder *dibuilder, const char *name, | 54 | ZigLLVMDIType *ZigLLVMCreateDebugBasicType(ZigLLVMDIBuilder *dibuilder, const char *name, |
| 60 | uint64_t size_in_bits, uint64_t align_in_bits, unsigned encoding); | 55 | uint64_t size_in_bits, unsigned encoding); |
| 61 | 56 | ||
| 62 | ZigLLVMDIType *ZigLLVMCreateDebugArrayType(ZigLLVMDIBuilder *dibuilder, | 57 | ZigLLVMDIType *ZigLLVMCreateDebugArrayType(ZigLLVMDIBuilder *dibuilder, |
| 63 | uint64_t size_in_bits, uint64_t align_in_bits, ZigLLVMDIType *elem_type, | 58 | uint64_t size_in_bits, uint64_t align_in_bits, ZigLLVMDIType *elem_type, |
| ... | @@ -128,7 +123,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | ... | @@ -128,7 +123,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, |
| 128 | 123 | ||
| 129 | ZigLLVMDIGlobalVariable *ZigLLVMCreateGlobalVariable(ZigLLVMDIBuilder *dbuilder, | 124 | ZigLLVMDIGlobalVariable *ZigLLVMCreateGlobalVariable(ZigLLVMDIBuilder *dbuilder, |
| 130 | ZigLLVMDIScope *scope, const char *name, const char *linkage_name, ZigLLVMDIFile *file, | 125 | ZigLLVMDIScope *scope, const char *name, const char *linkage_name, ZigLLVMDIFile *file, |
| 131 | unsigned line_no, ZigLLVMDIType *di_type, bool is_local_to_unit, LLVMValueRef constant_val); | 126 | unsigned line_no, ZigLLVMDIType *di_type, bool is_local_to_unit); |
| 132 | 127 | ||
| 133 | ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilder, | 128 | ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilder, |
| 134 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | 129 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, |
| ... | @@ -138,7 +133,7 @@ ZigLLVMDILexicalBlock *ZigLLVMCreateLexicalBlock(ZigLLVMDIBuilder *dbuilder, Zig | ... | @@ -138,7 +133,7 @@ ZigLLVMDILexicalBlock *ZigLLVMCreateLexicalBlock(ZigLLVMDIBuilder *dbuilder, Zig |
| 138 | ZigLLVMDIFile *file, unsigned line, unsigned col); | 133 | ZigLLVMDIFile *file, unsigned line, unsigned col); |
| 139 | 134 | ||
| 140 | ZigLLVMDICompileUnit *ZigLLVMCreateCompileUnit(ZigLLVMDIBuilder *dibuilder, | 135 | ZigLLVMDICompileUnit *ZigLLVMCreateCompileUnit(ZigLLVMDIBuilder *dibuilder, |
| 141 | unsigned lang, const char *file, const char *dir, const char *producer, | 136 | unsigned lang, ZigLLVMDIFile *difile, const char *producer, |
| 142 | bool is_optimized, const char *flags, unsigned runtime_version, const char *split_name, | 137 | bool is_optimized, const char *flags, unsigned runtime_version, const char *split_name, |
| 143 | uint64_t dwo_id, bool emit_debug_info); | 138 | uint64_t dwo_id, bool emit_debug_info); |
| 144 | 139 | ||
| ... | @@ -173,55 +168,58 @@ unsigned ZigLLVMGetPrefTypeAlignment(LLVMTargetDataRef TD, LLVMTypeRef Ty); | ... | @@ -173,55 +168,58 @@ unsigned ZigLLVMGetPrefTypeAlignment(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
| 173 | // copied from include/llvm/ADT/Triple.h | 168 | // copied from include/llvm/ADT/Triple.h |
| 174 | 169 | ||
| 175 | enum ZigLLVM_ArchType { | 170 | enum ZigLLVM_ArchType { |
| 176 | ZigLLVM_UnknownArch, | 171 | ZigLLVM_UnknownArch, |
| 177 | 172 | ||
| 178 | ZigLLVM_arm, // ARM (little endian): arm, armv.*, xscale | 173 | ZigLLVM_arm, // ARM (little endian): arm, armv.*, xscale |
| 179 | ZigLLVM_armeb, // ARM (big endian): armeb | 174 | ZigLLVM_armeb, // ARM (big endian): armeb |
| 180 | ZigLLVM_aarch64, // AArch64 (little endian): aarch64 | 175 | ZigLLVM_aarch64, // AArch64 (little endian): aarch64 |
| 181 | ZigLLVM_aarch64_be, // AArch64 (big endian): aarch64_be | 176 | ZigLLVM_aarch64_be, // AArch64 (big endian): aarch64_be |
| 182 | ZigLLVM_avr, // AVR: Atmel AVR microcontroller | 177 | ZigLLVM_avr, // AVR: Atmel AVR microcontroller |
| 183 | ZigLLVM_bpfel, // eBPF or extended BPF or 64-bit BPF (little endian) | 178 | ZigLLVM_bpfel, // eBPF or extended BPF or 64-bit BPF (little endian) |
| 184 | ZigLLVM_bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian) | 179 | ZigLLVM_bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian) |
| 185 | ZigLLVM_hexagon, // Hexagon: hexagon | 180 | ZigLLVM_hexagon, // Hexagon: hexagon |
| 186 | ZigLLVM_mips, // MIPS: mips, mipsallegrex | 181 | ZigLLVM_mips, // MIPS: mips, mipsallegrex |
| 187 | ZigLLVM_mipsel, // MIPSEL: mipsel, mipsallegrexel | 182 | ZigLLVM_mipsel, // MIPSEL: mipsel, mipsallegrexel |
| 188 | ZigLLVM_mips64, // MIPS64: mips64 | 183 | ZigLLVM_mips64, // MIPS64: mips64 |
| 189 | ZigLLVM_mips64el, // MIPS64EL: mips64el | 184 | ZigLLVM_mips64el, // MIPS64EL: mips64el |
| 190 | ZigLLVM_msp430, // MSP430: msp430 | 185 | ZigLLVM_msp430, // MSP430: msp430 |
| 191 | ZigLLVM_ppc, // PPC: powerpc | 186 | ZigLLVM_ppc, // PPC: powerpc |
| 192 | ZigLLVM_ppc64, // PPC64: powerpc64, ppu | 187 | ZigLLVM_ppc64, // PPC64: powerpc64, ppu |
| 193 | ZigLLVM_ppc64le, // PPC64LE: powerpc64le | 188 | ZigLLVM_ppc64le, // PPC64LE: powerpc64le |
| 194 | ZigLLVM_r600, // R600: AMD GPUs HD2XXX - HD6XXX | 189 | ZigLLVM_r600, // R600: AMD GPUs HD2XXX - HD6XXX |
| 195 | ZigLLVM_amdgcn, // AMDGCN: AMD GCN GPUs | 190 | ZigLLVM_amdgcn, // AMDGCN: AMD GCN GPUs |
| 196 | ZigLLVM_sparc, // Sparc: sparc | 191 | ZigLLVM_riscv32, // RISC-V (32-bit): riscv32 |
| 197 | ZigLLVM_sparcv9, // Sparcv9: Sparcv9 | 192 | ZigLLVM_riscv64, // RISC-V (64-bit): riscv64 |
| 198 | ZigLLVM_sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant | 193 | ZigLLVM_sparc, // Sparc: sparc |
| 199 | ZigLLVM_systemz, // SystemZ: s390x | 194 | ZigLLVM_sparcv9, // Sparcv9: Sparcv9 |
| 200 | ZigLLVM_tce, // TCE (http://tce.cs.tut.fi/): tce | 195 | ZigLLVM_sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant |
| 201 | ZigLLVM_thumb, // Thumb (little endian): thumb, thumbv.* | 196 | ZigLLVM_systemz, // SystemZ: s390x |
| 202 | ZigLLVM_thumbeb, // Thumb (big endian): thumbeb | 197 | ZigLLVM_tce, // TCE (http://tce.cs.tut.fi/): tce |
| 203 | ZigLLVM_x86, // X86: i[3-9]86 | 198 | ZigLLVM_tcele, // TCE little endian (http://tce.cs.tut.fi/): tcele |
| 204 | ZigLLVM_x86_64, // X86-64: amd64, x86_64 | 199 | ZigLLVM_thumb, // Thumb (little endian): thumb, thumbv.* |
| 205 | ZigLLVM_xcore, // XCore: xcore | 200 | ZigLLVM_thumbeb, // Thumb (big endian): thumbeb |
| 206 | ZigLLVM_nvptx, // NVPTX: 32-bit | 201 | ZigLLVM_x86, // X86: i[3-9]86 |
| 207 | ZigLLVM_nvptx64, // NVPTX: 64-bit | 202 | ZigLLVM_x86_64, // X86-64: amd64, x86_64 |
| 208 | ZigLLVM_le32, // le32: generic little-endian 32-bit CPU (PNaCl) | 203 | ZigLLVM_xcore, // XCore: xcore |
| 209 | ZigLLVM_le64, // le64: generic little-endian 64-bit CPU (PNaCl) | 204 | ZigLLVM_nvptx, // NVPTX: 32-bit |
| 210 | ZigLLVM_amdil, // AMDIL | 205 | ZigLLVM_nvptx64, // NVPTX: 64-bit |
| 211 | ZigLLVM_amdil64, // AMDIL with 64-bit pointers | 206 | ZigLLVM_le32, // le32: generic little-endian 32-bit CPU (PNaCl) |
| 212 | ZigLLVM_hsail, // AMD HSAIL | 207 | ZigLLVM_le64, // le64: generic little-endian 64-bit CPU (PNaCl) |
| 213 | ZigLLVM_hsail64, // AMD HSAIL with 64-bit pointers | 208 | ZigLLVM_amdil, // AMDIL |
| 214 | ZigLLVM_spir, // SPIR: standard portable IR for OpenCL 32-bit version | 209 | ZigLLVM_amdil64, // AMDIL with 64-bit pointers |
| 215 | ZigLLVM_spir64, // SPIR: standard portable IR for OpenCL 64-bit version | 210 | ZigLLVM_hsail, // AMD HSAIL |
| 216 | ZigLLVM_kalimba, // Kalimba: generic kalimba | 211 | ZigLLVM_hsail64, // AMD HSAIL with 64-bit pointers |
| 217 | ZigLLVM_shave, // SHAVE: Movidius vector VLIW processors | 212 | ZigLLVM_spir, // SPIR: standard portable IR for OpenCL 32-bit version |
| 218 | ZigLLVM_lanai, // Lanai: Lanai 32-bit | 213 | ZigLLVM_spir64, // SPIR: standard portable IR for OpenCL 64-bit version |
| 219 | ZigLLVM_wasm32, // WebAssembly with 32-bit pointers | 214 | ZigLLVM_kalimba, // Kalimba: generic kalimba |
| 220 | ZigLLVM_wasm64, // WebAssembly with 64-bit pointers | 215 | ZigLLVM_shave, // SHAVE: Movidius vector VLIW processors |
| 221 | ZigLLVM_renderscript32, // 32-bit RenderScript | 216 | ZigLLVM_lanai, // Lanai: Lanai 32-bit |
| 222 | ZigLLVM_renderscript64, // 64-bit RenderScript | 217 | ZigLLVM_wasm32, // WebAssembly with 32-bit pointers |
| 223 | 218 | ZigLLVM_wasm64, // WebAssembly with 64-bit pointers | |
| 224 | ZigLLVM_LastArchType = ZigLLVM_renderscript64 | 219 | ZigLLVM_renderscript32, // 32-bit RenderScript |
| 220 | ZigLLVM_renderscript64, // 64-bit RenderScript | ||
| 221 | |||
| 222 | ZigLLVM_LastArchType = ZigLLVM_renderscript64 | ||
| 225 | }; | 223 | }; |
| 226 | 224 | ||
| 227 | enum ZigLLVM_SubArchType { | 225 | enum ZigLLVM_SubArchType { |
| ... | @@ -230,6 +228,7 @@ enum ZigLLVM_SubArchType { | ... | @@ -230,6 +228,7 @@ enum ZigLLVM_SubArchType { |
| 230 | ZigLLVM_ARMSubArch_v8_2a, | 228 | ZigLLVM_ARMSubArch_v8_2a, |
| 231 | ZigLLVM_ARMSubArch_v8_1a, | 229 | ZigLLVM_ARMSubArch_v8_1a, |
| 232 | ZigLLVM_ARMSubArch_v8, | 230 | ZigLLVM_ARMSubArch_v8, |
| 231 | ZigLLVM_ARMSubArch_v8r, | ||
| 233 | ZigLLVM_ARMSubArch_v8m_baseline, | 232 | ZigLLVM_ARMSubArch_v8m_baseline, |
| 234 | ZigLLVM_ARMSubArch_v8m_mainline, | 233 | ZigLLVM_ARMSubArch_v8m_mainline, |
| 235 | ZigLLVM_ARMSubArch_v7, | 234 | ZigLLVM_ARMSubArch_v7, |
| ... | @@ -247,86 +246,93 @@ enum ZigLLVM_SubArchType { | ... | @@ -247,86 +246,93 @@ enum ZigLLVM_SubArchType { |
| 247 | 246 | ||
| 248 | ZigLLVM_KalimbaSubArch_v3, | 247 | ZigLLVM_KalimbaSubArch_v3, |
| 249 | ZigLLVM_KalimbaSubArch_v4, | 248 | ZigLLVM_KalimbaSubArch_v4, |
| 250 | ZigLLVM_KalimbaSubArch_v5 | 249 | ZigLLVM_KalimbaSubArch_v5, |
| 251 | }; | 250 | }; |
| 251 | |||
| 252 | enum ZigLLVM_VendorType { | 252 | enum ZigLLVM_VendorType { |
| 253 | ZigLLVM_UnknownVendor, | 253 | ZigLLVM_UnknownVendor, |
| 254 | 254 | ||
| 255 | ZigLLVM_Apple, | 255 | ZigLLVM_Apple, |
| 256 | ZigLLVM_PC, | 256 | ZigLLVM_PC, |
| 257 | ZigLLVM_SCEI, | 257 | ZigLLVM_SCEI, |
| 258 | ZigLLVM_BGP, | 258 | ZigLLVM_BGP, |
| 259 | ZigLLVM_BGQ, | 259 | ZigLLVM_BGQ, |
| 260 | ZigLLVM_Freescale, | 260 | ZigLLVM_Freescale, |
| 261 | ZigLLVM_IBM, | 261 | ZigLLVM_IBM, |
| 262 | ZigLLVM_ImaginationTechnologies, | 262 | ZigLLVM_ImaginationTechnologies, |
| 263 | ZigLLVM_MipsTechnologies, | 263 | ZigLLVM_MipsTechnologies, |
| 264 | ZigLLVM_NVIDIA, | 264 | ZigLLVM_NVIDIA, |
| 265 | ZigLLVM_CSR, | 265 | ZigLLVM_CSR, |
| 266 | ZigLLVM_Myriad, | 266 | ZigLLVM_Myriad, |
| 267 | ZigLLVM_AMD, | 267 | ZigLLVM_AMD, |
| 268 | ZigLLVM_Mesa, | 268 | ZigLLVM_Mesa, |
| 269 | 269 | ||
| 270 | ZigLLVM_LastVendorType = ZigLLVM_Mesa | 270 | ZigLLVM_LastVendorType = ZigLLVM_Mesa |
| 271 | }; | 271 | }; |
| 272 | |||
| 272 | enum ZigLLVM_OSType { | 273 | enum ZigLLVM_OSType { |
| 273 | ZigLLVM_UnknownOS, | 274 | ZigLLVM_UnknownOS, |
| 274 | 275 | ||
| 275 | ZigLLVM_CloudABI, | 276 | ZigLLVM_CloudABI, |
| 276 | ZigLLVM_Darwin, | 277 | ZigLLVM_Darwin, |
| 277 | ZigLLVM_DragonFly, | 278 | ZigLLVM_DragonFly, |
| 278 | ZigLLVM_FreeBSD, | 279 | ZigLLVM_FreeBSD, |
| 279 | ZigLLVM_IOS, | 280 | ZigLLVM_Fuchsia, |
| 280 | ZigLLVM_KFreeBSD, | 281 | ZigLLVM_IOS, |
| 281 | ZigLLVM_Linux, | 282 | ZigLLVM_KFreeBSD, |
| 282 | ZigLLVM_Lv2, // PS3 | 283 | ZigLLVM_Linux, |
| 283 | ZigLLVM_MacOSX, | 284 | ZigLLVM_Lv2, // PS3 |
| 284 | ZigLLVM_NetBSD, | 285 | ZigLLVM_MacOSX, |
| 285 | ZigLLVM_OpenBSD, | 286 | ZigLLVM_NetBSD, |
| 286 | ZigLLVM_Solaris, | 287 | ZigLLVM_OpenBSD, |
| 287 | ZigLLVM_Win32, | 288 | ZigLLVM_Solaris, |
| 288 | ZigLLVM_Haiku, | 289 | ZigLLVM_Win32, |
| 289 | ZigLLVM_Minix, | 290 | ZigLLVM_Haiku, |
| 290 | ZigLLVM_RTEMS, | 291 | ZigLLVM_Minix, |
| 291 | ZigLLVM_NaCl, // Native Client | 292 | ZigLLVM_RTEMS, |
| 292 | ZigLLVM_CNK, // BG/P Compute-Node Kernel | 293 | ZigLLVM_NaCl, // Native Client |
| 293 | ZigLLVM_Bitrig, | 294 | ZigLLVM_CNK, // BG/P Compute-Node Kernel |
| 294 | ZigLLVM_AIX, | 295 | ZigLLVM_Bitrig, |
| 295 | ZigLLVM_CUDA, // NVIDIA CUDA | 296 | ZigLLVM_AIX, |
| 296 | ZigLLVM_NVCL, // NVIDIA OpenCL | 297 | ZigLLVM_CUDA, // NVIDIA CUDA |
| 297 | ZigLLVM_AMDHSA, // AMD HSA Runtime | 298 | ZigLLVM_NVCL, // NVIDIA OpenCL |
| 298 | ZigLLVM_PS4, | 299 | ZigLLVM_AMDHSA, // AMD HSA Runtime |
| 299 | ZigLLVM_ELFIAMCU, | 300 | ZigLLVM_PS4, |
| 300 | ZigLLVM_TvOS, // Apple tvOS | 301 | ZigLLVM_ELFIAMCU, |
| 301 | ZigLLVM_WatchOS, // Apple watchOS | 302 | ZigLLVM_TvOS, // Apple tvOS |
| 302 | ZigLLVM_Mesa3D, | 303 | ZigLLVM_WatchOS, // Apple watchOS |
| 303 | 304 | ZigLLVM_Mesa3D, | |
| 304 | ZigLLVM_LastOSType = ZigLLVM_Mesa3D | 305 | ZigLLVM_Contiki, |
| 306 | |||
| 307 | ZigLLVM_LastOSType = ZigLLVM_Contiki | ||
| 305 | }; | 308 | }; |
| 309 | |||
| 306 | enum ZigLLVM_EnvironmentType { | 310 | enum ZigLLVM_EnvironmentType { |
| 307 | ZigLLVM_UnknownEnvironment, | 311 | ZigLLVM_UnknownEnvironment, |
| 308 | 312 | ||
| 309 | ZigLLVM_GNU, | 313 | ZigLLVM_GNU, |
| 310 | ZigLLVM_GNUABI64, | 314 | ZigLLVM_GNUABI64, |
| 311 | ZigLLVM_GNUEABI, | 315 | ZigLLVM_GNUEABI, |
| 312 | ZigLLVM_GNUEABIHF, | 316 | ZigLLVM_GNUEABIHF, |
| 313 | ZigLLVM_GNUX32, | 317 | ZigLLVM_GNUX32, |
| 314 | ZigLLVM_CODE16, | 318 | ZigLLVM_CODE16, |
| 315 | ZigLLVM_EABI, | 319 | ZigLLVM_EABI, |
| 316 | ZigLLVM_EABIHF, | 320 | ZigLLVM_EABIHF, |
| 317 | ZigLLVM_Android, | 321 | ZigLLVM_Android, |
| 318 | ZigLLVM_Musl, | 322 | ZigLLVM_Musl, |
| 319 | ZigLLVM_MuslEABI, | 323 | ZigLLVM_MuslEABI, |
| 320 | ZigLLVM_MuslEABIHF, | 324 | ZigLLVM_MuslEABIHF, |
| 321 | 325 | ||
| 322 | ZigLLVM_MSVC, | 326 | ZigLLVM_MSVC, |
| 323 | ZigLLVM_Itanium, | 327 | ZigLLVM_Itanium, |
| 324 | ZigLLVM_Cygnus, | 328 | ZigLLVM_Cygnus, |
| 325 | ZigLLVM_AMDOpenCL, | 329 | ZigLLVM_AMDOpenCL, |
| 326 | ZigLLVM_CoreCLR, | 330 | ZigLLVM_CoreCLR, |
| 327 | 331 | ZigLLVM_OpenCL, | |
| 328 | ZigLLVM_LastEnvironmentType = ZigLLVM_CoreCLR | 332 | |
| 333 | ZigLLVM_LastEnvironmentType = ZigLLVM_OpenCL | ||
| 329 | }; | 334 | }; |
| 335 | |||
| 330 | enum ZigLLVM_ObjectFormatType { | 336 | enum ZigLLVM_ObjectFormatType { |
| 331 | ZigLLVM_UnknownObjectFormat, | 337 | ZigLLVM_UnknownObjectFormat, |
| 332 | 338 |