Thanks to Sean Silva for the suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196924
91177308-0d34-0410-b5e6-
96231b3b80d8
The void type does not represent any value and has no size.
The void type does not represent any value and has no size.
Function Type
-------------
Function Type
-------------
The function type can be thought of as a function signature. It consists of a
return type and a list of formal parameter types. The return type of a function
type is a void type or first class type --- except for :ref:`label <t_label>`
and :ref:`metadata <t_metadata>` types.
The function type can be thought of as a function signature. It consists of a
return type and a list of formal parameter types. The return type of a function
type is a void type or first class type --- except for :ref:`label <t_label>`
and :ref:`metadata <t_metadata>` types.
handling intrinsic <int_varargs>` functions. '``<returntype>``' is any type
except :ref:`label <t_label>` and :ref:`metadata <t_metadata>`.
handling intrinsic <int_varargs>` functions. '``<returntype>``' is any type
except :ref:`label <t_label>` and :ref:`metadata <t_metadata>`.
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``i32 (i32)`` | function taking an ``i32``, returning an ``i32`` |
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``i32 (i32)`` | function taking an ``i32``, returning an ``i32`` |
Integer Type
""""""""""""
Integer Type
""""""""""""
The integer type is a very simple type that simply specifies an
arbitrary bit width for the integer type desired. Any bit width from 1
bit to 2\ :sup:`23`\ -1 (about 8 million) can be specified.
The integer type is a very simple type that simply specifies an
arbitrary bit width for the integer type desired. Any bit width from 1
bit to 2\ :sup:`23`\ -1 (about 8 million) can be specified.
The x86mmx type represents a value held in an MMX register on an x86
machine. The operations allowed on it are quite limited: parameters and
The x86mmx type represents a value held in an MMX register on an x86
machine. The operations allowed on it are quite limited: parameters and
and/or results of this type. There are no arrays, vectors or constants
of this type.
and/or results of this type. There are no arrays, vectors or constants
of this type.
Pointer Type
""""""""""""
Pointer Type
""""""""""""
The pointer type is used to specify memory locations. Pointers are
commonly used to reference objects in memory.
The pointer type is used to specify memory locations. Pointers are
commonly used to reference objects in memory.
Note that LLVM does not permit pointers to void (``void*``) nor does it
permit pointers to labels (``label*``). Use ``i8*`` instead.
Note that LLVM does not permit pointers to void (``void*``) nor does it
permit pointers to labels (``label*``). Use ``i8*`` instead.
+-------------------------+--------------------------------------------------------------------------------------------------------------+
| ``[4 x i32]*`` | A :ref:`pointer <t_pointer>` to :ref:`array <t_array>` of four ``i32`` values. |
+-------------------------+--------------------------------------------------------------------------------------------------------------+
| ``[4 x i32]*`` | A :ref:`pointer <t_pointer>` to :ref:`array <t_array>` of four ``i32`` values. |
A vector type is a simple derived type that represents a vector of
elements. Vector types are used when multiple primitive data are
A vector type is a simple derived type that represents a vector of
elements. Vector types are used when multiple primitive data are
requires a size (number of elements) and an underlying primitive data
type. Vector types are considered :ref:`first class <t_firstclass>`.
requires a size (number of elements) and an underlying primitive data
type. Vector types are considered :ref:`first class <t_firstclass>`.
elementtype may be any integer or floating point type, or a pointer to
these types. Vectors of size zero are not allowed.
elementtype may be any integer or floating point type, or a pointer to
these types. Vectors of size zero are not allowed.
+-------------------+--------------------------------------------------+
| ``<4 x i32>`` | Vector of 4 32-bit integer values. |
+-------------------+--------------------------------------------------+
| ``<4 x i32>`` | Vector of 4 32-bit integer values. |
The label type represents code labels.
The label type represents code labels.
Metadata Type
^^^^^^^^^^^^^
Metadata Type
^^^^^^^^^^^^^
The metadata type represents embedded metadata. No derived types may be
created from metadata except for :ref:`function <t_function>` arguments.
The metadata type represents embedded metadata. No derived types may be
created from metadata except for :ref:`function <t_function>` arguments.
The array type is a very simple derived type that arranges elements
sequentially in memory. The array type requires a size (number of
elements) and an underlying data type.
The array type is a very simple derived type that arranges elements
sequentially in memory. The array type requires a size (number of
elements) and an underlying data type.
The number of elements is a constant integer value; ``elementtype`` may
be any type with a size.
The number of elements is a constant integer value; ``elementtype`` may
be any type with a size.
+------------------+--------------------------------------+
| ``[40 x i32]`` | Array of 40 32-bit integer values. |
+------------------+--------------------------------------+
| ``[40 x i32]`` | Array of 40 32-bit integer values. |
Structure Type
""""""""""""""
Structure Type
""""""""""""""
The structure type is used to represent a collection of data members
together in memory. The elements of a structure may be any type that has
The structure type is used to represent a collection of data members
together in memory. The elements of a structure may be any type that has
or opaque since there is no way to write one. Identified types can be
recursive, can be opaqued, and are never uniqued.
or opaque since there is no way to write one. Identified types can be
recursive, can be opaqued, and are never uniqued.
::
%T1 = type { <type list> } ; Identified normal struct type
%T2 = type <{ <type list> }> ; Identified packed struct type
::
%T1 = type { <type list> } ; Identified normal struct type
%T2 = type <{ <type list> }> ; Identified packed struct type
+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``{ i32, i32, i32 }`` | A triple of three ``i32`` values |
+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``{ i32, i32, i32 }`` | A triple of three ``i32`` values |
Opaque Structure Types
""""""""""""""""""""""
Opaque Structure Types
""""""""""""""""""""""
Opaque structure types are used to represent named structure types that
do not have a body specified. This corresponds (for example) to the C
notion of a forward declared structure.
Opaque structure types are used to represent named structure types that
do not have a body specified. This corresponds (for example) to the C
notion of a forward declared structure.
::
%X = type opaque
%52 = type opaque
::
%X = type opaque
%52 = type opaque
+--------------+-------------------+
| ``opaque`` | An opaque type. |
+--------------+-------------------+
| ``opaque`` | An opaque type. |