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; }
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; }
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; }
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; }
private Instruction CreateNonIndexedInstruction(OpCode code) { var inst = new Instruction(code); _insts.Add(inst); return inst; }