<div dir="ltr"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"> .. contents::</span><br style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"> :local:</span><br style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">- :depth: 3</span><br style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">+ :depth: 4</span><br>
<div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">Please revert this part of the patch. It makes the table of contents basically unreadable. (It causes each instruction/intrinsic to have a "Syntax", "Semantics", "Arguments", ... beneath it which severely bloats the ToC).</span></div>
<div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">For now, you can unnest the Single Value, Label, Metadata, Aggregate from under First Class, and have First Class just contain a list of all the first class types, with links to them.</span></div>
<div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">In the long run, the "Syntax", "Semantics", ... should probably be changed to not use section divisions for labeling. I'm looking perhaps at doing something like CMake does (e.g. <</span><a href="http://cmake.org/gitweb?p=cmake.git;a=tree;f=Help/variable;h=7e7a7c6f3e9f452d0e0e7c58e1f23c28367d7e18;hb=HEAD">http://cmake.org/gitweb?p=cmake.git;a=tree;f=Help/variable;h=7e7a7c6f3e9f452d0e0e7c58e1f23c28367d7e18;hb=HEAD</a>>), which helps keep things nicely factored (a Sphinx plugin then does a bit of touchup to join everything together into the final docs). Alternatively, we could use reST's field lists <<a href="http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists">http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists</a>> with a Sphinx plugin that recognizes and handles them nicely.</div>
<div><br></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">-- Sean Silva</span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></span></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 7, 2013 at 2:34 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Sat Dec 7 13:34:20 2013<br>
New Revision: 196661<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=196661&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=196661&view=rev</a><br>
Log:<br>
Remove the notion of primitive types.<br>
<br>
They were out of place since the introduction of arbitrary precision integer<br>
types.<br>
<br>
This also synchronizes the documentation to Types.h, so it refers to first class<br>
types and single value types.<br>
<br>
Modified:<br>
llvm/trunk/docs/LangRef.rst<br>
llvm/trunk/include/llvm/IR/Type.h<br>
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp<br>
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp<br>
llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp<br>
<br>
Modified: llvm/trunk/docs/LangRef.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=196661&r1=196660&r2=196661&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=196661&r1=196660&r2=196661&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/docs/LangRef.rst (original)<br>
+++ llvm/trunk/docs/LangRef.rst Sat Dec 7 13:34:20 2013<br>
@@ -4,7 +4,7 @@ LLVM Language Reference Manual<br>
<br>
.. contents::<br>
:local:<br>
- :depth: 3<br>
+ :depth: 4<br>
<br>
Abstract<br>
========<br>
@@ -1476,80 +1476,94 @@ transformation. A strong type system mak<br>
generated code and enables novel analyses and transformations that are<br>
not feasible to perform on normal three address code representations.<br>
<br>
-.. _typeclassifications:<br>
+.. _t_void:<br>
<br>
-Type Classifications<br>
---------------------<br>
+Void Type<br>
+---------<br>
<br>
-The types fall into a few useful classifications:<br>
+Overview:<br>
+^^^^^^^^^<br>
<br>
+The void type does not represent any value and has no size.<br>
<br>
-.. list-table::<br>
- :header-rows: 1<br>
+Syntax:<br>
+^^^^^^^<br>
+<br>
+::<br>
+<br>
+ void<br>
+<br>
+<br>
+.. _t_function:<br>
+<br>
+Function Type<br>
+-------------<br>
+<br>
+Overview:<br>
+^^^^^^^^^<br>
+<br>
+The function type can be thought of as a function signature. It consists of a<br>
+return type and a list of formal parameter types. The return type of a function<br>
+type is a void type or first class type --- except for :ref:`label <t_label>`<br>
+and :ref:`metadata <t_metadata>` types.<br>
+<br>
+Syntax:<br>
+^^^^^^^<br>
+<br>
+::<br>
<br>
- * - Classification<br>
- - Types<br>
+ <returntype> (<parameter list>)<br>
+<br>
+...where '``<parameter list>``' is a comma-separated list of type<br>
+specifiers. Optionally, the parameter list may include a type ``...``, which<br>
+indicates that the function takes a variable number of arguments. Variable<br>
+argument functions can access their arguments with the :ref:`variable argument<br>
+handling intrinsic <int_varargs>` functions. '``<returntype>``' is any type<br>
+except :ref:`label <t_label>` and :ref:`metadata <t_metadata>`.<br>
+<br>
+Examples:<br>
+^^^^^^^^^<br>
+<br>
++---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
+| ``i32 (i32)`` | function taking an ``i32``, returning an ``i32`` |<br>
++---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
+| ``float (i16, i32 *) *`` | :ref:`Pointer <t_pointer>` to a function that takes an ``i16`` and a :ref:`pointer <t_pointer>` to ``i32``, returning ``float``. |<br>
++---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
+| ``i32 (i8*, ...)`` | A vararg function that takes at least one :ref:`pointer <t_pointer>` to ``i8`` (char in C), which returns an integer. This is the signature for ``printf`` in LLVM. |<br>
++---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
+| ``{i32, i32} (i32)`` | A function taking an ``i32``, returning a :ref:`structure <t_struct>` containing two ``i32`` values |<br>
++---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
+<br>
+.. _t_firstclass:<br>
<br>
- * - :ref:`integer <t_integer>`<br>
- - ``i1``, ``i2``, ``i3``, ... ``i8``, ... ``i16``, ... ``i32``, ...<br>
- ``i64``, ...<br>
-<br>
- * - :ref:`floating point <t_floating>`<br>
- - ``half``, ``float``, ``double``, ``x86_fp80``, ``fp128``,<br>
- ``ppc_fp128``<br>
-<br>
-<br>
- * - first class<br>
-<br>
- .. _t_firstclass:<br>
-<br>
- - :ref:`integer <t_integer>`, :ref:`floating point <t_floating>`,<br>
- :ref:`pointer <t_pointer>`, :ref:`vector <t_vector>`,<br>
- :ref:`structure <t_struct>`, :ref:`array <t_array>`,<br>
- :ref:`label <t_label>`, :ref:`metadata <t_metadata>`.<br>
-<br>
- * - :ref:`primitive <t_primitive>`<br>
- - :ref:`label <t_label>`,<br>
- :ref:`void <t_void>`,<br>
- :ref:`integer <t_integer>`,<br>
- :ref:`floating point <t_floating>`,<br>
- :ref:`x86mmx <t_x86mmx>`,<br>
- :ref:`metadata <t_metadata>`.<br>
-<br>
- * - :ref:`derived <t_derived>`<br>
- - :ref:`array <t_array>`,<br>
- :ref:`function <t_function>`,<br>
- :ref:`pointer <t_pointer>`,<br>
- :ref:`structure <t_struct>`,<br>
- :ref:`vector <t_vector>`,<br>
- :ref:`opaque <t_opaque>`.<br>
+First Class Types<br>
+-----------------<br>
<br>
The :ref:`first class <t_firstclass>` types are perhaps the most important.<br>
Values of these types are the only ones which can be produced by<br>
instructions.<br>
<br>
-.. _t_primitive:<br>
+.. _t_single_value:<br>
<br>
-Primitive Types<br>
----------------<br>
+Single Value Types<br>
+^^^^^^^^^^^^^^^^^^<br>
<br>
-The primitive types are the fundamental building blocks of the LLVM<br>
-system.<br>
+These are the types that are valid in registers from CodeGen's perspective.<br>
<br>
.. _t_integer:<br>
<br>
Integer Type<br>
-^^^^^^^^^^^^<br>
+""""""""""""<br>
<br>
Overview:<br>
-"""""""""<br>
+*********<br>
<br>
The integer type is a very simple type that simply specifies an<br>
arbitrary bit width for the integer type desired. Any bit width from 1<br>
bit to 2\ :sup:`23`\ -1 (about 8 million) can be specified.<br>
<br>
Syntax:<br>
-"""""""<br>
+*******<br>
<br>
::<br>
<br>
@@ -1559,7 +1573,7 @@ The number of bits the integer will occu<br>
value.<br>
<br>
Examples:<br>
-"""""""""<br>
+*********<br>
<br>
+----------------+------------------------------------------------+<br>
| ``i1`` | a single-bit integer. |<br>
@@ -1572,7 +1586,7 @@ Examples:<br>
.. _t_floating:<br>
<br>
Floating Point Types<br>
-^^^^^^^^^^^^^^^^^^^^<br>
+""""""""""""""""""""<br>
<br>
.. list-table::<br>
:header-rows: 1<br>
@@ -1601,10 +1615,10 @@ Floating Point Types<br>
.. _t_x86mmx:<br>
<br>
X86mmx Type<br>
-^^^^^^^^^^^<br>
+"""""""""""<br>
<br>
Overview:<br>
-"""""""""<br>
+*********<br>
<br>
The x86mmx type represents a value held in an MMX register on an x86<br>
machine. The operations allowed on it are quite limited: parameters and<br>
@@ -1614,28 +1628,87 @@ and/or results of this type. There are n<br>
of this type.<br>
<br>
Syntax:<br>
-"""""""<br>
+*******<br>
<br>
::<br>
<br>
x86mmx<br>
<br>
-.. _t_void:<br>
<br>
-Void Type<br>
-^^^^^^^^^<br>
+.. _t_pointer:<br>
+<br>
+Pointer Type<br>
+""""""""""""<br>
<br>
Overview:<br>
-"""""""""<br>
+*********<br>
<br>
-The void type does not represent any value and has no size.<br>
+The pointer type is used to specify memory locations. Pointers are<br>
+commonly used to reference objects in memory.<br>
+<br>
+Pointer types may have an optional address space attribute defining the<br>
+numbered address space where the pointed-to object resides. The default<br>
+address space is number zero. The semantics of non-zero address spaces<br>
+are target-specific.<br>
+<br>
+Note that LLVM does not permit pointers to void (``void*``) nor does it<br>
+permit pointers to labels (``label*``). Use ``i8*`` instead.<br>
<br>
Syntax:<br>
-"""""""<br>
+*******<br>
<br>
::<br>
<br>
- void<br>
+ <type> *<br>
+<br>
+Examples:<br>
+*********<br>
+<br>
++-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
+| ``[4 x i32]*`` | A :ref:`pointer <t_pointer>` to :ref:`array <t_array>` of four ``i32`` values. |<br>
++-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
+| ``i32 (i32*) *`` | A :ref:`pointer <t_pointer>` to a :ref:`function <t_function>` that takes an ``i32*``, returning an ``i32``. |<br>
++-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
+| ``i32 addrspace(5)*`` | A :ref:`pointer <t_pointer>` to an ``i32`` value that resides in address space #5. |<br>
++-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
+<br>
+.. _t_vector:<br>
+<br>
+Vector Type<br>
+"""""""""""<br>
+<br>
+Overview:<br>
+*********<br>
+<br>
+A vector type is a simple derived type that represents a vector of<br>
+elements. Vector types are used when multiple primitive data are<br>
+operated in parallel using a single instruction (SIMD). A vector type<br>
+requires a size (number of elements) and an underlying primitive data<br>
+type. Vector types are considered :ref:`first class <t_firstclass>`.<br>
+<br>
+Syntax:<br>
+*******<br>
+<br>
+::<br>
+<br>
+ < <# elements> x <elementtype> ><br>
+<br>
+The number of elements is a constant integer value larger than 0;<br>
+elementtype may be any integer or floating point type, or a pointer to<br>
+these types. Vectors of size zero are not allowed.<br>
+<br>
+Examples:<br>
+*********<br>
+<br>
++-------------------+--------------------------------------------------+<br>
+| ``<4 x i32>`` | Vector of 4 32-bit integer values. |<br>
++-------------------+--------------------------------------------------+<br>
+| ``<8 x float>`` | Vector of 8 32-bit floating-point values. |<br>
++-------------------+--------------------------------------------------+<br>
+| ``<2 x i64>`` | Vector of 2 64-bit integer values. |<br>
++-------------------+--------------------------------------------------+<br>
+| ``<4 x i64*>`` | Vector of 4 pointers to 64-bit integer values. |<br>
++-------------------+--------------------------------------------------+<br>
<br>
.. _t_label:<br>
<br>
@@ -1672,18 +1745,6 @@ Syntax:<br>
<br>
metadata<br>
<br>
-.. _t_derived:<br>
-<br>
-Derived Types<br>
--------------<br>
-<br>
-The real power in LLVM comes from the derived types in the system. This<br>
-is what allows a programmer to represent arrays, functions, pointers,<br>
-and other useful types. Each of these types contain one or more element<br>
-types which may be a primitive type, or another derived type. For<br>
-example, it is possible to have a two dimensional array, using an array<br>
-as the element type of another array.<br>
-<br>
.. _t_aggregate:<br>
<br>
Aggregate Types<br>
@@ -1697,17 +1758,17 @@ aggregate types.<br>
.. _t_array:<br>
<br>
Array Type<br>
-^^^^^^^^^^<br>
+""""""""""<br>
<br>
Overview:<br>
-"""""""""<br>
+*********<br>
<br>
The array type is a very simple derived type that arranges elements<br>
sequentially in memory. The array type requires a size (number of<br>
elements) and an underlying data type.<br>
<br>
Syntax:<br>
-"""""""<br>
+*******<br>
<br>
::<br>
<br>
@@ -1717,7 +1778,7 @@ The number of elements is a constant int<br>
be any type with a size.<br>
<br>
Examples:<br>
-"""""""""<br>
+*********<br>
<br>
+------------------+--------------------------------------+<br>
| ``[40 x i32]`` | Array of 40 32-bit integer values. |<br>
@@ -1745,53 +1806,13 @@ LLVM with a zero length array type. An i<br>
arrays' in LLVM could use the type "``{ i32, [0 x float]}``", for<br>
example.<br>
<br>
-.. _t_function:<br>
-<br>
-Function Type<br>
-^^^^^^^^^^^^^<br>
-<br>
-Overview:<br>
-"""""""""<br>
-<br>
-The function type can be thought of as a function signature. It consists of a<br>
-return type and a list of formal parameter types. The return type of a function<br>
-type is a void type or first class type --- except for :ref:`label <t_label>`<br>
-and :ref:`metadata <t_metadata>` types.<br>
-<br>
-Syntax:<br>
-"""""""<br>
-<br>
-::<br>
-<br>
- <returntype> (<parameter list>)<br>
-<br>
-...where '``<parameter list>``' is a comma-separated list of type<br>
-specifiers. Optionally, the parameter list may include a type ``...``, which<br>
-indicates that the function takes a variable number of arguments. Variable<br>
-argument functions can access their arguments with the :ref:`variable argument<br>
-handling intrinsic <int_varargs>` functions. '``<returntype>``' is any type<br>
-except :ref:`label <t_label>` and :ref:`metadata <t_metadata>`.<br>
-<br>
-Examples:<br>
-"""""""""<br>
-<br>
-+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
-| ``i32 (i32)`` | function taking an ``i32``, returning an ``i32`` |<br>
-+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
-| ``float (i16, i32 *) *`` | :ref:`Pointer <t_pointer>` to a function that takes an ``i16`` and a :ref:`pointer <t_pointer>` to ``i32``, returning ``float``. |<br>
-+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
-| ``i32 (i8*, ...)`` | A vararg function that takes at least one :ref:`pointer <t_pointer>` to ``i8`` (char in C), which returns an integer. This is the signature for ``printf`` in LLVM. |<br>
-+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
-| ``{i32, i32} (i32)`` | A function taking an ``i32``, returning a :ref:`structure <t_struct>` containing two ``i32`` values |<br>
-+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
-<br>
.. _t_struct:<br>
<br>
Structure Type<br>
-^^^^^^^^^^^^^^<br>
+""""""""""""""<br>
<br>
Overview:<br>
-"""""""""<br>
+*********<br>
<br>
The structure type is used to represent a collection of data members<br>
together in memory. The elements of a structure may be any type that has<br>
@@ -1816,7 +1837,7 @@ or opaque since there is no way to write<br>
recursive, can be opaqued, and are never uniqued.<br>
<br>
Syntax:<br>
-"""""""<br>
+*******<br>
<br>
::<br>
<br>
@@ -1824,7 +1845,7 @@ Syntax:<br>
%T2 = type <{ <type list> }> ; Identified packed struct type<br>
<br>
Examples:<br>
-"""""""""<br>
+*********<br>
<br>
+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+<br>
| ``{ i32, i32, i32 }`` | A triple of three ``i32`` values |<br>
@@ -1837,17 +1858,17 @@ Examples:<br>
.. _t_opaque:<br>
<br>
Opaque Structure Types<br>
-^^^^^^^^^^^^^^^^^^^^^^<br>
+""""""""""""""""""""""<br>
<br>
Overview:<br>
-"""""""""<br>
+*********<br>
<br>
Opaque structure types are used to represent named structure types that<br>
do not have a body specified. This corresponds (for example) to the C<br>
notion of a forward declared structure.<br>
<br>
Syntax:<br>
-"""""""<br>
+*******<br>
<br>
::<br>
<br>
@@ -1855,87 +1876,12 @@ Syntax:<br>
%52 = type opaque<br>
<br>
Examples:<br>
-"""""""""<br>
+*********<br>
<br>
+--------------+-------------------+<br>
| ``opaque`` | An opaque type. |<br>
+--------------+-------------------+<br>
<br>
-.. _t_pointer:<br>
-<br>
-Pointer Type<br>
-^^^^^^^^^^^^<br>
-<br>
-Overview:<br>
-"""""""""<br>
-<br>
-The pointer type is used to specify memory locations. Pointers are<br>
-commonly used to reference objects in memory.<br>
-<br>
-Pointer types may have an optional address space attribute defining the<br>
-numbered address space where the pointed-to object resides. The default<br>
-address space is number zero. The semantics of non-zero address spaces<br>
-are target-specific.<br>
-<br>
-Note that LLVM does not permit pointers to void (``void*``) nor does it<br>
-permit pointers to labels (``label*``). Use ``i8*`` instead.<br>
-<br>
-Syntax:<br>
-"""""""<br>
-<br>
-::<br>
-<br>
- <type> *<br>
-<br>
-Examples:<br>
-"""""""""<br>
-<br>
-+-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
-| ``[4 x i32]*`` | A :ref:`pointer <t_pointer>` to :ref:`array <t_array>` of four ``i32`` values. |<br>
-+-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
-| ``i32 (i32*) *`` | A :ref:`pointer <t_pointer>` to a :ref:`function <t_function>` that takes an ``i32*``, returning an ``i32``. |<br>
-+-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
-| ``i32 addrspace(5)*`` | A :ref:`pointer <t_pointer>` to an ``i32`` value that resides in address space #5. |<br>
-+-------------------------+--------------------------------------------------------------------------------------------------------------+<br>
-<br>
-.. _t_vector:<br>
-<br>
-Vector Type<br>
-^^^^^^^^^^^<br>
-<br>
-Overview:<br>
-"""""""""<br>
-<br>
-A vector type is a simple derived type that represents a vector of<br>
-elements. Vector types are used when multiple primitive data are<br>
-operated in parallel using a single instruction (SIMD). A vector type<br>
-requires a size (number of elements) and an underlying primitive data<br>
-type. Vector types are considered :ref:`first class <t_firstclass>`.<br>
-<br>
-Syntax:<br>
-"""""""<br>
-<br>
-::<br>
-<br>
- < <# elements> x <elementtype> ><br>
-<br>
-The number of elements is a constant integer value larger than 0;<br>
-elementtype may be any integer or floating point type, or a pointer to<br>
-these types. Vectors of size zero are not allowed.<br>
-<br>
-Examples:<br>
-"""""""""<br>
-<br>
-+-------------------+--------------------------------------------------+<br>
-| ``<4 x i32>`` | Vector of 4 32-bit integer values. |<br>
-+-------------------+--------------------------------------------------+<br>
-| ``<8 x float>`` | Vector of 8 32-bit floating-point values. |<br>
-+-------------------+--------------------------------------------------+<br>
-| ``<2 x i64>`` | Vector of 2 64-bit integer values. |<br>
-+-------------------+--------------------------------------------------+<br>
-| ``<4 x i64*>`` | Vector of 4 pointers to 64-bit integer values. |<br>
-+-------------------+--------------------------------------------------+<br>
-<br>
Constants<br>
=========<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/IR/Type.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Type.h?rev=196661&r1=196660&r2=196661&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Type.h?rev=196661&r1=196660&r2=196661&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/Type.h (original)<br>
+++ llvm/trunk/include/llvm/IR/Type.h Sat Dec 7 13:34:20 2013<br>
@@ -71,10 +71,7 @@ public:<br>
StructTyID, ///< 12: Structures<br>
ArrayTyID, ///< 13: Arrays<br>
PointerTyID, ///< 14: Pointers<br>
- VectorTyID, ///< 15: SIMD 'packed' format, or other vector type<br>
-<br>
- LastPrimitiveTyID = X86_MMXTyID,<br>
- FirstDerivedTyID = IntegerTyID<br>
+ VectorTyID ///< 15: SIMD 'packed' format, or other vector type<br>
};<br>
<br>
private:<br>
@@ -239,12 +236,6 @@ public:<br>
/// elements or all its elements are empty.<br>
bool isEmptyTy() const;<br>
<br>
- /// Here are some useful little methods to query what type derived types are<br>
- /// Note that all other types can just compare to see if this == Type::xxxTy;<br>
- ///<br>
- bool isPrimitiveType() const { return getTypeID() <= LastPrimitiveTyID; }<br>
- bool isDerivedType() const { return getTypeID() >= FirstDerivedTyID; }<br>
-<br>
/// isFirstClassType - Return true if the type is "first class", meaning it<br>
/// is a valid type for a Value.<br>
///<br>
@@ -257,9 +248,8 @@ public:<br>
/// and array types.<br>
///<br>
bool isSingleValueType() const {<br>
- return (getTypeID() != VoidTyID && isPrimitiveType()) ||<br>
- getTypeID() == IntegerTyID || getTypeID() == PointerTyID ||<br>
- getTypeID() == VectorTyID;<br>
+ return isFloatingPointTy() || isX86_MMXTy() || isIntegerTy() ||<br>
+ isPointerTy() || isVectorTy();<br>
}<br>
<br>
/// isAggregateType - Return true if the type is an aggregate type. This<br>
<br>
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=196661&r1=196660&r2=196661&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=196661&r1=196660&r2=196661&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)<br>
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Sat Dec 7 13:34:20 2013<br>
@@ -361,25 +361,25 @@ void CppWriter::printEscapedString(const<br>
}<br>
<br>
std::string CppWriter::getCppName(Type* Ty) {<br>
- // First, handle the primitive types .. easy<br>
- if (Ty->isPrimitiveType() || Ty->isIntegerTy()) {<br>
- switch (Ty->getTypeID()) {<br>
- case Type::VoidTyID: return "Type::getVoidTy(mod->getContext())";<br>
- case Type::IntegerTyID: {<br>
- unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();<br>
- return "IntegerType::get(mod->getContext(), " + utostr(BitWidth) + ")";<br>
- }<br>
- case Type::X86_FP80TyID: return "Type::getX86_FP80Ty(mod->getContext())";<br>
- case Type::FloatTyID: return "Type::getFloatTy(mod->getContext())";<br>
- case Type::DoubleTyID: return "Type::getDoubleTy(mod->getContext())";<br>
- case Type::LabelTyID: return "Type::getLabelTy(mod->getContext())";<br>
- case Type::X86_MMXTyID: return "Type::getX86_MMXTy(mod->getContext())";<br>
- default:<br>
- error("Invalid primitive type");<br>
- break;<br>
- }<br>
- // shouldn't be returned, but make it sensible<br>
+ switch (Ty->getTypeID()) {<br>
+ default:<br>
+ break;<br>
+ case Type::VoidTyID:<br>
return "Type::getVoidTy(mod->getContext())";<br>
+ case Type::IntegerTyID: {<br>
+ unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();<br>
+ return "IntegerType::get(mod->getContext(), " + utostr(BitWidth) + ")";<br>
+ }<br>
+ case Type::X86_FP80TyID:<br>
+ return "Type::getX86_FP80Ty(mod->getContext())";<br>
+ case Type::FloatTyID:<br>
+ return "Type::getFloatTy(mod->getContext())";<br>
+ case Type::DoubleTyID:<br>
+ return "Type::getDoubleTy(mod->getContext())";<br>
+ case Type::LabelTyID:<br>
+ return "Type::getLabelTy(mod->getContext())";<br>
+ case Type::X86_MMXTyID:<br>
+ return "Type::getX86_MMXTy(mod->getContext())";<br>
}<br>
<br>
// Now, see if we've seen the type before and return that<br>
@@ -537,7 +537,8 @@ void CppWriter::printAttributes(const At<br>
<br>
void CppWriter::printType(Type* Ty) {<br>
// We don't print definitions for primitive types<br>
- if (Ty->isPrimitiveType() || Ty->isIntegerTy())<br>
+ if (Ty->isFloatingPointTy() || Ty->isX86_MMXTy() || Ty->isIntegerTy() ||<br>
+ Ty->isLabelTy() || Ty->isMetadataTy() || Ty->isVoidTy())<br>
return;<br>
<br>
// If we already defined this type, we don't need to define it again.<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=196661&r1=196660&r2=196661&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=196661&r1=196660&r2=196661&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Sat Dec 7 13:34:20 2013<br>
@@ -430,7 +430,7 @@ void NVPTXAsmPrinter::printReturnValStr(<br>
O << " (";<br>
<br>
if (isABI) {<br>
- if (Ty->isPrimitiveType() || Ty->isIntegerTy()) {<br>
+ if (Ty->isFloatingPointTy() || Ty->isIntegerTy()) {<br>
unsigned size = 0;<br>
if (const IntegerType *ITy = dyn_cast<IntegerType>(Ty)) {<br>
size = ITy->getBitWidth();<br>
@@ -1207,7 +1207,7 @@ void NVPTXAsmPrinter::printModuleLevelGV<br>
else<br>
O << " .align " << GVar->getAlignment();<br>
<br>
- if (ETy->isPrimitiveType() || ETy->isIntegerTy() || isa<PointerType>(ETy)) {<br>
+ if (ETy->isSingleValueType()) {<br>
O << " .";<br>
// Special case: ABI requires that we use .u8 for predicates<br>
if (ETy->isIntegerTy(1))<br>
@@ -1378,7 +1378,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVaria<br>
else<br>
O << " .align " << GVar->getAlignment();<br>
<br>
- if (ETy->isPrimitiveType() || ETy->isIntegerTy() || isa<PointerType>(ETy)) {<br>
+ if (ETy->isSingleValueType()) {<br>
O << " .";<br>
O << getPTXFundamentalTypeStr(ETy);<br>
O << " ";<br>
@@ -1410,7 +1410,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVaria<br>
}<br>
<br>
static unsigned int getOpenCLAlignment(const DataLayout *TD, Type *Ty) {<br>
- if (Ty->isPrimitiveType() || Ty->isIntegerTy() || isa<PointerType>(Ty))<br>
+ if (Ty->isSingleValueType())<br>
return TD->getPrefTypeAlignment(Ty);<br>
<br>
const ArrayType *ATy = dyn_cast<ArrayType>(Ty);<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=196661&r1=196660&r2=196661&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=196661&r1=196660&r2=196661&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp Sat Dec 7 13:34:20 2013<br>
@@ -361,7 +361,7 @@ NVPTXTargetLowering::getPrototype(Type *<br>
O << "()";<br>
} else {<br>
O << "(";<br>
- if (retTy->isPrimitiveType() || retTy->isIntegerTy()) {<br>
+ if (retTy->isFloatingPointTy() || retTy->isIntegerTy()) {<br>
unsigned size = 0;<br>
if (const IntegerType *ITy = dyn_cast<IntegerType>(retTy)) {<br>
size = ITy->getBitWidth();<br>
@@ -856,8 +856,7 @@ SDValue NVPTXTargetLowering::LowerCall(T<br>
// .param .align 16 .b8 retval0[<size-in-bytes>], or<br>
// .param .b<size-in-bits> retval0<br>
unsigned resultsz = TD->getTypeAllocSizeInBits(retTy);<br>
- if (retTy->isPrimitiveType() || retTy->isIntegerTy() ||<br>
- retTy->isPointerTy()) {<br>
+ if (retTy->isSingleValueType()) {<br>
// Scalar needs to be at least 32bit wide<br>
if (resultsz < 32)<br>
resultsz = 32;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>