示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IMethodBody MinimizeLocals()
        {
            //First eliminate redundant store load pairs

            //now run a post order traversal of blocks, and a reverse traversal of instructions in each block. Once a write to an SSA local is processed, return its
            //minimized local to a pool of available locals.

            var methodBody  = this.cdfg.MethodBody;
            var ilGenerator = new ILGenerator(host, methodBody.MethodDefinition);
            var converter   = new ILConverter(this.cdfg, ilGenerator, this.localScopeProvider, this.sourceLocationProvider);

            converter.PopulateILGenerator();
            return(new ILGeneratorMethodBody(ilGenerator, methodBody.LocalsAreZeroed, converter.MaxStack, methodBody.MethodDefinition,
                                             converter.Locals.AsReadOnly(), Enumerable <ITypeDefinition> .Empty));
        }
        public Benchmarks()
        {
            _testClass = new TestClass
            {
                String       = "Hello, World!",
                Int          = 1234,
                SomeIntegers = new[]
                {
                    1, 2, 8, 9, 20, 15
                },
                LongInt          = 1106300L,
                UltraLongInt     = 11063002uL,
                Identifier       = 0xFF,
                SuperUselessByte = 0x0A,
            };

            _data = DConverter <TestClass> .Serialize(_testClass);

            _pm = new ProtocolMessage.ProtocolMessageManager();

            if (!(new ConverterContainer().RequestConverter <TestClass>() is ILConverter <TestClass> ilConv))
            {
                throw new Exception($"IL is not fully spported for the benchmarks yet.");
            }

            _tc = ilConv;

            foreach (var benchmark in GetType()
                     .GetMethods()
                     .Where(x => x.GetCustomAttributes(true)
                            .OfType <BenchmarkAttribute>()
                            .Count() > 0))
            {
                benchmark.Invoke(this, null);
            }
        }
示例#3
0
 public static bool TryGetILConverter(OpCode opCode, out ILConverter ilc) =>
 ilConverters.TryGetValue(opCode, out ilc);
示例#4
0
 public ILBody(Label label, ILConverter ilc, ICodeInformation code)
 {
     this.Label       = label;
     this.ILConverter = ilc;
     this.Code        = code;
 }
示例#5
0
 public void Reset()
 {
     il_converter = null;
 }
示例#6
0
        private ILConverter il_converter;        //=new NETGenerator.ILConverter();

        public void Compile(IProgramNode ProgramTree, string TargetFileName, string SourceFileName,
                            CompilerOptions options, Hashtable StandartDirectories, string[] ResourceFiles)
        {
            il_converter = new ILConverter(StandartDirectories);
            il_converter.ConvertFromTree(ProgramTree, TargetFileName, SourceFileName, options, ResourceFiles);
        }
示例#7
0
 public ILBody(Label label, ILConverter ilc, object operand)
 {
     this.Label       = label;
     this.ILConverter = ilc;
     this.Operand     = operand;
 }
示例#8
0
文件: Program.cs 项目: daeken/Tarogen
 public static void Main(string[] args)
 {
     WriteLine($"from ast import *\nroot = {ILConverter.Convert(typeof(PsxCpu)).ToPython()}");
 }
示例#9
0
文件: Utilities.cs 项目: ifle/IL2C
 public static bool TryGetILConverter(OpCode opCode, out ILConverter ilc)
 {
     return(ilConverters.TryGetValue(opCode, out ilc));
 }