[llvm-dev] RFC: PointerType should derive from Type rather than SequentialType
Peter Collingbourne via llvm-dev
llvm-dev at lists.llvm.org
Sat Oct 29 20:41:29 PDT 2016
Hi all,
An oddity that has existed for a long time in the IR is that PointerType
derives from SequentialType. Per subject I propose to make PointerType
derive from Type for a couple of reasons:
- Values of type PointerType are unlike the other SequentialTypes (arrays
and vectors) in that they do not hold values of the element type. By moving
PointerType we can unify certain aspects of how the other SequentialTypes
are handled.
- PointerType will have no place in the SequentialType hierarchy once
pointee types are removed, so this is a necessary step towards removing
pointee types.
Although this would slightly complicate GEP enumeration, this can be
handled at the API level and is also inevitable given the move to remove
pointee types.
Specifically I want to change the API exposed by the GEP type iterator so
that each iterator can be in one of three states: unbounded array (i.e. the
existing PointerType state, which would represent the first "element" of
the GEP), bounded array (the existing ArrayType state) or struct (the
existing StructType state). In the former two cases clients would not have
access to the "underlying" type and would only be able to access the
"boundedness", the upper bound if any and the element type.
Thanks,
--
--
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161029/067503cc/attachment.html>
More information about the llvm-dev
mailing list