Exemplo n.º 1
0
        bool ResolveBasicBlock(IList <ILNode> nodes, ILBasicBlock bb, int pos)
        {
            if (singleBasicBlockOptimizations == null)
            {
                singleBasicBlockOptimizations = new Func <IList <ILNode>, ILExpression, int, bool>[]
                {
                    MatchVariablePush,  // checks pushes for instance or indexs for vars
                    SimpleAssignments,
                    AssignValueTo,
                    ComplexAssignments,    // basicly self increment, this SHOULDN'T cross block boundrys
                    SimplifyBranches,      // Any resolved pushes are put into a branch argument
                    CombineCall,           // Any resolved pushes are put into a branch argument
                    CombineExpressions
                };
            }
            bool modified = bb.RunOptimizationAndRestart(singleBasicBlockOptimizations);

            if (modified && Context.Debug) // It should be 100% resolved at this point
            {
                if (bb.RunOptimizationAndRestart(singleBasicBlockOptimizations))
                {
                    bb.DebugSave("badresolve.txt");
                    bool test = bb.RunOptimizationAndRestart(singleBasicBlockOptimizations);



                    Debug.Assert(!test);
                }
            }
            return(modified);
        }