LLVM 23.0.0git
MachineFrameInfo.h
Go to the documentation of this file.
1//===-- CodeGen/MachineFrameInfo.h - Abstract Stack Frame Rep. --*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// The file defines the MachineFrameInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
14#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
15
22#include <cassert>
23#include <vector>
24
25namespace llvm {
26class raw_ostream;
27class MachineFunction;
29class BitVector;
30class AllocaInst;
31
32/// The CalleeSavedInfo class tracks the information need to locate where a
33/// callee saved register is in the current frame.
34/// Callee saved reg can also be saved to a different register rather than
35/// on the stack by setting DstReg instead of FrameIdx.
37 MCRegister Reg;
38 union {
40 unsigned DstReg;
41 };
42 /// Flag indicating whether the register is actually restored in the epilog.
43 /// In most cases, if a register is saved, it is also restored. There are
44 /// some situations, though, when this is not the case. For example, the
45 /// LR register on ARM is usually saved, but on exit from the function its
46 /// saved value may be loaded directly into PC. Since liveness tracking of
47 /// physical registers treats callee-saved registers are live outside of
48 /// the function, LR would be treated as live-on-exit, even though in these
49 /// scenarios it is not. This flag is added to indicate that the saved
50 /// register described by this object is not restored in the epilog.
51 /// The long-term solution is to model the liveness of callee-saved registers
52 /// by implicit uses on the return instructions, however, the required
53 /// changes in the ARM backend would be quite extensive.
54 bool Restored = true;
55 /// Flag indicating whether the register is spilled to stack or another
56 /// register.
57 bool SpilledToReg = false;
58
59public:
60 explicit CalleeSavedInfo(MCRegister R, int FI = 0) : Reg(R), FrameIdx(FI) {}
61
62 // Accessors.
63 MCRegister getReg() const { return Reg; }
64 int getFrameIdx() const { return FrameIdx; }
65 MCRegister getDstReg() const { return DstReg; }
66 void setReg(MCRegister R) { Reg = R; }
67 void setFrameIdx(int FI) {
68 FrameIdx = FI;
69 SpilledToReg = false;
70 }
71 void setDstReg(MCRegister SpillReg) {
72 DstReg = SpillReg.id();
73 SpilledToReg = true;
74 }
75 bool isRestored() const { return Restored; }
76 void setRestored(bool R) { Restored = R; }
77 bool isSpilledToReg() const { return SpilledToReg; }
78};
79
82
83/// The MachineFrameInfo class represents an abstract stack frame until
84/// prolog/epilog code is inserted. This class is key to allowing stack frame
85/// representation optimizations, such as frame pointer elimination. It also
86/// allows more mundane (but still important) optimizations, such as reordering
87/// of abstract objects on the stack frame.
88///
89/// To support this, the class assigns unique integer identifiers to stack
90/// objects requested clients. These identifiers are negative integers for
91/// fixed stack objects (such as arguments passed on the stack) or nonnegative
92/// for objects that may be reordered. Instructions which refer to stack
93/// objects use a special MO_FrameIndex operand to represent these frame
94/// indexes.
95///
96/// Because this class keeps track of all references to the stack frame, it
97/// knows when a variable sized object is allocated on the stack. This is the
98/// sole condition which prevents frame pointer elimination, which is an
99/// important optimization on register-poor architectures. Because original
100/// variable sized alloca's in the source program are the only source of
101/// variable sized stack objects, it is safe to decide whether there will be
102/// any variable sized objects before all stack objects are known (for
103/// example, register allocator spill code never needs variable sized
104/// objects).
105///
106/// When prolog/epilog code emission is performed, the final stack frame is
107/// built and the machine instructions are modified to refer to the actual
108/// stack offsets of the object, eliminating all MO_FrameIndex operands from
109/// the program.
110///
111/// Abstract Stack Frame Information
113public:
114 /// Stack Smashing Protection (SSP) rules require that vulnerable stack
115 /// allocations are located close the stack protector.
117 SSPLK_None, ///< Did not trigger a stack protector. No effect on data
118 ///< layout.
119 SSPLK_LargeArray, ///< Array or nested array >= SSP-buffer-size. Closest
120 ///< to the stack protector.
121 SSPLK_SmallArray, ///< Array or nested array < SSP-buffer-size. 2nd closest
122 ///< to the stack protector.
123 SSPLK_AddrOf ///< The address of this allocation is exposed and
124 ///< triggered protection. 3rd closest to the protector.
125 };
126
127private:
128 // Represent a single object allocated on the stack.
129 struct StackObject {
130 // The offset of this object from the stack pointer on entry to
131 // the function. This field has no meaning for a variable sized element.
132 int64_t SPOffset;
133
134 // The size of this object on the stack. 0 means a variable sized object,
135 // ~0ULL means a dead object.
137
138 // The required alignment of this stack slot.
139 Align Alignment;
140
141 // If true, the value of the stack object is set before
142 // entering the function and is not modified inside the function. By
143 // default, fixed objects are immutable unless marked otherwise.
144 bool isImmutable;
145
146 // If true the stack object is used as spill slot. It
147 // cannot alias any other memory objects.
148 bool isSpillSlot;
149
150 /// If true, this stack slot is used to spill a value (could be deopt
151 /// and/or GC related) over a statepoint. We know that the address of the
152 /// slot can't alias any LLVM IR value. This is very similar to a Spill
153 /// Slot, but is created by statepoint lowering is SelectionDAG, not the
154 /// register allocator.
155 bool isStatepointSpillSlot = false;
156
157 /// If true, this stack slot is used for spilling a callee saved register
158 /// in the calling convention of the containing function.
159 bool isCalleeSaved = false;
160
161 /// Identifier for stack memory type analagous to address space. If this is
162 /// non-0, the meaning is target defined. Offsets cannot be directly
163 /// compared between objects with different stack IDs. The object may not
164 /// necessarily reside in the same contiguous memory block as other stack
165 /// objects. Objects with differing stack IDs should not be merged or
166 /// replaced substituted for each other.
167 //
168 /// It is assumed a target uses consecutive, increasing stack IDs starting
169 /// from 1.
170 uint8_t StackID;
171
172 /// If this stack object is originated from an Alloca instruction
173 /// this value saves the original IR allocation. Can be NULL.
174 const AllocaInst *Alloca;
175
176 // If true, the object was mapped into the local frame
177 // block and doesn't need additional handling for allocation beyond that.
178 bool PreAllocated = false;
179
180 // If true, an LLVM IR value might point to this object.
181 // Normally, spill slots and fixed-offset objects don't alias IR-accessible
182 // objects, but there are exceptions (on PowerPC, for example, some byval
183 // arguments have ABI-prescribed offsets).
184 bool isAliased;
185
186 /// If true, the object has been zero-extended.
187 bool isZExt = false;
188
189 /// If true, the object has been sign-extended.
190 bool isSExt = false;
191
192 uint8_t SSPLayout = SSPLK_None;
193
194 StackObject(uint64_t Size, Align Alignment, int64_t SPOffset,
195 bool IsImmutable, bool IsSpillSlot, const AllocaInst *Alloca,
196 bool IsAliased, uint8_t StackID = 0)
197 : SPOffset(SPOffset), Size(Size), Alignment(Alignment),
198 isImmutable(IsImmutable), isSpillSlot(IsSpillSlot), StackID(StackID),
199 Alloca(Alloca), isAliased(IsAliased) {}
200 };
201
202 /// The alignment of the stack.
203 Align StackAlignment;
204
205 /// Can the stack be realigned. This can be false if the target does not
206 /// support stack realignment, or if the user asks us not to realign the
207 /// stack. In this situation, overaligned allocas are all treated as dynamic
208 /// allocations and the target must handle them as part of DYNAMIC_STACKALLOC
209 /// lowering. All non-alloca stack objects have their alignment clamped to the
210 /// base ABI stack alignment.
211 /// FIXME: There is room for improvement in this case, in terms of
212 /// grouping overaligned allocas into a "secondary stack frame" and
213 /// then only use a single alloca to allocate this frame and only a
214 /// single virtual register to access it. Currently, without such an
215 /// optimization, each such alloca gets its own dynamic realignment.
216 bool StackRealignable;
217
218 /// Whether the function has the \c alignstack attribute.
219 bool ForcedRealign;
220
221 /// The list of stack objects allocated.
222 std::vector<StackObject> Objects;
223
224 /// This contains the number of fixed objects contained on
225 /// the stack. Because fixed objects are stored at a negative index in the
226 /// Objects list, this is also the index to the 0th object in the list.
227 unsigned NumFixedObjects = 0;
228
229 /// This boolean keeps track of whether any variable
230 /// sized objects have been allocated yet.
231 bool HasVarSizedObjects = false;
232
233 /// This boolean keeps track of whether there is a call
234 /// to builtin \@llvm.frameaddress.
235 bool FrameAddressTaken = false;
236
237 /// This boolean keeps track of whether there is a call
238 /// to builtin \@llvm.returnaddress.
239 bool ReturnAddressTaken = false;
240
241 /// This boolean keeps track of whether there is a call
242 /// to builtin \@llvm.experimental.stackmap.
243 bool HasStackMap = false;
244
245 /// This boolean keeps track of whether there is a call
246 /// to builtin \@llvm.experimental.patchpoint.
247 bool HasPatchPoint = false;
248
249 /// The prolog/epilog code inserter calculates the final stack
250 /// offsets for all of the fixed size objects, updating the Objects list
251 /// above. It then updates StackSize to contain the number of bytes that need
252 /// to be allocated on entry to the function.
253 uint64_t StackSize = 0;
254
255 /// The amount that a frame offset needs to be adjusted to
256 /// have the actual offset from the stack/frame pointer. The exact usage of
257 /// this is target-dependent, but it is typically used to adjust between
258 /// SP-relative and FP-relative offsets. E.G., if objects are accessed via
259 /// SP then OffsetAdjustment is zero; if FP is used, OffsetAdjustment is set
260 /// to the distance between the initial SP and the value in FP. For many
261 /// targets, this value is only used when generating debug info (via
262 /// TargetRegisterInfo::getFrameIndexReference); when generating code, the
263 /// corresponding adjustments are performed directly.
264 int64_t OffsetAdjustment = 0;
265
266 /// The prolog/epilog code inserter may process objects that require greater
267 /// alignment than the default alignment the target provides.
268 /// To handle this, MaxAlignment is set to the maximum alignment
269 /// needed by the objects on the current frame. If this is greater than the
270 /// native alignment maintained by the compiler, dynamic alignment code will
271 /// be needed.
272 ///
273 Align MaxAlignment;
274
275 /// Set to true if this function adjusts the stack -- e.g.,
276 /// when calling another function. This is only valid during and after
277 /// prolog/epilog code insertion.
278 bool AdjustsStack = false;
279
280 /// Set to true if this function has any function calls.
281 bool HasCalls = false;
282
283 /// Frame-pointer policy for this function to avoid repeated attribute
284 /// lookups in hot paths.
285 FramePointerKind FramePointerPolicy = FramePointerKind::None;
286
287 /// The frame index for the stack protector.
288 int StackProtectorIdx = -1;
289
290 /// The frame index for the function context. Used for SjLj exceptions.
291 int FunctionContextIdx = -1;
292
293 /// This contains the size of the largest call frame if the target uses frame
294 /// setup/destroy pseudo instructions (as defined in the TargetFrameInfo
295 /// class). This information is important for frame pointer elimination.
296 /// It is only valid during and after prolog/epilog code insertion.
297 uint64_t MaxCallFrameSize = ~UINT64_C(0);
298
299 /// The number of bytes of callee saved registers that the target wants to
300 /// report for the current function in the CodeView S_FRAMEPROC record.
301 unsigned CVBytesOfCalleeSavedRegisters = 0;
302
303 /// The prolog/epilog code inserter fills in this vector with each
304 /// callee saved register saved in either the frame or a different
305 /// register. Beyond its use by the prolog/ epilog code inserter,
306 /// this data is used for debug info and exception handling.
307 std::vector<CalleeSavedInfo> CSInfo;
308
309 /// Has CSInfo been set yet?
310 bool CSIValid = false;
311
312 /// References to frame indices which are mapped
313 /// into the local frame allocation block. <FrameIdx, LocalOffset>
314 SmallVector<std::pair<int, int64_t>, 32> LocalFrameObjects;
315
316 /// Size of the pre-allocated local frame block.
317 int64_t LocalFrameSize = 0;
318
319 /// Required alignment of the local object blob, which is the strictest
320 /// alignment of any object in it.
321 Align LocalFrameMaxAlign;
322
323 /// Whether the local object blob needs to be allocated together. If not,
324 /// PEI should ignore the isPreAllocated flags on the stack objects and
325 /// just allocate them normally.
326 bool UseLocalStackAllocationBlock = false;
327
328 /// True if the function dynamically adjusts the stack pointer through some
329 /// opaque mechanism like inline assembly or Win32 EH.
330 bool HasOpaqueSPAdjustment = false;
331
332 /// True if the function contains operations which will lower down to
333 /// instructions which manipulate the stack pointer.
334 bool HasCopyImplyingStackAdjustment = false;
335
336 /// True if the function contains a call to the llvm.vastart intrinsic.
337 bool HasVAStart = false;
338
339 /// True if this is a varargs function that contains a musttail call.
340 bool HasMustTailInVarArgFunc = false;
341
342 /// True if this function contains a tail call. If so immutable objects like
343 /// function arguments are no longer so. A tail call *can* override fixed
344 /// stack objects like arguments so we can't treat them as immutable.
345 bool HasTailCall = false;
346
347 /// Not empty, if shrink-wrapping found a better place for the prologue.
348 SaveRestorePoints SavePoints;
349 /// Not empty, if shrink-wrapping found a better place for the epilogue.
350 SaveRestorePoints RestorePoints;
351
352 /// Size of the UnsafeStack Frame
353 uint64_t UnsafeStackSize = 0;
354
355public:
356 explicit MachineFrameInfo(Align StackAlignment, bool StackRealignable,
357 bool ForcedRealign)
358 : StackAlignment(StackAlignment),
359 StackRealignable(StackRealignable), ForcedRealign(ForcedRealign) {}
360
362
363 bool isStackRealignable() const { return StackRealignable; }
364
365 /// Return true if there are any stack objects in this function.
366 bool hasStackObjects() const { return !Objects.empty(); }
367
368 /// This method may be called any time after instruction
369 /// selection is complete to determine if the stack frame for this function
370 /// contains any variable sized objects.
371 bool hasVarSizedObjects() const { return HasVarSizedObjects; }
372
373 /// Return the index for the stack protector object.
374 int getStackProtectorIndex() const { return StackProtectorIdx; }
375 void setStackProtectorIndex(int I) { StackProtectorIdx = I; }
376 bool hasStackProtectorIndex() const { return StackProtectorIdx != -1; }
377
378 /// Return the index for the function context object.
379 /// This object is used for SjLj exceptions.
380 int getFunctionContextIndex() const { return FunctionContextIdx; }
381 void setFunctionContextIndex(int I) { FunctionContextIdx = I; }
382 bool hasFunctionContextIndex() const { return FunctionContextIdx != -1; }
383
384 /// This method may be called any time after instruction
385 /// selection is complete to determine if there is a call to
386 /// \@llvm.frameaddress in this function.
387 bool isFrameAddressTaken() const { return FrameAddressTaken; }
388 void setFrameAddressIsTaken(bool T) { FrameAddressTaken = T; }
389
390 /// This method may be called any time after
391 /// instruction selection is complete to determine if there is a call to
392 /// \@llvm.returnaddress in this function.
393 bool isReturnAddressTaken() const { return ReturnAddressTaken; }
394 void setReturnAddressIsTaken(bool s) { ReturnAddressTaken = s; }
395
396 /// This method may be called any time after instruction
397 /// selection is complete to determine if there is a call to builtin
398 /// \@llvm.experimental.stackmap.
399 bool hasStackMap() const { return HasStackMap; }
400 void setHasStackMap(bool s = true) { HasStackMap = s; }
401
402 /// This method may be called any time after instruction
403 /// selection is complete to determine if there is a call to builtin
404 /// \@llvm.experimental.patchpoint.
405 bool hasPatchPoint() const { return HasPatchPoint; }
406 void setHasPatchPoint(bool s = true) { HasPatchPoint = s; }
407
408 /// Return true if this function requires a split stack prolog, even if it
409 /// uses no stack space. This is only meaningful for functions where
410 /// MachineFunction::shouldSplitStack() returns true.
411 //
412 // For non-leaf functions we have to allow for the possibility that the call
413 // is to a non-split function, as in PR37807. This function could also take
414 // the address of a non-split function. When the linker tries to adjust its
415 // non-existent prologue, it would fail with an error. Mark the object file so
416 // that such failures are not errors. See this Go language bug-report
417 // https://go-review.googlesource.com/c/go/+/148819/
419 return getStackSize() != 0 || hasTailCall();
420 }
421
422 /// Return the minimum frame object index.
423 int getObjectIndexBegin() const { return -NumFixedObjects; }
424
425 /// Return one past the maximum frame object index.
426 int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; }
427
428 /// Return the number of fixed objects.
429 unsigned getNumFixedObjects() const { return NumFixedObjects; }
430
431 /// Return the number of objects.
432 unsigned getNumObjects() const { return Objects.size(); }
433
434 /// Map a frame index into the local object block
435 void mapLocalFrameObject(int ObjectIndex, int64_t Offset) {
436 LocalFrameObjects.push_back(std::pair<int, int64_t>(ObjectIndex, Offset));
437 Objects[ObjectIndex + NumFixedObjects].PreAllocated = true;
438 }
439
440 /// Get the local offset mapping for a for an object.
441 std::pair<int, int64_t> getLocalFrameObjectMap(int i) const {
442 assert (i >= 0 && (unsigned)i < LocalFrameObjects.size() &&
443 "Invalid local object reference!");
444 return LocalFrameObjects[i];
445 }
446
447 /// Return the number of objects allocated into the local object block.
448 int64_t getLocalFrameObjectCount() const { return LocalFrameObjects.size(); }
449
450 /// Set the size of the local object blob.
451 void setLocalFrameSize(int64_t sz) { LocalFrameSize = sz; }
452
453 /// Get the size of the local object blob.
454 int64_t getLocalFrameSize() const { return LocalFrameSize; }
455
456 /// Required alignment of the local object blob,
457 /// which is the strictest alignment of any object in it.
458 void setLocalFrameMaxAlign(Align Alignment) {
459 LocalFrameMaxAlign = Alignment;
460 }
461
462 /// Return the required alignment of the local object blob.
463 Align getLocalFrameMaxAlign() const { return LocalFrameMaxAlign; }
464
465 /// Get whether the local allocation blob should be allocated together or
466 /// let PEI allocate the locals in it directly.
468 return UseLocalStackAllocationBlock;
469 }
470
471 /// setUseLocalStackAllocationBlock - Set whether the local allocation blob
472 /// should be allocated together or let PEI allocate the locals in it
473 /// directly.
475 UseLocalStackAllocationBlock = v;
476 }
477
478 /// Return true if the object was pre-allocated into the local block.
479 bool isObjectPreAllocated(int ObjectIdx) const {
480 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
481 "Invalid Object Idx!");
482 return Objects[ObjectIdx+NumFixedObjects].PreAllocated;
483 }
484
485 /// Return the size of the specified object.
486 int64_t getObjectSize(int ObjectIdx) const {
487 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
488 "Invalid Object Idx!");
489 return Objects[ObjectIdx+NumFixedObjects].Size;
490 }
491
492 /// Change the size of the specified stack object.
493 void setObjectSize(int ObjectIdx, int64_t Size) {
494 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
495 "Invalid Object Idx!");
496 Objects[ObjectIdx+NumFixedObjects].Size = Size;
497 }
498
499 /// Return the alignment of the specified stack object.
500 Align getObjectAlign(int ObjectIdx) const {
501 assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
502 "Invalid Object Idx!");
503 return Objects[ObjectIdx + NumFixedObjects].Alignment;
504 }
505
506 /// Should this stack ID be considered in MaxAlignment.
508 return StackID == TargetStackID::Default ||
511 }
512
513 bool hasScalableStackID(int ObjectIdx) const {
514 uint8_t StackID = getStackID(ObjectIdx);
515 return isScalableStackID(StackID);
516 }
517
518 bool isScalableStackID(uint8_t StackID) const {
519 return StackID == TargetStackID::ScalableVector ||
521 }
522
523 /// setObjectAlignment - Change the alignment of the specified stack object.
524 void setObjectAlignment(int ObjectIdx, Align Alignment) {
525 assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
526 "Invalid Object Idx!");
527 Objects[ObjectIdx + NumFixedObjects].Alignment = Alignment;
528
529 // Only ensure max alignment for the default and scalable vector stack.
530 uint8_t StackID = getStackID(ObjectIdx);
531 if (contributesToMaxAlignment(StackID))
532 ensureMaxAlignment(Alignment);
533 }
534
535 /// Return the underlying Alloca of the specified
536 /// stack object if it exists. Returns 0 if none exists.
537 const AllocaInst* getObjectAllocation(int ObjectIdx) const {
538 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
539 "Invalid Object Idx!");
540 return Objects[ObjectIdx+NumFixedObjects].Alloca;
541 }
542
543 /// Remove the underlying Alloca of the specified stack object if it
544 /// exists. This generally should not be used and is for reduction tooling.
545 void clearObjectAllocation(int ObjectIdx) {
546 assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
547 "Invalid Object Idx!");
548 Objects[ObjectIdx + NumFixedObjects].Alloca = nullptr;
549 }
550
551 /// Return the assigned stack offset of the specified object
552 /// from the incoming stack pointer.
553 int64_t getObjectOffset(int ObjectIdx) const {
554 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
555 "Invalid Object Idx!");
556 assert(!isDeadObjectIndex(ObjectIdx) &&
557 "Getting frame offset for a dead object?");
558 return Objects[ObjectIdx+NumFixedObjects].SPOffset;
559 }
560
561 bool isObjectZExt(int ObjectIdx) const {
562 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
563 "Invalid Object Idx!");
564 return Objects[ObjectIdx+NumFixedObjects].isZExt;
565 }
566
567 void setObjectZExt(int ObjectIdx, bool IsZExt) {
568 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
569 "Invalid Object Idx!");
570 Objects[ObjectIdx+NumFixedObjects].isZExt = IsZExt;
571 }
572
573 bool isObjectSExt(int ObjectIdx) const {
574 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
575 "Invalid Object Idx!");
576 return Objects[ObjectIdx+NumFixedObjects].isSExt;
577 }
578
579 void setObjectSExt(int ObjectIdx, bool IsSExt) {
580 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
581 "Invalid Object Idx!");
582 Objects[ObjectIdx+NumFixedObjects].isSExt = IsSExt;
583 }
584
585 /// Set the stack frame offset of the specified object. The
586 /// offset is relative to the stack pointer on entry to the function.
587 void setObjectOffset(int ObjectIdx, int64_t SPOffset) {
588 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
589 "Invalid Object Idx!");
590 assert(!isDeadObjectIndex(ObjectIdx) &&
591 "Setting frame offset for a dead object?");
592 Objects[ObjectIdx+NumFixedObjects].SPOffset = SPOffset;
593 }
594
595 SSPLayoutKind getObjectSSPLayout(int ObjectIdx) const {
596 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
597 "Invalid Object Idx!");
598 return (SSPLayoutKind)Objects[ObjectIdx+NumFixedObjects].SSPLayout;
599 }
600
601 void setObjectSSPLayout(int ObjectIdx, SSPLayoutKind Kind) {
602 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
603 "Invalid Object Idx!");
604 assert(!isDeadObjectIndex(ObjectIdx) &&
605 "Setting SSP layout for a dead object?");
606 Objects[ObjectIdx+NumFixedObjects].SSPLayout = Kind;
607 }
608
609 /// Return the number of bytes that must be allocated to hold
610 /// all of the fixed size frame objects. This is only valid after
611 /// Prolog/Epilog code insertion has finalized the stack frame layout.
612 uint64_t getStackSize() const { return StackSize; }
613
614 /// Set the size of the stack.
615 void setStackSize(uint64_t Size) { StackSize = Size; }
616
617 /// Estimate and return the size of the stack frame.
619
620 /// Return the correction for frame offsets.
621 int64_t getOffsetAdjustment() const { return OffsetAdjustment; }
622
623 /// Set the correction for frame offsets.
624 void setOffsetAdjustment(int64_t Adj) { OffsetAdjustment = Adj; }
625
626 /// Return the alignment in bytes that this function must be aligned to,
627 /// which is greater than the default stack alignment provided by the target.
628 Align getMaxAlign() const { return MaxAlignment; }
629
630 /// Make sure the function is at least Align bytes aligned.
631 LLVM_ABI void ensureMaxAlignment(Align Alignment);
632
633 /// Return true if stack realignment is forced by function attributes or if
634 /// the stack alignment.
635 bool shouldRealignStack() const {
636 return ForcedRealign || MaxAlignment > StackAlignment;
637 }
638
639 /// Return true if this function adjusts the stack -- e.g.,
640 /// when calling another function. This is only valid during and after
641 /// prolog/epilog code insertion.
642 bool adjustsStack() const { return AdjustsStack; }
643 void setAdjustsStack(bool V) { AdjustsStack = V; }
644
645 /// Return true if the current function has any function calls.
646 bool hasCalls() const { return HasCalls; }
647 void setHasCalls(bool V) { HasCalls = V; }
648
649 FramePointerKind getFramePointerPolicy() const { return FramePointerPolicy; }
651 FramePointerPolicy = Kind;
652 }
653
654 /// Returns true if the function contains opaque dynamic stack adjustments.
655 bool hasOpaqueSPAdjustment() const { return HasOpaqueSPAdjustment; }
656 void setHasOpaqueSPAdjustment(bool B) { HasOpaqueSPAdjustment = B; }
657
658 /// Returns true if the function contains operations which will lower down to
659 /// instructions which manipulate the stack pointer.
661 return HasCopyImplyingStackAdjustment;
662 }
664 HasCopyImplyingStackAdjustment = B;
665 }
666
667 /// Returns true if the function calls the llvm.va_start intrinsic.
668 bool hasVAStart() const { return HasVAStart; }
669 void setHasVAStart(bool B) { HasVAStart = B; }
670
671 /// Returns true if the function is variadic and contains a musttail call.
672 bool hasMustTailInVarArgFunc() const { return HasMustTailInVarArgFunc; }
673 void setHasMustTailInVarArgFunc(bool B) { HasMustTailInVarArgFunc = B; }
674
675 /// Returns true if the function contains a tail call.
676 bool hasTailCall() const { return HasTailCall; }
677 void setHasTailCall(bool V = true) { HasTailCall = V; }
678
679 /// Computes the maximum size of a callframe.
680 /// This only works for targets defining
681 /// TargetInstrInfo::getCallFrameSetupOpcode(), getCallFrameDestroyOpcode(),
682 /// and getFrameSize().
683 /// This is usually computed by the prologue epilogue inserter but some
684 /// targets may call this to compute it earlier.
685 /// If FrameSDOps is passed, the frame instructions in the MF will be
686 /// inserted into it.
688 MachineFunction &MF,
689 std::vector<MachineBasicBlock::iterator> *FrameSDOps = nullptr);
690
691 /// Return the maximum size of a call frame that must be
692 /// allocated for an outgoing function call. This is only available if
693 /// CallFrameSetup/Destroy pseudo instructions are used by the target, and
694 /// then only during or after prolog/epilog code insertion.
695 ///
697 // TODO: Enable this assert when targets are fixed.
698 //assert(isMaxCallFrameSizeComputed() && "MaxCallFrameSize not computed yet");
700 return 0;
701 return MaxCallFrameSize;
702 }
704 return MaxCallFrameSize != ~UINT64_C(0);
705 }
706 void setMaxCallFrameSize(uint64_t S) { MaxCallFrameSize = S; }
707
708 /// Returns how many bytes of callee-saved registers the target pushed in the
709 /// prologue. Only used for debug info.
711 return CVBytesOfCalleeSavedRegisters;
712 }
714 CVBytesOfCalleeSavedRegisters = S;
715 }
716
717 /// Create a new object at a fixed location on the stack.
718 /// All fixed objects should be created before other objects are created for
719 /// efficiency. By default, fixed objects are not pointed to by LLVM IR
720 /// values. This returns an index with a negative value.
721 LLVM_ABI int CreateFixedObject(uint64_t Size, int64_t SPOffset,
722 bool IsImmutable, bool isAliased = false);
723
724 /// Create a spill slot at a fixed location on the stack.
725 /// Returns an index with a negative value.
727 bool IsImmutable = false);
728
729 /// Returns true if the specified index corresponds to a fixed stack object.
730 bool isFixedObjectIndex(int ObjectIdx) const {
731 return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects);
732 }
733
734 /// Returns true if the specified index corresponds
735 /// to an object that might be pointed to by an LLVM IR value.
736 bool isAliasedObjectIndex(int ObjectIdx) const {
737 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
738 "Invalid Object Idx!");
739 return Objects[ObjectIdx+NumFixedObjects].isAliased;
740 }
741
742 /// Set "maybe pointed to by an LLVM IR value" for an object.
743 void setIsAliasedObjectIndex(int ObjectIdx, bool IsAliased) {
744 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
745 "Invalid Object Idx!");
746 Objects[ObjectIdx+NumFixedObjects].isAliased = IsAliased;
747 }
748
749 /// Returns true if the specified index corresponds to an immutable object.
750 bool isImmutableObjectIndex(int ObjectIdx) const {
751 // Tail calling functions can clobber their function arguments.
752 if (HasTailCall)
753 return false;
754 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
755 "Invalid Object Idx!");
756 return Objects[ObjectIdx+NumFixedObjects].isImmutable;
757 }
758
759 /// Marks the immutability of an object.
760 void setIsImmutableObjectIndex(int ObjectIdx, bool IsImmutable) {
761 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
762 "Invalid Object Idx!");
763 Objects[ObjectIdx+NumFixedObjects].isImmutable = IsImmutable;
764 }
765
766 /// Returns true if the specified index corresponds to a spill slot.
767 bool isSpillSlotObjectIndex(int ObjectIdx) const {
768 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
769 "Invalid Object Idx!");
770 return Objects[ObjectIdx+NumFixedObjects].isSpillSlot;
771 }
772
773 bool isStatepointSpillSlotObjectIndex(int ObjectIdx) const {
774 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
775 "Invalid Object Idx!");
776 return Objects[ObjectIdx+NumFixedObjects].isStatepointSpillSlot;
777 }
778
779 bool isCalleeSavedObjectIndex(int ObjectIdx) const {
780 assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
781 "Invalid Object Idx!");
782 return Objects[ObjectIdx + NumFixedObjects].isCalleeSaved;
783 }
784
785 void setIsCalleeSavedObjectIndex(int ObjectIdx, bool IsCalleeSaved) {
786 assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
787 "Invalid Object Idx!");
788 Objects[ObjectIdx + NumFixedObjects].isCalleeSaved = IsCalleeSaved;
789 }
790
791 /// \see StackID
792 uint8_t getStackID(int ObjectIdx) const {
793 return Objects[ObjectIdx+NumFixedObjects].StackID;
794 }
795
796 /// \see StackID
797 void setStackID(int ObjectIdx, uint8_t ID) {
798 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
799 "Invalid Object Idx!");
800 Objects[ObjectIdx+NumFixedObjects].StackID = ID;
801 // If ID > 0, MaxAlignment may now be overly conservative.
802 // If ID == 0, MaxAlignment will need to be updated separately.
803 }
804
805 /// Returns true if the specified index corresponds to a dead object.
806 bool isDeadObjectIndex(int ObjectIdx) const {
807 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
808 "Invalid Object Idx!");
809 return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
810 }
811
812 /// Returns true if the specified index corresponds to a variable sized
813 /// object.
814 bool isVariableSizedObjectIndex(int ObjectIdx) const {
815 assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
816 "Invalid Object Idx!");
817 return Objects[ObjectIdx + NumFixedObjects].Size == 0;
818 }
819
821 assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
822 "Invalid Object Idx!");
823 Objects[ObjectIdx+NumFixedObjects].isStatepointSpillSlot = true;
824 assert(isStatepointSpillSlotObjectIndex(ObjectIdx) && "inconsistent");
825 }
826
827 /// Create a new statically sized stack object, returning
828 /// a nonnegative identifier to represent it.
830 bool isSpillSlot,
831 const AllocaInst *Alloca = nullptr,
832 uint8_t ID = 0);
833
834 /// Create a new statically sized stack object that represents a spill slot,
835 /// returning a nonnegative identifier to represent it.
837
838 /// Remove or mark dead a statically sized stack object.
839 void RemoveStackObject(int ObjectIdx) {
840 // Mark it dead.
841 Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL;
842 }
843
844 /// Notify the MachineFrameInfo object that a variable sized object has been
845 /// created. This must be created whenever a variable sized object is
846 /// created, whether or not the index returned is actually used.
848 const AllocaInst *Alloca);
849
850 /// Returns a reference to call saved info vector for the current function.
851 const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {
852 return CSInfo;
853 }
854 /// \copydoc getCalleeSavedInfo()
855 std::vector<CalleeSavedInfo> &getCalleeSavedInfo() { return CSInfo; }
856
857 /// Used by prolog/epilog inserter to set the function's callee saved
858 /// information.
859 void setCalleeSavedInfo(std::vector<CalleeSavedInfo> CSI) {
860 CSInfo = std::move(CSI);
861 }
862
863 /// Has the callee saved info been calculated yet?
864 bool isCalleeSavedInfoValid() const { return CSIValid; }
865
866 void setCalleeSavedInfoValid(bool v) { CSIValid = v; }
867
868 const SaveRestorePoints &getRestorePoints() const { return RestorePoints; }
869
870 const SaveRestorePoints &getSavePoints() const { return SavePoints; }
871
872 void setSavePoints(SaveRestorePoints NewSavePoints) {
873 SavePoints = std::move(NewSavePoints);
874 }
875
876 void setRestorePoints(SaveRestorePoints NewRestorePoints) {
877 RestorePoints = std::move(NewRestorePoints);
878 }
879
880 void clearSavePoints() { SavePoints.clear(); }
881 void clearRestorePoints() { RestorePoints.clear(); }
882
883 uint64_t getUnsafeStackSize() const { return UnsafeStackSize; }
884 void setUnsafeStackSize(uint64_t Size) { UnsafeStackSize = Size; }
885
886 /// Return a set of physical registers that are pristine.
887 ///
888 /// Pristine registers hold a value that is useless to the current function,
889 /// but that must be preserved - they are callee saved registers that are not
890 /// saved.
891 ///
892 /// Before the PrologueEpilogueInserter has placed the CSR spill code, this
893 /// method always returns an empty set.
895
896 /// Used by the MachineFunction printer to print information about
897 /// stack objects. Implemented in MachineFunction.cpp.
898 LLVM_ABI void print(const MachineFunction &MF, raw_ostream &OS) const;
899
900 /// dump - Print the function to stderr.
901 LLVM_ABI void dump(const MachineFunction &MF) const;
902};
903
904} // End llvm namespace
905
906#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
#define I(x, y, z)
Definition MD5.cpp:57
#define T
This file defines the SmallVector class.
an instruction to allocate memory on the stack
CalleeSavedInfo(MCRegister R, int FI=0)
void setReg(MCRegister R)
MCRegister getReg() const
MCRegister getDstReg() const
void setDstReg(MCRegister SpillReg)
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
constexpr unsigned id() const
Definition MCRegister.h:82
bool needsSplitStackProlog() const
Return true if this function requires a split stack prolog, even if it uses no stack space.
void setMaxCallFrameSize(uint64_t S)
LLVM_ABI int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
void clearObjectAllocation(int ObjectIdx)
Remove the underlying Alloca of the specified stack object if it exists.
void setObjectZExt(int ObjectIdx, bool IsZExt)
void setIsImmutableObjectIndex(int ObjectIdx, bool IsImmutable)
Marks the immutability of an object.
SSPLayoutKind getObjectSSPLayout(int ObjectIdx) const
bool isObjectPreAllocated(int ObjectIdx) const
Return true if the object was pre-allocated into the local block.
LLVM_ABI void computeMaxCallFrameSize(MachineFunction &MF, std::vector< MachineBasicBlock::iterator > *FrameSDOps=nullptr)
Computes the maximum size of a callframe.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
LLVM_ABI int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it.
LLVM_ABI void ensureMaxAlignment(Align Alignment)
Make sure the function is at least Align bytes aligned.
bool isReturnAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
MachineFrameInfo(Align StackAlignment, bool StackRealignable, bool ForcedRealign)
int64_t getLocalFrameObjectCount() const
Return the number of objects allocated into the local object block.
void setHasPatchPoint(bool s=true)
bool hasCalls() const
Return true if the current function has any function calls.
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
std::vector< CalleeSavedInfo > & getCalleeSavedInfo()
bool isScalableStackID(uint8_t StackID) const
FramePointerKind getFramePointerPolicy() const
void setUseLocalStackAllocationBlock(bool v)
setUseLocalStackAllocationBlock - Set whether the local allocation blob should be allocated together ...
Align getMaxAlign() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
Align getLocalFrameMaxAlign() const
Return the required alignment of the local object blob.
void setLocalFrameSize(int64_t sz)
Set the size of the local object blob.
void setObjectOffset(int ObjectIdx, int64_t SPOffset)
Set the stack frame offset of the specified object.
SSPLayoutKind
Stack Smashing Protection (SSP) rules require that vulnerable stack allocations are located close the...
@ SSPLK_SmallArray
Array or nested array < SSP-buffer-size.
@ SSPLK_LargeArray
Array or nested array >= SSP-buffer-size.
@ SSPLK_AddrOf
The address of this allocation is exposed and triggered protection.
@ SSPLK_None
Did not trigger a stack protector.
bool isCalleeSavedObjectIndex(int ObjectIdx) const
void markAsStatepointSpillSlotObjectIndex(int ObjectIdx)
std::pair< int, int64_t > getLocalFrameObjectMap(int i) const
Get the local offset mapping for a for an object.
bool contributesToMaxAlignment(uint8_t StackID)
Should this stack ID be considered in MaxAlignment.
void setFrameAddressIsTaken(bool T)
uint64_t getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call.
bool shouldRealignStack() const
Return true if stack realignment is forced by function attributes or if the stack alignment.
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
void setHasStackMap(bool s=true)
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
void setSavePoints(SaveRestorePoints NewSavePoints)
bool hasScalableStackID(int ObjectIdx) const
void setFramePointerPolicy(FramePointerKind Kind)
void setObjectSExt(int ObjectIdx, bool IsSExt)
void setObjectSSPLayout(int ObjectIdx, SSPLayoutKind Kind)
bool getUseLocalStackAllocationBlock() const
Get whether the local allocation blob should be allocated together or let PEI allocate the locals in ...
void setLocalFrameMaxAlign(Align Alignment)
Required alignment of the local object blob, which is the strictest alignment of any object in it.
bool isImmutableObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an immutable object.
void setCVBytesOfCalleeSavedRegisters(unsigned S)
int getStackProtectorIndex() const
Return the index for the stack protector object.
int64_t getOffsetAdjustment() const
Return the correction for frame offsets.
LLVM_ABI int CreateSpillStackObject(uint64_t Size, Align Alignment)
Create a new statically sized stack object that represents a spill slot, returning a nonnegative iden...
void setObjectSize(int ObjectIdx, int64_t Size)
Change the size of the specified stack object.
LLVM_ABI uint64_t estimateStackSize(const MachineFunction &MF) const
Estimate and return the size of the stack frame.
void setStackID(int ObjectIdx, uint8_t ID)
void setHasTailCall(bool V=true)
bool hasTailCall() const
Returns true if the function contains a tail call.
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
void setIsAliasedObjectIndex(int ObjectIdx, bool IsAliased)
Set "maybe pointed to by an LLVM IR value" for an object.
void setCalleeSavedInfoValid(bool v)
bool isStatepointSpillSlotObjectIndex(int ObjectIdx) const
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
void setReturnAddressIsTaken(bool s)
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
bool isObjectZExt(int ObjectIdx) const
void mapLocalFrameObject(int ObjectIndex, int64_t Offset)
Map a frame index into the local object block.
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool isMaxCallFrameSizeComputed() const
void setHasOpaqueSPAdjustment(bool B)
int64_t getLocalFrameSize() const
Get the size of the local object blob.
bool isObjectSExt(int ObjectIdx) const
LLVM_ABI BitVector getPristineRegs(const MachineFunction &MF) const
Return a set of physical registers that are pristine.
bool hasStackMap() const
This method may be called any time after instruction selection is complete to determine if there is a...
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
void RemoveStackObject(int ObjectIdx)
Remove or mark dead a statically sized stack object.
void setCalleeSavedInfo(std::vector< CalleeSavedInfo > CSI)
Used by prolog/epilog inserter to set the function's callee saved information.
void setHasCopyImplyingStackAdjustment(bool B)
LLVM_ABI void print(const MachineFunction &MF, raw_ostream &OS) const
Used by the MachineFunction printer to print information about stack objects.
unsigned getNumObjects() const
Return the number of objects.
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
unsigned getCVBytesOfCalleeSavedRegisters() const
Returns how many bytes of callee-saved registers the target pushed in the prologue.
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
LLVM_ABI int CreateVariableSizedObject(Align Alignment, const AllocaInst *Alloca)
Notify the MachineFrameInfo object that a variable sized object has been created.
uint64_t getUnsafeStackSize() const
LLVM_ABI void dump(const MachineFunction &MF) const
dump - Print the function to stderr.
int getObjectIndexEnd() const
Return one past the maximum frame object index.
bool hasStackProtectorIndex() const
void setRestorePoints(SaveRestorePoints NewRestorePoints)
bool hasCopyImplyingStackAdjustment() const
Returns true if the function contains operations which will lower down to instructions which manipula...
bool hasStackObjects() const
Return true if there are any stack objects in this function.
LLVM_ABI int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset, bool IsImmutable=false)
Create a spill slot at a fixed location on the stack.
MachineFrameInfo(const MachineFrameInfo &)=delete
uint8_t getStackID(int ObjectIdx) const
const SaveRestorePoints & getRestorePoints() const
unsigned getNumFixedObjects() const
Return the number of fixed objects.
void setIsCalleeSavedObjectIndex(int ObjectIdx, bool IsCalleeSaved)
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool hasFunctionContextIndex() const
void setStackSize(uint64_t Size)
Set the size of the stack.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
int getObjectIndexBegin() const
Return the minimum frame object index.
const SaveRestorePoints & getSavePoints() const
void setUnsafeStackSize(uint64_t Size)
void setHasMustTailInVarArgFunc(bool B)
void setObjectAlignment(int ObjectIdx, Align Alignment)
setObjectAlignment - Change the alignment of the specified stack object.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
void setOffsetAdjustment(int64_t Adj)
Set the correction for frame offsets.
int getFunctionContextIndex() const
Return the index for the function context object.
bool isAliasedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an object that might be pointed to by an LLVM IR v...
void setFunctionContextIndex(int I)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:532
FramePointerKind
Definition CodeGen.h:118
DenseMap< MachineBasicBlock *, std::vector< CalleeSavedInfo > > SaveRestorePoints
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39