[SVE][IR] Scalable Vector size queries and IR instruction support

* Adds a TypeSize struct to represent the known minimum size of a type
  along with a flag to indicate that the runtime size is a integer multiple
  of that size
* Converts existing size query functions from Type.h and DataLayout.h to
  return a TypeSize result
* Adds convenience methods (including a transparent conversion operator
  to uint64_t) so that most existing code 'just works' as if the return
  values were still scalars.
* Uses the new size queries along with ElementCount to ensure that all
  supported instructions used with scalable vectors can be constructed
  in IR.

Reviewers: hfinkel, lattner, rkruppe, greened, rovka, rengolin, sdesmalen

Reviewed By: rovka, sdesmalen

Differential Revision: https://reviews.llvm.org/D53137

llvm-svn: 374042
This commit is contained in:
Graham Hunter
2019-10-08 12:53:54 +00:00
parent df6e67697b
commit b302561b76
21 changed files with 811 additions and 110 deletions

View File

@@ -29,6 +29,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TypeSize.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
@@ -745,7 +746,10 @@ Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const {
llvm_unreachable("Bad type for getAlignment!!!");
}
return getAlignmentInfo(AlignType, getTypeSizeInBits(Ty), abi_or_pref, Ty);
// If we're dealing with a scalable vector, we just need the known minimum
// size for determining alignment. If not, we'll get the exact size.
return getAlignmentInfo(AlignType, getTypeSizeInBits(Ty).getKnownMinSize(),
abi_or_pref, Ty);
}
unsigned DataLayout::getABITypeAlignment(Type *Ty) const {