本文整理汇总了C++中BitArray::copyBits方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::copyBits方法的具体用法?C++ BitArray::copyBits怎么用?C++ BitArray::copyBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::copyBits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: livenessAnalysis
Error Context::livenessAnalysis() {
uint32_t bLen = static_cast<uint32_t>(
((_contextVd.getLength() + BitArray::kEntityBits - 1) / BitArray::kEntityBits));
// No variables.
if (bLen == 0)
return kErrorOk;
HLFunc* func = getFunc();
HLJump* from = NULL;
LivenessTarget* ltCur = NULL;
LivenessTarget* ltUnused = NULL;
PodList<HLNode*>::Link* retPtr = _returningList.getFirst();
ASMJIT_ASSERT(retPtr != NULL);
HLNode* node = retPtr->getValue();
size_t varMapToVaListOffset = _varMapToVaListOffset;
BitArray* bCur = newBits(bLen);
if (bCur == NULL)
goto _NoMemory;
// Allocate bits for code visited first time.
_OnVisit:
for (;;) {
if (node->hasLiveness()) {
if (bCur->_addBitsDelSource(node->getLiveness(), bCur, bLen))
goto _OnPatch;
else
goto _OnDone;
}
BitArray* bTmp = copyBits(bCur, bLen);
if (bTmp == NULL)
goto _NoMemory;
node->setLiveness(bTmp);
VarMap* map = node->getMap();
if (map != NULL) {
uint32_t vaCount = map->getVaCount();
VarAttr* vaList = reinterpret_cast<VarAttr*>(((uint8_t*)map) + varMapToVaListOffset);
for (uint32_t i = 0; i < vaCount; i++) {
VarAttr* va = &vaList[i];
VarData* vd = va->getVd();
uint32_t flags = va->getFlags();
uint32_t ctxId = vd->getLocalId();
if ((flags & kVarAttrWAll) && !(flags & kVarAttrRAll)) {
// Write-Only.
bTmp->setBit(ctxId);
bCur->delBit(ctxId);
}
else {
// Read-Only or Read/Write.
bTmp->setBit(ctxId);
bCur->setBit(ctxId);
}
}
}
if (node->getType() == kHLNodeTypeLabel)
goto _OnTarget;
if (node == func)
goto _OnDone;
ASMJIT_ASSERT(node->getPrev());
node = node->getPrev();
}
// Patch already generated liveness bits.
_OnPatch:
for (;;) {
ASMJIT_ASSERT(node->hasLiveness());
BitArray* bNode = node->getLiveness();
if (!bNode->_addBitsDelSource(bCur, bLen))
goto _OnDone;
if (node->getType() == kHLNodeTypeLabel)
goto _OnTarget;
if (node == func)
goto _OnDone;
node = node->getPrev();
}
_OnTarget:
if (static_cast<HLLabel*>(node)->getNumRefs() != 0) {
// Push a new LivenessTarget onto the stack if needed.
if (ltCur == NULL || ltCur->node != node) {
// Allocate a new LivenessTarget object (from pool or zone).
LivenessTarget* ltTmp = ltUnused;
//.........这里部分代码省略.........