Go to the documentation of this file.
30 return a.Alignment >
b.Alignment;
43 if (Size <= 4) Res = 16;
44 else if (Size <= 16) Res = 32;
45 else if (Size <= 128) Res = Size + 32;
46 else if (Size <= 512) Res = Size + 64;
47 else if (Size <= 4096) Res = Size + 128;
48 else Res = Size + 256;
55 assert(Granularity >= 8 && Granularity <= 64 &&
56 (Granularity & (Granularity - 1)) == 0);
57 assert(MinHeaderSize >= 16 && (MinHeaderSize & (MinHeaderSize - 1)) == 0 &&
58 MinHeaderSize >= Granularity);
59 const size_t NumVars = Vars.size();
61 for (
size_t i = 0;
i < NumVars;
i++)
72 for (
size_t i = 0;
i < NumVars;
i++) {
73 bool IsLast =
i == NumVars - 1;
77 assert((Alignment & (Alignment - 1)) == 0);
82 IsLast ? Granularity :
std::max(Granularity, Vars[
i + 1].Alignment);
88 if (
Offset % MinHeaderSize) {
100 StackDescription << Vars.size();
102 for (
const auto &Var : Vars) {
103 std::string Name = Var.Name;
108 StackDescription <<
" " << Var.Offset <<
" " << Var.Size <<
" "
109 << Name.size() <<
" " << Name;
111 return StackDescription.
str();
114 SmallVector<uint8_t, 64>
122 for (
const auto &Var : Vars) {
125 SB.
resize(SB.size() + Var.Size / Granularity, 0);
126 if (Var.Size % Granularity)
127 SB.push_back(Var.Size % Granularity);
139 for (
const auto &Var : Vars) {
140 assert(Var.LifetimeSize <= Var.Size);
142 (Var.LifetimeSize + Granularity - 1) / Granularity;
144 std::fill(SB.begin() +
Offset, SB.begin() +
Offset + LifetimeShadowSize,
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
This is an optimization pass for GlobalISel generic memory operations.
static uint64_t VarAndRedzoneSize(uint64_t Size, uint64_t Granularity, uint64_t Alignment)
SmallVector< uint8_t, 64 > GetShadowBytesAfterScope(const SmallVectorImpl< ASanStackVariableDescription > &Vars, const ASanStackFrameLayout &Layout)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
SmallVector< uint8_t, 64 > GetShadowBytes(const SmallVectorImpl< ASanStackVariableDescription > &Vars, const ASanStackFrameLayout &Layout)
static const uint64_t kMinAlignment
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
=0.0 ? 0.0 :(a > 0.0 ? 1.0 :-1.0) a
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int b
static bool CompareVars(const ASanStackVariableDescription &a, const ASanStackVariableDescription &b)
static const int kAsanStackUseAfterScopeMagic
static const int kAsanStackLeftRedzoneMagic
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef str() const
Return a StringRef for the vector contents.
void stable_sort(R &&Range)
static const int kAsanStackRightRedzoneMagic
SmallString< 64 > ComputeASanStackFrameDescription(const SmallVectorImpl< ASanStackVariableDescription > &Vars)
std::string to_string(const T &Value)
static const int kAsanStackMidRedzoneMagic
A raw_ostream that writes to an SmallVector or SmallString.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
ASanStackFrameLayout ComputeASanStackFrameLayout(SmallVectorImpl< ASanStackVariableDescription > &Vars, uint64_t Granularity, uint64_t MinHeaderSize)