| ... | @@ -12,6 +12,12 @@ const ValueArrayAbbrev = AbbrevOp{ .array_vbr = 6 }; | ... | @@ -12,6 +12,12 @@ const ValueArrayAbbrev = AbbrevOp{ .array_vbr = 6 }; |
| 12 | const ConstantAbbrev = AbbrevOp{ .vbr = 6 }; | 12 | const ConstantAbbrev = AbbrevOp{ .vbr = 6 }; |
| 13 | const ConstantArrayAbbrev = AbbrevOp{ .array_vbr = 6 }; | 13 | const ConstantArrayAbbrev = AbbrevOp{ .array_vbr = 6 }; |
| 14 | | 14 | |
| | 15 | const MetadataAbbrev = AbbrevOp{ .vbr = 16 }; |
| | 16 | const MetadataArrayAbbrev = AbbrevOp{ .array_vbr = 16 }; |
| | 17 | |
| | 18 | const LineAbbrev = AbbrevOp{ .vbr = 8 }; |
| | 19 | const ColumnAbbrev = AbbrevOp{ .vbr = 8 }; |
| | 20 | |
| 15 | const BlockAbbrev = AbbrevOp{ .vbr = 6 }; | 21 | const BlockAbbrev = AbbrevOp{ .vbr = 6 }; |
| 16 | | 22 | |
| 17 | pub const Identification = struct { | 23 | pub const Identification = struct { |
| ... | @@ -574,6 +580,446 @@ pub const Constants = struct { | ... | @@ -574,6 +580,446 @@ pub const Constants = struct { |
| 574 | }; | 580 | }; |
| 575 | }; | 581 | }; |
| 576 | | 582 | |
| | 583 | pub const MetadataBlock = struct { |
| | 584 | pub const id = 15; |
| | 585 | |
| | 586 | pub const abbrevs = [_]type{ |
| | 587 | Strings, |
| | 588 | File, |
| | 589 | CompileUnit, |
| | 590 | Subprogram, |
| | 591 | LexicalBlock, |
| | 592 | Location, |
| | 593 | BasicType, |
| | 594 | CompositeType, |
| | 595 | DerivedType, |
| | 596 | SubroutineType, |
| | 597 | Enumerator, |
| | 598 | Subrange, |
| | 599 | Expression, |
| | 600 | Node, |
| | 601 | LocalVar, |
| | 602 | Parameter, |
| | 603 | GlobalVar, |
| | 604 | GlobalVarExpression, |
| | 605 | Constant, |
| | 606 | Name, |
| | 607 | NamedNode, |
| | 608 | }; |
| | 609 | |
| | 610 | pub const Strings = struct { |
| | 611 | pub const ops = [_]AbbrevOp{ |
| | 612 | .{ .literal = 35 }, |
| | 613 | .{ .vbr = 6 }, |
| | 614 | .{ .vbr = 6 }, |
| | 615 | .blob, |
| | 616 | }; |
| | 617 | num_strings: u32, |
| | 618 | strings_offset: u32, |
| | 619 | blob: []const u8, |
| | 620 | }; |
| | 621 | |
| | 622 | pub const File = struct { |
| | 623 | pub const ops = [_]AbbrevOp{ |
| | 624 | .{ .literal = 16 }, |
| | 625 | .{ .literal = 1 }, // is distinct |
| | 626 | MetadataAbbrev, // name |
| | 627 | MetadataAbbrev, // path |
| | 628 | .{ .literal = 0 }, // checksum |
| | 629 | .{ .literal = 0 }, // checksum |
| | 630 | }; |
| | 631 | |
| | 632 | name: Builder.MetadataString, |
| | 633 | path: Builder.MetadataString, |
| | 634 | }; |
| | 635 | |
| | 636 | pub const CompileUnit = struct { |
| | 637 | pub const ops = [_]AbbrevOp{ |
| | 638 | .{ .literal = 20 }, |
| | 639 | .{ .literal = 1 }, // is distinct |
| | 640 | .{ .literal = std.dwarf.LANG.C99 }, // source language |
| | 641 | MetadataAbbrev, // file |
| | 642 | MetadataAbbrev, // producer |
| | 643 | .{ .fixed = 1 }, // is optimized |
| | 644 | .{ .literal = 0 }, // raw flags |
| | 645 | .{ .literal = 0 }, // runtime version |
| | 646 | .{ .literal = 0 }, // split debug file name |
| | 647 | .{ .literal = 1 }, // emission kind |
| | 648 | MetadataAbbrev, // enum types |
| | 649 | .{ .literal = 0 }, // retained types |
| | 650 | .{ .literal = 0 }, // subprograms |
| | 651 | MetadataAbbrev, // global variables |
| | 652 | .{ .literal = 0 }, // imported entities |
| | 653 | .{ .literal = 0 }, // DWO ID |
| | 654 | .{ .literal = 0 }, // macros |
| | 655 | .{ .literal = 0 }, // split debug inlining |
| | 656 | .{ .literal = 0 }, // debug info profiling |
| | 657 | .{ .literal = 0 }, // name table kind |
| | 658 | .{ .literal = 0 }, // ranges base address |
| | 659 | .{ .literal = 0 }, // raw sysroot |
| | 660 | .{ .literal = 0 }, // raw SDK |
| | 661 | }; |
| | 662 | |
| | 663 | file: Builder.Metadata, |
| | 664 | producer: Builder.MetadataString, |
| | 665 | is_optimized: bool, |
| | 666 | enums: Builder.Metadata, |
| | 667 | globals: Builder.Metadata, |
| | 668 | }; |
| | 669 | |
| | 670 | pub const Subprogram = struct { |
| | 671 | pub const ops = [_]AbbrevOp{ |
| | 672 | .{ .literal = 21 }, |
| | 673 | .{ .literal = 0b111 }, // is distinct | has sp flags | has flags |
| | 674 | MetadataAbbrev, // scope |
| | 675 | MetadataAbbrev, // name |
| | 676 | MetadataAbbrev, // linkage name |
| | 677 | MetadataAbbrev, // file |
| | 678 | LineAbbrev, // line |
| | 679 | MetadataAbbrev, // type |
| | 680 | LineAbbrev, // scope line |
| | 681 | .{ .literal = 0 }, // containing type |
| | 682 | .{ .fixed = 32 }, // sp flags |
| | 683 | .{ .literal = 0 }, // virtual index |
| | 684 | .{ .fixed = 32 }, // flags |
| | 685 | MetadataAbbrev, // compile unit |
| | 686 | .{ .literal = 0 }, // template params |
| | 687 | .{ .literal = 0 }, // declaration |
| | 688 | .{ .literal = 0 }, // retained nodes |
| | 689 | .{ .literal = 0 }, // this adjustment |
| | 690 | .{ .literal = 0 }, // thrown types |
| | 691 | .{ .literal = 0 }, // annotations |
| | 692 | .{ .literal = 0 }, // target function name |
| | 693 | }; |
| | 694 | |
| | 695 | scope: Builder.Metadata, |
| | 696 | name: Builder.MetadataString, |
| | 697 | linkage_name: Builder.MetadataString, |
| | 698 | file: Builder.Metadata, |
| | 699 | line: u32, |
| | 700 | ty: Builder.Metadata, |
| | 701 | scope_line: u32, |
| | 702 | sp_flags: u32, |
| | 703 | flags: u32, |
| | 704 | compile_unit: Builder.Metadata, |
| | 705 | }; |
| | 706 | |
| | 707 | pub const LexicalBlock = struct { |
| | 708 | pub const ops = [_]AbbrevOp{ |
| | 709 | .{ .literal = 22 }, |
| | 710 | .{ .literal = 1 }, // is distinct |
| | 711 | MetadataAbbrev, // scope |
| | 712 | MetadataAbbrev, // file |
| | 713 | LineAbbrev, // line |
| | 714 | ColumnAbbrev, // column |
| | 715 | }; |
| | 716 | |
| | 717 | scope: Builder.Metadata, |
| | 718 | file: Builder.Metadata, |
| | 719 | line: u32, |
| | 720 | column: u32, |
| | 721 | }; |
| | 722 | |
| | 723 | pub const Location = struct { |
| | 724 | pub const ops = [_]AbbrevOp{ |
| | 725 | .{ .literal = 7 }, |
| | 726 | .{ .literal = 0 }, // is distinct |
| | 727 | LineAbbrev, // line |
| | 728 | ColumnAbbrev, // column |
| | 729 | MetadataAbbrev, // scope |
| | 730 | MetadataAbbrev, // inlined at |
| | 731 | .{ .literal = 0 }, // is implicit code |
| | 732 | }; |
| | 733 | |
| | 734 | line: u32, |
| | 735 | column: u32, |
| | 736 | scope: u32, |
| | 737 | inlined_at: Builder.Metadata, |
| | 738 | }; |
| | 739 | |
| | 740 | pub const BasicType = struct { |
| | 741 | pub const ops = [_]AbbrevOp{ |
| | 742 | .{ .literal = 15 }, |
| | 743 | .{ .literal = 1 }, // is distinct |
| | 744 | .{ .literal = std.dwarf.TAG.base_type }, // tag |
| | 745 | MetadataAbbrev, // name |
| | 746 | .{ .vbr = 6 }, // size in bits |
| | 747 | .{ .literal = 0 }, // align in bits |
| | 748 | .{ .vbr = 8 }, // encoding |
| | 749 | .{ .literal = 0 }, // flags |
| | 750 | }; |
| | 751 | |
| | 752 | name: Builder.MetadataString, |
| | 753 | size_in_bits: u64, |
| | 754 | encoding: u32, |
| | 755 | }; |
| | 756 | |
| | 757 | pub const CompositeType = struct { |
| | 758 | pub const ops = [_]AbbrevOp{ |
| | 759 | .{ .literal = 18 }, |
| | 760 | .{ .literal = 1 | 0x2 }, // is distinct | is not used in old type ref |
| | 761 | .{ .fixed = 32 }, // tag |
| | 762 | MetadataAbbrev, // name |
| | 763 | MetadataAbbrev, // file |
| | 764 | LineAbbrev, // line |
| | 765 | MetadataAbbrev, // scope |
| | 766 | MetadataAbbrev, // underlying type |
| | 767 | .{ .vbr = 6 }, // size in bits |
| | 768 | .{ .vbr = 6 }, // align in bits |
| | 769 | .{ .literal = 0 }, // offset in bits |
| | 770 | .{ .literal = 0 }, // flags |
| | 771 | MetadataAbbrev, // elements |
| | 772 | .{ .literal = 0 }, // runtime lang |
| | 773 | .{ .literal = 0 }, // vtable holder |
| | 774 | .{ .literal = 0 }, // template params |
| | 775 | .{ .literal = 0 }, // raw id |
| | 776 | .{ .literal = 0 }, // discriminator |
| | 777 | .{ .literal = 0 }, // data location |
| | 778 | .{ .literal = 0 }, // associated |
| | 779 | .{ .literal = 0 }, // allocated |
| | 780 | .{ .literal = 0 }, // rank |
| | 781 | .{ .literal = 0 }, // annotations |
| | 782 | }; |
| | 783 | |
| | 784 | tag: u32, |
| | 785 | name: Builder.MetadataString, |
| | 786 | file: Builder.Metadata, |
| | 787 | line: u32, |
| | 788 | scope: Builder.Metadata, |
| | 789 | underlying_type: Builder.Metadata, |
| | 790 | size_in_bits: u64, |
| | 791 | align_in_bits: u64, |
| | 792 | elements: Builder.Metadata, |
| | 793 | }; |
| | 794 | |
| | 795 | pub const DerivedType = struct { |
| | 796 | pub const ops = [_]AbbrevOp{ |
| | 797 | .{ .literal = 17 }, |
| | 798 | .{ .literal = 1 }, // is distinct |
| | 799 | .{ .fixed = 32 }, // tag |
| | 800 | MetadataAbbrev, // name |
| | 801 | MetadataAbbrev, // file |
| | 802 | LineAbbrev, // line |
| | 803 | MetadataAbbrev, // scope |
| | 804 | MetadataAbbrev, // underlying type |
| | 805 | .{ .vbr = 6 }, // size in bits |
| | 806 | .{ .vbr = 6 }, // align in bits |
| | 807 | .{ .vbr = 6 }, // offset in bits |
| | 808 | .{ .literal = 0 }, // flags |
| | 809 | .{ .literal = 0 }, // extra data |
| | 810 | }; |
| | 811 | |
| | 812 | tag: u32, |
| | 813 | name: Builder.MetadataString, |
| | 814 | file: Builder.Metadata, |
| | 815 | line: u32, |
| | 816 | scope: Builder.Metadata, |
| | 817 | underlying_type: Builder.Metadata, |
| | 818 | size_in_bits: u64, |
| | 819 | align_in_bits: u64, |
| | 820 | offset_in_bits: u64, |
| | 821 | }; |
| | 822 | |
| | 823 | pub const SubroutineType = struct { |
| | 824 | pub const ops = [_]AbbrevOp{ |
| | 825 | .{ .literal = 19 }, |
| | 826 | .{ .literal = 1 | 0x2 }, // is distinct | has no old type refs |
| | 827 | .{ .literal = 0 }, // flags |
| | 828 | MetadataAbbrev, // types |
| | 829 | .{ .literal = 0 }, // cc |
| | 830 | }; |
| | 831 | |
| | 832 | types: Builder.Metadata, |
| | 833 | }; |
| | 834 | |
| | 835 | pub const Enumerator = struct { |
| | 836 | pub const id = 14; |
| | 837 | |
| | 838 | pub const Flags = packed struct(u3) { |
| | 839 | distinct: bool = true, |
| | 840 | unsigned: bool, |
| | 841 | bigint: bool, |
| | 842 | }; |
| | 843 | |
| | 844 | pub const ops = [_]AbbrevOp{ |
| | 845 | .{ .literal = Enumerator.id }, |
| | 846 | .{ .fixed = @bitSizeOf(Flags) }, // flags |
| | 847 | .{ .vbr = 6 }, // bit width |
| | 848 | MetadataAbbrev, // name |
| | 849 | .{ .vbr = 16 }, // integer value |
| | 850 | }; |
| | 851 | |
| | 852 | flags: Flags, |
| | 853 | bit_width: u32, |
| | 854 | name: Builder.MetadataString, |
| | 855 | value: std.math.big.Limb, |
| | 856 | }; |
| | 857 | |
| | 858 | pub const Subrange = struct { |
| | 859 | pub const ops = [_]AbbrevOp{ |
| | 860 | .{ .literal = 0b11 }, |
| | 861 | MetadataAbbrev, // count |
| | 862 | MetadataAbbrev, // lower bound |
| | 863 | .{ .literal = 0 }, // upper bound |
| | 864 | .{ .literal = 0 }, // stride |
| | 865 | }; |
| | 866 | |
| | 867 | count: Builder.Metadata, |
| | 868 | lower_bound: Builder.Metadata, |
| | 869 | }; |
| | 870 | |
| | 871 | pub const Expression = struct { |
| | 872 | pub const ops = [_]AbbrevOp{ |
| | 873 | .{ .literal = 29 }, |
| | 874 | .{ .literal = 0 | (3 << 1) }, // is distinct | version |
| | 875 | MetadataArrayAbbrev, // elements |
| | 876 | }; |
| | 877 | |
| | 878 | elements: []const u32, |
| | 879 | }; |
| | 880 | |
| | 881 | pub const Node = struct { |
| | 882 | pub const ops = [_]AbbrevOp{ |
| | 883 | .{ .literal = 3 }, |
| | 884 | MetadataArrayAbbrev, // elements |
| | 885 | }; |
| | 886 | |
| | 887 | elements: []const Builder.Metadata, |
| | 888 | }; |
| | 889 | |
| | 890 | pub const LocalVar = struct { |
| | 891 | pub const ops = [_]AbbrevOp{ |
| | 892 | .{ .literal = 28 }, |
| | 893 | .{ .literal = 0b11 }, // is distinct | has alignment |
| | 894 | MetadataAbbrev, // scope |
| | 895 | MetadataAbbrev, // name |
| | 896 | MetadataAbbrev, // file |
| | 897 | LineAbbrev, // line |
| | 898 | MetadataAbbrev, // type |
| | 899 | .{ .literal = 0 }, // arg |
| | 900 | .{ .literal = 0 }, // flags |
| | 901 | .{ .literal = 0 }, // align bits |
| | 902 | .{ .literal = 0 }, // annotations |
| | 903 | }; |
| | 904 | |
| | 905 | scope: Builder.Metadata, |
| | 906 | name: Builder.MetadataString, |
| | 907 | file: Builder.Metadata, |
| | 908 | line: u32, |
| | 909 | ty: Builder.Metadata, |
| | 910 | }; |
| | 911 | |
| | 912 | pub const Parameter = struct { |
| | 913 | pub const ops = [_]AbbrevOp{ |
| | 914 | .{ .literal = 28 }, |
| | 915 | .{ .literal = 0b11 }, // is distinct | has alignment |
| | 916 | MetadataAbbrev, // scope |
| | 917 | MetadataAbbrev, // name |
| | 918 | MetadataAbbrev, // file |
| | 919 | LineAbbrev, // line |
| | 920 | MetadataAbbrev, // type |
| | 921 | .{ .vbr = 4 }, // arg |
| | 922 | .{ .literal = 0 }, // flags |
| | 923 | .{ .literal = 0 }, // align bits |
| | 924 | .{ .literal = 0 }, // annotations |
| | 925 | }; |
| | 926 | |
| | 927 | scope: Builder.Metadata, |
| | 928 | name: Builder.MetadataString, |
| | 929 | file: Builder.Metadata, |
| | 930 | line: u32, |
| | 931 | ty: Builder.Metadata, |
| | 932 | arg: u32, |
| | 933 | }; |
| | 934 | |
| | 935 | pub const GlobalVar = struct { |
| | 936 | pub const ops = [_]AbbrevOp{ |
| | 937 | .{ .literal = 27 }, |
| | 938 | .{ .literal = 0b101 }, // is distinct | version |
| | 939 | MetadataAbbrev, // scope |
| | 940 | MetadataAbbrev, // name |
| | 941 | MetadataAbbrev, // linkage name |
| | 942 | MetadataAbbrev, // file |
| | 943 | LineAbbrev, // line |
| | 944 | MetadataAbbrev, // type |
| | 945 | .{ .fixed = 1 }, // local |
| | 946 | .{ .literal = 1 }, // defined |
| | 947 | .{ .literal = 0 }, // static data members declaration |
| | 948 | .{ .literal = 0 }, // template params |
| | 949 | .{ .literal = 0 }, // align in bits |
| | 950 | .{ .literal = 0 }, // annotations |
| | 951 | }; |
| | 952 | |
| | 953 | scope: Builder.Metadata, |
| | 954 | name: Builder.MetadataString, |
| | 955 | linkage_name: Builder.MetadataString, |
| | 956 | file: Builder.Metadata, |
| | 957 | line: u32, |
| | 958 | ty: Builder.Metadata, |
| | 959 | local: bool, |
| | 960 | }; |
| | 961 | |
| | 962 | pub const GlobalVarExpression = struct { |
| | 963 | pub const ops = [_]AbbrevOp{ |
| | 964 | .{ .literal = 37 }, |
| | 965 | .{ .literal = 1 }, // is distinct |
| | 966 | MetadataAbbrev, // variable |
| | 967 | MetadataAbbrev, // expression |
| | 968 | }; |
| | 969 | |
| | 970 | variable: Builder.Metadata, |
| | 971 | expression: Builder.Metadata, |
| | 972 | }; |
| | 973 | |
| | 974 | pub const Constant = struct { |
| | 975 | pub const ops = [_]AbbrevOp{ |
| | 976 | .{ .literal = 2 }, |
| | 977 | MetadataAbbrev, // type |
| | 978 | MetadataAbbrev, // value |
| | 979 | }; |
| | 980 | |
| | 981 | ty: Builder.Type, |
| | 982 | constant: Builder.Constant, |
| | 983 | }; |
| | 984 | |
| | 985 | pub const Name = struct { |
| | 986 | pub const ops = [_]AbbrevOp{ |
| | 987 | .{ .literal = 4 }, |
| | 988 | .{ .array_fixed = 8 }, // name |
| | 989 | }; |
| | 990 | |
| | 991 | name: []const u8, |
| | 992 | }; |
| | 993 | |
| | 994 | pub const NamedNode = struct { |
| | 995 | pub const ops = [_]AbbrevOp{ |
| | 996 | .{ .literal = 10 }, |
| | 997 | MetadataArrayAbbrev, // elements |
| | 998 | }; |
| | 999 | |
| | 1000 | elements: []const Builder.Metadata, |
| | 1001 | }; |
| | 1002 | }; |
| | 1003 | |
| | 1004 | pub const FunctionMetadataBlock = struct { |
| | 1005 | pub const id = 15; |
| | 1006 | |
| | 1007 | pub const abbrevs = [_]type{ |
| | 1008 | Value, |
| | 1009 | }; |
| | 1010 | |
| | 1011 | pub const Value = struct { |
| | 1012 | pub const ops = [_]AbbrevOp{ |
| | 1013 | .{ .literal = 2 }, |
| | 1014 | .{ .fixed = 32 }, // variable |
| | 1015 | .{ .fixed = 32 }, // expression |
| | 1016 | }; |
| | 1017 | |
| | 1018 | ty: Builder.Type, |
| | 1019 | value: Builder.Value, |
| | 1020 | }; |
| | 1021 | }; |
| | 1022 | |
| 577 | pub const FunctionBlock = struct { | 1023 | pub const FunctionBlock = struct { |
| 578 | pub const id = 12; | 1024 | pub const id = 12; |
| 579 | | 1025 | |
| ... | @@ -610,6 +1056,8 @@ pub const FunctionBlock = struct { | ... | @@ -610,6 +1056,8 @@ pub const FunctionBlock = struct { |
| 610 | AtomicRmw, | 1056 | AtomicRmw, |
| 611 | CmpXchg, | 1057 | CmpXchg, |
| 612 | Fence, | 1058 | Fence, |
| | 1059 | DebugLoc, |
| | 1060 | DebugLocAgain, |
| 613 | }; | 1061 | }; |
| 614 | | 1062 | |
| 615 | pub const DeclareBlocks = struct { | 1063 | pub const DeclareBlocks = struct { |
| ... | @@ -1067,6 +1515,28 @@ pub const FunctionBlock = struct { | ... | @@ -1067,6 +1515,28 @@ pub const FunctionBlock = struct { |
| 1067 | ordering: Builder.AtomicOrdering, | 1515 | ordering: Builder.AtomicOrdering, |
| 1068 | sync_scope: Builder.SyncScope, | 1516 | sync_scope: Builder.SyncScope, |
| 1069 | }; | 1517 | }; |
| | 1518 | |
| | 1519 | pub const DebugLoc = struct { |
| | 1520 | pub const ops = [_]AbbrevOp{ |
| | 1521 | .{ .literal = 35 }, |
| | 1522 | .{ .fixed = 32 }, |
| | 1523 | .{ .fixed = 32 }, |
| | 1524 | .{ .fixed = 32 }, |
| | 1525 | .{ .fixed = 32 }, |
| | 1526 | .{ .fixed = 1 }, |
| | 1527 | }; |
| | 1528 | line: u32, |
| | 1529 | column: u32, |
| | 1530 | scope: Builder.Metadata, |
| | 1531 | inlined_at: Builder.Metadata, |
| | 1532 | is_implicit: bool, |
| | 1533 | }; |
| | 1534 | |
| | 1535 | pub const DebugLocAgain = struct { |
| | 1536 | pub const ops = [_]AbbrevOp{ |
| | 1537 | .{ .literal = 33 }, |
| | 1538 | }; |
| | 1539 | }; |
| 1070 | }; | 1540 | }; |
| 1071 | | 1541 | |
| 1072 | pub const FunctionValueSymbolTable = struct { | 1542 | pub const FunctionValueSymbolTable = struct { |