Lib/vc4/KernelDriver.cpp
/**
 * Convert intermediate instruction into core instruction
 */
Convert intermediate instruction into core instruction
Convert intermediate instruction into core instruction
void convertInstr(V3DLib::Instr &instr) {
  switch (instr.tag) {
    case IRQ:
      instr.tag           = LI;
      instr.LI.imm        = Imm(1);
      instr.set_cond_clear();
      instr.assign_cond(AssignCond(AssignCond::Tag::ALWAYS));
      instr.dest(Reg(SPECIAL, SPECIAL_HOST_INT));
      break;
    case DMA_LOAD_WAIT:
    case DMA_STORE_WAIT: {
      RegId src = instr.tag == DMA_LOAD_WAIT ? SPECIAL_DMA_LD_WAIT : SPECIAL_DMA_ST_WAIT;
      instr.tag     = ALU;
      instr.ALU.op  = ALUOp(ALUOp::A_BOR);
      instr.set_cond_clear();
      instr.assign_cond(AssignCond(AssignCond::Tag::NEVER));
      instr.ALU.srcA = Reg(SPECIAL, src);  
      instr.ALU.srcB = Reg(SPECIAL, src);
      instr.dest(Reg(NONE, 0));
      break;
    }
    default:
      break;  
  }
}
void convertInstr ( V3DLib :: Instr & instr ) { switch ( instr . tag ) { case IRQ : instr . tag = LI ; instr . LI . imm = Imm ( 1 ) ; instr . set_cond_clear ( ) ; instr . assign_cond ( AssignCond ( AssignCond :: Tag :: ALWAYS ) ) ; instr . dest ( Reg ( SPECIAL , SPECIAL_HOST_INT ) ) ; break ; case DMA_LOAD_WAIT : case DMA_STORE_WAIT : { RegId src = instr . tag == DMA_LOAD_WAIT ? SPECIAL_DMA_LD_WAIT : SPECIAL_DMA_ST_WAIT ; instr . tag = ALU ; instr . ALU . op = ALUOp ( ALUOp :: A_BOR ) ; instr . set_cond_clear ( ) ; instr . assign_cond ( AssignCond ( AssignCond :: Tag :: NEVER ) ) ; instr . ALU . srcA = Reg ( SPECIAL , src ) ; instr . ALU . srcB = Reg ( SPECIAL , src ) ; instr . dest ( Reg ( NONE , 0 ) ) ; break ; } default : break ; } }
Convert intermediate instruction into core instruction
Convert intermediate instruction into core instruction
// srcA is same as srcB // rest passes through