| author | |
| committer | |
| log | 1fa4d2a5afd35ebb58c84ea030046fc557ffad01 |
| tree | 0835d834877cb84d0ec39d38dd3afaa484c234f3 |
| parent | 077cd4b9a46d431b09698554d321d7dad1bca8ca |
7 files changed, 329 insertions(+), 329 deletions(-)
src/all_types.hpp+7-7| ... | ... | @@ -1015,7 +1015,7 @@ struct TypeTableEntry { |
| 1015 | 1015 | Buf name; |
| 1016 | 1016 | |
| 1017 | 1017 | LLVMTypeRef type_ref; |
| 1018 | LLVMZigDIType *di_type; | |
| 1018 | ZigLLVMDIType *di_type; | |
| 1019 | 1019 | |
| 1020 | 1020 | bool zero_bits; |
| 1021 | 1021 | bool deep_const; |
| ... | ... | @@ -1055,7 +1055,7 @@ struct ImportTableEntry { |
| 1055 | 1055 | AstNode *root; |
| 1056 | 1056 | Buf *path; // relative to root_package->root_src_dir |
| 1057 | 1057 | PackageTableEntry *package; |
| 1058 | LLVMZigDIFile *di_file; | |
| 1058 | ZigLLVMDIFile *di_file; | |
| 1059 | 1059 | Buf *source_code; |
| 1060 | 1060 | ZigList<int> *line_offsets; |
| 1061 | 1061 | BlockContext *block_context; |
| ... | ... | @@ -1190,8 +1190,8 @@ struct CodeGen { |
| 1190 | 1190 | LLVMModuleRef module; |
| 1191 | 1191 | ZigList<ErrorMsg*> errors; |
| 1192 | 1192 | LLVMBuilderRef builder; |
| 1193 | LLVMZigDIBuilder *dbuilder; | |
| 1194 | LLVMZigDICompileUnit *compile_unit; | |
| 1193 | ZigLLVMDIBuilder *dbuilder; | |
| 1194 | ZigLLVMDICompileUnit *compile_unit; | |
| 1195 | 1195 | |
| 1196 | 1196 | ZigList<Buf *> link_libs; // non-libc link libs |
| 1197 | 1197 | |
| ... | ... | @@ -1271,7 +1271,7 @@ struct CodeGen { |
| 1271 | 1271 | uint32_t target_environ_index; |
| 1272 | 1272 | uint32_t target_oformat_index; |
| 1273 | 1273 | LLVMTargetMachineRef target_machine; |
| 1274 | LLVMZigDIFile *dummy_di_file; | |
| 1274 | ZigLLVMDIFile *dummy_di_file; | |
| 1275 | 1275 | bool is_native_target; |
| 1276 | 1276 | PackageTableEntry *root_package; |
| 1277 | 1277 | PackageTableEntry *std_package; |
| ... | ... | @@ -1341,7 +1341,7 @@ struct VariableTableEntry { |
| 1341 | 1341 | AstNode *decl_node; |
| 1342 | 1342 | // which node contains the ConstExprValue for this variable's value |
| 1343 | 1343 | AstNode *val_node; |
| 1344 | LLVMZigDILocalVariable *di_loc_var; | |
| 1344 | ZigLLVMDILocalVariable *di_loc_var; | |
| 1345 | 1345 | int src_arg_index; |
| 1346 | 1346 | int gen_arg_index; |
| 1347 | 1347 | BlockContext *block_context; |
| ... | ... | @@ -1383,7 +1383,7 @@ struct BlockContext { |
| 1383 | 1383 | // it would pertain to |
| 1384 | 1384 | AstNode *parent_loop_node; |
| 1385 | 1385 | |
| 1386 | LLVMZigDIScope *di_scope; | |
| 1386 | ZigLLVMDIScope *di_scope; | |
| 1387 | 1387 | Buf *c_import_buf; |
| 1388 | 1388 | |
| 1389 | 1389 | // if this is true, then this code will not be generated |
src/analyze.cpp+68-68| ... | ... | @@ -312,7 +312,7 @@ TypeTableEntry *get_pointer_to_type(CodeGen *g, TypeTableEntry *child_type, bool |
| 312 | 312 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 313 | 313 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 314 | 314 | assert(child_type->di_type); |
| 315 | entry->di_type = LLVMZigCreateDebugPointerType(g->dbuilder, child_type->di_type, | |
| 315 | entry->di_type = ZigLLVMCreateDebugPointerType(g->dbuilder, child_type->di_type, | |
| 316 | 316 | debug_size_in_bits, debug_align_in_bits, buf_ptr(&entry->name)); |
| 317 | 317 | } |
| 318 | 318 | |
| ... | ... | @@ -355,11 +355,11 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) { |
| 355 | 355 | entry->type_ref = LLVMStructType(elem_types, 2, false); |
| 356 | 356 | |
| 357 | 357 | |
| 358 | LLVMZigDIScope *compile_unit_scope = LLVMZigCompileUnitToScope(g->compile_unit); | |
| 359 | LLVMZigDIFile *di_file = nullptr; | |
| 358 | ZigLLVMDIScope *compile_unit_scope = ZigLLVMCompileUnitToScope(g->compile_unit); | |
| 359 | ZigLLVMDIFile *di_file = nullptr; | |
| 360 | 360 | unsigned line = 0; |
| 361 | entry->di_type = LLVMZigCreateReplaceableCompositeType(g->dbuilder, | |
| 362 | LLVMZigTag_DW_structure_type(), buf_ptr(&entry->name), | |
| 361 | entry->di_type = ZigLLVMCreateReplaceableCompositeType(g->dbuilder, | |
| 362 | ZigLLVMTag_DW_structure_type(), buf_ptr(&entry->name), | |
| 363 | 363 | compile_unit_scope, di_file, line); |
| 364 | 364 | |
| 365 | 365 | uint64_t val_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, child_type->type_ref); |
| ... | ... | @@ -374,27 +374,27 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) { |
| 374 | 374 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 375 | 375 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 376 | 376 | |
| 377 | LLVMZigDIType *di_element_types[] = { | |
| 378 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 377 | ZigLLVMDIType *di_element_types[] = { | |
| 378 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 379 | 379 | "val", di_file, line, |
| 380 | 380 | val_debug_size_in_bits, |
| 381 | 381 | val_debug_align_in_bits, |
| 382 | 382 | val_offset_in_bits, |
| 383 | 383 | 0, child_type->di_type), |
| 384 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 384 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 385 | 385 | "maybe", di_file, line, |
| 386 | 386 | maybe_debug_size_in_bits, |
| 387 | 387 | maybe_debug_align_in_bits, |
| 388 | 388 | maybe_offset_in_bits, |
| 389 | 389 | 0, child_type->di_type), |
| 390 | 390 | }; |
| 391 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, | |
| 391 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | |
| 392 | 392 | compile_unit_scope, |
| 393 | 393 | buf_ptr(&entry->name), |
| 394 | 394 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, |
| 395 | 395 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| 396 | 396 | |
| 397 | LLVMZigReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 397 | ZigLLVMReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 398 | 398 | entry->di_type = replacement_di_type; |
| 399 | 399 | } |
| 400 | 400 | |
| ... | ... | @@ -431,11 +431,11 @@ static TypeTableEntry *get_error_type(CodeGen *g, TypeTableEntry *child_type) { |
| 431 | 431 | }; |
| 432 | 432 | entry->type_ref = LLVMStructType(elem_types, 2, false); |
| 433 | 433 | |
| 434 | LLVMZigDIScope *compile_unit_scope = LLVMZigCompileUnitToScope(g->compile_unit); | |
| 435 | LLVMZigDIFile *di_file = nullptr; | |
| 434 | ZigLLVMDIScope *compile_unit_scope = ZigLLVMCompileUnitToScope(g->compile_unit); | |
| 435 | ZigLLVMDIFile *di_file = nullptr; | |
| 436 | 436 | unsigned line = 0; |
| 437 | entry->di_type = LLVMZigCreateReplaceableCompositeType(g->dbuilder, | |
| 438 | LLVMZigTag_DW_structure_type(), buf_ptr(&entry->name), | |
| 437 | entry->di_type = ZigLLVMCreateReplaceableCompositeType(g->dbuilder, | |
| 438 | ZigLLVMTag_DW_structure_type(), buf_ptr(&entry->name), | |
| 439 | 439 | compile_unit_scope, di_file, line); |
| 440 | 440 | |
| 441 | 441 | uint64_t tag_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, g->err_tag_type->type_ref); |
| ... | ... | @@ -449,14 +449,14 @@ static TypeTableEntry *get_error_type(CodeGen *g, TypeTableEntry *child_type) { |
| 449 | 449 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 450 | 450 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 451 | 451 | |
| 452 | LLVMZigDIType *di_element_types[] = { | |
| 453 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 452 | ZigLLVMDIType *di_element_types[] = { | |
| 453 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 454 | 454 | "tag", di_file, line, |
| 455 | 455 | tag_debug_size_in_bits, |
| 456 | 456 | tag_debug_align_in_bits, |
| 457 | 457 | tag_offset_in_bits, |
| 458 | 458 | 0, child_type->di_type), |
| 459 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 459 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 460 | 460 | "value", di_file, line, |
| 461 | 461 | value_debug_size_in_bits, |
| 462 | 462 | value_debug_align_in_bits, |
| ... | ... | @@ -464,7 +464,7 @@ static TypeTableEntry *get_error_type(CodeGen *g, TypeTableEntry *child_type) { |
| 464 | 464 | 0, child_type->di_type), |
| 465 | 465 | }; |
| 466 | 466 | |
| 467 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, | |
| 467 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | |
| 468 | 468 | compile_unit_scope, |
| 469 | 469 | buf_ptr(&entry->name), |
| 470 | 470 | di_file, line, |
| ... | ... | @@ -473,7 +473,7 @@ static TypeTableEntry *get_error_type(CodeGen *g, TypeTableEntry *child_type) { |
| 473 | 473 | 0, |
| 474 | 474 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| 475 | 475 | |
| 476 | LLVMZigReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 476 | ZigLLVMReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 477 | 477 | entry->di_type = replacement_di_type; |
| 478 | 478 | } |
| 479 | 479 | |
| ... | ... | @@ -500,7 +500,7 @@ TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t |
| 500 | 500 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 501 | 501 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 502 | 502 | |
| 503 | entry->di_type = LLVMZigCreateDebugArrayType(g->dbuilder, debug_size_in_bits, | |
| 503 | entry->di_type = ZigLLVMCreateDebugArrayType(g->dbuilder, debug_size_in_bits, | |
| 504 | 504 | debug_align_in_bits, child_type->di_type, array_size); |
| 505 | 505 | } |
| 506 | 506 | entry->data.array.child_type = child_type; |
| ... | ... | @@ -562,11 +562,11 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *child_type, bool is_c |
| 562 | 562 | buf_appendf(&entry->name, "[]%s", buf_ptr(&child_type->name)); |
| 563 | 563 | entry->type_ref = LLVMStructCreateNamed(LLVMGetGlobalContext(), buf_ptr(&entry->name)); |
| 564 | 564 | |
| 565 | LLVMZigDIScope *compile_unit_scope = LLVMZigCompileUnitToScope(g->compile_unit); | |
| 566 | LLVMZigDIFile *di_file = nullptr; | |
| 565 | ZigLLVMDIScope *compile_unit_scope = ZigLLVMCompileUnitToScope(g->compile_unit); | |
| 566 | ZigLLVMDIFile *di_file = nullptr; | |
| 567 | 567 | unsigned line = 0; |
| 568 | entry->di_type = LLVMZigCreateReplaceableCompositeType(g->dbuilder, | |
| 569 | LLVMZigTag_DW_structure_type(), buf_ptr(&entry->name), | |
| 568 | entry->di_type = ZigLLVMCreateReplaceableCompositeType(g->dbuilder, | |
| 569 | ZigLLVMTag_DW_structure_type(), buf_ptr(&entry->name), | |
| 570 | 570 | compile_unit_scope, di_file, line); |
| 571 | 571 | |
| 572 | 572 | if (child_type->zero_bits) { |
| ... | ... | @@ -589,21 +589,21 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *child_type, bool is_c |
| 589 | 589 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 590 | 590 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 591 | 591 | |
| 592 | LLVMZigDIType *di_element_types[] = { | |
| 593 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 592 | ZigLLVMDIType *di_element_types[] = { | |
| 593 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 594 | 594 | "len", di_file, line, |
| 595 | 595 | len_debug_size_in_bits, |
| 596 | 596 | len_debug_align_in_bits, |
| 597 | 597 | len_offset_in_bits, |
| 598 | 598 | 0, usize_type->di_type), |
| 599 | 599 | }; |
| 600 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, | |
| 600 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | |
| 601 | 601 | compile_unit_scope, |
| 602 | 602 | buf_ptr(&entry->name), |
| 603 | 603 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, |
| 604 | 604 | nullptr, di_element_types, 1, 0, nullptr, ""); |
| 605 | 605 | |
| 606 | LLVMZigReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 606 | ZigLLVMReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 607 | 607 | entry->di_type = replacement_di_type; |
| 608 | 608 | } else { |
| 609 | 609 | TypeTableEntry *pointer_type = get_pointer_to_type(g, child_type, is_const); |
| ... | ... | @@ -630,27 +630,27 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *child_type, bool is_c |
| 630 | 630 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 631 | 631 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 632 | 632 | |
| 633 | LLVMZigDIType *di_element_types[] = { | |
| 634 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 633 | ZigLLVMDIType *di_element_types[] = { | |
| 634 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 635 | 635 | "ptr", di_file, line, |
| 636 | 636 | ptr_debug_size_in_bits, |
| 637 | 637 | ptr_debug_align_in_bits, |
| 638 | 638 | ptr_offset_in_bits, |
| 639 | 639 | 0, pointer_type->di_type), |
| 640 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), | |
| 640 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(entry->di_type), | |
| 641 | 641 | "len", di_file, line, |
| 642 | 642 | len_debug_size_in_bits, |
| 643 | 643 | len_debug_align_in_bits, |
| 644 | 644 | len_offset_in_bits, |
| 645 | 645 | 0, usize_type->di_type), |
| 646 | 646 | }; |
| 647 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, | |
| 647 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | |
| 648 | 648 | compile_unit_scope, |
| 649 | 649 | buf_ptr(&entry->name), |
| 650 | 650 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, |
| 651 | 651 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| 652 | 652 | |
| 653 | LLVMZigReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 653 | ZigLLVMReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); | |
| 654 | 654 | entry->di_type = replacement_di_type; |
| 655 | 655 | } |
| 656 | 656 | |
| ... | ... | @@ -736,7 +736,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id, bool gen_debug_inf |
| 736 | 736 | // +1 for maybe making the first argument the return value |
| 737 | 737 | LLVMTypeRef *gen_param_types = allocate<LLVMTypeRef>(1 + fn_type_id->param_count); |
| 738 | 738 | // +1 because 0 is the return type and +1 for maybe making first arg ret val |
| 739 | LLVMZigDIType **param_di_types = allocate<LLVMZigDIType*>(2 + fn_type_id->param_count); | |
| 739 | ZigLLVMDIType **param_di_types = allocate<ZigLLVMDIType*>(2 + fn_type_id->param_count); | |
| 740 | 740 | param_di_types[0] = fn_type_id->return_type->di_type; |
| 741 | 741 | int gen_param_index = 0; |
| 742 | 742 | TypeTableEntry *gen_return_type; |
| ... | ... | @@ -788,7 +788,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id, bool gen_debug_inf |
| 788 | 788 | fn_type->data.fn.raw_type_ref = LLVMFunctionType(gen_return_type->type_ref, |
| 789 | 789 | gen_param_types, gen_param_index, fn_type_id->is_var_args); |
| 790 | 790 | fn_type->type_ref = LLVMPointerType(fn_type->data.fn.raw_type_ref, 0); |
| 791 | fn_type->di_type = LLVMZigCreateSubroutineType(g->dbuilder, param_di_types, gen_param_index + 1, 0); | |
| 791 | fn_type->di_type = ZigLLVMCreateSubroutineType(g->dbuilder, param_di_types, gen_param_index + 1, 0); | |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | g->fn_type_table.put(&fn_type->data.fn.fn_type_id, fn_type); |
| ... | ... | @@ -829,9 +829,9 @@ TypeTableEntry *get_partial_container_type(CodeGen *g, ImportTableEntry *import, |
| 829 | 829 | unsigned line = decl_node ? decl_node->line : 0; |
| 830 | 830 | |
| 831 | 831 | entry->type_ref = LLVMStructCreateNamed(LLVMGetGlobalContext(), name); |
| 832 | entry->di_type = LLVMZigCreateReplaceableCompositeType(g->dbuilder, | |
| 833 | LLVMZigTag_DW_structure_type(), name, | |
| 834 | LLVMZigFileToScope(import->di_file), import->di_file, line + 1); | |
| 832 | entry->di_type = ZigLLVMCreateReplaceableCompositeType(g->dbuilder, | |
| 833 | ZigLLVMTag_DW_structure_type(), name, | |
| 834 | ZigLLVMFileToScope(import->di_file), import->di_file, line + 1); | |
| 835 | 835 | |
| 836 | 836 | buf_init_from_str(&entry->name, name); |
| 837 | 837 | |
| ... | ... | @@ -1262,13 +1262,13 @@ static void resolve_function_proto(CodeGen *g, AstNode *node, FnTableEntry *fn_t |
| 1262 | 1262 | bool is_definition = fn_table_entry->fn_def_node != nullptr; |
| 1263 | 1263 | unsigned flags = 0; |
| 1264 | 1264 | bool is_optimized = g->is_release_build; |
| 1265 | LLVMZigDISubprogram *subprogram = LLVMZigCreateFunction(g->dbuilder, | |
| 1265 | ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder, | |
| 1266 | 1266 | containing_context->di_scope, buf_ptr(&fn_table_entry->symbol_name), "", |
| 1267 | 1267 | import->di_file, line_number, |
| 1268 | 1268 | fn_type->di_type, fn_table_entry->internal_linkage, |
| 1269 | 1269 | is_definition, scope_line, flags, is_optimized, nullptr); |
| 1270 | 1270 | |
| 1271 | fn_table_entry->fn_def_node->data.fn_def.block_context->di_scope = LLVMZigSubprogramToScope(subprogram); | |
| 1271 | fn_table_entry->fn_def_node->data.fn_def.block_context->di_scope = ZigLLVMSubprogramToScope(subprogram); | |
| 1272 | 1272 | ZigLLVMFnSetSubprogram(fn_table_entry->fn_value, subprogram); |
| 1273 | 1273 | } |
| 1274 | 1274 | } |
| ... | ... | @@ -1302,11 +1302,11 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1302 | 1302 | |
| 1303 | 1303 | enum_type->data.enumeration.field_count = field_count; |
| 1304 | 1304 | enum_type->data.enumeration.fields = allocate<TypeEnumField>(field_count); |
| 1305 | LLVMZigDIEnumerator **di_enumerators = allocate<LLVMZigDIEnumerator*>(field_count); | |
| 1305 | ZigLLVMDIEnumerator **di_enumerators = allocate<ZigLLVMDIEnumerator*>(field_count); | |
| 1306 | 1306 | |
| 1307 | 1307 | // we possibly allocate too much here since gen_field_count can be lower than field_count. |
| 1308 | 1308 | // the only problem is potential wasted space though. |
| 1309 | LLVMZigDIType **union_inner_di_types = allocate<LLVMZigDIType*>(field_count); | |
| 1309 | ZigLLVMDIType **union_inner_di_types = allocate<ZigLLVMDIType*>(field_count); | |
| 1310 | 1310 | |
| 1311 | 1311 | TypeTableEntry *biggest_union_member = nullptr; |
| 1312 | 1312 | uint64_t biggest_align_in_bits = 0; |
| ... | ... | @@ -1332,7 +1332,7 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | 1334 | |
| 1335 | di_enumerators[i] = LLVMZigCreateDebugEnumerator(g->dbuilder, buf_ptr(type_enum_field->name), i); | |
| 1335 | di_enumerators[i] = ZigLLVMCreateDebugEnumerator(g->dbuilder, buf_ptr(type_enum_field->name), i); | |
| 1336 | 1336 | |
| 1337 | 1337 | if (field_type->id == TypeTableEntryIdStruct) { |
| 1338 | 1338 | resolve_struct_type(g, import, field_type); |
| ... | ... | @@ -1348,8 +1348,8 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1348 | 1348 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, field_type->type_ref); |
| 1349 | 1349 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, field_type->type_ref); |
| 1350 | 1350 | |
| 1351 | union_inner_di_types[gen_field_index] = LLVMZigCreateDebugMemberType(g->dbuilder, | |
| 1352 | LLVMZigTypeToScope(enum_type->di_type), buf_ptr(type_enum_field->name), | |
| 1351 | union_inner_di_types[gen_field_index] = ZigLLVMCreateDebugMemberType(g->dbuilder, | |
| 1352 | ZigLLVMTypeToScope(enum_type->di_type), buf_ptr(type_enum_field->name), | |
| 1353 | 1353 | import->di_file, field_node->line + 1, |
| 1354 | 1354 | debug_size_in_bits, |
| 1355 | 1355 | debug_align_in_bits, |
| ... | ... | @@ -1394,21 +1394,21 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1394 | 1394 | // create debug type for tag |
| 1395 | 1395 | uint64_t tag_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, tag_type_entry->type_ref); |
| 1396 | 1396 | uint64_t tag_debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, tag_type_entry->type_ref); |
| 1397 | LLVMZigDIType *tag_di_type = LLVMZigCreateDebugEnumerationType(g->dbuilder, | |
| 1398 | LLVMZigTypeToScope(enum_type->di_type), "AnonEnum", import->di_file, decl_node->line + 1, | |
| 1397 | ZigLLVMDIType *tag_di_type = ZigLLVMCreateDebugEnumerationType(g->dbuilder, | |
| 1398 | ZigLLVMTypeToScope(enum_type->di_type), "AnonEnum", import->di_file, decl_node->line + 1, | |
| 1399 | 1399 | tag_debug_size_in_bits, tag_debug_align_in_bits, di_enumerators, field_count, |
| 1400 | 1400 | tag_type_entry->di_type, ""); |
| 1401 | 1401 | |
| 1402 | 1402 | // create debug type for union |
| 1403 | LLVMZigDIType *union_di_type = LLVMZigCreateDebugUnionType(g->dbuilder, | |
| 1404 | LLVMZigTypeToScope(enum_type->di_type), "AnonUnion", import->di_file, decl_node->line + 1, | |
| 1403 | ZigLLVMDIType *union_di_type = ZigLLVMCreateDebugUnionType(g->dbuilder, | |
| 1404 | ZigLLVMTypeToScope(enum_type->di_type), "AnonUnion", import->di_file, decl_node->line + 1, | |
| 1405 | 1405 | biggest_union_member_size_in_bits, biggest_align_in_bits, 0, union_inner_di_types, |
| 1406 | 1406 | gen_field_index, 0, ""); |
| 1407 | 1407 | |
| 1408 | 1408 | // create debug types for members of root struct |
| 1409 | 1409 | uint64_t tag_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, enum_type->type_ref, 0); |
| 1410 | LLVMZigDIType *tag_member_di_type = LLVMZigCreateDebugMemberType(g->dbuilder, | |
| 1411 | LLVMZigTypeToScope(enum_type->di_type), "tag_field", | |
| 1410 | ZigLLVMDIType *tag_member_di_type = ZigLLVMCreateDebugMemberType(g->dbuilder, | |
| 1411 | ZigLLVMTypeToScope(enum_type->di_type), "tag_field", | |
| 1412 | 1412 | import->di_file, decl_node->line + 1, |
| 1413 | 1413 | tag_debug_size_in_bits, |
| 1414 | 1414 | tag_debug_align_in_bits, |
| ... | ... | @@ -1416,8 +1416,8 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1416 | 1416 | 0, tag_di_type); |
| 1417 | 1417 | |
| 1418 | 1418 | uint64_t union_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, enum_type->type_ref, 1); |
| 1419 | LLVMZigDIType *union_member_di_type = LLVMZigCreateDebugMemberType(g->dbuilder, | |
| 1420 | LLVMZigTypeToScope(enum_type->di_type), "union_field", | |
| 1419 | ZigLLVMDIType *union_member_di_type = ZigLLVMCreateDebugMemberType(g->dbuilder, | |
| 1420 | ZigLLVMTypeToScope(enum_type->di_type), "union_field", | |
| 1421 | 1421 | import->di_file, decl_node->line + 1, |
| 1422 | 1422 | biggest_union_member_size_in_bits, |
| 1423 | 1423 | biggest_align_in_bits, |
| ... | ... | @@ -1425,7 +1425,7 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1425 | 1425 | 0, union_di_type); |
| 1426 | 1426 | |
| 1427 | 1427 | // create debug type for root struct |
| 1428 | LLVMZigDIType *di_root_members[] = { | |
| 1428 | ZigLLVMDIType *di_root_members[] = { | |
| 1429 | 1429 | tag_member_di_type, |
| 1430 | 1430 | union_member_di_type, |
| 1431 | 1431 | }; |
| ... | ... | @@ -1433,15 +1433,15 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1433 | 1433 | |
| 1434 | 1434 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, enum_type->type_ref); |
| 1435 | 1435 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, enum_type->type_ref); |
| 1436 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, | |
| 1437 | LLVMZigFileToScope(import->di_file), | |
| 1436 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | |
| 1437 | ZigLLVMFileToScope(import->di_file), | |
| 1438 | 1438 | buf_ptr(decl_node->data.struct_decl.name), |
| 1439 | 1439 | import->di_file, decl_node->line + 1, |
| 1440 | 1440 | debug_size_in_bits, |
| 1441 | 1441 | debug_align_in_bits, |
| 1442 | 1442 | 0, nullptr, di_root_members, 2, 0, nullptr, ""); |
| 1443 | 1443 | |
| 1444 | LLVMZigReplaceTemporary(g->dbuilder, enum_type->di_type, replacement_di_type); | |
| 1444 | ZigLLVMReplaceTemporary(g->dbuilder, enum_type->di_type, replacement_di_type); | |
| 1445 | 1445 | enum_type->di_type = replacement_di_type; |
| 1446 | 1446 | } else { |
| 1447 | 1447 | // create llvm type for root struct |
| ... | ... | @@ -1450,15 +1450,15 @@ static void resolve_enum_type(CodeGen *g, ImportTableEntry *import, TypeTableEnt |
| 1450 | 1450 | // create debug type for tag |
| 1451 | 1451 | uint64_t tag_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, tag_type_entry->type_ref); |
| 1452 | 1452 | uint64_t tag_debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, tag_type_entry->type_ref); |
| 1453 | LLVMZigDIType *tag_di_type = LLVMZigCreateDebugEnumerationType(g->dbuilder, | |
| 1454 | LLVMZigFileToScope(import->di_file), buf_ptr(decl_node->data.struct_decl.name), | |
| 1453 | ZigLLVMDIType *tag_di_type = ZigLLVMCreateDebugEnumerationType(g->dbuilder, | |
| 1454 | ZigLLVMFileToScope(import->di_file), buf_ptr(decl_node->data.struct_decl.name), | |
| 1455 | 1455 | import->di_file, decl_node->line + 1, |
| 1456 | 1456 | tag_debug_size_in_bits, |
| 1457 | 1457 | tag_debug_align_in_bits, |
| 1458 | 1458 | di_enumerators, field_count, |
| 1459 | 1459 | tag_type_entry->di_type, ""); |
| 1460 | 1460 | |
| 1461 | LLVMZigReplaceTemporary(g->dbuilder, enum_type->di_type, tag_di_type); | |
| 1461 | ZigLLVMReplaceTemporary(g->dbuilder, enum_type->di_type, tag_di_type); | |
| 1462 | 1462 | enum_type->di_type = tag_di_type; |
| 1463 | 1463 | |
| 1464 | 1464 | } |
| ... | ... | @@ -1552,7 +1552,7 @@ static void resolve_struct_type(CodeGen *g, ImportTableEntry *import, TypeTableE |
| 1552 | 1552 | int gen_field_count = gen_field_index; |
| 1553 | 1553 | LLVMStructSetBody(struct_type->type_ref, element_types, gen_field_count, false); |
| 1554 | 1554 | |
| 1555 | LLVMZigDIType **di_element_types = allocate<LLVMZigDIType*>(gen_field_count); | |
| 1555 | ZigLLVMDIType **di_element_types = allocate<ZigLLVMDIType*>(gen_field_count); | |
| 1556 | 1556 | |
| 1557 | 1557 | for (int i = 0; i < field_count; i += 1) { |
| 1558 | 1558 | AstNode *field_node = decl_node->data.struct_decl.fields.at(i); |
| ... | ... | @@ -1568,8 +1568,8 @@ static void resolve_struct_type(CodeGen *g, ImportTableEntry *import, TypeTableE |
| 1568 | 1568 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, field_type->type_ref); |
| 1569 | 1569 | uint64_t debug_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, struct_type->type_ref, |
| 1570 | 1570 | gen_field_index); |
| 1571 | di_element_types[gen_field_index] = LLVMZigCreateDebugMemberType(g->dbuilder, | |
| 1572 | LLVMZigTypeToScope(struct_type->di_type), buf_ptr(type_struct_field->name), | |
| 1571 | di_element_types[gen_field_index] = ZigLLVMCreateDebugMemberType(g->dbuilder, | |
| 1572 | ZigLLVMTypeToScope(struct_type->di_type), buf_ptr(type_struct_field->name), | |
| 1573 | 1573 | import->di_file, field_node->line + 1, |
| 1574 | 1574 | debug_size_in_bits, |
| 1575 | 1575 | debug_align_in_bits, |
| ... | ... | @@ -1582,15 +1582,15 @@ static void resolve_struct_type(CodeGen *g, ImportTableEntry *import, TypeTableE |
| 1582 | 1582 | |
| 1583 | 1583 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, struct_type->type_ref); |
| 1584 | 1584 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, struct_type->type_ref); |
| 1585 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, | |
| 1586 | LLVMZigFileToScope(import->di_file), | |
| 1585 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | |
| 1586 | ZigLLVMFileToScope(import->di_file), | |
| 1587 | 1587 | buf_ptr(decl_node->data.struct_decl.name), |
| 1588 | 1588 | import->di_file, decl_node->line + 1, |
| 1589 | 1589 | debug_size_in_bits, |
| 1590 | 1590 | debug_align_in_bits, |
| 1591 | 1591 | 0, nullptr, di_element_types, gen_field_count, 0, nullptr, ""); |
| 1592 | 1592 | |
| 1593 | LLVMZigReplaceTemporary(g->dbuilder, struct_type->di_type, replacement_di_type); | |
| 1593 | ZigLLVMReplaceTemporary(g->dbuilder, struct_type->di_type, replacement_di_type); | |
| 1594 | 1594 | struct_type->di_type = replacement_di_type; |
| 1595 | 1595 | |
| 1596 | 1596 | struct_type->zero_bits = (debug_size_in_bits == 0); |
| ... | ... | @@ -7059,12 +7059,12 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, |
| 7059 | 7059 | //ast_render(stderr, import_entry->root, 4); |
| 7060 | 7060 | } |
| 7061 | 7061 | |
| 7062 | import_entry->di_file = LLVMZigCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); | |
| 7062 | import_entry->di_file = ZigLLVMCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); | |
| 7063 | 7063 | g->import_table.put(abs_full_path, import_entry); |
| 7064 | 7064 | g->import_queue.append(import_entry); |
| 7065 | 7065 | |
| 7066 | 7066 | import_entry->block_context = new_block_context(import_entry->root, nullptr); |
| 7067 | import_entry->block_context->di_scope = LLVMZigFileToScope(import_entry->di_file); | |
| 7067 | import_entry->block_context->di_scope = ZigLLVMFileToScope(import_entry->di_file); | |
| 7068 | 7068 | |
| 7069 | 7069 | |
| 7070 | 7070 | assert(import_entry->root->type == NodeTypeRoot); |
src/codegen.cpp+37-37| ... | ... | @@ -1144,7 +1144,7 @@ static LLVMValueRef gen_fn_call_expr(CodeGen *g, AstNode *node) { |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | set_debug_source_node(g, node); |
| 1147 | LLVMValueRef result = LLVMZigBuildCall(g->builder, fn_val, | |
| 1147 | LLVMValueRef result = ZigLLVMBuildCall(g->builder, fn_val, | |
| 1148 | 1148 | gen_param_values, gen_param_index, fn_type->data.fn.calling_convention, ""); |
| 1149 | 1149 | |
| 1150 | 1150 | if (src_return_type->id == TypeTableEntryIdUnreachable) { |
| ... | ... | @@ -2631,9 +2631,9 @@ static LLVMValueRef gen_if_bool_expr(CodeGen *g, AstNode *node) { |
| 2631 | 2631 | static void gen_var_debug_decl(CodeGen *g, VariableTableEntry *var) { |
| 2632 | 2632 | BlockContext *block_context = var->block_context; |
| 2633 | 2633 | AstNode *source_node = var->decl_node; |
| 2634 | LLVMZigDILocation *debug_loc = LLVMZigGetDebugLoc(source_node->line + 1, source_node->column + 1, | |
| 2634 | ZigLLVMDILocation *debug_loc = ZigLLVMGetDebugLoc(source_node->line + 1, source_node->column + 1, | |
| 2635 | 2635 | block_context->di_scope); |
| 2636 | LLVMZigInsertDeclareAtEnd(g->dbuilder, var->value_ref, var->di_loc_var, debug_loc, | |
| 2636 | ZigLLVMInsertDeclareAtEnd(g->dbuilder, var->value_ref, var->di_loc_var, debug_loc, | |
| 2637 | 2637 | LLVMGetInsertBlock(g->builder)); |
| 2638 | 2638 | } |
| 2639 | 2639 | |
| ... | ... | @@ -3963,7 +3963,7 @@ static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef ini |
| 3963 | 3963 | assert(var->import); |
| 3964 | 3964 | assert(type_entry); |
| 3965 | 3965 | bool is_local_to_unit = true; |
| 3966 | LLVMZigCreateGlobalVariable(g->dbuilder, | |
| 3966 | ZigLLVMCreateGlobalVariable(g->dbuilder, | |
| 3967 | 3967 | var->block_context->di_scope, buf_ptr(&var->name), |
| 3968 | 3968 | buf_ptr(&var->name), var->import->di_file, var->decl_node->line + 1, |
| 3969 | 3969 | type_entry->di_type, is_local_to_unit, init_val); |
| ... | ... | @@ -4073,13 +4073,13 @@ static void do_code_gen(CodeGen *g) { |
| 4073 | 4073 | if (!type_has_bits(fn_type->data.fn.fn_type_id.return_type)) { |
| 4074 | 4074 | // nothing to do |
| 4075 | 4075 | } else if (fn_type->data.fn.fn_type_id.return_type->id == TypeTableEntryIdPointer) { |
| 4076 | LLVMZigAddNonNullAttr(fn_table_entry->fn_value, 0); | |
| 4076 | ZigLLVMAddNonNullAttr(fn_table_entry->fn_value, 0); | |
| 4077 | 4077 | } else if (handle_is_ptr(fn_type->data.fn.fn_type_id.return_type) && |
| 4078 | 4078 | !fn_type->data.fn.fn_type_id.is_extern) |
| 4079 | 4079 | { |
| 4080 | 4080 | LLVMValueRef first_arg = LLVMGetParam(fn_table_entry->fn_value, 0); |
| 4081 | 4081 | LLVMAddAttribute(first_arg, LLVMStructRetAttribute); |
| 4082 | LLVMZigAddNonNullAttr(fn_table_entry->fn_value, 1); | |
| 4082 | ZigLLVMAddNonNullAttr(fn_table_entry->fn_value, 1); | |
| 4083 | 4083 | is_sret = true; |
| 4084 | 4084 | } |
| 4085 | 4085 | if (fn_table_entry->is_pure && !is_sret && g->is_release_build) { |
| ... | ... | @@ -4112,7 +4112,7 @@ static void do_code_gen(CodeGen *g) { |
| 4112 | 4112 | LLVMAddAttribute(argument_val, LLVMReadOnlyAttribute); |
| 4113 | 4113 | } |
| 4114 | 4114 | if (param_type->id == TypeTableEntryIdPointer) { |
| 4115 | LLVMZigAddNonNullAttr(fn_table_entry->fn_value, gen_index + 1); | |
| 4115 | ZigLLVMAddNonNullAttr(fn_table_entry->fn_value, gen_index + 1); | |
| 4116 | 4116 | } |
| 4117 | 4117 | if (is_byval) { |
| 4118 | 4118 | // TODO |
| ... | ... | @@ -4189,12 +4189,12 @@ static void do_code_gen(CodeGen *g) { |
| 4189 | 4189 | BlockContext *block_context = fn_table_entry->all_block_contexts.at(bc_i); |
| 4190 | 4190 | |
| 4191 | 4191 | if (!block_context->di_scope) { |
| 4192 | LLVMZigDILexicalBlock *di_block = LLVMZigCreateLexicalBlock(g->dbuilder, | |
| 4192 | ZigLLVMDILexicalBlock *di_block = ZigLLVMCreateLexicalBlock(g->dbuilder, | |
| 4193 | 4193 | block_context->parent->di_scope, |
| 4194 | 4194 | import->di_file, |
| 4195 | 4195 | block_context->node->line + 1, |
| 4196 | 4196 | block_context->node->column + 1); |
| 4197 | block_context->di_scope = LLVMZigLexicalBlockToScope(di_block); | |
| 4197 | block_context->di_scope = ZigLLVMLexicalBlockToScope(di_block); | |
| 4198 | 4198 | } |
| 4199 | 4199 | |
| 4200 | 4200 | |
| ... | ... | @@ -4237,7 +4237,7 @@ static void do_code_gen(CodeGen *g) { |
| 4237 | 4237 | unsigned align_bytes = ZigLLVMGetPrefTypeAlignment(g->target_data_ref, var->type->type_ref); |
| 4238 | 4238 | LLVMSetAlignment(var->value_ref, align_bytes); |
| 4239 | 4239 | } |
| 4240 | var->di_loc_var = LLVMZigCreateParameterVariable(g->dbuilder, var->block_context->di_scope, | |
| 4240 | var->di_loc_var = ZigLLVMCreateParameterVariable(g->dbuilder, var->block_context->di_scope, | |
| 4241 | 4241 | buf_ptr(&var->name), import->di_file, var->decl_node->line + 1, |
| 4242 | 4242 | gen_type->di_type, !g->strip_debug_symbols, 0, var->gen_arg_index + 1); |
| 4243 | 4243 | |
| ... | ... | @@ -4248,7 +4248,7 @@ static void do_code_gen(CodeGen *g) { |
| 4248 | 4248 | unsigned align_bytes = ZigLLVMGetPrefTypeAlignment(g->target_data_ref, var->type->type_ref); |
| 4249 | 4249 | LLVMSetAlignment(var->value_ref, align_bytes); |
| 4250 | 4250 | |
| 4251 | var->di_loc_var = LLVMZigCreateAutoVariable(g->dbuilder, var->block_context->di_scope, | |
| 4251 | var->di_loc_var = ZigLLVMCreateAutoVariable(g->dbuilder, var->block_context->di_scope, | |
| 4252 | 4252 | buf_ptr(&var->name), import->di_file, var->decl_node->line + 1, |
| 4253 | 4253 | var->type->di_type, !g->strip_debug_symbols, 0); |
| 4254 | 4254 | } |
| ... | ... | @@ -4283,7 +4283,7 @@ static void do_code_gen(CodeGen *g) { |
| 4283 | 4283 | } |
| 4284 | 4284 | assert(!g->errors.length); |
| 4285 | 4285 | |
| 4286 | LLVMZigDIBuilderFinalize(g->dbuilder); | |
| 4286 | ZigLLVMDIBuilderFinalize(g->dbuilder); | |
| 4287 | 4287 | |
| 4288 | 4288 | if (g->verbose) { |
| 4289 | 4289 | LLVMDumpModule(g->module); |
| ... | ... | @@ -4387,21 +4387,21 @@ static void define_builtin_types(CodeGen *g) { |
| 4387 | 4387 | unsigned dwarf_tag; |
| 4388 | 4388 | if (is_signed) { |
| 4389 | 4389 | if (size_in_bits == 8) { |
| 4390 | dwarf_tag = LLVMZigEncoding_DW_ATE_signed_char(); | |
| 4390 | dwarf_tag = ZigLLVMEncoding_DW_ATE_signed_char(); | |
| 4391 | 4391 | } else { |
| 4392 | dwarf_tag = LLVMZigEncoding_DW_ATE_signed(); | |
| 4392 | dwarf_tag = ZigLLVMEncoding_DW_ATE_signed(); | |
| 4393 | 4393 | } |
| 4394 | 4394 | } else { |
| 4395 | 4395 | if (size_in_bits == 8) { |
| 4396 | dwarf_tag = LLVMZigEncoding_DW_ATE_unsigned_char(); | |
| 4396 | dwarf_tag = ZigLLVMEncoding_DW_ATE_unsigned_char(); | |
| 4397 | 4397 | } else { |
| 4398 | dwarf_tag = LLVMZigEncoding_DW_ATE_unsigned(); | |
| 4398 | dwarf_tag = ZigLLVMEncoding_DW_ATE_unsigned(); | |
| 4399 | 4399 | } |
| 4400 | 4400 | } |
| 4401 | 4401 | |
| 4402 | 4402 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4403 | 4403 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4404 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4404 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4405 | 4405 | debug_size_in_bits, debug_align_in_bits, dwarf_tag); |
| 4406 | 4406 | entry->data.integral.is_signed = is_signed; |
| 4407 | 4407 | entry->data.integral.bit_count = size_in_bits; |
| ... | ... | @@ -4424,10 +4424,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4424 | 4424 | |
| 4425 | 4425 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4426 | 4426 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4427 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4427 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4428 | 4428 | debug_size_in_bits, |
| 4429 | 4429 | debug_align_in_bits, |
| 4430 | is_signed ? LLVMZigEncoding_DW_ATE_signed() : LLVMZigEncoding_DW_ATE_unsigned()); | |
| 4430 | is_signed ? ZigLLVMEncoding_DW_ATE_signed() : ZigLLVMEncoding_DW_ATE_unsigned()); | |
| 4431 | 4431 | entry->data.integral.is_signed = is_signed; |
| 4432 | 4432 | entry->data.integral.bit_count = size_in_bits; |
| 4433 | 4433 | g->primitive_type_table.put(&entry->name, entry); |
| ... | ... | @@ -4442,10 +4442,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4442 | 4442 | buf_init_from_str(&entry->name, "bool"); |
| 4443 | 4443 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4444 | 4444 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4445 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4445 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4446 | 4446 | debug_size_in_bits, |
| 4447 | 4447 | debug_align_in_bits, |
| 4448 | LLVMZigEncoding_DW_ATE_boolean()); | |
| 4448 | ZigLLVMEncoding_DW_ATE_boolean()); | |
| 4449 | 4449 | g->builtin_types.entry_bool = entry; |
| 4450 | 4450 | g->primitive_type_table.put(&entry->name, entry); |
| 4451 | 4451 | } |
| ... | ... | @@ -4466,10 +4466,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4466 | 4466 | |
| 4467 | 4467 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4468 | 4468 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4469 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4469 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4470 | 4470 | debug_size_in_bits, |
| 4471 | 4471 | debug_align_in_bits, |
| 4472 | is_signed ? LLVMZigEncoding_DW_ATE_signed() : LLVMZigEncoding_DW_ATE_unsigned()); | |
| 4472 | is_signed ? ZigLLVMEncoding_DW_ATE_signed() : ZigLLVMEncoding_DW_ATE_unsigned()); | |
| 4473 | 4473 | g->primitive_type_table.put(&entry->name, entry); |
| 4474 | 4474 | |
| 4475 | 4475 | if (is_signed) { |
| ... | ... | @@ -4487,10 +4487,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4487 | 4487 | |
| 4488 | 4488 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4489 | 4489 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4490 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4490 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4491 | 4491 | debug_size_in_bits, |
| 4492 | 4492 | debug_align_in_bits, |
| 4493 | LLVMZigEncoding_DW_ATE_float()); | |
| 4493 | ZigLLVMEncoding_DW_ATE_float()); | |
| 4494 | 4494 | g->builtin_types.entry_f32 = entry; |
| 4495 | 4495 | g->primitive_type_table.put(&entry->name, entry); |
| 4496 | 4496 | } |
| ... | ... | @@ -4503,10 +4503,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4503 | 4503 | |
| 4504 | 4504 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4505 | 4505 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4506 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4506 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4507 | 4507 | debug_size_in_bits, |
| 4508 | 4508 | debug_align_in_bits, |
| 4509 | LLVMZigEncoding_DW_ATE_float()); | |
| 4509 | ZigLLVMEncoding_DW_ATE_float()); | |
| 4510 | 4510 | g->builtin_types.entry_f64 = entry; |
| 4511 | 4511 | g->primitive_type_table.put(&entry->name, entry); |
| 4512 | 4512 | } |
| ... | ... | @@ -4519,10 +4519,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4519 | 4519 | |
| 4520 | 4520 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 4521 | 4521 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 4522 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4522 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4523 | 4523 | debug_size_in_bits, |
| 4524 | 4524 | debug_align_in_bits, |
| 4525 | LLVMZigEncoding_DW_ATE_float()); | |
| 4525 | ZigLLVMEncoding_DW_ATE_float()); | |
| 4526 | 4526 | g->builtin_types.entry_c_long_double = entry; |
| 4527 | 4527 | g->primitive_type_table.put(&entry->name, entry); |
| 4528 | 4528 | } |
| ... | ... | @@ -4532,10 +4532,10 @@ static void define_builtin_types(CodeGen *g) { |
| 4532 | 4532 | entry->type_ref = LLVMVoidType(); |
| 4533 | 4533 | entry->zero_bits = true; |
| 4534 | 4534 | buf_init_from_str(&entry->name, "void"); |
| 4535 | entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4535 | entry->di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | |
| 4536 | 4536 | 0, |
| 4537 | 4537 | 0, |
| 4538 | LLVMZigEncoding_DW_ATE_unsigned()); | |
| 4538 | ZigLLVMEncoding_DW_ATE_unsigned()); | |
| 4539 | 4539 | g->builtin_types.entry_void = entry; |
| 4540 | 4540 | g->primitive_type_table.put(&entry->name, entry); |
| 4541 | 4541 | } |
| ... | ... | @@ -4884,8 +4884,8 @@ static void init(CodeGen *g, Buf *source_path) { |
| 4884 | 4884 | const char *target_specific_cpu_args; |
| 4885 | 4885 | const char *target_specific_features; |
| 4886 | 4886 | if (g->is_native_target) { |
| 4887 | target_specific_cpu_args = LLVMZigGetHostCPUName(); | |
| 4888 | target_specific_features = LLVMZigGetNativeFeatures(); | |
| 4887 | target_specific_cpu_args = ZigLLVMGetHostCPUName(); | |
| 4888 | target_specific_features = ZigLLVMGetNativeFeatures(); | |
| 4889 | 4889 | } else { |
| 4890 | 4890 | target_specific_cpu_args = ""; |
| 4891 | 4891 | target_specific_features = ""; |
| ... | ... | @@ -4904,16 +4904,16 @@ static void init(CodeGen *g, Buf *source_path) { |
| 4904 | 4904 | g->is_big_endian = (LLVMByteOrder(g->target_data_ref) == LLVMBigEndian); |
| 4905 | 4905 | |
| 4906 | 4906 | g->builder = LLVMCreateBuilder(); |
| 4907 | g->dbuilder = LLVMZigCreateDIBuilder(g->module, true); | |
| 4907 | g->dbuilder = ZigLLVMCreateDIBuilder(g->module, true); | |
| 4908 | 4908 | |
| 4909 | LLVMZigSetFastMath(g->builder, true); | |
| 4909 | ZigLLVMSetFastMath(g->builder, true); | |
| 4910 | 4910 | |
| 4911 | 4911 | |
| 4912 | 4912 | Buf *producer = buf_sprintf("zig %s", ZIG_VERSION_STRING); |
| 4913 | 4913 | bool is_optimized = g->is_release_build; |
| 4914 | 4914 | const char *flags = ""; |
| 4915 | 4915 | unsigned runtime_version = 0; |
| 4916 | g->compile_unit = LLVMZigCreateCompileUnit(g->dbuilder, LLVMZigLang_DW_LANG_C99(), | |
| 4916 | g->compile_unit = ZigLLVMCreateCompileUnit(g->dbuilder, ZigLLVMLang_DW_LANG_C99(), | |
| 4917 | 4917 | buf_ptr(source_path), buf_ptr(&g->root_package->root_src_dir), |
| 4918 | 4918 | buf_ptr(producer), is_optimized, flags, runtime_version, |
| 4919 | 4919 | "", 0, !g->strip_debug_symbols); |
| ... | ... | @@ -4938,7 +4938,7 @@ void codegen_parseh(CodeGen *g, Buf *src_dirname, Buf *src_basename, Buf *source |
| 4938 | 4938 | |
| 4939 | 4939 | init(g, full_path); |
| 4940 | 4940 | |
| 4941 | import->di_file = LLVMZigCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); | |
| 4941 | import->di_file = ZigLLVMCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); | |
| 4942 | 4942 | |
| 4943 | 4943 | ZigList<ErrorMsg *> errors = {0}; |
| 4944 | 4944 | int err = parse_h_buf(import, &errors, source_code, g, nullptr); |
src/link.cpp+1-1| ... | ... | @@ -763,7 +763,7 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 763 | 763 | fprintf(stderr, "---------------\n"); |
| 764 | 764 | } |
| 765 | 765 | |
| 766 | LLVMZigOptimizeModule(g->target_machine, g->module); | |
| 766 | ZigLLVMOptimizeModule(g->target_machine, g->module); | |
| 767 | 767 | |
| 768 | 768 | if (g->verbose) { |
| 769 | 769 | LLVMDumpModule(g->module); |
src/parseh.cpp+15-15| ... | ... | @@ -808,11 +808,11 @@ static void add_alias(Context *c, const char *new_name, const char *target_name) |
| 808 | 808 | |
| 809 | 809 | static void replace_with_fwd_decl(Context *c, TypeTableEntry *struct_type, Buf *full_type_name) { |
| 810 | 810 | unsigned line = c->source_node ? c->source_node->line : 0; |
| 811 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugForwardDeclType(c->codegen->dbuilder, | |
| 812 | LLVMZigTag_DW_structure_type(), buf_ptr(full_type_name), | |
| 813 | LLVMZigFileToScope(c->import->di_file), c->import->di_file, line); | |
| 811 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugForwardDeclType(c->codegen->dbuilder, | |
| 812 | ZigLLVMTag_DW_structure_type(), buf_ptr(full_type_name), | |
| 813 | ZigLLVMFileToScope(c->import->di_file), c->import->di_file, line); | |
| 814 | 814 | |
| 815 | LLVMZigReplaceTemporary(c->codegen->dbuilder, struct_type->di_type, replacement_di_type); | |
| 815 | ZigLLVMReplaceTemporary(c->codegen->dbuilder, struct_type->di_type, replacement_di_type); | |
| 816 | 816 | struct_type->di_type = replacement_di_type; |
| 817 | 817 | } |
| 818 | 818 | |
| ... | ... | @@ -872,7 +872,7 @@ static TypeTableEntry *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) |
| 872 | 872 | |
| 873 | 873 | enum_type->data.enumeration.field_count = field_count; |
| 874 | 874 | enum_type->data.enumeration.fields = allocate<TypeEnumField>(field_count); |
| 875 | LLVMZigDIEnumerator **di_enumerators = allocate<LLVMZigDIEnumerator*>(field_count); | |
| 875 | ZigLLVMDIEnumerator **di_enumerators = allocate<ZigLLVMDIEnumerator*>(field_count); | |
| 876 | 876 | |
| 877 | 877 | uint32_t i = 0; |
| 878 | 878 | for (auto it = enum_def->enumerator_begin(), |
| ... | ... | @@ -894,7 +894,7 @@ static TypeTableEntry *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) |
| 894 | 894 | type_enum_field->type_entry = c->codegen->builtin_types.entry_void; |
| 895 | 895 | type_enum_field->value = i; |
| 896 | 896 | |
| 897 | di_enumerators[i] = LLVMZigCreateDebugEnumerator(c->codegen->dbuilder, buf_ptr(type_enum_field->name), i); | |
| 897 | di_enumerators[i] = ZigLLVMCreateDebugEnumerator(c->codegen->dbuilder, buf_ptr(type_enum_field->name), i); | |
| 898 | 898 | |
| 899 | 899 | |
| 900 | 900 | // in C each enum value is in the global namespace. so we put them there too. |
| ... | ... | @@ -913,14 +913,14 @@ static TypeTableEntry *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) |
| 913 | 913 | unsigned line = c->source_node ? (c->source_node->line + 1) : 0; |
| 914 | 914 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(c->codegen->target_data_ref, enum_type->type_ref); |
| 915 | 915 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(c->codegen->target_data_ref, enum_type->type_ref); |
| 916 | LLVMZigDIType *tag_di_type = LLVMZigCreateDebugEnumerationType(c->codegen->dbuilder, | |
| 917 | LLVMZigFileToScope(c->import->di_file), buf_ptr(bare_name), | |
| 916 | ZigLLVMDIType *tag_di_type = ZigLLVMCreateDebugEnumerationType(c->codegen->dbuilder, | |
| 917 | ZigLLVMFileToScope(c->import->di_file), buf_ptr(bare_name), | |
| 918 | 918 | c->import->di_file, line, |
| 919 | 919 | debug_size_in_bits, |
| 920 | 920 | debug_align_in_bits, |
| 921 | 921 | di_enumerators, field_count, tag_type_entry->di_type, ""); |
| 922 | 922 | |
| 923 | LLVMZigReplaceTemporary(c->codegen->dbuilder, enum_type->di_type, tag_di_type); | |
| 923 | ZigLLVMReplaceTemporary(c->codegen->dbuilder, enum_type->di_type, tag_di_type); | |
| 924 | 924 | enum_type->di_type = tag_di_type; |
| 925 | 925 | |
| 926 | 926 | return enum_type; |
| ... | ... | @@ -1053,7 +1053,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ |
| 1053 | 1053 | struct_type->data.structure.src_field_count = field_count; |
| 1054 | 1054 | struct_type->data.structure.fields = allocate<TypeStructField>(field_count); |
| 1055 | 1055 | LLVMTypeRef *element_types = allocate<LLVMTypeRef>(field_count); |
| 1056 | LLVMZigDIType **di_element_types = allocate<LLVMZigDIType*>(field_count); | |
| 1056 | ZigLLVMDIType **di_element_types = allocate<ZigLLVMDIType*>(field_count); | |
| 1057 | 1057 | |
| 1058 | 1058 | // next, populate element_types as its needed for LLVMStructSetBody which is needed for LLVMOffsetOfElement |
| 1059 | 1059 | uint32_t i = 0; |
| ... | ... | @@ -1094,8 +1094,8 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ |
| 1094 | 1094 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(c->codegen->target_data_ref, field_type->type_ref); |
| 1095 | 1095 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(c->codegen->target_data_ref, field_type->type_ref); |
| 1096 | 1096 | uint64_t debug_offset_in_bits = 8*LLVMOffsetOfElement(c->codegen->target_data_ref, struct_type->type_ref, i); |
| 1097 | di_element_types[i] = LLVMZigCreateDebugMemberType(c->codegen->dbuilder, | |
| 1098 | LLVMZigTypeToScope(struct_type->di_type), buf_ptr(type_struct_field->name), | |
| 1097 | di_element_types[i] = ZigLLVMCreateDebugMemberType(c->codegen->dbuilder, | |
| 1098 | ZigLLVMTypeToScope(struct_type->di_type), buf_ptr(type_struct_field->name), | |
| 1099 | 1099 | c->import->di_file, line + 1, |
| 1100 | 1100 | debug_size_in_bits, |
| 1101 | 1101 | debug_align_in_bits, |
| ... | ... | @@ -1112,15 +1112,15 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ |
| 1112 | 1112 | |
| 1113 | 1113 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(c->codegen->target_data_ref, struct_type->type_ref); |
| 1114 | 1114 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(c->codegen->target_data_ref, struct_type->type_ref); |
| 1115 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(c->codegen->dbuilder, | |
| 1116 | LLVMZigFileToScope(c->import->di_file), | |
| 1115 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(c->codegen->dbuilder, | |
| 1116 | ZigLLVMFileToScope(c->import->di_file), | |
| 1117 | 1117 | buf_ptr(full_type_name), c->import->di_file, line + 1, |
| 1118 | 1118 | debug_size_in_bits, |
| 1119 | 1119 | debug_align_in_bits, |
| 1120 | 1120 | 0, |
| 1121 | 1121 | nullptr, di_element_types, field_count, 0, nullptr, ""); |
| 1122 | 1122 | |
| 1123 | LLVMZigReplaceTemporary(c->codegen->dbuilder, struct_type->di_type, replacement_di_type); | |
| 1123 | ZigLLVMReplaceTemporary(c->codegen->dbuilder, struct_type->di_type, replacement_di_type); | |
| 1124 | 1124 | struct_type->di_type = replacement_di_type; |
| 1125 | 1125 | |
| 1126 | 1126 | return struct_type; |
src/zig_llvm.cpp+105-105| ... | ... | @@ -44,20 +44,20 @@ |
| 44 | 44 | |
| 45 | 45 | using namespace llvm; |
| 46 | 46 | |
| 47 | void LLVMZigInitializeLoopStrengthReducePass(LLVMPassRegistryRef R) { | |
| 47 | void ZigLLVMInitializeLoopStrengthReducePass(LLVMPassRegistryRef R) { | |
| 48 | 48 | initializeLoopStrengthReducePass(*unwrap(R)); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | void LLVMZigInitializeLowerIntrinsicsPass(LLVMPassRegistryRef R) { | |
| 51 | void ZigLLVMInitializeLowerIntrinsicsPass(LLVMPassRegistryRef R) { | |
| 52 | 52 | initializeLowerIntrinsicsPass(*unwrap(R)); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | char *LLVMZigGetHostCPUName(void) { | |
| 55 | char *ZigLLVMGetHostCPUName(void) { | |
| 56 | 56 | std::string str = sys::getHostCPUName(); |
| 57 | 57 | return strdup(str.c_str()); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | char *LLVMZigGetNativeFeatures(void) { | |
| 60 | char *ZigLLVMGetNativeFeatures(void) { | |
| 61 | 61 | SubtargetFeatures features; |
| 62 | 62 | |
| 63 | 63 | StringMap<bool> host_features; |
| ... | ... | @@ -74,7 +74,7 @@ static void addAddDiscriminatorsPass(const PassManagerBuilder &Builder, legacy:: |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | void LLVMZigOptimizeModule(LLVMTargetMachineRef targ_machine_ref, LLVMModuleRef module_ref) { | |
| 77 | void ZigLLVMOptimizeModule(LLVMTargetMachineRef targ_machine_ref, LLVMModuleRef module_ref) { | |
| 78 | 78 | TargetMachine* target_machine = reinterpret_cast<TargetMachine*>(targ_machine_ref); |
| 79 | 79 | Module* module = unwrap(module_ref); |
| 80 | 80 | TargetLibraryInfoImpl tlii(Triple(module->getTargetTriple())); |
| ... | ... | @@ -129,7 +129,7 @@ void LLVMZigOptimizeModule(LLVMTargetMachineRef targ_machine_ref, LLVMModuleRef |
| 129 | 129 | MPM->run(*module); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | LLVMValueRef LLVMZigBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, | |
| 132 | LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, | |
| 133 | 133 | unsigned NumArgs, unsigned CC, const char *Name) |
| 134 | 134 | { |
| 135 | 135 | CallInst *call_inst = CallInst::Create(unwrap(Fn), makeArrayRef(unwrap(Args), NumArgs), Name); |
| ... | ... | @@ -137,7 +137,7 @@ LLVMValueRef LLVMZigBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A |
| 137 | 137 | return wrap(unwrap(B)->Insert(call_inst)); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | void LLVMZigAddNonNullAttr(LLVMValueRef fn, unsigned i) | |
| 140 | void ZigLLVMAddNonNullAttr(LLVMValueRef fn, unsigned i) | |
| 141 | 141 | { |
| 142 | 142 | assert( isa<Function>(unwrap(fn)) ); |
| 143 | 143 | |
| ... | ... | @@ -146,31 +146,31 @@ void LLVMZigAddNonNullAttr(LLVMValueRef fn, unsigned i) |
| 146 | 146 | unwrapped_function->addAttribute(i, Attribute::NonNull); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | void ZigLLVMFnSetSubprogram(LLVMValueRef fn, LLVMZigDISubprogram *subprogram) { | |
| 149 | void ZigLLVMFnSetSubprogram(LLVMValueRef fn, ZigLLVMDISubprogram *subprogram) { | |
| 150 | 150 | assert( isa<Function>(unwrap(fn)) ); |
| 151 | 151 | Function *unwrapped_function = reinterpret_cast<Function*>(unwrap(fn)); |
| 152 | 152 | unwrapped_function->setSubprogram(reinterpret_cast<DISubprogram*>(subprogram)); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| 156 | LLVMZigDIType *LLVMZigCreateDebugPointerType(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *pointee_type, | |
| 156 | ZigLLVMDIType *ZigLLVMCreateDebugPointerType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *pointee_type, | |
| 157 | 157 | uint64_t size_in_bits, uint64_t align_in_bits, const char *name) |
| 158 | 158 | { |
| 159 | 159 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createPointerType( |
| 160 | 160 | reinterpret_cast<DIType*>(pointee_type), size_in_bits, align_in_bits, name); |
| 161 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 161 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | LLVMZigDIType *LLVMZigCreateDebugBasicType(LLVMZigDIBuilder *dibuilder, const char *name, | |
| 164 | ZigLLVMDIType *ZigLLVMCreateDebugBasicType(ZigLLVMDIBuilder *dibuilder, const char *name, | |
| 165 | 165 | uint64_t size_in_bits, uint64_t align_in_bits, unsigned encoding) |
| 166 | 166 | { |
| 167 | 167 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createBasicType( |
| 168 | 168 | name, size_in_bits, align_in_bits, encoding); |
| 169 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 169 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | LLVMZigDIType *LLVMZigCreateDebugArrayType(LLVMZigDIBuilder *dibuilder, uint64_t size_in_bits, | |
| 173 | uint64_t align_in_bits, LLVMZigDIType *elem_type, int elem_count) | |
| 172 | ZigLLVMDIType *ZigLLVMCreateDebugArrayType(ZigLLVMDIBuilder *dibuilder, uint64_t size_in_bits, | |
| 173 | uint64_t align_in_bits, ZigLLVMDIType *elem_type, int elem_count) | |
| 174 | 174 | { |
| 175 | 175 | SmallVector<Metadata *, 1> subrange; |
| 176 | 176 | subrange.push_back(reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateSubrange(0, elem_count)); |
| ... | ... | @@ -178,18 +178,18 @@ LLVMZigDIType *LLVMZigCreateDebugArrayType(LLVMZigDIBuilder *dibuilder, uint64_t |
| 178 | 178 | size_in_bits, align_in_bits, |
| 179 | 179 | reinterpret_cast<DIType*>(elem_type), |
| 180 | 180 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(subrange)); |
| 181 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 181 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | LLVMZigDIEnumerator *LLVMZigCreateDebugEnumerator(LLVMZigDIBuilder *dibuilder, const char *name, int64_t val) { | |
| 184 | ZigLLVMDIEnumerator *ZigLLVMCreateDebugEnumerator(ZigLLVMDIBuilder *dibuilder, const char *name, int64_t val) { | |
| 185 | 185 | DIEnumerator *di_enumerator = reinterpret_cast<DIBuilder*>(dibuilder)->createEnumerator(name, val); |
| 186 | return reinterpret_cast<LLVMZigDIEnumerator*>(di_enumerator); | |
| 186 | return reinterpret_cast<ZigLLVMDIEnumerator*>(di_enumerator); | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | LLVMZigDIType *LLVMZigCreateDebugEnumerationType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 190 | const char *name, LLVMZigDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 191 | uint64_t align_in_bits, LLVMZigDIEnumerator **enumerator_array, int enumerator_array_len, | |
| 192 | LLVMZigDIType *underlying_type, const char *unique_id) | |
| 189 | ZigLLVMDIType *ZigLLVMCreateDebugEnumerationType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 190 | const char *name, ZigLLVMDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 191 | uint64_t align_in_bits, ZigLLVMDIEnumerator **enumerator_array, int enumerator_array_len, | |
| 192 | ZigLLVMDIType *underlying_type, const char *unique_id) | |
| 193 | 193 | { |
| 194 | 194 | SmallVector<Metadata *, 8> fields; |
| 195 | 195 | for (int i = 0; i < enumerator_array_len; i += 1) { |
| ... | ... | @@ -204,12 +204,12 @@ LLVMZigDIType *LLVMZigCreateDebugEnumerationType(LLVMZigDIBuilder *dibuilder, LL |
| 204 | 204 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), |
| 205 | 205 | reinterpret_cast<DIType*>(underlying_type), |
| 206 | 206 | unique_id); |
| 207 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 207 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | LLVMZigDIType *LLVMZigCreateDebugMemberType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 211 | const char *name, LLVMZigDIFile *file, unsigned line, uint64_t size_in_bits, | |
| 212 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, LLVMZigDIType *type) | |
| 210 | ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 211 | 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) | |
| 213 | 213 | { |
| 214 | 214 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createMemberType( |
| 215 | 215 | reinterpret_cast<DIScope*>(scope), |
| ... | ... | @@ -217,12 +217,12 @@ LLVMZigDIType *LLVMZigCreateDebugMemberType(LLVMZigDIBuilder *dibuilder, LLVMZig |
| 217 | 217 | reinterpret_cast<DIFile*>(file), |
| 218 | 218 | line, size_in_bits, align_in_bits, offset_in_bits, flags, |
| 219 | 219 | reinterpret_cast<DIType*>(type)); |
| 220 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 220 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | LLVMZigDIType *LLVMZigCreateDebugUnionType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 224 | const char *name, LLVMZigDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 225 | uint64_t align_in_bits, unsigned flags, LLVMZigDIType **types_array, int types_array_len, | |
| 223 | ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 224 | const char *name, ZigLLVMDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 225 | uint64_t align_in_bits, unsigned flags, ZigLLVMDIType **types_array, int types_array_len, | |
| 226 | 226 | unsigned run_time_lang, const char *unique_id) |
| 227 | 227 | { |
| 228 | 228 | SmallVector<Metadata *, 8> fields; |
| ... | ... | @@ -237,13 +237,13 @@ LLVMZigDIType *LLVMZigCreateDebugUnionType(LLVMZigDIBuilder *dibuilder, LLVMZigD |
| 237 | 237 | line_number, size_in_bits, align_in_bits, flags, |
| 238 | 238 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), |
| 239 | 239 | run_time_lang, unique_id); |
| 240 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 240 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | LLVMZigDIType *LLVMZigCreateDebugStructType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 244 | const char *name, LLVMZigDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 245 | uint64_t align_in_bits, unsigned flags, LLVMZigDIType *derived_from, | |
| 246 | LLVMZigDIType **types_array, int types_array_len, unsigned run_time_lang, LLVMZigDIType *vtable_holder, | |
| 243 | ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 244 | const char *name, ZigLLVMDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 245 | uint64_t align_in_bits, unsigned flags, ZigLLVMDIType *derived_from, | |
| 246 | ZigLLVMDIType **types_array, int types_array_len, unsigned run_time_lang, ZigLLVMDIType *vtable_holder, | |
| 247 | 247 | const char *unique_id) |
| 248 | 248 | { |
| 249 | 249 | SmallVector<Metadata *, 8> fields; |
| ... | ... | @@ -261,41 +261,41 @@ LLVMZigDIType *LLVMZigCreateDebugStructType(LLVMZigDIBuilder *dibuilder, LLVMZig |
| 261 | 261 | run_time_lang, |
| 262 | 262 | reinterpret_cast<DIType*>(vtable_holder), |
| 263 | 263 | unique_id); |
| 264 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 264 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | LLVMZigDIType *LLVMZigCreateReplaceableCompositeType(LLVMZigDIBuilder *dibuilder, unsigned tag, | |
| 268 | const char *name, LLVMZigDIScope *scope, LLVMZigDIFile *file, unsigned line) | |
| 267 | ZigLLVMDIType *ZigLLVMCreateReplaceableCompositeType(ZigLLVMDIBuilder *dibuilder, unsigned tag, | |
| 268 | const char *name, ZigLLVMDIScope *scope, ZigLLVMDIFile *file, unsigned line) | |
| 269 | 269 | { |
| 270 | 270 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createReplaceableCompositeType( |
| 271 | 271 | tag, name, |
| 272 | 272 | reinterpret_cast<DIScope*>(scope), |
| 273 | 273 | reinterpret_cast<DIFile*>(file), |
| 274 | 274 | line); |
| 275 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 275 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | LLVMZigDIType *LLVMZigCreateDebugForwardDeclType(LLVMZigDIBuilder *dibuilder, unsigned tag, | |
| 279 | const char *name, LLVMZigDIScope *scope, LLVMZigDIFile *file, unsigned line) | |
| 278 | ZigLLVMDIType *ZigLLVMCreateDebugForwardDeclType(ZigLLVMDIBuilder *dibuilder, unsigned tag, | |
| 279 | const char *name, ZigLLVMDIScope *scope, ZigLLVMDIFile *file, unsigned line) | |
| 280 | 280 | { |
| 281 | 281 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createForwardDecl( |
| 282 | 282 | tag, name, |
| 283 | 283 | reinterpret_cast<DIScope*>(scope), |
| 284 | 284 | reinterpret_cast<DIFile*>(file), |
| 285 | 285 | line); |
| 286 | return reinterpret_cast<LLVMZigDIType*>(di_type); | |
| 286 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | void LLVMZigReplaceTemporary(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *type, | |
| 290 | LLVMZigDIType *replacement) | |
| 289 | void ZigLLVMReplaceTemporary(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *type, | |
| 290 | ZigLLVMDIType *replacement) | |
| 291 | 291 | { |
| 292 | 292 | reinterpret_cast<DIBuilder*>(dibuilder)->replaceTemporary( |
| 293 | 293 | TempDIType(reinterpret_cast<DIType*>(type)), |
| 294 | 294 | reinterpret_cast<DIType*>(replacement)); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | void LLVMZigReplaceDebugArrays(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *type, | |
| 298 | LLVMZigDIType **types_array, int types_array_len) | |
| 297 | void ZigLLVMReplaceDebugArrays(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *type, | |
| 298 | ZigLLVMDIType **types_array, int types_array_len) | |
| 299 | 299 | { |
| 300 | 300 | SmallVector<Metadata *, 8> fields; |
| 301 | 301 | for (int i = 0; i < types_array_len; i += 1) { |
| ... | ... | @@ -308,8 +308,8 @@ void LLVMZigReplaceDebugArrays(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *type, |
| 308 | 308 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields)); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | LLVMZigDIType *LLVMZigCreateSubroutineType(LLVMZigDIBuilder *dibuilder_wrapped, | |
| 312 | LLVMZigDIType **types_array, int types_array_len, unsigned flags) | |
| 311 | ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, | |
| 312 | ZigLLVMDIType **types_array, int types_array_len, unsigned flags) | |
| 313 | 313 | { |
| 314 | 314 | SmallVector<Metadata *, 8> types; |
| 315 | 315 | for (int i = 0; i < types_array_len; i += 1) { |
| ... | ... | @@ -321,51 +321,51 @@ LLVMZigDIType *LLVMZigCreateSubroutineType(LLVMZigDIBuilder *dibuilder_wrapped, |
| 321 | 321 | dibuilder->getOrCreateTypeArray(types), |
| 322 | 322 | flags); |
| 323 | 323 | DIType *ditype = subroutine_type; |
| 324 | return reinterpret_cast<LLVMZigDIType*>(ditype); | |
| 324 | return reinterpret_cast<ZigLLVMDIType*>(ditype); | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | unsigned LLVMZigEncoding_DW_ATE_unsigned(void) { | |
| 327 | unsigned ZigLLVMEncoding_DW_ATE_unsigned(void) { | |
| 328 | 328 | return dwarf::DW_ATE_unsigned; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | unsigned LLVMZigEncoding_DW_ATE_signed(void) { | |
| 331 | unsigned ZigLLVMEncoding_DW_ATE_signed(void) { | |
| 332 | 332 | return dwarf::DW_ATE_signed; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | unsigned LLVMZigEncoding_DW_ATE_float(void) { | |
| 335 | unsigned ZigLLVMEncoding_DW_ATE_float(void) { | |
| 336 | 336 | return dwarf::DW_ATE_float; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | unsigned LLVMZigEncoding_DW_ATE_boolean(void) { | |
| 339 | unsigned ZigLLVMEncoding_DW_ATE_boolean(void) { | |
| 340 | 340 | return dwarf::DW_ATE_boolean; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | unsigned LLVMZigEncoding_DW_ATE_unsigned_char(void) { | |
| 343 | unsigned ZigLLVMEncoding_DW_ATE_unsigned_char(void) { | |
| 344 | 344 | return dwarf::DW_ATE_unsigned_char; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | unsigned LLVMZigEncoding_DW_ATE_signed_char(void) { | |
| 347 | unsigned ZigLLVMEncoding_DW_ATE_signed_char(void) { | |
| 348 | 348 | return dwarf::DW_ATE_signed_char; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | unsigned LLVMZigLang_DW_LANG_C99(void) { | |
| 351 | unsigned ZigLLVMLang_DW_LANG_C99(void) { | |
| 352 | 352 | return dwarf::DW_LANG_C99; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | unsigned LLVMZigTag_DW_variable(void) { | |
| 355 | unsigned ZigLLVMTag_DW_variable(void) { | |
| 356 | 356 | return dwarf::DW_TAG_variable; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | unsigned LLVMZigTag_DW_structure_type(void) { | |
| 359 | unsigned ZigLLVMTag_DW_structure_type(void) { | |
| 360 | 360 | return dwarf::DW_TAG_structure_type; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | LLVMZigDIBuilder *LLVMZigCreateDIBuilder(LLVMModuleRef module, bool allow_unresolved) { | |
| 363 | ZigLLVMDIBuilder *ZigLLVMCreateDIBuilder(LLVMModuleRef module, bool allow_unresolved) { | |
| 364 | 364 | DIBuilder *di_builder = new DIBuilder(*unwrap(module), allow_unresolved); |
| 365 | return reinterpret_cast<LLVMZigDIBuilder *>(di_builder); | |
| 365 | return reinterpret_cast<ZigLLVMDIBuilder *>(di_builder); | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, LLVMZigDIScope *scope) { | |
| 368 | void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, ZigLLVMDIScope *scope) { | |
| 369 | 369 | unwrap(builder)->SetCurrentDebugLocation(DebugLoc::get( |
| 370 | 370 | line, column, reinterpret_cast<DIScope*>(scope))); |
| 371 | 371 | } |
| ... | ... | @@ -375,20 +375,20 @@ void ZigLLVMClearCurrentDebugLocation(LLVMBuilderRef builder) { |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | |
| 378 | LLVMZigDILexicalBlock *LLVMZigCreateLexicalBlock(LLVMZigDIBuilder *dbuilder, LLVMZigDIScope *scope, | |
| 379 | LLVMZigDIFile *file, unsigned line, unsigned col) | |
| 378 | ZigLLVMDILexicalBlock *ZigLLVMCreateLexicalBlock(ZigLLVMDIBuilder *dbuilder, ZigLLVMDIScope *scope, | |
| 379 | ZigLLVMDIFile *file, unsigned line, unsigned col) | |
| 380 | 380 | { |
| 381 | 381 | DILexicalBlock *result = reinterpret_cast<DIBuilder*>(dbuilder)->createLexicalBlock( |
| 382 | 382 | reinterpret_cast<DIScope*>(scope), |
| 383 | 383 | reinterpret_cast<DIFile*>(file), |
| 384 | 384 | line, |
| 385 | 385 | col); |
| 386 | return reinterpret_cast<LLVMZigDILexicalBlock*>(result); | |
| 386 | return reinterpret_cast<ZigLLVMDILexicalBlock*>(result); | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | LLVMZigDILocalVariable *LLVMZigCreateAutoVariable(LLVMZigDIBuilder *dbuilder, | |
| 390 | LLVMZigDIScope *scope, const char *name, LLVMZigDIFile *file, unsigned line_no, | |
| 391 | LLVMZigDIType *type, bool always_preserve, unsigned flags) | |
| 389 | ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | |
| 390 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | |
| 391 | ZigLLVMDIType *type, bool always_preserve, unsigned flags) | |
| 392 | 392 | { |
| 393 | 393 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createAutoVariable( |
| 394 | 394 | reinterpret_cast<DIScope*>(scope), |
| ... | ... | @@ -398,12 +398,12 @@ LLVMZigDILocalVariable *LLVMZigCreateAutoVariable(LLVMZigDIBuilder *dbuilder, |
| 398 | 398 | reinterpret_cast<DIType*>(type), |
| 399 | 399 | always_preserve, |
| 400 | 400 | flags); |
| 401 | return reinterpret_cast<LLVMZigDILocalVariable*>(result); | |
| 401 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | LLVMZigDIGlobalVariable *LLVMZigCreateGlobalVariable(LLVMZigDIBuilder *dbuilder, | |
| 405 | LLVMZigDIScope *scope, const char *name, const char *linkage_name, LLVMZigDIFile *file, | |
| 406 | unsigned line_no, LLVMZigDIType *di_type, bool is_local_to_unit, LLVMValueRef constant_val) | |
| 404 | ZigLLVMDIGlobalVariable *ZigLLVMCreateGlobalVariable(ZigLLVMDIBuilder *dbuilder, | |
| 405 | 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) | |
| 407 | 407 | { |
| 408 | 408 | DIGlobalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createGlobalVariable( |
| 409 | 409 | reinterpret_cast<DIScope*>(scope), |
| ... | ... | @@ -414,12 +414,12 @@ LLVMZigDIGlobalVariable *LLVMZigCreateGlobalVariable(LLVMZigDIBuilder *dbuilder, |
| 414 | 414 | reinterpret_cast<DIType*>(di_type), |
| 415 | 415 | is_local_to_unit, |
| 416 | 416 | reinterpret_cast<llvm::Constant *>(constant_val)); |
| 417 | return reinterpret_cast<LLVMZigDIGlobalVariable*>(result); | |
| 417 | return reinterpret_cast<ZigLLVMDIGlobalVariable*>(result); | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | LLVMZigDILocalVariable *LLVMZigCreateParameterVariable(LLVMZigDIBuilder *dbuilder, | |
| 421 | LLVMZigDIScope *scope, const char *name, LLVMZigDIFile *file, unsigned line_no, | |
| 422 | LLVMZigDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) | |
| 420 | ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilder, | |
| 421 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | |
| 422 | ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) | |
| 423 | 423 | { |
| 424 | 424 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createParameterVariable( |
| 425 | 425 | reinterpret_cast<DIScope*>(scope), |
| ... | ... | @@ -430,54 +430,54 @@ LLVMZigDILocalVariable *LLVMZigCreateParameterVariable(LLVMZigDIBuilder *dbuilde |
| 430 | 430 | reinterpret_cast<DIType*>(type), |
| 431 | 431 | always_preserve, |
| 432 | 432 | flags); |
| 433 | return reinterpret_cast<LLVMZigDILocalVariable*>(result); | |
| 433 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | LLVMZigDIScope *LLVMZigLexicalBlockToScope(LLVMZigDILexicalBlock *lexical_block) { | |
| 436 | ZigLLVMDIScope *ZigLLVMLexicalBlockToScope(ZigLLVMDILexicalBlock *lexical_block) { | |
| 437 | 437 | DIScope *scope = reinterpret_cast<DILexicalBlock*>(lexical_block); |
| 438 | return reinterpret_cast<LLVMZigDIScope*>(scope); | |
| 438 | return reinterpret_cast<ZigLLVMDIScope*>(scope); | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | LLVMZigDIScope *LLVMZigCompileUnitToScope(LLVMZigDICompileUnit *compile_unit) { | |
| 441 | ZigLLVMDIScope *ZigLLVMCompileUnitToScope(ZigLLVMDICompileUnit *compile_unit) { | |
| 442 | 442 | DIScope *scope = reinterpret_cast<DICompileUnit*>(compile_unit); |
| 443 | return reinterpret_cast<LLVMZigDIScope*>(scope); | |
| 443 | return reinterpret_cast<ZigLLVMDIScope*>(scope); | |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | LLVMZigDIScope *LLVMZigFileToScope(LLVMZigDIFile *difile) { | |
| 446 | ZigLLVMDIScope *ZigLLVMFileToScope(ZigLLVMDIFile *difile) { | |
| 447 | 447 | DIScope *scope = reinterpret_cast<DIFile*>(difile); |
| 448 | return reinterpret_cast<LLVMZigDIScope*>(scope); | |
| 448 | return reinterpret_cast<ZigLLVMDIScope*>(scope); | |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | LLVMZigDIScope *LLVMZigSubprogramToScope(LLVMZigDISubprogram *subprogram) { | |
| 451 | ZigLLVMDIScope *ZigLLVMSubprogramToScope(ZigLLVMDISubprogram *subprogram) { | |
| 452 | 452 | DIScope *scope = reinterpret_cast<DISubprogram*>(subprogram); |
| 453 | return reinterpret_cast<LLVMZigDIScope*>(scope); | |
| 453 | return reinterpret_cast<ZigLLVMDIScope*>(scope); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | LLVMZigDIScope *LLVMZigTypeToScope(LLVMZigDIType *type) { | |
| 456 | ZigLLVMDIScope *ZigLLVMTypeToScope(ZigLLVMDIType *type) { | |
| 457 | 457 | DIScope *scope = reinterpret_cast<DIType*>(type); |
| 458 | return reinterpret_cast<LLVMZigDIScope*>(scope); | |
| 458 | return reinterpret_cast<ZigLLVMDIScope*>(scope); | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | LLVMZigDICompileUnit *LLVMZigCreateCompileUnit(LLVMZigDIBuilder *dibuilder, | |
| 461 | ZigLLVMDICompileUnit *ZigLLVMCreateCompileUnit(ZigLLVMDIBuilder *dibuilder, | |
| 462 | 462 | unsigned lang, const char *file, const char *dir, const char *producer, |
| 463 | 463 | bool is_optimized, const char *flags, unsigned runtime_version, const char *split_name, |
| 464 | 464 | uint64_t dwo_id, bool emit_debug_info) |
| 465 | 465 | { |
| 466 | 466 | DICompileUnit *result = reinterpret_cast<DIBuilder*>(dibuilder)->createCompileUnit( |
| 467 | 467 | lang, file, dir, producer, is_optimized, flags, runtime_version, split_name); |
| 468 | return reinterpret_cast<LLVMZigDICompileUnit*>(result); | |
| 468 | return reinterpret_cast<ZigLLVMDICompileUnit*>(result); | |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | |
| 472 | LLVMZigDIFile *LLVMZigCreateFile(LLVMZigDIBuilder *dibuilder, const char *filename, const char *directory) { | |
| 472 | ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filename, const char *directory) { | |
| 473 | 473 | DIFile *result = reinterpret_cast<DIBuilder*>(dibuilder)->createFile(filename, directory); |
| 474 | return reinterpret_cast<LLVMZigDIFile*>(result); | |
| 474 | return reinterpret_cast<ZigLLVMDIFile*>(result); | |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | LLVMZigDISubprogram *LLVMZigCreateFunction(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 478 | const char *name, const char *linkage_name, LLVMZigDIFile *file, unsigned lineno, | |
| 479 | LLVMZigDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line, | |
| 480 | unsigned flags, bool is_optimized, LLVMZigDISubprogram *decl_subprogram) | |
| 477 | ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 478 | const char *name, const char *linkage_name, ZigLLVMDIFile *file, unsigned lineno, | |
| 479 | ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line, | |
| 480 | unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram) | |
| 481 | 481 | { |
| 482 | 482 | DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type)); |
| 483 | 483 | DISubprogram *result = reinterpret_cast<DIBuilder*>(dibuilder)->createFunction( |
| ... | ... | @@ -489,26 +489,26 @@ LLVMZigDISubprogram *LLVMZigCreateFunction(LLVMZigDIBuilder *dibuilder, LLVMZigD |
| 489 | 489 | is_local_to_unit, is_definition, scope_line, flags, is_optimized, |
| 490 | 490 | nullptr, |
| 491 | 491 | reinterpret_cast<DISubprogram *>(decl_subprogram)); |
| 492 | return reinterpret_cast<LLVMZigDISubprogram*>(result); | |
| 492 | return reinterpret_cast<ZigLLVMDISubprogram*>(result); | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | void LLVMZigDIBuilderFinalize(LLVMZigDIBuilder *dibuilder) { | |
| 495 | void ZigLLVMDIBuilderFinalize(ZigLLVMDIBuilder *dibuilder) { | |
| 496 | 496 | reinterpret_cast<DIBuilder*>(dibuilder)->finalize(); |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | LLVMZigInsertionPoint *LLVMZigSaveInsertPoint(LLVMBuilderRef builder_wrapped) { | |
| 499 | ZigLLVMInsertionPoint *ZigLLVMSaveInsertPoint(LLVMBuilderRef builder_wrapped) { | |
| 500 | 500 | IRBuilderBase::InsertPoint *ip = new IRBuilderBase::InsertPoint(); |
| 501 | 501 | *ip = unwrap(builder_wrapped)->saveIP(); |
| 502 | return reinterpret_cast<LLVMZigInsertionPoint*>(ip); | |
| 502 | return reinterpret_cast<ZigLLVMInsertionPoint*>(ip); | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | void LLVMZigRestoreInsertPoint(LLVMBuilderRef builder, LLVMZigInsertionPoint *ip_wrapped) { | |
| 505 | void ZigLLVMRestoreInsertPoint(LLVMBuilderRef builder, ZigLLVMInsertionPoint *ip_wrapped) { | |
| 506 | 506 | IRBuilderBase::InsertPoint *ip = reinterpret_cast<IRBuilderBase::InsertPoint*>(ip_wrapped); |
| 507 | 507 | unwrap(builder)->restoreIP(*ip); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | LLVMValueRef LLVMZigInsertDeclareAtEnd(LLVMZigDIBuilder *dibuilder, LLVMValueRef storage, | |
| 511 | LLVMZigDILocalVariable *var_info, LLVMZigDILocation *debug_loc, LLVMBasicBlockRef basic_block_ref) | |
| 510 | LLVMValueRef ZigLLVMInsertDeclareAtEnd(ZigLLVMDIBuilder *dibuilder, LLVMValueRef storage, | |
| 511 | ZigLLVMDILocalVariable *var_info, ZigLLVMDILocation *debug_loc, LLVMBasicBlockRef basic_block_ref) | |
| 512 | 512 | { |
| 513 | 513 | Instruction *result = reinterpret_cast<DIBuilder*>(dibuilder)->insertDeclare( |
| 514 | 514 | unwrap(storage), |
| ... | ... | @@ -519,8 +519,8 @@ LLVMValueRef LLVMZigInsertDeclareAtEnd(LLVMZigDIBuilder *dibuilder, LLVMValueRef |
| 519 | 519 | return wrap(result); |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | LLVMValueRef LLVMZigInsertDeclare(LLVMZigDIBuilder *dibuilder, LLVMValueRef storage, | |
| 523 | LLVMZigDILocalVariable *var_info, LLVMZigDILocation *debug_loc, LLVMValueRef insert_before_instr) | |
| 522 | LLVMValueRef ZigLLVMInsertDeclare(ZigLLVMDIBuilder *dibuilder, LLVMValueRef storage, | |
| 523 | ZigLLVMDILocalVariable *var_info, ZigLLVMDILocation *debug_loc, LLVMValueRef insert_before_instr) | |
| 524 | 524 | { |
| 525 | 525 | Instruction *result = reinterpret_cast<DIBuilder*>(dibuilder)->insertDeclare( |
| 526 | 526 | unwrap(storage), |
| ... | ... | @@ -531,12 +531,12 @@ LLVMValueRef LLVMZigInsertDeclare(LLVMZigDIBuilder *dibuilder, LLVMValueRef stor |
| 531 | 531 | return wrap(result); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | LLVMZigDILocation *LLVMZigGetDebugLoc(unsigned line, unsigned col, LLVMZigDIScope *scope) { | |
| 534 | ZigLLVMDILocation *ZigLLVMGetDebugLoc(unsigned line, unsigned col, ZigLLVMDIScope *scope) { | |
| 535 | 535 | DebugLoc debug_loc = DebugLoc::get(line, col, reinterpret_cast<DIScope*>(scope), nullptr); |
| 536 | return reinterpret_cast<LLVMZigDILocation*>(debug_loc.get()); | |
| 536 | return reinterpret_cast<ZigLLVMDILocation*>(debug_loc.get()); | |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | void LLVMZigSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) { | |
| 539 | void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) { | |
| 540 | 540 | if (on_state) { |
| 541 | 541 | FastMathFlags fmf; |
| 542 | 542 | fmf.setUnsafeAlgebra(); |
src/zig_llvm.hpp+96-96| ... | ... | @@ -14,29 +14,29 @@ |
| 14 | 14 | #include <llvm-c/Initialization.h> |
| 15 | 15 | #include <llvm-c/TargetMachine.h> |
| 16 | 16 | |
| 17 | struct LLVMZigDIType; | |
| 18 | struct LLVMZigDIBuilder; | |
| 19 | struct LLVMZigDICompileUnit; | |
| 20 | struct LLVMZigDIScope; | |
| 21 | struct LLVMZigDIFile; | |
| 22 | struct LLVMZigDILexicalBlock; | |
| 23 | struct LLVMZigDISubprogram; | |
| 24 | struct LLVMZigDISubroutineType; | |
| 25 | struct LLVMZigDILocalVariable; | |
| 26 | struct LLVMZigDIGlobalVariable; | |
| 27 | struct LLVMZigDILocation; | |
| 28 | struct LLVMZigDIEnumerator; | |
| 29 | struct LLVMZigInsertionPoint; | |
| 30 | ||
| 31 | void LLVMZigInitializeLoopStrengthReducePass(LLVMPassRegistryRef R); | |
| 32 | void LLVMZigInitializeLowerIntrinsicsPass(LLVMPassRegistryRef R); | |
| 33 | ||
| 34 | char *LLVMZigGetHostCPUName(void); | |
| 35 | char *LLVMZigGetNativeFeatures(void); | |
| 36 | ||
| 37 | void LLVMZigOptimizeModule(LLVMTargetMachineRef targ_machine_ref, LLVMModuleRef module_ref); | |
| 38 | ||
| 39 | LLVMValueRef LLVMZigBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, | |
| 17 | struct ZigLLVMDIType; | |
| 18 | struct ZigLLVMDIBuilder; | |
| 19 | struct ZigLLVMDICompileUnit; | |
| 20 | struct ZigLLVMDIScope; | |
| 21 | struct ZigLLVMDIFile; | |
| 22 | struct ZigLLVMDILexicalBlock; | |
| 23 | struct ZigLLVMDISubprogram; | |
| 24 | struct ZigLLVMDISubroutineType; | |
| 25 | struct ZigLLVMDILocalVariable; | |
| 26 | struct ZigLLVMDIGlobalVariable; | |
| 27 | struct ZigLLVMDILocation; | |
| 28 | struct ZigLLVMDIEnumerator; | |
| 29 | struct ZigLLVMInsertionPoint; | |
| 30 | ||
| 31 | void ZigLLVMInitializeLoopStrengthReducePass(LLVMPassRegistryRef R); | |
| 32 | void ZigLLVMInitializeLowerIntrinsicsPass(LLVMPassRegistryRef R); | |
| 33 | ||
| 34 | char *ZigLLVMGetHostCPUName(void); | |
| 35 | char *ZigLLVMGetNativeFeatures(void); | |
| 36 | ||
| 37 | void ZigLLVMOptimizeModule(LLVMTargetMachineRef targ_machine_ref, LLVMModuleRef module_ref); | |
| 38 | ||
| 39 | LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, | |
| 40 | 40 | unsigned NumArgs, unsigned CC, const char *Name); |
| 41 | 41 | |
| 42 | 42 | LLVMValueRef ZigLLVMBuildCmpXchg(LLVMBuilderRef builder, LLVMValueRef ptr, LLVMValueRef cmp, |
| ... | ... | @@ -51,118 +51,118 @@ LLVMValueRef ZigLLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, |
| 51 | 51 | LLVMValueRef RHS, const char *Name); |
| 52 | 52 | |
| 53 | 53 | // 0 is return value, 1 is first arg |
| 54 | void LLVMZigAddNonNullAttr(LLVMValueRef fn, unsigned i); | |
| 54 | void ZigLLVMAddNonNullAttr(LLVMValueRef fn, unsigned i); | |
| 55 | 55 | |
| 56 | LLVMZigDIType *LLVMZigCreateDebugPointerType(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *pointee_type, | |
| 56 | ZigLLVMDIType *ZigLLVMCreateDebugPointerType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *pointee_type, | |
| 57 | 57 | uint64_t size_in_bits, uint64_t align_in_bits, const char *name); |
| 58 | 58 | |
| 59 | LLVMZigDIType *LLVMZigCreateDebugBasicType(LLVMZigDIBuilder *dibuilder, const char *name, | |
| 59 | ZigLLVMDIType *ZigLLVMCreateDebugBasicType(ZigLLVMDIBuilder *dibuilder, const char *name, | |
| 60 | 60 | uint64_t size_in_bits, uint64_t align_in_bits, unsigned encoding); |
| 61 | 61 | |
| 62 | LLVMZigDIType *LLVMZigCreateDebugArrayType(LLVMZigDIBuilder *dibuilder, | |
| 63 | uint64_t size_in_bits, uint64_t align_in_bits, LLVMZigDIType *elem_type, | |
| 62 | ZigLLVMDIType *ZigLLVMCreateDebugArrayType(ZigLLVMDIBuilder *dibuilder, | |
| 63 | uint64_t size_in_bits, uint64_t align_in_bits, ZigLLVMDIType *elem_type, | |
| 64 | 64 | int elem_count); |
| 65 | 65 | |
| 66 | LLVMZigDIEnumerator *LLVMZigCreateDebugEnumerator(LLVMZigDIBuilder *dibuilder, const char *name, int64_t val); | |
| 66 | ZigLLVMDIEnumerator *ZigLLVMCreateDebugEnumerator(ZigLLVMDIBuilder *dibuilder, const char *name, int64_t val); | |
| 67 | 67 | |
| 68 | LLVMZigDIType *LLVMZigCreateDebugEnumerationType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 69 | const char *name, LLVMZigDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 70 | uint64_t align_in_bits, LLVMZigDIEnumerator **enumerator_array, int enumerator_array_len, | |
| 71 | LLVMZigDIType *underlying_type, const char *unique_id); | |
| 68 | ZigLLVMDIType *ZigLLVMCreateDebugEnumerationType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 69 | const char *name, ZigLLVMDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 70 | uint64_t align_in_bits, ZigLLVMDIEnumerator **enumerator_array, int enumerator_array_len, | |
| 71 | ZigLLVMDIType *underlying_type, const char *unique_id); | |
| 72 | 72 | |
| 73 | LLVMZigDIType *LLVMZigCreateDebugStructType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 74 | const char *name, LLVMZigDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 75 | uint64_t align_in_bits, unsigned flags, LLVMZigDIType *derived_from, | |
| 76 | LLVMZigDIType **types_array, int types_array_len, unsigned run_time_lang, LLVMZigDIType *vtable_holder, | |
| 73 | ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 74 | const char *name, ZigLLVMDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 75 | uint64_t align_in_bits, unsigned flags, ZigLLVMDIType *derived_from, | |
| 76 | ZigLLVMDIType **types_array, int types_array_len, unsigned run_time_lang, ZigLLVMDIType *vtable_holder, | |
| 77 | 77 | const char *unique_id); |
| 78 | 78 | |
| 79 | LLVMZigDIType *LLVMZigCreateDebugUnionType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 80 | const char *name, LLVMZigDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 81 | uint64_t align_in_bits, unsigned flags, LLVMZigDIType **types_array, int types_array_len, | |
| 79 | ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 80 | const char *name, ZigLLVMDIFile *file, unsigned line_number, uint64_t size_in_bits, | |
| 81 | uint64_t align_in_bits, unsigned flags, ZigLLVMDIType **types_array, int types_array_len, | |
| 82 | 82 | unsigned run_time_lang, const char *unique_id); |
| 83 | 83 | |
| 84 | LLVMZigDIType *LLVMZigCreateDebugMemberType(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 85 | const char *name, LLVMZigDIFile *file, unsigned line, uint64_t size_in_bits, | |
| 86 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, LLVMZigDIType *type); | |
| 84 | ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 85 | const char *name, ZigLLVMDIFile *file, unsigned line, uint64_t size_in_bits, | |
| 86 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, ZigLLVMDIType *type); | |
| 87 | 87 | |
| 88 | LLVMZigDIType *LLVMZigCreateReplaceableCompositeType(LLVMZigDIBuilder *dibuilder, unsigned tag, | |
| 89 | const char *name, LLVMZigDIScope *scope, LLVMZigDIFile *file, unsigned line); | |
| 88 | ZigLLVMDIType *ZigLLVMCreateReplaceableCompositeType(ZigLLVMDIBuilder *dibuilder, unsigned tag, | |
| 89 | const char *name, ZigLLVMDIScope *scope, ZigLLVMDIFile *file, unsigned line); | |
| 90 | 90 | |
| 91 | LLVMZigDIType *LLVMZigCreateDebugForwardDeclType(LLVMZigDIBuilder *dibuilder, unsigned tag, | |
| 92 | const char *name, LLVMZigDIScope *scope, LLVMZigDIFile *file, unsigned line); | |
| 91 | ZigLLVMDIType *ZigLLVMCreateDebugForwardDeclType(ZigLLVMDIBuilder *dibuilder, unsigned tag, | |
| 92 | const char *name, ZigLLVMDIScope *scope, ZigLLVMDIFile *file, unsigned line); | |
| 93 | 93 | |
| 94 | void LLVMZigReplaceTemporary(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *type, | |
| 95 | LLVMZigDIType *replacement); | |
| 94 | void ZigLLVMReplaceTemporary(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *type, | |
| 95 | ZigLLVMDIType *replacement); | |
| 96 | 96 | |
| 97 | void LLVMZigReplaceDebugArrays(LLVMZigDIBuilder *dibuilder, LLVMZigDIType *type, | |
| 98 | LLVMZigDIType **types_array, int types_array_len); | |
| 97 | void ZigLLVMReplaceDebugArrays(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIType *type, | |
| 98 | ZigLLVMDIType **types_array, int types_array_len); | |
| 99 | 99 | |
| 100 | LLVMZigDIType *LLVMZigCreateSubroutineType(LLVMZigDIBuilder *dibuilder_wrapped, | |
| 101 | LLVMZigDIType **types_array, int types_array_len, unsigned flags); | |
| 100 | ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, | |
| 101 | ZigLLVMDIType **types_array, int types_array_len, unsigned flags); | |
| 102 | 102 | |
| 103 | unsigned LLVMZigEncoding_DW_ATE_unsigned(void); | |
| 104 | unsigned LLVMZigEncoding_DW_ATE_signed(void); | |
| 105 | unsigned LLVMZigEncoding_DW_ATE_float(void); | |
| 106 | unsigned LLVMZigEncoding_DW_ATE_boolean(void); | |
| 107 | unsigned LLVMZigEncoding_DW_ATE_unsigned_char(void); | |
| 108 | unsigned LLVMZigEncoding_DW_ATE_signed_char(void); | |
| 109 | unsigned LLVMZigLang_DW_LANG_C99(void); | |
| 110 | unsigned LLVMZigTag_DW_variable(void); | |
| 111 | unsigned LLVMZigTag_DW_structure_type(void); | |
| 103 | unsigned ZigLLVMEncoding_DW_ATE_unsigned(void); | |
| 104 | unsigned ZigLLVMEncoding_DW_ATE_signed(void); | |
| 105 | unsigned ZigLLVMEncoding_DW_ATE_float(void); | |
| 106 | unsigned ZigLLVMEncoding_DW_ATE_boolean(void); | |
| 107 | unsigned ZigLLVMEncoding_DW_ATE_unsigned_char(void); | |
| 108 | unsigned ZigLLVMEncoding_DW_ATE_signed_char(void); | |
| 109 | unsigned ZigLLVMLang_DW_LANG_C99(void); | |
| 110 | unsigned ZigLLVMTag_DW_variable(void); | |
| 111 | unsigned ZigLLVMTag_DW_structure_type(void); | |
| 112 | 112 | |
| 113 | LLVMZigDIBuilder *LLVMZigCreateDIBuilder(LLVMModuleRef module, bool allow_unresolved); | |
| 113 | ZigLLVMDIBuilder *ZigLLVMCreateDIBuilder(LLVMModuleRef module, bool allow_unresolved); | |
| 114 | 114 | void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module); |
| 115 | 115 | |
| 116 | void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, LLVMZigDIScope *scope); | |
| 116 | void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, ZigLLVMDIScope *scope); | |
| 117 | 117 | void ZigLLVMClearCurrentDebugLocation(LLVMBuilderRef builder); |
| 118 | 118 | |
| 119 | LLVMZigDIScope *LLVMZigLexicalBlockToScope(LLVMZigDILexicalBlock *lexical_block); | |
| 120 | LLVMZigDIScope *LLVMZigCompileUnitToScope(LLVMZigDICompileUnit *compile_unit); | |
| 121 | LLVMZigDIScope *LLVMZigFileToScope(LLVMZigDIFile *difile); | |
| 122 | LLVMZigDIScope *LLVMZigSubprogramToScope(LLVMZigDISubprogram *subprogram); | |
| 123 | LLVMZigDIScope *LLVMZigTypeToScope(LLVMZigDIType *type); | |
| 119 | ZigLLVMDIScope *ZigLLVMLexicalBlockToScope(ZigLLVMDILexicalBlock *lexical_block); | |
| 120 | ZigLLVMDIScope *ZigLLVMCompileUnitToScope(ZigLLVMDICompileUnit *compile_unit); | |
| 121 | ZigLLVMDIScope *ZigLLVMFileToScope(ZigLLVMDIFile *difile); | |
| 122 | ZigLLVMDIScope *ZigLLVMSubprogramToScope(ZigLLVMDISubprogram *subprogram); | |
| 123 | ZigLLVMDIScope *ZigLLVMTypeToScope(ZigLLVMDIType *type); | |
| 124 | 124 | |
| 125 | LLVMZigDILocalVariable *LLVMZigCreateAutoVariable(LLVMZigDIBuilder *dbuilder, | |
| 126 | LLVMZigDIScope *scope, const char *name, LLVMZigDIFile *file, unsigned line_no, | |
| 127 | LLVMZigDIType *type, bool always_preserve, unsigned flags); | |
| 125 | ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | |
| 126 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | |
| 127 | ZigLLVMDIType *type, bool always_preserve, unsigned flags); | |
| 128 | 128 | |
| 129 | LLVMZigDIGlobalVariable *LLVMZigCreateGlobalVariable(LLVMZigDIBuilder *dbuilder, | |
| 130 | LLVMZigDIScope *scope, const char *name, const char *linkage_name, LLVMZigDIFile *file, | |
| 131 | unsigned line_no, LLVMZigDIType *di_type, bool is_local_to_unit, LLVMValueRef constant_val); | |
| 129 | ZigLLVMDIGlobalVariable *ZigLLVMCreateGlobalVariable(ZigLLVMDIBuilder *dbuilder, | |
| 130 | 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); | |
| 132 | 132 | |
| 133 | LLVMZigDILocalVariable *LLVMZigCreateParameterVariable(LLVMZigDIBuilder *dbuilder, | |
| 134 | LLVMZigDIScope *scope, const char *name, LLVMZigDIFile *file, unsigned line_no, | |
| 135 | LLVMZigDIType *type, bool always_preserve, unsigned flags, unsigned arg_no); | |
| 133 | ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilder, | |
| 134 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | |
| 135 | ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no); | |
| 136 | 136 | |
| 137 | LLVMZigDILexicalBlock *LLVMZigCreateLexicalBlock(LLVMZigDIBuilder *dbuilder, LLVMZigDIScope *scope, | |
| 138 | LLVMZigDIFile *file, unsigned line, unsigned col); | |
| 137 | ZigLLVMDILexicalBlock *ZigLLVMCreateLexicalBlock(ZigLLVMDIBuilder *dbuilder, ZigLLVMDIScope *scope, | |
| 138 | ZigLLVMDIFile *file, unsigned line, unsigned col); | |
| 139 | 139 | |
| 140 | LLVMZigDICompileUnit *LLVMZigCreateCompileUnit(LLVMZigDIBuilder *dibuilder, | |
| 140 | ZigLLVMDICompileUnit *ZigLLVMCreateCompileUnit(ZigLLVMDIBuilder *dibuilder, | |
| 141 | 141 | unsigned lang, const char *file, const char *dir, const char *producer, |
| 142 | 142 | bool is_optimized, const char *flags, unsigned runtime_version, const char *split_name, |
| 143 | 143 | uint64_t dwo_id, bool emit_debug_info); |
| 144 | 144 | |
| 145 | LLVMZigDIFile *LLVMZigCreateFile(LLVMZigDIBuilder *dibuilder, const char *filename, const char *directory); | |
| 145 | ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filename, const char *directory); | |
| 146 | 146 | |
| 147 | LLVMZigDISubprogram *LLVMZigCreateFunction(LLVMZigDIBuilder *dibuilder, LLVMZigDIScope *scope, | |
| 148 | const char *name, const char *linkage_name, LLVMZigDIFile *file, unsigned lineno, | |
| 149 | LLVMZigDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line, | |
| 150 | unsigned flags, bool is_optimized, LLVMZigDISubprogram *decl_subprogram); | |
| 147 | ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope, | |
| 148 | const char *name, const char *linkage_name, ZigLLVMDIFile *file, unsigned lineno, | |
| 149 | ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line, | |
| 150 | unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram); | |
| 151 | 151 | |
| 152 | void ZigLLVMFnSetSubprogram(LLVMValueRef fn, LLVMZigDISubprogram *subprogram); | |
| 152 | void ZigLLVMFnSetSubprogram(LLVMValueRef fn, ZigLLVMDISubprogram *subprogram); | |
| 153 | 153 | |
| 154 | void LLVMZigDIBuilderFinalize(LLVMZigDIBuilder *dibuilder); | |
| 154 | void ZigLLVMDIBuilderFinalize(ZigLLVMDIBuilder *dibuilder); | |
| 155 | 155 | |
| 156 | LLVMZigInsertionPoint *LLVMZigSaveInsertPoint(LLVMBuilderRef builder); | |
| 157 | void LLVMZigRestoreInsertPoint(LLVMBuilderRef builder, LLVMZigInsertionPoint *point); | |
| 156 | ZigLLVMInsertionPoint *ZigLLVMSaveInsertPoint(LLVMBuilderRef builder); | |
| 157 | void ZigLLVMRestoreInsertPoint(LLVMBuilderRef builder, ZigLLVMInsertionPoint *point); | |
| 158 | 158 | |
| 159 | LLVMValueRef LLVMZigInsertDeclareAtEnd(LLVMZigDIBuilder *dibuilder, LLVMValueRef storage, | |
| 160 | LLVMZigDILocalVariable *var_info, LLVMZigDILocation *debug_loc, LLVMBasicBlockRef basic_block_ref); | |
| 161 | LLVMValueRef LLVMZigInsertDeclare(LLVMZigDIBuilder *dibuilder, LLVMValueRef storage, | |
| 162 | LLVMZigDILocalVariable *var_info, LLVMZigDILocation *debug_loc, LLVMValueRef insert_before_instr); | |
| 163 | LLVMZigDILocation *LLVMZigGetDebugLoc(unsigned line, unsigned col, LLVMZigDIScope *scope); | |
| 159 | LLVMValueRef ZigLLVMInsertDeclareAtEnd(ZigLLVMDIBuilder *dibuilder, LLVMValueRef storage, | |
| 160 | ZigLLVMDILocalVariable *var_info, ZigLLVMDILocation *debug_loc, LLVMBasicBlockRef basic_block_ref); | |
| 161 | LLVMValueRef ZigLLVMInsertDeclare(ZigLLVMDIBuilder *dibuilder, LLVMValueRef storage, | |
| 162 | ZigLLVMDILocalVariable *var_info, ZigLLVMDILocation *debug_loc, LLVMValueRef insert_before_instr); | |
| 163 | ZigLLVMDILocation *ZigLLVMGetDebugLoc(unsigned line, unsigned col, ZigLLVMDIScope *scope); | |
| 164 | 164 | |
| 165 | void LLVMZigSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state); | |
| 165 | void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state); | |
| 166 | 166 | |
| 167 | 167 | void ZigLLVMAddFunctionAttr(LLVMValueRef fn, const char *attr_name, const char *attr_value); |
| 168 | 168 |