MCPcopy Create free account
hub / github.com/ZDoom/gzdoom / _newStackCell

Method _newStackCell

libraries/asmjit/asmjit/base/regalloc.cpp:209–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209RACell* RAPass::_newStackCell(uint32_t size, uint32_t alignment) {
210 RACell* cell = static_cast<RACell*>(_zone->alloc(sizeof(RACell)));
211 if (ASMJIT_UNLIKELY(!cell)) return nullptr;
212
213 if (alignment == 0)
214 alignment = RAGetDefaultAlignment(size);
215
216 if (alignment > 64)
217 alignment = 64;
218
219 ASMJIT_ASSERT(Utils::isPowerOf2(alignment));
220 size = Utils::alignTo<uint32_t>(size, alignment);
221
222 // Insert it sorted according to the alignment and size.
223 {
224 RACell** pPrev = &_memStackCells;
225 RACell* cur = *pPrev;
226
227 while (cur && ((cur->alignment > alignment) || (cur->alignment == alignment && cur->size > size))) {
228 pPrev = &cur->next;
229 cur = *pPrev;
230 }
231
232 cell->next = cur;
233 cell->offset = 0;
234 cell->size = size;
235 cell->alignment = alignment;
236
237 *pPrev = cell;
238 _memStackCellsUsed++;
239
240 _memMaxAlign = std::max<uint32_t>(_memMaxAlign, alignment);
241 _memStackTotal += size;
242 }
243
244 return cell;
245}
246
247Error RAPass::resolveCellOffsets() {
248 RACell* varCell = _memVarCells;

Callers

nothing calls this directly

Calls 3

RAGetDefaultAlignmentFunction · 0.85
isPowerOf2Function · 0.85
allocMethod · 0.45

Tested by

no test coverage detected