Skip to content

Commit d921f0f

Browse files
committed
[MIR] Add support for MachineFrameInfo::LocalFrameSize
MFI.LocalFrameSize was not serialized. It is usually set from LocalStackSlotAllocation, so if that pass doesn't run it is impossible do deduce it from the stack objects. Until now, this information was lost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329382 91177308-0d34-0410-b5e6-96231b3b80d8 apple-llvm-split-commit: a42368b06a2c9d25ae78347f1974d6772843b659 apple-llvm-split-dir: llvm/
1 parent 0c05283 commit d921f0f

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

llvm/include/llvm/CodeGen/MIRYamlMapping.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ struct MachineFrameInfo {
403403
bool HasOpaqueSPAdjustment = false;
404404
bool HasVAStart = false;
405405
bool HasMustTailInVarArgFunc = false;
406+
unsigned LocalFrameSize = 0;
406407
StringValue SavePoint;
407408
StringValue RestorePoint;
408409

@@ -420,6 +421,7 @@ struct MachineFrameInfo {
420421
HasOpaqueSPAdjustment == Other.HasOpaqueSPAdjustment &&
421422
HasVAStart == Other.HasVAStart &&
422423
HasMustTailInVarArgFunc == Other.HasMustTailInVarArgFunc &&
424+
LocalFrameSize == Other.LocalFrameSize &&
423425
SavePoint == Other.SavePoint && RestorePoint == Other.RestorePoint;
424426
}
425427
};
@@ -443,6 +445,7 @@ template <> struct MappingTraits<MachineFrameInfo> {
443445
YamlIO.mapOptional("hasVAStart", MFI.HasVAStart, false);
444446
YamlIO.mapOptional("hasMustTailInVarArgFunc", MFI.HasMustTailInVarArgFunc,
445447
false);
448+
YamlIO.mapOptional("localFrameSize", MFI.LocalFrameSize, (unsigned)0);
446449
YamlIO.mapOptional("savePoint", MFI.SavePoint,
447450
StringValue()); // Don't print it out when it's empty.
448451
YamlIO.mapOptional("restorePoint", MFI.RestorePoint,

llvm/lib/CodeGen/MIRParser/MIRParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ bool MIRParserImpl::initializeFrameInfo(PerFunctionMIParsingState &PFS,
568568
MFI.setHasOpaqueSPAdjustment(YamlMFI.HasOpaqueSPAdjustment);
569569
MFI.setHasVAStart(YamlMFI.HasVAStart);
570570
MFI.setHasMustTailInVarArgFunc(YamlMFI.HasMustTailInVarArgFunc);
571+
MFI.setLocalFrameSize(YamlMFI.LocalFrameSize);
571572
if (!YamlMFI.SavePoint.Value.empty()) {
572573
MachineBasicBlock *MBB = nullptr;
573574
if (parseMBBReference(PFS, MBB, YamlMFI.SavePoint))

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ void MIRPrinter::convert(ModuleSlotTracker &MST,
348348
YamlMFI.HasOpaqueSPAdjustment = MFI.hasOpaqueSPAdjustment();
349349
YamlMFI.HasVAStart = MFI.hasVAStart();
350350
YamlMFI.HasMustTailInVarArgFunc = MFI.hasMustTailInVarArgFunc();
351+
YamlMFI.LocalFrameSize = MFI.getLocalFrameSize();
351352
if (MFI.getSavePoint()) {
352353
raw_string_ostream StrOS(YamlMFI.SavePoint.Value);
353354
MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)

llvm/test/CodeGen/MIR/Generic/frame-info.mir

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ tracksRegLiveness: true
4141
# CHECK-NEXT: hasOpaqueSPAdjustment: false
4242
# CHECK-NEXT: hasVAStart: false
4343
# CHECK-NEXT: hasMustTailInVarArgFunc: false
44+
# CHECK-NEXT: localFrameSize: 0
4445
# CHECK-NEXT: savePoint: ''
4546
# CHECK-NEXT: restorePoint: ''
4647
# CHECK: body
@@ -85,6 +86,7 @@ frameInfo:
8586
hasOpaqueSPAdjustment: true
8687
hasVAStart: true
8788
hasMustTailInVarArgFunc: true
89+
localFrameSize: 256
8890
body: |
8991
bb.0.entry:
9092
...

0 commit comments

Comments
 (0)