diff mbox

Commit: MSP430: Rename entries in option enums

Message ID 87porhgqdf.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton June 16, 2016, 2:28 p.m. UTC
Hi Guys,

  I recently noticed that the MSP430 backend uses some pretty generic
  names for the enum values of its hardware multiply and memory region
  options.  This could possibly cause problems if these names are used
  elsewhere, so I have decided to check in the patch below to fix this.

  Tested with no regressions on an msp430-elf toolchain.

Cheers
  Nick

gcc/ChangeLog
2016-06-16  Nick Clifton  <nickc@redhat.com>

	* config/msp430/msp430-opts.h (msp430_hwmult_types): Add
	MSP430_HWMULT_ prefix to enum values.
	(msp430_regions): Add MSP430_REGION_ prefix to enum values.
	* config/msp430/msp430.c: Update use of enum values.
	* config/msp430/msp430.md: Likewise.
	* config/msp430/msp430.opt: Likewise.
diff mbox

Patch

Index: config/msp430/msp430-opts.h
===================================================================
--- config/msp430/msp430-opts.h	(revision 237527)
+++ config/msp430/msp430-opts.h	(working copy)
@@ -22,19 +22,19 @@ 
 
 enum msp430_hwmult_types
 {
-  NONE,
-  AUTO,
-  SMALL,
-  LARGE,
-  F5SERIES
+  MSP430_HWMULT_NONE,
+  MSP430_HWMULT_AUTO,
+  MSP430_HWMULT_SMALL,
+  MSP430_HWMULT_LARGE,
+  MSP430_HWMULT_F5SERIES
 };
 
 enum msp430_regions
 {
-  ANY,
-  EITHER,
-  LOWER,
-  UPPER
+  MSP430_REGION_ANY,
+  MSP430_REGION_EITHER,
+  MSP430_REGION_LOWER,
+  MSP430_REGION_UPPER
 };
 
 #endif
Index: config/msp430/msp430.c
===================================================================
--- config/msp430/msp430.c	(revision 237527)
+++ config/msp430/msp430.c	(working copy)
@@ -777,20 +777,21 @@ 
 			   target_mcu, xisa ? "430X" : "430", msp430x ? "430X" : "430");
 
 		if (msp430_mcu_data[i].hwmpy == 0
-		    && msp430_hwmult_type != AUTO
-		    && msp430_hwmult_type != NONE)
+		    && msp430_hwmult_type != MSP430_HWMULT_AUTO
+		    && msp430_hwmult_type != MSP430_HWMULT_NONE)
 		  warning (0, "MCU '%s' does not have hardware multiply support, but -mhwmult is set to %s",
 			   target_mcu,
-			   msp430_hwmult_type == SMALL ? "16-bit" : msp430_hwmult_type == LARGE ? "32-bit" : "f5series");
-		else if (msp430_hwmult_type == SMALL
+			   msp430_hwmult_type == MSP430_HWMULT_SMALL ? "16-bit"
+			   : msp430_hwmult_type == MSP430_HWMULT_LARGE ? "32-bit" : "f5series");
+		else if (msp430_hwmult_type == MSP430_HWMULT_SMALL
 		    && msp430_mcu_data[i].hwmpy != 1
 		    && msp430_mcu_data[i].hwmpy != 2 )
 		  warning (0, "MCU '%s' supports %s hardware multiply, but -mhwmult is set to 16-bit",
 			   target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy));
-		else if (msp430_hwmult_type == LARGE && msp430_mcu_data[i].hwmpy != 4)
+		else if (msp430_hwmult_type == MSP430_HWMULT_LARGE && msp430_mcu_data[i].hwmpy != 4)
 		  warning (0, "MCU '%s' supports %s hardware multiply, but -mhwmult is set to 32-bit",
 			   target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy));
-		else if (msp430_hwmult_type == F5SERIES && msp430_mcu_data[i].hwmpy != 8)
+		else if (msp430_hwmult_type == MSP430_HWMULT_F5SERIES && msp430_mcu_data[i].hwmpy != 8)
 		  warning (0, "MCU '%s' supports %s hardware multiply, but -mhwmult is set to f5series",
 			   target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy));
 	      }
@@ -801,7 +802,7 @@ 
 
       if (i < 0)
 	{
-	  if (msp430_hwmult_type == AUTO)
+	  if (msp430_hwmult_type == MSP430_HWMULT_AUTO)
 	    {
 	      if (msp430_warn_mcu)
 		{
@@ -815,7 +816,7 @@ 
 			     target_mcu);
 		}
 
-	      msp430_hwmult_type = NONE;
+	      msp430_hwmult_type = MSP430_HWMULT_NONE;
 	    }
 	  else if (target_cpu == NULL)
 	    {
@@ -833,15 +834,15 @@ 
     }
 
   /* The F5 series are all able to support the 430X ISA.  */
-  if (target_cpu == NULL && target_mcu == NULL && msp430_hwmult_type == F5SERIES)
+  if (target_cpu == NULL && target_mcu == NULL && msp430_hwmult_type == MSP430_HWMULT_F5SERIES)
     msp430x = true;
 
   if (TARGET_LARGE && !msp430x)
     error ("-mlarge requires a 430X-compatible -mmcu=");
 
-  if (msp430_code_region == UPPER && ! msp430x)
+  if (msp430_code_region == MSP430_REGION_UPPER && ! msp430x)
     error ("-mcode-region=upper requires 430X-compatible cpu");
-  if (msp430_data_region == UPPER && ! msp430x)
+  if (msp430_data_region == MSP430_REGION_UPPER && ! msp430x)
     error ("-mdata-region=upper requires 430X-compatible cpu");
 
   if (flag_exceptions || flag_non_call_exceptions
@@ -2166,24 +2167,24 @@ 
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
-      if (msp430_code_region == LOWER)
+      if (msp430_code_region == MSP430_REGION_LOWER)
 	return lower_prefix;
 
-      if (msp430_code_region == UPPER)
+      if (msp430_code_region == MSP430_REGION_UPPER)
 	return upper_prefix;
 
-      if (msp430_code_region == EITHER)
+      if (msp430_code_region == MSP430_REGION_EITHER)
 	return either_prefix;
     }
   else
     {
-      if (msp430_data_region == LOWER)
+      if (msp430_data_region == MSP430_REGION_LOWER)
 	return lower_prefix;
 
-      if (msp430_data_region == UPPER)
+      if (msp430_data_region == MSP430_REGION_UPPER)
 	return upper_prefix;
 
-      if (msp430_data_region == EITHER)
+      if (msp430_data_region == MSP430_REGION_EITHER)
 	return either_prefix;
     }
 
@@ -2354,7 +2355,7 @@ 
 				   unsigned HOST_WIDE_INT size,
 				   unsigned int           align)
 {
-  if (msp430_data_region == ANY)
+  if (msp430_data_region == MSP430_REGION_ANY)
     {
       fprintf (stream, COMMON_ASM_OP);
       assemble_name (stream, name);
@@ -2370,9 +2371,9 @@ 
       else
 	switch (msp430_data_region)
 	  {
-	  case UPPER: sec = get_named_section (NULL, ".upper.bss", 0); break;
-	  case LOWER: sec = get_named_section (NULL, ".lower.bss", 0); break;
-	  case EITHER: sec = get_named_section (NULL, ".either.bss", 0); break;
+	  case MSP430_REGION_UPPER: sec = get_named_section (NULL, ".upper.bss", 0); break;
+	  case MSP430_REGION_LOWER: sec = get_named_section (NULL, ".lower.bss", 0); break;
+	  case MSP430_REGION_EITHER: sec = get_named_section (NULL, ".either.bss", 0); break;
 	  default:
 	    gcc_unreachable ();
 	  }
@@ -2396,8 +2397,8 @@ 
      short jumps when there is a chance that the instructions will end up in a low
      section.  */
   return
-    msp430_code_region == EITHER
-    || msp430_code_region == LOWER
+    msp430_code_region == MSP430_REGION_EITHER
+    || msp430_code_region == MSP430_REGION_LOWER
     || has_attr (ATTR_EITHER, current_function_decl)
     || has_attr (ATTR_LOWER, current_function_decl);
 }
@@ -3204,10 +3205,10 @@ 
   static const char * cached_match = NULL;
   static bool         cached_result;
 
-  if (msp430_hwmult_type == F5SERIES)
+  if (msp430_hwmult_type == MSP430_HWMULT_F5SERIES)
     return true;
 
-  if (target_mcu == NULL || msp430_hwmult_type != AUTO)
+  if (target_mcu == NULL || msp430_hwmult_type != MSP430_HWMULT_AUTO)
     return false;
 
   if (target_mcu == cached_match)
@@ -3242,10 +3243,10 @@ 
   static bool         cached_result;
   int i;
 
-  if (msp430_hwmult_type == LARGE)
+  if (msp430_hwmult_type == MSP430_HWMULT_LARGE)
     return true;
 
-  if (target_mcu == NULL || msp430_hwmult_type != AUTO)
+  if (target_mcu == NULL || msp430_hwmult_type != MSP430_HWMULT_AUTO)
     return false;
 
   if (target_mcu == cached_match)
@@ -3271,10 +3272,10 @@ 
   static bool         cached_result;
   int i;
 
-  if (msp430_hwmult_type == NONE)
+  if (msp430_hwmult_type == MSP430_HWMULT_NONE)
     return true;
 
-  if (msp430_hwmult_type != AUTO)
+  if (msp430_hwmult_type != MSP430_HWMULT_AUTO)
     return false;
 
   if (target_mcu == NULL)
@@ -3312,7 +3313,7 @@ 
 
   /* If we have been given a specific MCU name then we may be
      able to make use of its hardware multiply capabilities.  */
-  if (msp430_hwmult_type != NONE)
+  if (msp430_hwmult_type != MSP430_HWMULT_NONE)
     {
       if (strcmp ("__mspabi_mpyi", name) == 0)
 	{
Index: config/msp430/msp430.md
===================================================================
--- config/msp430/msp430.md	(revision 237527)
+++ config/msp430/msp430.md	(working copy)
@@ -1510,7 +1510,7 @@ 
   [(set (match_operand:SI                          0 "register_operand" "=r")
 	(mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%0"))
 		 (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
-  "optimize > 2 && msp430_hwmult_type != NONE"
+  "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
   "*
     if (msp430_use_f5_series_hwmult ())
       return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C2 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\";
@@ -1523,7 +1523,7 @@ 
   [(set (match_operand:SI                          0 "register_operand" "=r")
 	(mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%0"))
 		 (zero_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
-  "optimize > 2 && msp430_hwmult_type != NONE"
+  "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
   "*
     if (msp430_use_f5_series_hwmult ())
       return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C0 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\";
@@ -1536,7 +1536,7 @@ 
   [(set (match_operand:DI                          0 "register_operand" "=r")
 	(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%0"))
 		 (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
-  "optimize > 2 && msp430_hwmult_type != NONE"
+  "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
   "*
     if (msp430_use_f5_series_hwmult ())
       return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D4 { MOV.W %H1, &0x04D6 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\";
@@ -1549,7 +1549,7 @@ 
   [(set (match_operand:DI                          0 "register_operand" "=r")
 	(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
 		 (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
-  "optimize > 2 && msp430_hwmult_type != NONE"
+  "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
   "*
     if (msp430_use_f5_series_hwmult ())
       return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D0 { MOV.W %H1, &0x04D2 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\";
Index: config/msp430/msp430.opt
===================================================================
--- config/msp430/msp430.opt	(revision 237527)
+++ config/msp430/msp430.opt	(working copy)
@@ -41,7 +41,7 @@ 
 config/msp430/msp430-opts.h
 
 mhwmult=
-Target Joined RejectNegative Report ToLower Var(msp430_hwmult_type) Enum(msp430_hwmult_types) Init(AUTO)
+Target Joined RejectNegative Report ToLower Var(msp430_hwmult_type) Enum(msp430_hwmult_types) Init(MSP430_HWMULT_AUTO)
 Specify the type of hardware multiply to support.
 
 Enum
@@ -48,26 +48,26 @@ 
 Name(msp430_hwmult_types) Type(enum msp430_hwmult_types)
 
 EnumValue
-Enum(msp430_hwmult_types) String(none) Value(NONE)
+Enum(msp430_hwmult_types) String(none) Value(MSP430_HWMULT_NONE)
 
 EnumValue
-Enum(msp430_hwmult_types) String(auto) Value(AUTO)
+Enum(msp430_hwmult_types) String(auto) Value(MSP430_HWMULT_AUTO)
 
 EnumValue
-Enum(msp430_hwmult_types) String(16bit) Value(SMALL)
+Enum(msp430_hwmult_types) String(16bit) Value(MSP430_HWMULT_SMALL)
 
 EnumValue
-Enum(msp430_hwmult_types) String(32bit) Value(LARGE)
+Enum(msp430_hwmult_types) String(32bit) Value(MSP430_HWMULT_LARGE)
 
 EnumValue
-Enum(msp430_hwmult_types) String(f5series) Value(F5SERIES)
+Enum(msp430_hwmult_types) String(f5series) Value(MSP430_HWMULT_F5SERIES)
 
 mcode-region=
-Target Joined RejectNegative Report ToLower Var(msp430_code_region) Enum(msp430_regions) Init(ANY)
+Target Joined RejectNegative Report ToLower Var(msp430_code_region) Enum(msp430_regions) Init(MSP430_REGION_ANY)
 Specify whether functions should be placed into low or high memory.
 
 mdata-region=
-Target Joined RejectNegative Report ToLower Var(msp430_data_region) Enum(msp430_regions) Init(ANY)
+Target Joined RejectNegative Report ToLower Var(msp430_data_region) Enum(msp430_regions) Init(MSP430_REGION_ANY)
 Specify whether variables should be placed into low or high memory.
 
 Enum
@@ -74,16 +74,16 @@ 
 Name(msp430_regions) Type(enum msp430_regions)
 
 EnumValue
-Enum(msp430_regions) String(none) Value(ANY)
+Enum(msp430_regions) String(none) Value(MSP430_REGION_ANY)
 
 EnumValue
-Enum(msp430_regions) String(either) Value(EITHER)
+Enum(msp430_regions) String(either) Value(MSP430_REGION_EITHER)
 
 EnumValue
-Enum(msp430_regions) String(lower) Value(LOWER)
+Enum(msp430_regions) String(lower) Value(MSP430_REGION_LOWER)
 
 EnumValue
-Enum(msp430_regions) String(upper) Value(UPPER)
+Enum(msp430_regions) String(upper) Value(MSP430_REGION_UPPER)
 
 msilicon-errata=
 Target Joined RejectNegative Report ToLower