[LLVMdev] Are integer types primitive?

Chandler Carruth chandlerc at google.com
Mon Aug 12 14:15:06 PDT 2013


Originally, the distinguishing feature of "primitive" types was that they
were enumerable and not parameterized on anything.

Then we moved to arbitrary bit-width integers types to generalize things
significantly (the right move IMO).

Thus, integers were no longer technically primitive types, and their
categorization in code has changed to reflect this.


But that doesn't make *any sense*. The documentation for primitive types
also is still written in a way that would include integers.


I think we just need a new distinguishing criteria for primitive versus
derived types, and (to me) one immediately presents itself. Derived types
are types composed of some *other* LLVM type(s) and additional information.
Primitive types are not decomposable into any other LLVM type. Thus,
pointers, arrays, vectors, and structures are derived from other LLVM
types, while integers are primitive types and just happen to be
parameterized on a specific bitwidth.

If others agree, we should update both code and documentation to
consistently document this distinction. Doing so would also require
auditing *all* uses of the primitive information. I suspect there may be a
few other places that should be clarified besides the one Joey points out.

CC-ing Chris as this is really his call.
-Chandler


On Sun, Aug 11, 2013 at 4:52 PM, Keno Fischer <kfischer at csail.mit.edu>wrote:

> The LLVM docs seem to indicate that integer types are considered
> primitive, however looking at the code I see `FirstDerivedTyID =
> IntegerTyID`, implying that integers are derived rather than primitive.
> Should the docs be updated?
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130812/1df519e2/attachment.html>


More information about the llvm-dev mailing list