internal static MethodBodyBlock AnnotateMethod(AnnotatedAssemblyHolder holder, AnnotatedMethod method) { MethodBodyBlock mbbDown = holder.SourceHolder[method.SourceMethod]; MethodBodyBlock mbbUp = mbbDown.Clone() as MethodBodyBlock; UpAndDownNodes upDownNodes = new UpAndDownNodes(); State state = new State(mbbUp.Variables.Count); for(int i = 0; i < mbbUp.Variables.ParameterMapper.Count; i++) { Variable var = mbbUp.Variables.ParameterMapper[i]; state.Pool[var] = new Location(var.Type); state.Pool[var].Val = (method.ParamVals[i].Val as ReferenceBTValue).ToStack(var.Type); } upDownNodes.SetUpAndDownNode(mbbDown, state, mbbUp); AnnotatingVisitor aVisitor; LiftingVisitor lVisitor; ControllingVisitor cVisitor = new ControllingVisitor(holder, method, upDownNodes, mbbUp, out aVisitor, out lVisitor); aVisitor.AddTask(mbbUp, state); return mbbUp; }
internal AnnotatingVisitor(AnnotatedAssemblyHolder holder, AnnotatedMethod method, ControllingVisitor cVisitor, UpAndDownNodes upDownNodes) : base(holder.GraphProcessor, 0) { this.holder = holder; this.cVisitor = cVisitor; this.upDownNodes = upDownNodes; this.ret = method.ReturnValue; }
internal ControllingVisitor(AnnotatedAssemblyHolder holder, AnnotatedMethod method, UpAndDownNodes upDownNodes, MethodBodyBlock mbbUp, out AnnotatingVisitor aVisitor, out LiftingVisitor lVisitor) : base(holder.GraphProcessor, 2) { this.holder = holder; this.method = method; this.method.ControllingVisitor = this; this.aVisitor = aVisitor = new AnnotatingVisitor(holder, method, this, upDownNodes); this.lVisitor = lVisitor = new LiftingVisitor(holder, this, aVisitor, upDownNodes); this.upDownNodes = upDownNodes; this.mbbUp = mbbUp; this.users = 0; }
internal LiftingVisitor(AnnotatedAssemblyHolder holder, ControllingVisitor cVisitor, AnnotatingVisitor aVisitor, UpAndDownNodes upDownNodes) : base(holder.GraphProcessor, 1) { this.cVisitor = cVisitor; this.aVisitor = aVisitor; this.upDownNodes = upDownNodes; }