[PATCH] D61435: [AArch64] NFC: Add generic StackOffset to describe scalable offsets.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 05:38:33 PDT 2019


sdesmalen created this revision.
sdesmalen added reviewers: thegameg, rovka, t.p.northover, efriedma.
Herald added subscribers: kristof.beyls, javed.absar.

To support spilling/filling of scalable vectors we need a more generic
representation of a stack offset than simply 'int'.

For this we introduce the StackOffset struct, which comprises multiple
offsets sized by their respective MVTs. Byte-offsets will thus be a simple
tuple such as { offset, MVT::i8 }. Adding two byte-offsets will result in a
byte offset { offsetA + offsetB, MVT::i8 }. When two offsets have different
types, we can canonicalise them to use the same MVT, as long as their
runtime sizes are guaranteed to have the same size-ratio as they would have
at compile-time.

When we have both scalable- and fixed-size objects on the stack, we can 
create an offset that is:

  ({ offset_fixed, MVT::i8 } + { offset_scalable, MVT::nxv1i8 })

The struct also contains a getForFrameOffset() method that is specific to
AArch64 and decomposes the frame-offset to be used directly in instructions
that operate on the stack or index into the stack.

Note: This patch adds StackOffset as an AArch64-only concept, but we would
like to make this a generic concept/struct that is supported by all 
interfaces that take or return stack offsets (currently as 'int'). Since
that would be a bigger change that is currently pending on D32530 <https://reviews.llvm.org/D32530> landing,
we thought it makes sense to first show/prove the concept in the AArch64
target before proposing to roll this out further.


https://reviews.llvm.org/D61435

Files:
  lib/Target/AArch64/AArch64FrameLowering.cpp
  lib/Target/AArch64/AArch64FrameLowering.h
  lib/Target/AArch64/AArch64InstrInfo.cpp
  lib/Target/AArch64/AArch64InstrInfo.h
  lib/Target/AArch64/AArch64RegisterInfo.cpp
  lib/Target/AArch64/AArch64StackOffset.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61435.197752.patch
Type: text/x-patch
Size: 22374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190502/f5732790/attachment.bin>


More information about the llvm-commits mailing list