Example #1
0
        private Instruction GetInstruction(Expression exp, OpCode code)
        {
            Instruction inst;

            if (_indexedInsts.TryGetValue(exp, out inst))
                return inst;
            inst = new Instruction(code);
            _indexedInsts.Add(exp, inst);
            _insts.Add(inst);
            return inst;
        }
Example #2
0
        public static Variable CreateTemp(Type type, Instruction defineInstr)
        {
            var var = new Variable
            {
                Name = "t" + (_tempVarId++),
                SymType = SymbolType.ST_TEMP,
                ValType = type,
                DefineInstruction = defineInstr
            };

            return var;
        }
Example #3
0
        private Variable ComputeTempVar(Expression exp, OpCode code, Variable[] sources)
        {
            Instruction inst;
            if (_indexedInsts.TryGetValue(exp, out inst))
                return inst.Destinations[0];
            inst = new Instruction(code);
            _indexedInsts.Add(exp, inst);
            _insts.Add(inst);

            foreach (var s in sources)
                inst.Sources.Add(s);

            var d = Variable.CreateTemp(exp.Type, inst);
            inst.Destinations.Add(d);
            return d;
        }
Example #4
0
        public static Variable CreateLocal(string name, Type type, Instruction defineInstr)
        {
            var var = new Variable
            {
                Name = name,
                SymType = SymbolType.ST_LOCAL,
                ValType = type,
                DefineInstruction = defineInstr
            };

            return var;
        }
Example #5
0
 private Instruction CreateNonIndexedInstruction(OpCode code)
 {
     var inst = new Instruction(code);
     _insts.Add(inst);
     return inst;
 }