本文整理汇总了C++中ControlFlowGraph::getDfBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlFlowGraph::getDfBlock方法的具体用法?C++ ControlFlowGraph::getDfBlock怎么用?C++ ControlFlowGraph::getDfBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlFlowGraph
的用法示例。
在下文中一共展示了ControlFlowGraph::getDfBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateParams
void LiveDict::updateParams() {
ControlFlowGraph *g = m_am.graph();
ControlBlock *b = g->getDfBlock(1);
size_t width = g->bitWidth();
BitOps::Bits *avlin = b->getRow(DataFlow::PAvailIn);
BitOps::Bits *dieout = m_am.graph()->getTempBits(0);
BitOps::set(width, dieout, 0);
for (int i = size(); i--; ) {
if (ExpressionPtr e = get(i)) {
always_assert(e->is(Expression::KindOfSimpleVariable));
Symbol *sym = static_pointer_cast<SimpleVariable>(e)->getSymbol();
if (sym) {
if (sym->isParameter() || sym->isClosureVar() || e->isThis()) {
BitOps::set_bit(e->getCanonID(), avlin, true);
}
if (sym->isNeeded() || sym->isReferenced()) {
BitOps::set_bit(e->getCanonID(), dieout, true);
}
}
}
}
for (int i = g->getNumBlocks(); i; i--) {
b = g->getDfBlock(i);
if (!b->out_size()) {
BitOps::bit_or(width, b->getRow(DataFlow::PDieOut),
b->getRow(DataFlow::PDieOut), dieout);
}
}
}
示例2: ComputeAvailable
void DataFlow::ComputeAvailable(const ControlFlowGraph &g) {
int num = g.getNumBlocks();
bool changed;
BitOps::Bits *tmp1 = g.getTempBits(0);
bool hasAltered = g.rowExists(Altered);
size_t width = g.bitWidth();
bool firstTime = true;
do {
changed = false;
for (int i = 1; i <= num; i++) {
ControlBlock *b = g.getDfBlock(i);
std::pair<in_edge_iterator, in_edge_iterator> vi =
in_edges(b, g);
BitOps::Bits *ain = b->getRow(AvailIn);
if (vi.first != vi.second) {
ControlBlock *p = source(*vi.first, g);
if (++vi.first != vi.second) {
if (!changed) BitOps::bit_copy(width, tmp1, ain);
BitOps::bit_and(width, ain,
p->getRow(AvailOut),
source(*vi.first, g)->getRow(AvailOut));
while (++vi.first != vi.second) {
p = source(*vi.first, g);
BitOps::bit_and(width, ain, ain, p->getRow(AvailOut));
}
if (!changed) changed = !BitOps::bit_equal(width, tmp1, ain);
} else {
if (!changed) {
changed = !BitOps::bit_equal(width, ain, p->getRow(AvailOut));
}
BitOps::bit_copy(width, ain, p->getRow(AvailOut));
}
} else if (firstTime) {
// available defaults to all 1s
// if there are no preds, set to all 0s
BitOps::set(width, ain, 0);
}
BitOps::Bits *aout = b->getRow(AvailOut);
if (!changed) BitOps::bit_copy(width, tmp1, aout);
BitOps::Bits *avl = b->getRow(Available);
if (hasAltered) {
BitOps::Bits *alt = b->getRow(Altered);
BitOps::bit_andc_or(width, aout, ain, alt, avl);
} else {
BitOps::bit_or(width, aout, ain, avl);
}
if (!changed) changed = !BitOps::bit_equal(width, tmp1, aout);
}
firstTime = false;
} while (changed);
}
示例3: ComputeAnticipated
void DataFlow::ComputeAnticipated(const ControlFlowGraph &g) {
int num = g.getNumBlocks();
bool changed;
BitOps::Bits *tmp1 = g.getTempBits(0);
bool hasAltered = g.rowExists(Altered);
size_t width = g.bitWidth();
bool firstTime = true;
do {
changed = false;
for (int i = num; i ; i--) {
ControlBlock *b = g.getDfBlock(i);
std::pair<out_edge_iterator, out_edge_iterator> vi =
out_edges(b, g);
BitOps::Bits *aout = b->getRow(AntOut);
if (vi.first != vi.second) {
ControlBlock *s = target(*vi.first, g);
if (++vi.first != vi.second) {
if (!changed) BitOps::bit_copy(width, tmp1, aout);
BitOps::bit_and(width, aout,
s->getRow(AntIn),
target(*vi.first, g)->getRow(AntIn));
while (++vi.first != vi.second) {
s = target(*vi.first, g);
BitOps::bit_and(width, aout, aout, s->getRow(AntIn));
}
if (!changed) changed = !BitOps::bit_equal(width, tmp1, aout);
} else {
if (!changed) {
changed = !BitOps::bit_equal(width, aout, s->getRow(AntIn));
}
BitOps::bit_copy(width, aout, s->getRow(AntIn));
}
} else if (firstTime) {
// anticipated defaults to all 1s
// if there are no succs, set to all 0s
BitOps::set(width, aout, 0);
}
BitOps::Bits *ain = b->getRow(AntIn);
if (!changed) BitOps::bit_copy(width, tmp1, ain);
BitOps::Bits *ant = b->getRow(Anticipated);
if (hasAltered) {
BitOps::Bits *alt = b->getRow(Altered);
BitOps::bit_andc_or(width, ain, aout, alt, ant);
} else {
BitOps::bit_or(width, ain, aout, ant);
}
if (!changed) changed = !BitOps::bit_equal(width, tmp1, ain);
}
} while (changed);
}
示例4: ComputeUsed
void DataFlow::ComputeUsed(const ControlFlowGraph &g) {
int num = g.getNumBlocks();
size_t width = g.bitWidth();
for (int i = num; i ; i--) {
ControlBlock *b = g.getDfBlock(i);
BitOps::Bits *ant = b->getRow(Anticipated);
BitOps::Bits *alt = b->getRow(Altered);
BitOps::Bits *avl = b->getRow(Available);
BitOps::bit_or_or(width, b->getRow(Used), ant, alt, avl);
}
}
示例5: ComputeForwards
void DataFlow::ComputeForwards(T func, const ControlFlowGraph &g,
int lAttr, int altAttr,
int inAttr, int outAttr) {
int num = g.getNumBlocks();
bool changed;
BitOps::Bits *tmp1 = g.getTempBits(0);
bool hasAltered = g.rowExists(altAttr);
size_t width = g.bitWidth();
do {
changed = false;
for (int i = 1; i <= num; i++) {
ControlBlock *b = g.getDfBlock(i);
std::pair<in_edge_iterator, in_edge_iterator> vi =
boost::in_edges(b, g);
BitOps::Bits *ain = b->getRow(inAttr);
if (vi.first != vi.second) {
ControlBlock *p = boost::source(*vi.first, g);
if (++vi.first != vi.second) {
if (!changed) BitOps::bit_copy(width, tmp1, ain);
func(width, ain,
p->getRow(outAttr),
boost::source(*vi.first, g)->getRow(outAttr));
while (++vi.first != vi.second) {
p = boost::source(*vi.first, g);
func(width, ain, ain, p->getRow(outAttr));
}
if (!changed) changed = !BitOps::bit_equal(width, tmp1, ain);
} else {
if (!changed) {
changed = !BitOps::bit_equal(width, ain, p->getRow(outAttr));
}
BitOps::bit_copy(width, ain, p->getRow(outAttr));
}
}
BitOps::Bits *aout = b->getRow(outAttr);
if (!changed) BitOps::bit_copy(width, tmp1, aout);
BitOps::Bits *avl = b->getRow(lAttr);
if (hasAltered) {
BitOps::Bits *alt = b->getRow(altAttr);
BitOps::bit_andc_or(width, aout, ain, alt, avl);
} else {
BitOps::bit_or(width, aout, ain, avl);
}
if (!changed) changed = !BitOps::bit_equal(width, tmp1, aout);
}
} while (changed);
}
示例6: updateParams
void RefDict::updateParams() {
ControlFlowGraph *g = m_am.graph();
ControlBlock *b = g->getDfBlock(1);
BitOps::Bits *refbv = b->getRow(DataFlow::PRefIn);
BitOps::Bits *objbv = b->getRow(DataFlow::PObjIn);
for (int i = size(); i--; ) {
if (ExpressionPtr e = get(i)) {
always_assert(e->is(Expression::KindOfSimpleVariable));
always_assert(((unsigned int)i) == e->getCanonID());
Symbol *sym = static_pointer_cast<SimpleVariable>(e)->getSymbol();
if (sym && (sym->isParameter() || sym->isClosureVar())) {
TypePtr paramType;
bool isRef;
if (sym->isParameter()) {
ExpressionListPtr methodParams = m_method_stmt->getParams();
ExpressionPtr paramExprPtr =
(*methodParams)[sym->getParameterIndex()];
paramType = paramExprPtr->getType();
isRef = m_method_stmt->isRef(sym->getParameterIndex());
} else {
assert(sym->isClosureVar());
// can only assume it is a Variant for now
paramType = Type::Variant;
isRef = sym->isRefClosureVar();
}
if (first_pass) {
if (isRef || sym->isCallTimeRef()) {
BitOps::set_bit(i, refbv, true);
}
} else {
if (paramType) {
if (!paramType->isNoObjectInvolved()) {
BitOps::set_bit(i, objbv, true);
}
} else {
// no type information, so we must assume it holds an object
BitOps::set_bit(i, objbv, true);
}
}
}
}
}
}