llvm.org GIT mirror llvm / 5927be1
MachineFrameInfo: Track whether MaxCallFrameSize is computed yet; NFC This tracks whether MaxCallFrameSize is computed yet. Ideally we would assert and fail when the value is queried before it is computed, however this fails various targets that need to be fixed first. Differential Revision: https://reviews.llvm.org/D32570 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301851 91177308-0d34-0410-b5e6-96231b3b80d8 Matthias Braun 3 years ago
6 changed file(s) with 17 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
344344 bool HasCalls = false;
345345 StringValue StackProtector;
346346 // TODO: Serialize FunctionContextIdx
347 unsigned MaxCallFrameSize = 0;
347 unsigned MaxCallFrameSize = ~0u; ///< ~0u means: not computed yet.
348348 bool HasOpaqueSPAdjustment = false;
349349 bool HasVAStart = false;
350350 bool HasMustTailInVarArgFunc = false;
365365 YamlIO.mapOptional("hasCalls", MFI.HasCalls);
366366 YamlIO.mapOptional("stackProtector", MFI.StackProtector,
367367 StringValue()); // Don't print it out when it's empty.
368 YamlIO.mapOptional("maxCallFrameSize", MFI.MaxCallFrameSize);
368 YamlIO.mapOptional("maxCallFrameSize", MFI.MaxCallFrameSize, ~0u);
369369 YamlIO.mapOptional("hasOpaqueSPAdjustment", MFI.HasOpaqueSPAdjustment);
370370 YamlIO.mapOptional("hasVAStart", MFI.HasVAStart);
371371 YamlIO.mapOptional("hasMustTailInVarArgFunc", MFI.HasMustTailInVarArgFunc);
219219 /// setup/destroy pseudo instructions (as defined in the TargetFrameInfo
220220 /// class). This information is important for frame pointer elimination.
221221 /// It is only valid during and after prolog/epilog code insertion.
222 unsigned MaxCallFrameSize = 0;
222 unsigned MaxCallFrameSize = ~0u;
223223
224224 /// The prolog/epilog code inserter fills in this vector with each
225225 /// callee saved register saved in the frame. Beyond its use by the prolog/
524524 /// CallFrameSetup/Destroy pseudo instructions are used by the target, and
525525 /// then only during or after prolog/epilog code insertion.
526526 ///
527 unsigned getMaxCallFrameSize() const { return MaxCallFrameSize; }
527 unsigned getMaxCallFrameSize() const {
528 // TODO: Enable this assert when targets are fixed.
529 //assert(isMaxCallFrameSizeComputed() && "MaxCallFrameSize not computed yet");
530 if (!isMaxCallFrameSizeComputed())
531 return 0;
532 return MaxCallFrameSize;
533 }
534 bool isMaxCallFrameSizeComputed() const {
535 return MaxCallFrameSize != ~0u;
536 }
528537 void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; }
529538
530539 /// Create a new object at a fixed location on the stack.
540540 MFI.ensureMaxAlignment(YamlMFI.MaxAlignment);
541541 MFI.setAdjustsStack(YamlMFI.AdjustsStack);
542542 MFI.setHasCalls(YamlMFI.HasCalls);
543 MFI.setMaxCallFrameSize(YamlMFI.MaxCallFrameSize);
543 if (YamlMFI.MaxCallFrameSize != ~0u)
544 MFI.setMaxCallFrameSize(YamlMFI.MaxCallFrameSize);
544545 MFI.setHasOpaqueSPAdjustment(YamlMFI.HasOpaqueSPAdjustment);
545546 MFI.setHasVAStart(YamlMFI.HasVAStart);
546547 MFI.setHasMustTailInVarArgFunc(YamlMFI.HasMustTailInVarArgFunc);
285285 YamlMFI.MaxAlignment = MFI.getMaxAlignment();
286286 YamlMFI.AdjustsStack = MFI.adjustsStack();
287287 YamlMFI.HasCalls = MFI.hasCalls();
288 YamlMFI.MaxCallFrameSize = MFI.getMaxCallFrameSize();
288 YamlMFI.MaxCallFrameSize = MFI.isMaxCallFrameSizeComputed()
289 ? MFI.getMaxCallFrameSize() : ~0u;
289290 YamlMFI.HasOpaqueSPAdjustment = MFI.hasOpaqueSPAdjustment();
290291 YamlMFI.HasVAStart = MFI.hasVAStart();
291292 YamlMFI.HasMustTailInVarArgFunc = MFI.hasMustTailInVarArgFunc();
3535 # CHECK-NEXT: maxAlignment:
3636 # CHECK-NEXT: adjustsStack: false
3737 # CHECK-NEXT: hasCalls: false
38 # CHECK-NEXT: maxCallFrameSize: 0
3938 # CHECK-NEXT: hasOpaqueSPAdjustment: false
4039 # CHECK-NEXT: hasVAStart: false
4140 # CHECK-NEXT: hasMustTailInVarArgFunc: false
1919 ; CHECK-NEXT: maxAlignment: 0
2020 ; CHECK-NEXT: adjustsStack: false
2121 ; CHECK-NEXT: hasCalls: false
22 ; CHECK-NEXT: maxCallFrameSize: 0
2322 ; CHECK-NEXT: hasOpaqueSPAdjustment: false
2423 ; CHECK-NEXT: hasVAStart: false
2524 ; CHECK-NEXT: hasMustTailInVarArgFunc: false