Lib/Target/instr/Imm.cpp
/**
 * Return encoded small value for immediate, if possible
 *
 * @return Encoded value if encoding possible, -17 otherwise
 */
Return encoded small value for immediate, if possible
@return Encoded value if encoding possible, -17 otherwise
Return encoded small value for immediate if possible @return Encoded value if encoding possible - 17 otherwise
int Imm::encode_imm() const {
  assert(m_tag != IMM_MASK);  
  int dummy = INVALID_ENCODING;  
  if (Platform::compiling_for_vc4()) {
    if (is_int()) {
      dummy = encodeSmallInt(m_intVal);
    } else if (is_float()) {
      dummy = encodeSmallFloat(m_floatVal);
    }
    if (dummy == -1) dummy = INVALID_ENCODING;
  } else {
    if (is_int()) {
      if (!v3d::instr::SmallImm::int_to_opcode_value(m_intVal, dummy)) {
        dummy = INVALID_ENCODING;
      }
    } else if (is_float()) {
      if (!v3d::instr::SmallImm::float_to_opcode_value(m_floatVal, dummy)) {
        dummy = INVALID_ENCODING;
      }
    }
  }
  return dummy;
}
int Imm :: encode_imm ( ) const { assert ( m_tag != IMM_MASK ) ; int dummy = INVALID_ENCODING ; if ( Platform :: compiling_for_vc4 ( ) ) { if ( is_int ( ) ) { dummy = encodeSmallInt ( m_intVal ) ; } else if ( is_float ( ) ) { dummy = encodeSmallFloat ( m_floatVal ) ; } if ( dummy == -1 ) dummy = INVALID_ENCODING ; } else { if ( is_int ( ) ) { if ( ! v3d :: instr :: SmallImm :: int_to_opcode_value ( m_intVal , dummy ) ) { dummy = INVALID_ENCODING ; } } else if ( is_float ( ) ) { if ( ! v3d :: instr :: SmallImm :: float_to_opcode_value ( m_floatVal , dummy ) ) { dummy = INVALID_ENCODING ; } } } return dummy ; }
Return encoded small value for immediate, if possible
 @return Encoded value if encoding possible, -17 otherwise
Return encoded small value for immediate if possible @return Encoded value if encoding possible - 17 otherwise
// Not dealing with this here // Invalid value for both v3d and vc4