[llvm] r265972 - Use member initializers for all scalar fields of MachineFrameInfo to save boilerplate
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 11 10:54:16 PDT 2016
Author: rnk
Date: Mon Apr 11 12:54:16 2016
New Revision: 265972
URL: http://llvm.org/viewvc/llvm-project?rev=265972&view=rev
Log:
Use member initializers for all scalar fields of MachineFrameInfo to save boilerplate
No functionality change.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=265972&r1=265971&r2=265972&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Mon Apr 11 12:54:16 2016
@@ -161,33 +161,33 @@ class MachineFrameInfo {
/// This contains the number of fixed objects contained on
/// the stack. Because fixed objects are stored at a negative index in the
/// Objects list, this is also the index to the 0th object in the list.
- unsigned NumFixedObjects;
+ unsigned NumFixedObjects = 0;
/// This boolean keeps track of whether any variable
/// sized objects have been allocated yet.
- bool HasVarSizedObjects;
+ bool HasVarSizedObjects = false;
/// This boolean keeps track of whether there is a call
/// to builtin \@llvm.frameaddress.
- bool FrameAddressTaken;
+ bool FrameAddressTaken = false;
/// This boolean keeps track of whether there is a call
/// to builtin \@llvm.returnaddress.
- bool ReturnAddressTaken;
+ bool ReturnAddressTaken = false;
/// This boolean keeps track of whether there is a call
/// to builtin \@llvm.experimental.stackmap.
- bool HasStackMap;
+ bool HasStackMap = false;
/// This boolean keeps track of whether there is a call
/// to builtin \@llvm.experimental.patchpoint.
- bool HasPatchPoint;
+ bool HasPatchPoint = false;
/// The prolog/epilog code inserter calculates the final stack
/// offsets for all of the fixed size objects, updating the Objects list
/// above. It then updates StackSize to contain the number of bytes that need
/// to be allocated on entry to the function.
- uint64_t StackSize;
+ uint64_t StackSize = 0;
/// The amount that a frame offset needs to be adjusted to
/// have the actual offset from the stack/frame pointer. The exact usage of
@@ -198,7 +198,7 @@ class MachineFrameInfo {
/// targets, this value is only used when generating debug info (via
/// TargetRegisterInfo::getFrameIndexReference); when generating code, the
/// corresponding adjustments are performed directly.
- int OffsetAdjustment;
+ int OffsetAdjustment = 0;
/// The prolog/epilog code inserter may process objects that require greater
/// alignment than the default alignment the target provides.
@@ -207,27 +207,27 @@ class MachineFrameInfo {
/// native alignment maintained by the compiler, dynamic alignment code will
/// be needed.
///
- unsigned MaxAlignment;
+ unsigned MaxAlignment = 0;
/// Set to true if this function adjusts the stack -- e.g.,
/// when calling another function. This is only valid during and after
/// prolog/epilog code insertion.
- bool AdjustsStack;
+ bool AdjustsStack = false;
/// Set to true if this function has any function calls.
- bool HasCalls;
+ bool HasCalls = false;
/// The frame index for the stack protector.
- int StackProtectorIdx;
+ int StackProtectorIdx = -1;
/// The frame index for the function context. Used for SjLj exceptions.
- int FunctionContextIdx;
+ int FunctionContextIdx = -1;
/// This contains the size of the largest call frame if the target uses frame
/// setup/destroy pseudo instructions (as defined in the TargetFrameInfo
/// class). This information is important for frame pointer elimination.
/// It is only valid during and after prolog/epilog code insertion.
- unsigned MaxCallFrameSize;
+ unsigned MaxCallFrameSize = 0;
/// The prolog/epilog code inserter fills in this vector with each
/// callee saved register saved in the frame. Beyond its use by the prolog/
@@ -236,76 +236,53 @@ class MachineFrameInfo {
std::vector<CalleeSavedInfo> CSInfo;
/// Has CSInfo been set yet?
- bool CSIValid;
+ bool CSIValid = false;
/// References to frame indices which are mapped
/// into the local frame allocation block. <FrameIdx, LocalOffset>
SmallVector<std::pair<int, int64_t>, 32> LocalFrameObjects;
/// Size of the pre-allocated local frame block.
- int64_t LocalFrameSize;
+ int64_t LocalFrameSize = 0;
/// Required alignment of the local object blob, which is the strictest
/// alignment of any object in it.
- unsigned LocalFrameMaxAlign;
+ unsigned LocalFrameMaxAlign = 0;
/// Whether the local object blob needs to be allocated together. If not,
/// PEI should ignore the isPreAllocated flags on the stack objects and
/// just allocate them normally.
- bool UseLocalStackAllocationBlock;
+ bool UseLocalStackAllocationBlock = false;
/// True if the function dynamically adjusts the stack pointer through some
/// opaque mechanism like inline assembly or Win32 EH.
- bool HasOpaqueSPAdjustment;
+ bool HasOpaqueSPAdjustment = false;
/// True if the function contains operations which will lower down to
/// instructions which manipulate the stack pointer.
- bool HasCopyImplyingStackAdjustment;
+ bool HasCopyImplyingStackAdjustment = false;
/// True if the function contains a call to the llvm.vastart intrinsic.
- bool HasVAStart;
+ bool HasVAStart = false;
/// True if this is a varargs function that contains a musttail call.
- bool HasMustTailInVarArgFunc;
+ bool HasMustTailInVarArgFunc = false;
/// True if this function contains a tail call. If so immutable objects like
/// function arguments are no longer so. A tail call *can* override fixed
/// stack objects like arguments so we can't treat them as immutable.
- bool HasTailCall;
+ bool HasTailCall = false;
/// Not null, if shrink-wrapping found a better place for the prologue.
- MachineBasicBlock *Save;
+ MachineBasicBlock *Save = nullptr;
/// Not null, if shrink-wrapping found a better place for the epilogue.
- MachineBasicBlock *Restore;
+ MachineBasicBlock *Restore = nullptr;
public:
explicit MachineFrameInfo(unsigned StackAlignment, bool StackRealignable,
bool ForcedRealign)
: StackAlignment(StackAlignment), StackRealignable(StackRealignable),
- ForcedRealign(ForcedRealign) {
- StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
- HasVarSizedObjects = false;
- FrameAddressTaken = false;
- ReturnAddressTaken = false;
- HasStackMap = false;
- HasPatchPoint = false;
- AdjustsStack = false;
- HasCalls = false;
- StackProtectorIdx = -1;
- FunctionContextIdx = -1;
- MaxCallFrameSize = 0;
- CSIValid = false;
- LocalFrameSize = 0;
- LocalFrameMaxAlign = 0;
- UseLocalStackAllocationBlock = false;
- HasOpaqueSPAdjustment = false;
- HasCopyImplyingStackAdjustment = false;
- HasVAStart = false;
- HasMustTailInVarArgFunc = false;
- Save = nullptr;
- Restore = nullptr;
- HasTailCall = false;
- }
+ ForcedRealign(ForcedRealign) {}
/// Return true if there are any stack objects in this function.
bool hasStackObjects() const { return !Objects.empty(); }
More information about the llvm-commits
mailing list