-C/C++ basic types
------------------
-
-The following are the basic type descriptors for C/C++ core types:
-
-bool
-^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"bool", ;; Name
- i32 0, ;; Line number
- i64 8, ;; Size in Bits
- i64 8, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 2 ;; Encoding
- }
-
-char
-^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"char", ;; Name
- i32 0, ;; Line number
- i64 8, ;; Size in Bits
- i64 8, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 6 ;; Encoding
- }
-
-unsigned char
-^^^^^^^^^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"unsigned char",
- i32 0, ;; Line number
- i64 8, ;; Size in Bits
- i64 8, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 8 ;; Encoding
- }
-
-short
-^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"short int",
- i32 0, ;; Line number
- i64 16, ;; Size in Bits
- i64 16, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 5 ;; Encoding
- }
-
-unsigned short
-^^^^^^^^^^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"short unsigned int",
- i32 0, ;; Line number
- i64 16, ;; Size in Bits
- i64 16, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 7 ;; Encoding
- }
-
-int
-^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"int", ;; Name
- i32 0, ;; Line number
- i64 32, ;; Size in Bits
- i64 32, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 5 ;; Encoding
- }
-
-unsigned int
-^^^^^^^^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"unsigned int",
- i32 0, ;; Line number
- i64 32, ;; Size in Bits
- i64 32, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 7 ;; Encoding
- }
-
-long long
-^^^^^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"long long int",
- i32 0, ;; Line number
- i64 64, ;; Size in Bits
- i64 64, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 5 ;; Encoding
- }
-
-unsigned long long
-^^^^^^^^^^^^^^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"long long unsigned int",
- i32 0, ;; Line number
- i64 64, ;; Size in Bits
- i64 64, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 7 ;; Encoding
- }
-
-float
-^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"float",
- i32 0, ;; Line number
- i64 32, ;; Size in Bits
- i64 32, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 4 ;; Encoding
- }
-
-double
-^^^^^^
-
-.. code-block:: llvm
-
- !2 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"double",;; Name
- i32 0, ;; Line number
- i64 64, ;; Size in Bits
- i64 64, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 4 ;; Encoding
- }
-
-C/C++ derived types
--------------------
-
-Given the following as an example of C/C++ derived type:
-
-.. code-block:: c
-
- typedef const int *IntPtr;
-
-a C/C++ front-end would generate the following descriptors:
-
-.. code-block:: llvm
-
- ;;
- ;; Define the typedef "IntPtr".
- ;;
- !2 = metadata !{
- i32 786454, ;; Tag
- metadata !3, ;; File
- metadata !1, ;; Context
- metadata !"IntPtr", ;; Name
- i32 0, ;; Line number
- i64 0, ;; Size in bits
- i64 0, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- metadata !4 ;; Derived From type
- }
- ;;
- ;; Define the pointer type.
- ;;
- !4 = metadata !{
- i32 786447, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"", ;; Name
- i32 0, ;; Line number
- i64 64, ;; Size in bits
- i64 64, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- metadata !5 ;; Derived From type
- }
- ;;
- ;; Define the const type.
- ;;
- !5 = metadata !{
- i32 786470, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"", ;; Name
- i32 0, ;; Line number
- i64 0, ;; Size in bits
- i64 0, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- metadata !6 ;; Derived From type
- }
- ;;
- ;; Define the int type.
- ;;
- !6 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"int", ;; Name
- i32 0, ;; Line number
- i64 32, ;; Size in bits
- i64 32, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- i32 5 ;; Encoding
- }
-
-C/C++ struct/union types
-------------------------
-
-Given the following as an example of C/C++ struct type:
-
-.. code-block:: c
-
- struct Color {
- unsigned Red;
- unsigned Green;
- unsigned Blue;
- };
-
-a C/C++ front-end would generate the following descriptors:
-
-.. code-block:: llvm
-
- ;;
- ;; Define basic type for unsigned int.
- ;;
- !5 = metadata !{
- i32 786468, ;; Tag
- null, ;; File
- null, ;; Context
- metadata !"unsigned int",
- i32 0, ;; Line number
- i64 32, ;; Size in Bits
- i64 32, ;; Align in Bits
- i64 0, ;; Offset in Bits
- i32 0, ;; Flags
- i32 7 ;; Encoding
- }
- ;;
- ;; Define composite type for struct Color.
- ;;
- !2 = metadata !{
- i32 786451, ;; Tag
- metadata !1, ;; Compile unit
- null, ;; Context
- metadata !"Color", ;; Name
- i32 1, ;; Line number
- i64 96, ;; Size in bits
- i64 32, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- null, ;; Derived From
- metadata !3, ;; Elements
- i32 0, ;; Runtime Language
- null, ;; Base type containing the vtable pointer for this type
- null ;; Template parameters
- }
-
- ;;
- ;; Define the Red field.
- ;;
- !4 = metadata !{
- i32 786445, ;; Tag
- metadata !1, ;; File
- metadata !1, ;; Context
- metadata !"Red", ;; Name
- i32 2, ;; Line number
- i64 32, ;; Size in bits
- i64 32, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- metadata !5 ;; Derived From type
- }
-
- ;;
- ;; Define the Green field.
- ;;
- !6 = metadata !{
- i32 786445, ;; Tag
- metadata !1, ;; File
- metadata !1, ;; Context
- metadata !"Green", ;; Name
- i32 3, ;; Line number
- i64 32, ;; Size in bits
- i64 32, ;; Align in bits
- i64 32, ;; Offset in bits
- i32 0, ;; Flags
- metadata !5 ;; Derived From type
- }
-
- ;;
- ;; Define the Blue field.
- ;;
- !7 = metadata !{
- i32 786445, ;; Tag
- metadata !1, ;; File
- metadata !1, ;; Context
- metadata !"Blue", ;; Name
- i32 4, ;; Line number
- i64 32, ;; Size in bits
- i64 32, ;; Align in bits
- i64 64, ;; Offset in bits
- i32 0, ;; Flags
- metadata !5 ;; Derived From type
- }
-
- ;;
- ;; Define the array of fields used by the composite type Color.
- ;;
- !3 = metadata !{metadata !4, metadata !6, metadata !7}
-
-C/C++ enumeration types
------------------------
-
-Given the following as an example of C/C++ enumeration type:
-
-.. code-block:: c
-
- enum Trees {
- Spruce = 100,
- Oak = 200,
- Maple = 300
- };
-
-a C/C++ front-end would generate the following descriptors:
-
-.. code-block:: llvm
-
- ;;
- ;; Define composite type for enum Trees
- ;;
- !2 = metadata !{
- i32 786436, ;; Tag
- metadata !1, ;; File
- metadata !1, ;; Context
- metadata !"Trees", ;; Name
- i32 1, ;; Line number
- i64 32, ;; Size in bits
- i64 32, ;; Align in bits
- i64 0, ;; Offset in bits
- i32 0, ;; Flags
- null, ;; Derived From type
- metadata !3, ;; Elements
- i32 0 ;; Runtime language
- }
-
- ;;
- ;; Define the array of enumerators used by composite type Trees.
- ;;
- !3 = metadata !{metadata !4, metadata !5, metadata !6}
-
- ;;
- ;; Define Spruce enumerator.
- ;;
- !4 = metadata !{i32 786472, metadata !"Spruce", i64 100}
-
- ;;
- ;; Define Oak enumerator.
- ;;
- !5 = metadata !{i32 786472, metadata !"Oak", i64 200}
-
- ;;
- ;; Define Maple enumerator.
- ;;
- !6 = metadata !{i32 786472, metadata !"Maple", i64 300}
-