示例#1
0
 /// <summary>
 /// Called during moving some reister to memory. Update childs and then check if this node contains
 /// register to replace. If so return access local instead of this node nad when this node contains
 /// register (but is not this register) - move this subtree to the output list (newTrees).
 /// </summary>
 /// <returns>This node updated or generated access to local variable.</returns>
 /// <param name="map">Map from registers (to replace) to function locals.</param>
 /// <param name="newNodes">List for inserting new trees.</param>
 /// <param name="f">Function owning new locals.</param>
 internal virtual Node ReplaceRegisterWithLocal(IReadOnlyDictionary <RegisterNode, Local> map,
                                                List <Node> newTrees, Function f)
 {
     if (map.ContainsKey(_register))
     {
         Local l = map[_register];
         if (!(this is TemporaryNode))
         {
             newTrees.Add(new AssignmentNode(f.AccessLocal(l), this));
         }
         return(f.AccessLocal(l));
     }
     return(this);
 }