コード例 #1
0
        private void SimplifyAccessInBlocks(InstrumentationRegion region, Graph <Block> blockGraph,
                                            Block netBlock, CallCmd netCall)
        {
            var predecessorBlocks = blockGraph.NestedPredecessors(netBlock);
            var successorBlocks   = blockGraph.NestedSuccessors(netBlock);

            successorBlocks.RemoveWhere(val =>
                                        predecessorBlocks.Contains(val) || val.Equals(netBlock));

            foreach (var block in successorBlocks)
            {
                foreach (var call in block.Cmds.OfType <CallCmd>())
                {
                    if (!(call.callee.StartsWith("_WRITE_LS_$M.") ||
                          call.callee.StartsWith("_READ_LS_$M.")))
                    {
                        continue;
                    }

                    ReadWriteSlicing.CleanReadWriteSets(base.EP, region, call);

                    call.callee = "_NO_OP_$" + base.EP.Name;
                    call.Ins.Clear();
                    call.Outs.Clear();
                }
            }

            if (!predecessorBlocks.Contains(netBlock))
            {
                bool foundCall = false;
                foreach (var call in netBlock.Cmds.OfType <CallCmd>())
                {
                    if (!foundCall && call.Equals(netCall))
                    {
                        foundCall = true;
                        continue;
                    }

                    if (!foundCall)
                    {
                        continue;
                    }

                    if (!(call.callee.StartsWith("_WRITE_LS_$M.") ||
                          call.callee.StartsWith("_READ_LS_$M.")))
                    {
                        continue;
                    }

                    ReadWriteSlicing.CleanReadWriteSets(base.EP, region, call);

                    call.callee = "_NO_OP_$" + base.EP.Name;
                    call.Ins.Clear();
                    call.Outs.Clear();
                }
            }
        }
コード例 #2
0
        public void Run()
        {
            if (WhoopCommandLineOptions.Get().MeasurePassExecutionTime)
            {
                this.Timer = new ExecutionTimer();
                this.Timer.Start();
            }

            foreach (var region in base.AC.InstrumentationRegions)
            {
                this.SimplifyCallsInRegion(region);
            }

            foreach (var region in base.SlicedRegions)
            {
                base.SliceRegion(region);
            }

            this.SimplifyAccessesInChangingRegion();
            var predecessors = base.EP.CallGraph.NestedPredecessors(base.ChangingRegion);
            var successors   = base.EP.CallGraph.NestedSuccessors(base.ChangingRegion);

            predecessors.RemoveWhere(val => successors.Contains(val));
            this.SimplifyAccessesInPredecessors(predecessors);

            foreach (var region in base.AC.InstrumentationRegions)
            {
                ReadWriteSlicing.CleanReadWriteModsets(base.AC, base.EP, region);
            }

            if (WhoopCommandLineOptions.Get().MeasurePassExecutionTime)
            {
                this.Timer.Stop();
                Console.WriteLine(" |  |------ [NetEnableProgramSlicing] {0}", this.Timer.Result());
            }
        }
コード例 #3
0
        private void SimplifyBlocks(InstrumentationRegion region, Graph <Block> blockGraph,
                                    Block devBlock, CallCmd devCall)
        {
            var predecessorBlocks = blockGraph.NestedPredecessors(devBlock);
            var successorBlocks   = blockGraph.NestedSuccessors(devBlock);

            predecessorBlocks.RemoveWhere(val =>
                                          successorBlocks.Contains(val) || val.Equals(devBlock));

            foreach (var block in predecessorBlocks)
            {
                foreach (var call in block.Cmds.OfType <CallCmd>())
                {
                    if (call.callee.StartsWith("_WRITE_LS_$M.") ||
                        call.callee.StartsWith("_READ_LS_$M."))
                    {
                        ReadWriteSlicing.CleanReadWriteSets(base.EP, region, call);

                        call.callee = "_NO_OP_$" + base.EP.Name;
                        call.Ins.Clear();
                        call.Outs.Clear();
                    }
                    else
                    {
                        var calleeRegion = base.AC.InstrumentationRegions.Find(val =>
                                                                               val.Implementation().Name.Equals(call.callee));
                        if (calleeRegion == null)
                        {
                            continue;
                        }

                        call.callee = "_NO_OP_$" + base.EP.Name;
                        call.Ins.Clear();
                        call.Outs.Clear();
                    }
                }
            }

            if (!successorBlocks.Contains(devBlock))
            {
                foreach (var call in devBlock.Cmds.OfType <CallCmd>())
                {
                    if (call.Equals(devCall))
                    {
                        break;
                    }

                    if (call.callee.StartsWith("_WRITE_LS_$M.") ||
                        call.callee.StartsWith("_READ_LS_$M."))
                    {
                        ReadWriteSlicing.CleanReadWriteSets(base.EP, region, call);

                        call.callee = "_NO_OP_$" + base.EP.Name;
                        call.Ins.Clear();
                        call.Outs.Clear();
                    }
                    else
                    {
                        var calleeRegion = base.AC.InstrumentationRegions.Find(val =>
                                                                               val.Implementation().Name.Equals(call.callee));
                        if (calleeRegion == null)
                        {
                            continue;
                        }

                        call.callee = "_NO_OP_$" + base.EP.Name;
                        call.Ins.Clear();
                        call.Outs.Clear();
                    }
                }
            }
        }