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