/* -*-c-*- *********************************************************/
/*******************************************************************/
/*******************************************************************/
/**
  This file is for threaded code.

  ----
  This file is auto generated by insns2vm.rb
  DO NOT TOUCH!

  If you want to fix something, you must edit 'template/optinsn.inc.tmpl'
  or rb/insns2vm.rb
 */

static INSN *
insn_operands_unification(INSN *insnobj){
#ifdef OPT_OPERANDS_UNIFICATION
  /* optimize rule */
  switch(insnobj->insn_id){

case BIN(getlocal):
  if(
    insnobj->operands[1] == INT2FIX(0)
  ){
    insnobj->insn_id = BIN(getlocal_OP__WC__0);
    insnobj->operand_size = 1;
    break;
  }

  if(
    insnobj->operands[1] == INT2FIX(1)
  ){
    insnobj->insn_id = BIN(getlocal_OP__WC__1);
    insnobj->operand_size = 1;
    break;
  }

  break;
case BIN(setlocal):
  if(
    insnobj->operands[1] == INT2FIX(0)
  ){
    insnobj->insn_id = BIN(setlocal_OP__WC__0);
    insnobj->operand_size = 1;
    break;
  }

  if(
    insnobj->operands[1] == INT2FIX(1)
  ){
    insnobj->insn_id = BIN(setlocal_OP__WC__1);
    insnobj->operand_size = 1;
    break;
  }

  break;
case BIN(putobject):
  if(
    insnobj->operands[0] == INT2FIX(0)
  ){
    insnobj->insn_id = BIN(putobject_OP_INT2FIX_O_0_C_);
    insnobj->operand_size = 0;
    break;
  }

  if(
    insnobj->operands[0] == INT2FIX(1)
  ){
    insnobj->insn_id = BIN(putobject_OP_INT2FIX_O_1_C_);
    insnobj->operand_size = 0;
    break;
  }

  break;

  default:
    /* do nothing */;
    break;
  }
#endif
  return insnobj;
}

