本文整理汇总了C#中WorkItem.setWeightBefore方法的典型用法代码示例。如果您正苦于以下问题:C# WorkItem.setWeightBefore方法的具体用法?C# WorkItem.setWeightBefore怎么用?C# WorkItem.setWeightBefore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkItem
的用法示例。
在下文中一共展示了WorkItem.setWeightBefore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: process
private void process(WorkItem wi) {
Contract.Requires(wi != null);
GenKillWeight/*!*/ w = wi.getWeightAfter();
Contract.Assert(w != null);
for (int i = wi.block.Cmds.Count - 1; i >= 0; i--) {
Cmd/*!*/ c = wi.block.Cmds[i];
Contract.Assert(c != null);
if (c is CallCmd && procICFG.ContainsKey(cce.NonNull(cce.NonNull((CallCmd)c).Proc).Name)) {
w = GenKillWeight.extend(getWeightCall(cce.NonNull((CallCmd)c)), w);
} else {
GenKillWeight/*!*/ cweight = getWeight(c, wi.cfg.impl, program);
Contract.Assert(cweight != null);
w = GenKillWeight.extend(cweight, w);
}
}
bool change = wi.setWeightBefore(w);
if (change && wi.cfg.srcNodes.Contains(wi.block)) {
GenKillWeight/*!*/ prev = wi.cfg.summary;
Contract.Assert(prev != null);
GenKillWeight/*!*/ curr = GenKillWeight.combine(prev, wi.cfg.weightBefore[wi.block]);
Contract.Assert(curr != null);
if (!GenKillWeight.isEqual(prev, curr)) {
wi.cfg.summary = curr;
// push callers onto the worklist
if (callers.ContainsKey(wi.cfg.impl.Name)) {
foreach (WorkItem/*!*/ caller in callers[wi.cfg.impl.Name]) {
Contract.Assert(caller != null);
AddToWorkList(caller);
}
}
}
}
foreach (Block/*!*/ b in wi.cfg.predEdges[wi.block]) {
Contract.Assert(b != null);
GenKillWeight/*!*/ prev = wi.cfg.weightAfter[b];
Contract.Assert(prev != null);
GenKillWeight/*!*/ curr = GenKillWeight.combine(prev, w);
Contract.Assert(curr != null);
if (!GenKillWeight.isEqual(prev, curr)) {
wi.cfg.weightAfter[b] = curr;
AddToWorkList(new WorkItem(wi.cfg, b));
}
}
}