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;
49 return alignTo(std::max(Res, 2 * Granularity), Alignment);
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++)
62 Vars[i].Alignment = std::max(Vars[i].Alignment,
kMinAlignment);
70 std::max(std::max(MinHeaderSize, Granularity), Vars[0].Alignment);
72 for (
size_t i = 0; i < NumVars; i++) {
73 bool IsLast = i == NumVars - 1;
74 uint64_t Alignment = std::max(Granularity, Vars[i].Alignment);
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 <<
" "
111 return StackDescription.
str();
114SmallVector<uint8_t, 64>
122 for (
const auto &Var : Vars) {
125 SB.
resize(SB.
size() + Var.Size / Granularity, 0);
126 if (Var.Size % Granularity)
139 for (
const auto &Var : Vars) {
140 assert(Var.LifetimeSize <= Var.Size);
142 (Var.LifetimeSize + Granularity - 1) / Granularity;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
std::string to_string(const T &Value)
SmallVector< uint8_t, 64 > GetShadowBytesAfterScope(const SmallVectorImpl< ASanStackVariableDescription > &Vars, const ASanStackFrameLayout &Layout)
static bool CompareVars(const ASanStackVariableDescription &a, const ASanStackVariableDescription &b)
SmallString< 64 > ComputeASanStackFrameDescription(const SmallVectorImpl< ASanStackVariableDescription > &Vars)
static uint64_t VarAndRedzoneSize(uint64_t Size, uint64_t Granularity, uint64_t Alignment)
SmallVector< uint8_t, 64 > GetShadowBytes(const SmallVectorImpl< ASanStackVariableDescription > &Vars, const ASanStackFrameLayout &Layout)
static const uint64_t kMinAlignment
static const int kAsanStackUseAfterScopeMagic
ASanStackFrameLayout ComputeASanStackFrameLayout(SmallVectorImpl< ASanStackVariableDescription > &Vars, uint64_t Granularity, uint64_t MinHeaderSize)
static const int kAsanStackLeftRedzoneMagic
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
static const int kAsanStackRightRedzoneMagic
static const int kAsanStackMidRedzoneMagic