FreeBSD/contrib/binutils/gas/config/tc-arm.c
/* Relax a machine dependent frag.  This returns the amount by which
   the current size of the frag should change.  */
Relax a machine dependent frag.  This returns the amount by which
the current size of the frag should change.
Relax a machine dependent frag . This returns the amount by which the current size of the frag should change .
int
arm_relax_frag (asection *sec, fragS *fragp, long stretch)
{
  int oldsize;
  int newsize;
  oldsize = fragp->fr_var;
  switch (fragp->fr_subtype)
    {
    case T_MNEM_ldr_pc2:
      newsize = relax_adr(fragp, sec, stretch);
      break;
    case T_MNEM_ldr_pc:
    case T_MNEM_ldr_sp:
    case T_MNEM_str_sp:
      newsize = relax_immediate(fragp, 8, 2);
      break;
    case T_MNEM_ldr:
    case T_MNEM_str:
      newsize = relax_immediate(fragp, 5, 2);
      break;
    case T_MNEM_ldrh:
    case T_MNEM_strh:
      newsize = relax_immediate(fragp, 5, 1);
      break;
    case T_MNEM_ldrb:
    case T_MNEM_strb:
      newsize = relax_immediate(fragp, 5, 0);
      break;
    case T_MNEM_adr:
      newsize = relax_adr(fragp, sec, stretch);
      break;
    case T_MNEM_mov:
    case T_MNEM_movs:
    case T_MNEM_cmp:
    case T_MNEM_cmn:
      newsize = relax_immediate(fragp, 8, 0);
      break;
    case T_MNEM_b:
      newsize = relax_branch(fragp, sec, 11, stretch);
      break;
    case T_MNEM_bcond:
      newsize = relax_branch(fragp, sec, 8, stretch);
      break;
    case T_MNEM_add_sp:
    case T_MNEM_add_pc:
      newsize = relax_immediate (fragp, 8, 2);
      break;
    case T_MNEM_inc_sp:
    case T_MNEM_dec_sp:
      newsize = relax_immediate (fragp, 7, 2);
      break;
    case T_MNEM_addi:
    case T_MNEM_addis:
    case T_MNEM_subi:
    case T_MNEM_subis:
      newsize = relax_addsub (fragp, sec);
      break;
    default:
      abort();
    }
  fragp->fr_var = newsize;
  if (stretch <= 0 && newsize > 2)
    {
      md_convert_frag (sec->owner, sec, fragp);
      frag_wane(fragp);
    }
  return newsize - oldsize;
}
int arm_relax_frag ( asection * sec , fragS * fragp , long stretch ) { int oldsize ; int newsize ; oldsize = fragp -> fr_var ; switch ( fragp -> fr_subtype ) { case T_MNEM_ldr_pc2 : newsize = relax_adr ( fragp , sec , stretch ) ; break ; case T_MNEM_ldr_pc : case T_MNEM_ldr_sp : case T_MNEM_str_sp : newsize = relax_immediate ( fragp , 8 , 2 ) ; break ; case T_MNEM_ldr : case T_MNEM_str : newsize = relax_immediate ( fragp , 5 , 2 ) ; break ; case T_MNEM_ldrh : case T_MNEM_strh : newsize = relax_immediate ( fragp , 5 , 1 ) ; break ; case T_MNEM_ldrb : case T_MNEM_strb : newsize = relax_immediate ( fragp , 5 , 0 ) ; break ; case T_MNEM_adr : newsize = relax_adr ( fragp , sec , stretch ) ; break ; case T_MNEM_mov : case T_MNEM_movs : case T_MNEM_cmp : case T_MNEM_cmn : newsize = relax_immediate ( fragp , 8 , 0 ) ; break ; case T_MNEM_b : newsize = relax_branch ( fragp , sec , 11 , stretch ) ; break ; case T_MNEM_bcond : newsize = relax_branch ( fragp , sec , 8 , stretch ) ; break ; case T_MNEM_add_sp : case T_MNEM_add_pc : newsize = relax_immediate ( fragp , 8 , 2 ) ; break ; case T_MNEM_inc_sp : case T_MNEM_dec_sp : newsize = relax_immediate ( fragp , 7 , 2 ) ; break ; case T_MNEM_addi : case T_MNEM_addis : case T_MNEM_subi : case T_MNEM_subis : newsize = relax_addsub ( fragp , sec ) ; break ; default : abort ( ) ; } fragp -> fr_var = newsize ; if ( stretch <= 0 && newsize > 2 ) { md_convert_frag ( sec -> owner , sec , fragp ) ; frag_wane ( fragp ) ; } return newsize - oldsize ; }
Relax a machine dependent frag.
Relax a machine dependent frag .
/* Freeze wide instructions that are at or before the same location as
     in the previous pass.  This avoids infinite loops.
     Don't freeze them unconditionally because targets may be artificialy
     misaligned by the expansion of preceeding frags.  */