/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package targets.mips;

import API.CodeProcessorInterface;
import common.Block;
import common.Code;
import java.util.LinkedHashMap;

/**
 *
 * @author EUGENIO CARVALHO
 */
public class CopyDepsProcessor implements CodeProcessorInterface {

    protected Code tac;

    public CopyDepsProcessor() {
    }

    @Override
    public void Exec(Code c, LinkedHashMap<String, CodeProcessorInterface> cp) throws Exception {
        Block currentBlock = c.Block(),
                tacBlock = c.Parent.getBlocks().get(currentBlock.getName());
//        System.out.println("EXEC COPY DEPS:" + currentBlock.getName() + "\n" + tacBlock.GetDependences());
        for (String dep : tacBlock.GetDependences()) {
            currentBlock.AddDependence(dep);
        }
    }

}
