FreeBSD/contrib/binutils/gas/config/tc-arm.c
/* Helper function used for both push/pop and ldm/stm.  */
Helper function used for both push/pop and ldm/stm.
Helper function used for both push / pop and ldm / stm .
static void
encode_thumb2_ldmstm (int base, unsigned mask, bfd_boolean writeback)
{
  bfd_boolean load;
  load = (inst.instruction & (1 << 20)) != 0;
  if (mask & (1 << 13))
    inst.error =  _("SP not allowed in register list");
  if (load)
    {
      if (mask & (1 << 14)
	  && mask & (1 << 15))
	inst.error = _("LR and PC should not both be in register list");
      if ((mask & (1 << base)) != 0
	  && writeback)
	as_warn (_("base register should not be in register list "
		   "when written back"));
    }
  else
    {
      if (mask & (1 << 15))
	inst.error = _("PC not allowed in register list");
      if (mask & (1 << base))
	as_warn (_("value stored for r%d is UNPREDICTABLE"), base);
    }
  if ((mask & (mask - 1)) == 0)
    {
      if (writeback)
	{
	  if (inst.instruction & (1 << 23))
	    inst.instruction = 0x00000b04; 
	  else
	    inst.instruction = 0x00000d04; 
	}
      else
	{
	  if (inst.instruction & (1 << 23))
	    inst.instruction = 0x00800000; 
	  else
	    inst.instruction = 0x00000c04; 
	}
      inst.instruction |= 0xf8400000;
      if (load)
	inst.instruction |= 0x00100000;
      mask = ffs(mask) - 1;
      mask <<= 12;
    }
  else if (writeback)
    inst.instruction |= WRITE_BACK;
  inst.instruction |= mask;
  inst.instruction |= base << 16;
}
static void encode_thumb2_ldmstm ( int base , unsigned mask , bfd_boolean writeback ) { bfd_boolean load ; load = ( inst . instruction & ( 1 << 20 ) ) != 0 ; if ( mask & ( 1 << 13 ) ) inst . error = _ ( " " ) ; if ( load ) { if ( mask & ( 1 << 14 ) && mask & ( 1 << 15 ) ) inst . error = _ ( " " ) ; if ( ( mask & ( 1 << base ) ) != 0 && writeback ) as_warn ( _ ( " " " " ) ) ; } else { if ( mask & ( 1 << 15 ) ) inst . error = _ ( " " ) ; if ( mask & ( 1 << base ) ) as_warn ( _ ( " " ) , base ) ; } if ( ( mask & ( mask - 1 ) ) == 0 ) { if ( writeback ) { if ( inst . instruction & ( 1 << 23 ) ) inst . instruction = 0x00000b04 ; else inst . instruction = 0x00000d04 ; } else { if ( inst . instruction & ( 1 << 23 ) ) inst . instruction = 0x00800000 ; else inst . instruction = 0x00000c04 ; } inst . instruction |= 0xf8400000 ; if ( load ) inst . instruction |= 0x00100000 ; mask = ffs ( mask ) - 1 ; mask <<= 12 ; } else if ( writeback ) inst . instruction |= WRITE_BACK ; inst . instruction |= mask ; inst . instruction |= base << 16 ; }
Helper function used for both push/pop and ldm/stm.
Helper function used for both push / pop and ldm / stm .
/* Single register transfers implemented as str/ldr.  */ /* ia! -> [base], #4 */ /* db! -> [base, #-4]! */ /* ia -> [base] */ /* db -> [base, #-4] */