[llvm] 80845db - [Alignment][NFC] Migrate CallingConv tablegen code
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 06:33:46 PDT 2020
Author: Guillaume Chatelet
Date: 2020-06-05T13:33:34Z
New Revision: 80845db6a55c0c61e703ef7171511d03208f3d57
URL: https://github.com/llvm/llvm-project/commit/80845db6a55c0c61e703ef7171511d03208f3d57
DIFF: https://github.com/llvm/llvm-project/commit/80845db6a55c0c61e703ef7171511d03208f3d57.diff
LOG: [Alignment][NFC] Migrate CallingConv tablegen code
Summary:
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
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81196
Added:
Modified:
llvm/include/llvm/CodeGen/CallingConvLower.h
llvm/utils/TableGen/CallingConvEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/CallingConvLower.h b/llvm/include/llvm/CodeGen/CallingConvLower.h
index d96c4a8572bd..78a1ed595c8c 100644
--- a/llvm/include/llvm/CodeGen/CallingConvLower.h
+++ b/llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -424,16 +424,20 @@ class CCState {
/// 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);
@@ -447,11 +451,11 @@ class CCState {
/// Version of AllocateStack with list of extra registers to be shadowed.
/// Note that, unlike AllocateReg, this shadows ALL of the shadow registers.
- unsigned AllocateStack(unsigned Size, unsigned Align,
+ unsigned AllocateStack(unsigned Size, Align Alignment,
ArrayRef<MCPhysReg> ShadowRegs) {
for (unsigned i = 0; i < ShadowRegs.size(); ++i)
MarkAllocated(ShadowRegs[i]);
- return AllocateStack(Size, Align);
+ return AllocateStack(Size, Alignment);
}
// HandleByVal - Allocate a stack slot large enough to pass an argument by
diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp
index 9eabb44d9004..90b0c035c1ce 100644
--- a/llvm/utils/TableGen/CallingConvEmitter.cpp
+++ b/llvm/utils/TableGen/CallingConvEmitter.cpp
@@ -197,7 +197,7 @@ void CallingConvEmitter::EmitAction(Record *Action,
"getTypeAllocSize(EVT(LocVT).getTypeForEVT(State.getContext())),"
" ";
if (Align)
- O << Align;
+ O << "Align(" << Align << ")";
else
O << "\n" << IndentStr
<< " State.getMachineFunction().getDataLayout()."
@@ -224,8 +224,7 @@ void CallingConvEmitter::EmitAction(Record *Action,
O << "\n" << IndentStr << "};\n";
O << IndentStr << "unsigned Offset" << ++Counter
- << " = State.AllocateStack("
- << Size << ", " << Align << ", "
+ << " = State.AllocateStack(" << Size << ", Align(" << Align << "), "
<< "ShadowRegList" << ShadowRegListNumber << ");\n";
O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
<< Counter << ", LocVT, LocInfo));\n";
More information about the llvm-commits
mailing list