Ejemplo n.º 1
0
std::vector <PassElement *> *OperandSwap::entry (PassElement *pe, Description *desc) const
{
    Logging::log (0, "Starting Operand Swap", NULL);

    //First get Kernel
    Kernel *kernel = pe->getKernel ();

    if (kernel == NULL)
        return NULL;

    //Clear color
    kernel->clearColor ();

    //Prepare result
    std::vector <PassElement *> *res = new std::vector <PassElement *> ();

    //Create new vector for kernels
    std::vector<Kernel*> newKernels;

    //Push original kernel here
    newKernels.push_back (kernel);

    //Handle the Kernels
    handlePass (newKernels);

    //Now accept these all new kernels
    for (std::vector <Kernel *>::const_iterator it_kernel = newKernels.begin (); it_kernel != newKernels.end (); it_kernel++)
    {
        Kernel *tmp = *it_kernel;
        PassElement *pe_tmp = NULL;

        //If we have our original kernel, we can use pe
        if (kernel == tmp)
        {
            pe_tmp = pe;
        }
        else
        {
            //Create new PassElement
            pe_tmp = new PassElement ();
        }

        //Set new kernel and push to result vector
        pe_tmp->setKernel (tmp);
        res->push_back (pe_tmp);
    }

    Logging::log (0, "Stopping Operand Swap", NULL);

    (void) desc;

    return res;
}
Ejemplo n.º 2
0
std::vector <PassElement *> *myPluginEntry (PassElement *pe, Description *desc)  
{
	Logging::log (0, "Starting Filtering", NULL);

	//First get Kernel
	Kernel *kernel = pe->getKernel ();

	if (kernel == NULL)
	{
		return NULL;
	}

	//Clear color
	kernel->clearColor ();    

	//Prepare result
	std::vector <PassElement *> *res = NULL;

	//Create new vector for kernels
	std::vector<Kernel*> newKernels;

	//Now we start filtering
	int unrollFactor = -1;
	bool keepIt = handleKernel (kernel, desc, unrollFactor);

	if (keepIt == true)
	{
        //Create new vector
        res = new std::vector <PassElement *> ();
        //Ok we want this one, push it in
        res->push_back (pe);
	}

	Logging::log (0, "Stopping Filtering", NULL);

	(void) desc;	

    //Return result
	return res;
}