[PATCH] D65659: [LLVM][Alignment] Introduce Alignment In CallingConv

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 08:30:06 PDT 2019


gchatelet marked 2 inline comments as done.
gchatelet added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/CallingConvLower.h:425
   /// and alignment.
-  unsigned AllocateStack(unsigned Size, unsigned Align) {
-    assert(Align && ((Align - 1) & Align) == 0); // Align is power of 2.
+  unsigned AllocateStack(unsigned Size, unsigned Alignment) {
+    const llvm::Align Align(Alignment);
----------------
When most of the callers are switched to using the new Align type we can flip the interface, for now it triggers too many code changes.


================
Comment at: llvm/include/llvm/CodeGen/TargetCallingConv.h:124
 
-    unsigned getByValAlign() const { return (1U << ByValAlign) / 2; }
+    unsigned getByValAlign() const {
+      MaybeAlign A = decodeMaybeAlign(ByValAlign);
----------------
We do not change the interface just yet as it would trigger too many changes.
Here we introduce the type in the implementation only.
This helps making sure that setters are always using defined alignments (i.e. `>=1`)



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65659/new/

https://reviews.llvm.org/D65659





More information about the llvm-commits mailing list