This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thumb32 assembler (13/69)


Another tangential cleanup.  struct arm_fix contains a single tristate
(and its sole user treats it as a boolean); we can stash this directly
in tc_fix_data, saving both code and memory.

zw

	* config/tc-arm.c (struct arm_fix): Delete.
	(fix_new_arm): Stash value of thumb_mode directly in tc_fix_data.
	(md_apply_fix3): Retrieve thumb-mode flag directly from tc_fix_data.

===================================================================
Index: gas/config/tc-arm.c
--- gas/config/tc-arm.c	(revision 14)
+++ gas/config/tc-arm.c	(revision 15)
@@ -179,11 +179,6 @@
       instructions.  */
 static int thumb_mode = 0;
 
-typedef struct arm_fix
-{
-  int thumb_mode;
-} arm_fix_data;
-
 struct arm_it
 {
   const char *  error;
@@ -8862,7 +8857,6 @@
 	     int           reloc)
 {
   fixS *           new_fix;
-  arm_fix_data *   arm_data;
 
   switch (exp->X_op)
     {
@@ -8881,9 +8875,7 @@
 
   /* Mark whether the fix is to a THUMB instruction, or an ARM
      instruction.  */
-  arm_data = obstack_alloc (& notes, sizeof (arm_fix_data));
-  new_fix->tc_fix_data = (PTR) arm_data;
-  arm_data->thumb_mode = thumb_mode;
+  new_fix->tc_fix_data = (PTR) thumb_mode;
 }
 
 static void
@@ -11080,7 +11072,9 @@
   unsigned long  temp;
   int            sign;
   char *         buf = fixP->fx_where + fixP->fx_frag->fr_literal;
-  arm_fix_data * arm_data = (arm_fix_data *) fixP->tc_fix_data;
+  /* The double cast here prevents warnings about converting a pointer
+     to an integer of different size.  We know the value is 0, 1, or 2.  */
+  int		 fix_is_thumb = (int) (size_t) fixP->tc_fix_data;
 
   assert (fixP->fx_r_type <= BFD_RELOC_UNUSED);
 
@@ -11285,7 +11279,7 @@
       break;
 
     case BFD_RELOC_ARM_SWI:
-      if (arm_data->thumb_mode)
+      if (fix_is_thumb)
 	{
 	  if (((unsigned long) value) > 0xff)
 	    as_bad_where (fixP->fx_file, fixP->fx_line,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]