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

Method _newVarCell

libraries/asmjit/asmjit/base/regalloc.cpp:164–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164RACell* RAPass::_newVarCell(VirtReg* vreg) {
165 ASMJIT_ASSERT(vreg->_memCell == nullptr);
166
167 RACell* cell;
168 uint32_t size = vreg->getSize();
169
170 if (vreg->isStack()) {
171 cell = _newStackCell(size, vreg->getAlignment());
172 if (ASMJIT_UNLIKELY(!cell)) return nullptr;
173 }
174 else {
175 cell = static_cast<RACell*>(_zone->alloc(sizeof(RACell)));
176 if (!cell) goto _NoMemory;
177
178 cell->next = _memVarCells;
179 cell->offset = 0;
180 cell->size = size;
181 cell->alignment = size;
182
183 _memVarCells = cell;
184 _memMaxAlign = std::max<uint32_t>(_memMaxAlign, size);
185 _memVarTotal += size;
186
187 switch (size) {
188 case 1: _mem1ByteVarsUsed++ ; break;
189 case 2: _mem2ByteVarsUsed++ ; break;
190 case 4: _mem4ByteVarsUsed++ ; break;
191 case 8: _mem8ByteVarsUsed++ ; break;
192 case 16: _mem16ByteVarsUsed++; break;
193 case 32: _mem32ByteVarsUsed++; break;
194 case 64: _mem64ByteVarsUsed++; break;
195
196 default:
197 ASMJIT_NOT_REACHED();
198 }
199 }
200
201 vreg->_memCell = cell;
202 return cell;
203
204_NoMemory:
205 cc()->setLastError(DebugUtils::errored(kErrorNoHeapMemory));
206 return nullptr;
207}
208
209RACell* RAPass::_newStackCell(uint32_t size, uint32_t alignment) {
210 RACell* cell = static_cast<RACell*>(_zone->alloc(sizeof(RACell)));

Callers

nothing calls this directly

Calls 6

erroredFunction · 0.85
isStackMethod · 0.80
setLastErrorMethod · 0.80
getSizeMethod · 0.45
getAlignmentMethod · 0.45
allocMethod · 0.45

Tested by

no test coverage detected