Lib/Source/OpItems.cpp
/**
 * Translate source operator to target opcode
 */
Translate source operator to target opcode
Translate source operator to target opcode
ALUOp::Enum OpItems::opcode(Op const &op) {
  auto const *item = OpItems::find(op.op);
  if (item == nullptr) {
    if (op.type == BaseType::FLOAT) {
      assertq(false, "opcode(): Unhandled op for float", true);
    } else {
      assertq(false, "opcode(): Unhandled op for int", true);
    }
    return ALUOp::NOP;
  }
  if (item->v3d_specific()) {
    if (Platform::compiling_for_vc4()) {
      std::string msg;
      msg << "opcode(): " << item->dump() << " is only for v3d";
      assertq(false, msg, true);
    }
  }
  if (op.type == BaseType::FLOAT) {
    return item->aluop_float();
  } else {
    return item->aluop_int();
  }
}
ALUOp :: Enum OpItems :: opcode ( Op const & op ) { auto const * item = OpItems :: find ( op . op ) ; if ( item == nullptr ) { if ( op . type == BaseType :: FLOAT ) { assertq ( false , " " , true ) ; } else { assertq ( false , " " , true ) ; } return ALUOp :: NOP ; } if ( item -> v3d_specific ( ) ) { if ( Platform :: compiling_for_vc4 ( ) ) { std :: string msg ; msg << " " << item -> dump ( ) << " " ; assertq ( false , msg , true ) ; } } if ( op . type == BaseType :: FLOAT ) { return item -> aluop_float ( ) ; } else { return item -> aluop_int ( ) ; } }
Translate source operator to target opcode
Translate source operator to target opcode