Пример #1
0
        internal static GMacCodeBlock Process(GMacCodeBlock codeBlock)
        {
            var factoredSubExpressions = new TcbFactorSubExpressions(codeBlock);

            factoredSubExpressions.BeginProcessing();

            return(codeBlock);
        }
Пример #2
0
        private void ProcessSubExpressions()
        {
            //Use full reduction algorithm to produce less computations and simplest possible RHS expressions
            //but may take longer time and may require more temp variables
            if (GMacCompilerOptions.ReduceLowLevelRhsSubExpressions)
            {
                TcbReduceRhsExpressions.Process(CodeBlock);

                this.ReportNormal("Reduce RHS Sub-expressions", CodeBlock);

                if (EnableTestEvaluation)
                {
                    EvaluationDataHistory.AddEvaluation("Reduce RHS Sub-expressions");
                }

                return;
            }

            //Use partial reduction algorithm to factor out sub expressions used multiple times during
            //computation but may produce larger RHS expressions per temp\output variable

            //Remove temp variables having duplicate RHS expressions
            TcbRemoveDuplicateTemps.Process(CodeBlock);

            this.ReportNormal("Remove Duplicate Temps", CodeBlock);

            if (EnableTestEvaluation)
            {
                EvaluationDataHistory.AddEvaluation("Remove Duplicate Temps");
            }

            //Factor common sub-expressions into separate low-level temp variables
            TcbFactorSubExpressions.Process(CodeBlock);

            this.ReportNormal("Factor Common Sub-expressions", CodeBlock);

            if (EnableTestEvaluation)
            {
                EvaluationDataHistory.AddEvaluation("Factor Common Sub-expressions");
            }
        }