Allow DataLayout to support arbitrary pointer sizes
authorStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Fri, 19 Nov 2021 05:54:47 +0000 (21:54 -0800)
committerStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Wed, 8 Dec 2021 07:20:17 +0000 (23:20 -0800)
commit0fcb16eeb2284ad9b865d5865ae1b3c3a71a84d9
tree77fd6af9b7b40c22bc73c11b90b2db46c6331796
parent40028eaf703afdf5e50e05ac601b44501e285a42
Allow DataLayout to support arbitrary pointer sizes

Currently, it is impossible to specify a DataLayout with pointer
size and index size that is not a whole number of bytes.
This patch modifies
the DataLayout class to accept arbitrary pointer sizes and to
store the size as a number of bits, rather than as a number of bytes.
Generally speaking, the external interface of the class as used
by in-tree architectures remains the same and shouldn't affect the
behavior of architecures with pointer sizes equal to a whole number
of bytes.

Note the interface of setPointerAlignment has changed and takes
a pointer and index size that is a number of bits, rather than a number
of bytes.

Patch originally by Ajit Kumar Agarwal

Differential Revision: https://reviews.llvm.org/D114141
llvm/include/llvm/IR/DataLayout.h
llvm/lib/IR/DataLayout.cpp
llvm/test/Assembler/datalayout-anypointersize.ll [new file with mode: 0644]
llvm/test/Assembler/invalid-datalayout7.ll