MCPcopy Create free account
hub / github.com/ZDoom/Raze / livenessAnalysis

Method livenessAnalysis

libraries/asmjit/asmjit/base/regalloc.cpp:361–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359};
360
361Error RAPass::livenessAnalysis() {
362 uint32_t bLen = static_cast<uint32_t>(
363 ((_contextVd.getLength() + RABits::kEntityBits - 1) / RABits::kEntityBits));
364
365 // No variables.
366 if (bLen == 0)
367 return kErrorOk;
368
369 CCFunc* func = getFunc();
370 CBJump* from = nullptr;
371
372 LivenessTarget* ltCur = nullptr;
373 LivenessTarget* ltUnused = nullptr;
374
375 ZoneList<CBNode*>::Link* retPtr = _returningList.getFirst();
376 ASMJIT_ASSERT(retPtr != nullptr);
377
378 CBNode* node = retPtr->getValue();
379 RAData* wd;
380
381 size_t varMapToVaListOffset = _varMapToVaListOffset;
382 RABits* bCur = newBits(bLen);
383 if (ASMJIT_UNLIKELY(!bCur)) goto NoMem;
384
385 // Allocate bits for code visited first time.
386Visit:
387 for (;;) {
388 wd = node->getPassData<RAData>();
389 if (wd->liveness) {
390 if (bCur->_addBitsDelSource(wd->liveness, bCur, bLen))
391 goto Patch;
392 else
393 goto Done;
394 }
395
396 RABits* bTmp = copyBits(bCur, bLen);
397 if (!bTmp) goto NoMem;
398
399 wd = node->getPassData<RAData>();
400 wd->liveness = bTmp;
401
402 uint32_t tiedTotal = wd->tiedTotal;
403 TiedReg* tiedArray = reinterpret_cast<TiedReg*>(((uint8_t*)wd) + varMapToVaListOffset);
404
405 for (uint32_t i = 0; i < tiedTotal; i++) {
406 TiedReg* tied = &tiedArray[i];
407 VirtReg* vreg = tied->vreg;
408
409 uint32_t flags = tied->flags;
410 uint32_t raId = vreg->_raId;
411
412 if ((flags & TiedReg::kWAll) && !(flags & TiedReg::kRAll)) {
413 // Write-Only.
414 bTmp->setBit(raId);
415 bCur->delBit(raId);
416 }
417 else {
418 // Read-Only or Read/Write.

Callers

nothing calls this directly

Calls 15

getFuncFunction · 0.85
erroredFunction · 0.85
getFirstMethod · 0.80
_addBitsDelSourceMethod · 0.80
setBitMethod · 0.80
delBitMethod · 0.80
hasPassDataMethod · 0.80
getNumRefsMethod · 0.80
getFromMethod · 0.80
delBitsMethod · 0.80
getJumpNextMethod · 0.80
isJmpMethod · 0.80

Tested by

no test coverage detected