[PATCH] D81196: [Alignment][NFC] Migrate CallingConv tablegen code

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 14:59:16 PDT 2020


gchatelet created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We first migrate the generated code, more patches to come.

This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81196

Files:
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/utils/TableGen/CallingConvEmitter.cpp


Index: llvm/utils/TableGen/CallingConvEmitter.cpp
===================================================================
--- llvm/utils/TableGen/CallingConvEmitter.cpp
+++ llvm/utils/TableGen/CallingConvEmitter.cpp
@@ -197,7 +197,7 @@
              "getTypeAllocSize(EVT(LocVT).getTypeForEVT(State.getContext())),"
              " ";
       if (Align)
-        O << Align;
+        O << "Align(" << Align << ")";
       else
         O << "\n" << IndentStr
           << "  State.getMachineFunction().getDataLayout()."
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===================================================================
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -424,16 +424,20 @@
 
   /// AllocateStack - Allocate a chunk of stack space with the specified size
   /// and alignment.
-  unsigned AllocateStack(unsigned Size, unsigned Alignment) {
-    const Align CheckedAlignment(Alignment);
-    StackOffset = alignTo(StackOffset, CheckedAlignment);
+  unsigned AllocateStack(unsigned Size, Align Alignment) {
+    StackOffset = alignTo(StackOffset, Alignment);
     unsigned Result = StackOffset;
     StackOffset += Size;
-    MaxStackArgAlign = std::max(CheckedAlignment, MaxStackArgAlign);
-    ensureMaxAlignment(CheckedAlignment);
+    MaxStackArgAlign = std::max(Alignment, MaxStackArgAlign);
+    ensureMaxAlignment(Alignment);
     return Result;
   }
 
+  // FIXME: Deprecate this function when transition to Align is over.
+  unsigned AllocateStack(unsigned Size, unsigned Alignment) {
+    return AllocateStack(Size, Align(Alignment));
+  }
+
   void ensureMaxAlignment(Align Alignment) {
     if (!AnalyzingMustTailForwardedRegs)
       MF.getFrameInfo().ensureMaxAlignment(Alignment);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81196.268599.patch
Type: text/x-patch
Size: 1776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200604/888a1c51/attachment.bin>


More information about the llvm-commits mailing list