Beispiel #1
0
        private void EnumerateDefs()
        {
            foreach (KeyValuePair <long, ICollection <long> > nodeVariablesPair in Assignments)
            {
                long uNodeId = nodeVariablesPair.Key;

                foreach (long variable in nodeVariablesPair.Value)
                {
                    long def = (long)(DefsCount++);
                    DefToVarMap[def] = variable;

                    if (!CFG.IsSourceNode(uNodeId))
                    {
                        Ensure.That(NodeToVarMap.ContainsKey(uNodeId)).IsFalse();
                        NodeToVarMap[uNodeId] = variable;
                    }

                    AppHelper.TakeValueByKey(
                        VarToDefsMap,
                        variable,
                        () => new List <long>())
                    .Add(def);

                    AppHelper.TakeValueByKey(
                        NodeToDefsSet,
                        uNodeId,
                        () => new List <long>())
                    .Add(def);

                    DefToNodeMap[def] = uNodeId;
                }
            }
        }
Beispiel #2
0
        private void EnumerateUsages()
        {
            foreach (KeyValuePair <long, ICollection <long> > nodeVariablesPair in Usages)
            {
                long uNodeId = nodeVariablesPair.Key;

                foreach (long variable in nodeVariablesPair.Value)
                {
                    long usage = (long)(UsagesCount++);

                    AppHelper.TakeValueByKey(
                        NodeToUsesSet,
                        uNodeId,
                        () => new List <long>())
                    .Add(usage);

                    if (!CFG.IsSinkNode(uNodeId))
                    {
                        Ensure.That(NodeToVarMap.ContainsKey(uNodeId)).IsTrue();
                    }

                    UseToNodeMap[usage] = uNodeId;
                }
            }
        }