void HoistParameterLoadsPass::_tryHoistingLoad(
	ir::ControlFlowGraph::iterator block, ir::PTXInstruction* ptx,
	ir::IRKernel& k)
{
	report("  " << ptx->toString());
	
	auto newBlock = _getTopLevelDominatingBlock(k, block);
	
	if(newBlock == block) return;
	
	report("   hoisting to " << newBlock->label());
	
	auto dfg = static_cast<analysis::DataflowGraph*>(
		getAnalysis(Analysis::DataflowGraphAnalysis));
	
	auto load = new ir::PTXInstruction(ir::PTXInstruction::Ld);
	
	load->addressSpace   = ptx->addressSpace;
	load->type           = ptx->type;
	load->volatility     = ptx->volatility;
	load->cacheOperation = ptx->cacheOperation;
	
	load->d = ir::PTXOperand(ir::PTXOperand::Register,
		ptx->d.type, dfg->newRegister());
	load->a = ptx->a;
	
	insertBeforeTerminator(newBlock, load);
	
	ptx->opcode = ir::PTXInstruction::Mov;
	ptx->a      = load->d;
}
Пример #2
0
Register * newStdRegister(unsigned int name)
{
	Register * reg=newRegister(name,StdRegister_write,StdRegister_read);
	return reg;
}
Пример #3
0
/* WARNING: after calling newIORegister you have to call IORegister_set_functs */
Register * newIORegister(unsigned int name)
{
	return newRegister(name,IORegister_write,IORegister_read);
}
Пример #4
0
Register * newOutPutRegister(unsigned int name,FILE * stream)
{
	Register * reg=newRegister(name,OutPutRegister_write,OutPutRegister_read);
	reg->x_data=stream;
	return reg;
}
Пример #5
0
Register * newSpecialFunctionRegister(unsigned int name)
{
	Register * reg=newRegister(name,SpecialFunctionRegister_write,SpecialFunctionRegister_read);
	return reg;
}