Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-opcode-apply.c view on Meta::CPAN
case JIT_SIG_i_dd:
result = apply_i_dd(&const_result, value1, value2,
(jit_cf_i_dd_func) opcode_info->intrinsic);
break;
case JIT_SIG_D_D:
result = apply_D_D(&const_result, value1,
(jit_cf_D_D_func) opcode_info->intrinsic);
break;
case JIT_SIG_D_DD:
result = apply_D_DD(&const_result, value1, value2,
(jit_cf_D_DD_func) opcode_info->intrinsic);
break;
case JIT_SIG_i_D:
result = apply_i_D(&const_result, value1,
(jit_cf_i_D_func) opcode_info->intrinsic);
break;
case JIT_SIG_i_DD:
result = apply_i_DD(&const_result, value1, value2,
(jit_cf_i_DD_func) opcode_info->intrinsic);
break;
case JIT_SIG_conv:
result = apply_conv(&const_result, value1, 0);
break;
case JIT_SIG_conv_ovf:
result = apply_conv(&const_result, value1, 1);
break;
}
if(result)
{
return jit_value_create_constant(func, &const_result);
}
return 0;
}
jit_value_t
_jit_opcode_apply(jit_function_t func, jit_uint opcode, jit_type_t dest_type,
jit_value_t value1, jit_value_t value2)
{
const _jit_intrinsic_info_t *opcode_info;
if(!func || opcode >= JIT_OP_NUM_OPCODES)
{
return 0;
}
if((value1 == 0) || !value1->is_constant)
{
return 0;
}
opcode_info = &_jit_intrinsics[opcode];
if((opcode_info->flags & _JIT_INTRINSIC_FLAG_MASK) == _JIT_INTRINSIC_FLAG_NONE)
{
return apply_opcode(func, opcode_info, dest_type, value1, value2);
}
if((opcode_info->flags & _JIT_INTRINSIC_FLAG_MASK) == _JIT_INTRINSIC_FLAG_NOT)
{
jit_value_t value;
opcode = opcode_info->flags & ~_JIT_INTRINSIC_FLAG_MASK;
if(opcode >= JIT_OP_NUM_OPCODES)
{
return 0;
}
opcode_info = &(_jit_intrinsics[opcode]);
value = apply_opcode(func, opcode_info, dest_type, value1, value2);
if(value)
{
/*
* We have to apply a logical not to the constant
* jit_int result value.
*/
value->address = !(value->address);
return value;
}
}
return 0;
}
( run in 0.727 second using v1.01-cache-2.11-cpan-796a6f069b2 )