public AstNodeExprBinop(AstNodeExpr LeftNode, string Operator, AstNodeExpr RightNode) { this.LeftNode = LeftNode; this.Operator = Operator; this.RightNode = RightNode; CheckCompatibleTypes(); }
public AstNodeExprTerop(AstNodeExpr Cond, AstNodeExpr True, AstNodeExpr False) { if (True.Type != False.Type) throw(new Exception("Condition mismatch")); this.Cond = Cond; this.True = True; this.False = False; }
public AstNodeStmSwitch(AstNodeExpr switchValue, IEnumerable <AstNodeCase> cases, AstNodeCaseDefault caseDefault = null) { SwitchValue = switchValue; Cases = cases.ToArray(); CaseDefault = caseDefault; }
public AstNodeStmAssign(AstNodeExprLValue LValue, AstNodeExpr Value) { if (LValue.Type != Value.Type) throw (new Exception(String.Format("Local.Type({0}) != Value.Type({1})", LValue.Type, Value.Type))); this.LValue = LValue; this.Value = Value; }
public AstNodeStmIfElse(AstNodeExpr Condition, AstNodeStm True, AstNodeStm False = null) { //if (False == null) False = new AstNodeStmEmpty(); this.Condition = Condition; this.True = True; this.False = False; }
public AstNodeExprBinop(AstNodeExpr leftNode, string op, AstNodeExpr rightNode) { LeftNode = leftNode; Operator = op; RightNode = rightNode; CheckCompatibleTypes(); }
public AstNodeExprPropertyAccess(AstNodeExpr instance, PropertyInfo property, string propertyName = null) { if (property == null) { throw new Exception($"Property can't be null '{propertyName}'"); } Instance = instance; Property = property; }
public AstNodeExprFieldAccess(AstNodeExpr instance, FieldInfo field, string fieldName = null) { if (field == null) { throw (new Exception($"Field can't be null '{fieldName}'")); } Instance = instance; Field = field; }
public AstNodeExprFieldAccess(AstNodeExpr Instance, FieldInfo Field, string FieldName = null) { if (Field == null) { throw (new Exception(String.Format("Field can't be null '{0}'", FieldName))); } this.Instance = Instance; this.Field = Field; }
public AstNodeExprPropertyAccess(AstNodeExpr Instance, PropertyInfo Property, string PropertyName = null) { if (Property == null) { throw (new Exception(String.Format("Property can't be null '{0}'", PropertyName))); } this.Instance = Instance; this.Property = Property; }
public AstNodeExprTerop(AstNodeExpr cond, AstNodeExpr @true, AstNodeExpr @false) { if (@true.Type != @false.Type) { throw new Exception("Condition mismatch"); } Cond = cond; True = @true; False = @false; }
public AstNodeStmAssign(AstNodeExprLValue LValue, AstNodeExpr Value) { if (LValue.Type != Value.Type) { throw (new Exception(String.Format("Local.Type({0}) != Value.Type({1})", LValue.Type, Value.Type))); } this.LValue = LValue; this.Value = Value; }
public AstNodeExprTerop(AstNodeExpr Cond, AstNodeExpr True, AstNodeExpr False) { if (True.Type != False.Type) { throw(new Exception("Condition mismatch")); } this.Cond = Cond; this.True = True; this.False = False; }
public AstNodeStmAssign(AstNodeExprLValue leftValue, AstNodeExpr value) { if (leftValue.Type != value.Type) { throw (new Exception($"Local.Type({leftValue.Type}) != Value.Type({value.Type})")); } LeftValue = leftValue; Value = value; }
public static AstNodeExpr AstMemoryGetPointer(AstNodeExpr Address, bool Safe, string ErrorDescription = "ERROR") { if (Safe) { return ast.CallInstance( CpuThreadStateArgument(), (AddressToPointerFunc)CpuThreadState.Methods.GetMemoryPtrSafe, ast.Cast<uint>(Address) ); } else { return ast.CallInstance( CpuThreadStateArgument(), (AddressToPointerFunc)CpuThreadState.Methods.GetMemoryPtr, ast.Cast<uint>(Address) ); } }
public AstNodeExprArrayAccess(AstNodeExpr arrayInstance, AstNodeExpr index) { ArrayInstance = arrayInstance; Index = index; }
private static AstNodeExpr ReadMemory2(AstNodeExpr Address) { return ast.CallInstance(GetCpuContext(), (Func<ushort, ushort>)CpuContext._NullInstance.ReadMemory2, Address); }
public AstNodeExprPropertyAccess(AstNodeExpr Instance, string PropertyName) : this(Instance, Instance.Type.GetProperty(PropertyName), PropertyName) { }
private static AstNodeStm WriteMemory2(AstNodeExpr Address, AstNodeExpr Value) { return ast.Statement(ast.CallInstance(GetCpuContext(), (Action<ushort, ushort>)CpuContext._NullInstance.WriteMemory2, Address, Value)); }
public AstNodeExpr GetCallForAddress(AstNodeExpr Address) { return ast.CallInstance(GetCpuContext(), (Func<uint, Action<CpuContext>>)CpuContext._NullInstance.GetDelegateForAddress, ast.Cast<uint>(Address)); }
public AstNodeStmReturn(AstNodeExpr Expression = null) { this.Expression = Expression; }
public AstNodeExprCallInstance(AstNodeExpr Instance, MethodInfo MethodInfo, params AstNodeExpr[] Parameters) : base(MethodInfo, Parameters) { this.Instance = Instance; }
public AstNodeExprIndirect(AstNodeExpr AstNodeExpr) { this.PointerExpression = AstNodeExpr; }
public AstNodeExprCallDelegate(AstNodeExpr Object, params AstNodeExpr[] parameters) : base(Object, GetInvoke(Object.Type), parameters) { }
public AstNodeExprCallDelegate(AstNodeExpr Object, params AstNodeExpr[] Parameters) : base(Object, GetInvoke(Object.Type), Parameters) { }
public AstNodeStmSwitch(AstNodeExpr SwitchValue, IEnumerable <AstNodeCase> Cases, AstNodeCaseDefault CaseDefault = null) { this.SwitchValue = SwitchValue; this.Cases = Cases.ToArray(); this.CaseDefault = CaseDefault; }
public AstNodeExprUnop(string Operator, AstNodeExpr RightNode) { this.Operator = Operator; this.RightNode = RightNode; }
public AstNodeStmGotoIf(AstLabel AstLabel, AstNodeExpr Condition) : base(AstLabel) { this.Condition = Condition; }
static public AstNodeExprCall MethodCacheInfoCallDynamicPC(AstNodeExpr PC) { return ast.CallInstance(MethodCacheInfoGetAtPC(PC), (Action<CpuThreadState>)MethodCacheInfo.Methods.CallDelegate, CpuThreadStateArgument()); }
public AstNodeExprCast(Type CastedType, AstNodeExpr Expr, bool Explicit = true) { this.CastedType = CastedType; this.Expr = Expr; this.Explicit = Explicit; }
public AstNodeExprCallInstance(AstNodeExpr Instance, Delegate Delegate, params AstNodeExpr[] Parameters) : this(Instance, Delegate.Method, Parameters) { }
public AstNodeStmGotoIfFalse(AstLabel AstLabel, AstNodeExpr Condition) : base(AstLabel, Condition) { }
public AstNodeExprPropertyAccess(AstNodeExpr instance, string propertyName) : this(instance, instance.Type.GetProperty(propertyName), propertyName) { }
public AstNodeExprCallInstance(AstNodeExpr instance, MethodInfo methodInfo, params AstNodeExpr[] parameters) : base(methodInfo, parameters) { Instance = instance; }
//public AstNodeExpr IMM_s() { return this.Immediate(IMM); } //public AstNodeExpr IMM_u() { return this.Immediate((uint)(ushort)IMM); } //public AstNodeExpr IMM_uex() { return this.Immediate((uint)IMM); } public AstNodeStm AssignREG(string RegName, AstNodeExpr Expr) { return ast.Assign(REG(RegName), Expr); }
public AstNodeExprCallInstance(AstNodeExpr instance, Delegate mydelegate, params AstNodeExpr[] parameters) : this(instance, mydelegate.Method, parameters) { }
public AstNodeExprIndirect(AstNodeExpr astNodeExpr) => PointerExpression = astNodeExpr;
public AstNodeExprUnop(string op, AstNodeExpr rightNode) { Operator = op; RightNode = rightNode; }
public AstNodeExprCast(Type castedType, AstNodeExpr expr, bool Explicit = true) { CastedType = castedType; Expr = expr; this.Explicit = Explicit; }
static public AstNodeExpr MethodCacheInfoGetAtPC(AstNodeExpr PC) { return ast.CallInstance(ast.FieldAccess(MipsMethodEmitter.CpuThreadStateArgument(), "MethodCache"), (Func<uint, MethodCacheInfo>)MethodCache.Methods.GetForPC, PC); }
public AstNodeStm AssignGPR(int Index, AstNodeExpr Expr) { if (Index == 0) return new AstNodeStmEmpty(); return ast.Assign(GPR(Index), ast.Cast<uint>(Expr)); }
public AstNodeExprFieldAccess(AstNodeExpr Instance, string FieldName) : this(Instance, Instance.Type.GetField(FieldName), FieldName) { }
public AstNodeExprArrayAccess(AstNodeExpr ArrayInstance, AstNodeExpr Index) { this.ArrayInstance = ArrayInstance; this.Index = Index; }
public AstNodeExprFieldAccess(AstNodeExpr Instance, FieldInfo Field, string FieldName = null) { if (Field == null) throw (new Exception(String.Format("Field can't be null '{0}'", FieldName))); this.Instance = Instance; this.Field = Field; }
public AstNodeStmExpr(AstNodeExpr AstNodeExpr) { this.AstNodeExpr = AstNodeExpr; }
public AstNodeStmSwitch(AstNodeExpr SwitchValue, IEnumerable<AstNodeCase> Cases, AstNodeCaseDefault CaseDefault = null) { this.SwitchValue = SwitchValue; this.Cases = Cases.ToArray(); this.CaseDefault = CaseDefault; }
public AstNodeExprFieldAccess(AstNodeExpr instance, string fieldName) : this(instance, instance.Type.GetField(fieldName), fieldName) { }
static private DynarecResult _SUB(DynarecContextChip8 Context, byte X, AstNodeExpr Value) { return ast.Statements( ast.Assign(Context.GetRegister(15), ast.Cast<byte>(ast.Binary(ast.Cast<uint>(Context.GetRegister(X)), ">", ast.Cast<uint>(Value)))), ast.Assign(Context.GetRegister(X), Context.GetRegister(X) - Value) ); }
public AstNodeExprSetGetLValue(AstNodeExpr SetExpression, AstNodeExpr GetExpression) { this.SetExpression = SetExpression; this.GetExpression = GetExpression; }
public AstNodeExprPropertyAccess(AstNodeExpr Instance, PropertyInfo Property, string PropertyName = null) { if (Property == null) throw (new Exception(String.Format("Property can't be null '{0}'", PropertyName))); this.Instance = Instance; this.Property = Property; }
public AstNodeExprSetGetLValue(AstNodeExpr setExpression, AstNodeExpr getExpression) { SetExpression = setExpression; GetExpression = getExpression; }
public AstNodeExprNewArray AddValue(AstNodeExpr astNodeExpr) { Values.Add(astNodeExpr); return(this); }
//static public void DumpStackTrace() //{ // Console.WriteLine(Environment.StackTrace); //} private AstNodeStm ReturnFromFunction(AstNodeExpr AstNodeExpr) { #if ENABLE_NATIVE_CALLS return ast.Statements( AssignREG("PC", GPR(31)), ast.Statement(ast.CallInstance(MipsMethodEmitter.CpuThreadStateArgument(), (Action)CpuThreadState.Methods.Tick)), //ast.Statement(ast.CallStatic((Action)DumpStackTrace)), ast.Return() ); #else return JumpToAddress(AstNodeExpr); #endif }
private AstNodeStm AssignBranchFlag(AstNodeExpr Expr, bool AndLink = false) { this.AndLink = AndLink; this.BranchPC = PC; return ast.Assign(BranchFlag(), ast.Cast<bool>(Expr, Explicit: false)); }