Patchwork [i386] : Trivial, use bool some more.

login
register
mail settings
Submitter Uros Bizjak
Date May 17, 2011, 6:27 p.m.
Message ID <BANLkTime_YpN6wqF3MGVyYAOWhpGyyOoEQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/96004/
State New
Headers show

Comments

Uros Bizjak - May 17, 2011, 6:27 p.m.
Hello!

2011-05-16  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386-protos.h (output_fix_trunc): Change arg 3 to bool.
	(output_fp_compare): Change args 3 and 4 to bool.
	(ix86_expand_call): Change arg 6 to bool.
	(ix86_attr_length_immediate_default): Change arg 2 to bool.
	(ix86_attr_length_vex_default): Change arg 3 to bool.
	* config/i386/i386.md: Update all uses.
	* config/i386/i386.c: Ditto.
	(ix86_flags_dependent): Change return type to bool.

Patch was tested on x86_64-pc-linux-gnu {,-m32}, also with
--enable-build-with-cxx (additional patch is needed to bootstrap
without errors ATM).

Committed to mainline SVN.

Uros.

Patch

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 173832)
+++ config/i386/i386.md	(working copy)
@@ -414,9 +414,9 @@ 
 	   (const_int 0)
 	 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
 			  imul,icmp,push,pop")
-	   (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
+	   (symbol_ref "ix86_attr_length_immediate_default (insn, true)")
 	 (eq_attr "type" "imov,test")
-	   (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
+	   (symbol_ref "ix86_attr_length_immediate_default (insn, false)")
 	 (eq_attr "type" "call")
 	   (if_then_else (match_operand 0 "constant_call_address_operand" "")
 	     (const_int 4)
@@ -524,11 +524,11 @@ 
   (if_then_else (and (eq_attr "prefix_0f" "1")
 		     (eq_attr "prefix_extra" "0"))
     (if_then_else (eq_attr "prefix_vex_w" "1")
-      (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
-      (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
+      (symbol_ref "ix86_attr_length_vex_default (insn, true, true)")
+      (symbol_ref "ix86_attr_length_vex_default (insn, true, false)"))
     (if_then_else (eq_attr "prefix_vex_w" "1")
-      (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
-      (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
+      (symbol_ref "ix86_attr_length_vex_default (insn, false, true)")
+      (symbol_ref "ix86_attr_length_vex_default (insn, false, false)"))))
 
 ;; Set when modrm byte is used.
 (define_attr "modrm" ""
@@ -1262,7 +1262,7 @@ 
 	UNSPEC_FNSTSW))]
   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
    && GET_MODE (operands[1]) == GET_MODE (operands[2])"
-  "* return output_fp_compare (insn, operands, 0, 0);"
+  "* return output_fp_compare (insn, operands, false, false);"
   [(set_attr "type" "multi")
    (set_attr "unit" "i387")
    (set (attr "mode")
@@ -1309,7 +1309,7 @@ 
 	     (match_operand:XF 2 "register_operand" "f"))]
 	  UNSPEC_FNSTSW))]
   "TARGET_80387"
-  "* return output_fp_compare (insn, operands, 0, 0);"
+  "* return output_fp_compare (insn, operands, false, false);"
   [(set_attr "type" "multi")
    (set_attr "unit" "i387")
    (set_attr "mode" "XF")])
@@ -1343,7 +1343,7 @@ 
 	     (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
 	  UNSPEC_FNSTSW))]
   "TARGET_80387"
-  "* return output_fp_compare (insn, operands, 0, 0);"
+  "* return output_fp_compare (insn, operands, false, false);"
   [(set_attr "type" "multi")
    (set_attr "unit" "i387")
    (set_attr "mode" "<MODE>")])
@@ -1378,7 +1378,7 @@ 
 	  UNSPEC_FNSTSW))]
   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
    && GET_MODE (operands[1]) == GET_MODE (operands[2])"
-  "* return output_fp_compare (insn, operands, 0, 1);"
+  "* return output_fp_compare (insn, operands, false, true);"
   [(set_attr "type" "multi")
    (set_attr "unit" "i387")
    (set (attr "mode")
@@ -1428,7 +1428,7 @@ 
   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
    && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
    && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
-  "* return output_fp_compare (insn, operands, 0, 0);"
+  "* return output_fp_compare (insn, operands, false, false);"
   [(set_attr "type" "multi")
    (set_attr "unit" "i387")
    (set_attr "fp_int_src" "true")
@@ -1504,7 +1504,7 @@ 
   "TARGET_MIX_SSE_I387
    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
-  "* return output_fp_compare (insn, operands, 1, 0);"
+  "* return output_fp_compare (insn, operands, true, false);"
   [(set_attr "type" "fcmp,ssecomi")
    (set_attr "prefix" "orig,maybe_vex")
    (set (attr "mode")
@@ -1533,7 +1533,7 @@ 
   "TARGET_SSE_MATH
    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
-  "* return output_fp_compare (insn, operands, 1, 0);"
+  "* return output_fp_compare (insn, operands, true, false);"
   [(set_attr "type" "ssecomi")
    (set_attr "prefix" "maybe_vex")
    (set (attr "mode")
@@ -1557,7 +1557,7 @@ 
    && TARGET_CMOVE
    && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
-  "* return output_fp_compare (insn, operands, 1, 0);"
+  "* return output_fp_compare (insn, operands, true, false);"
   [(set_attr "type" "fcmp")
    (set (attr "mode")
      (cond [(match_operand:SF 1 "" "")
@@ -1577,7 +1577,7 @@ 
   "TARGET_MIX_SSE_I387
    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
-  "* return output_fp_compare (insn, operands, 1, 1);"
+  "* return output_fp_compare (insn, operands, true, true);"
   [(set_attr "type" "fcmp,ssecomi")
    (set_attr "prefix" "orig,maybe_vex")
    (set (attr "mode")
@@ -1606,7 +1606,7 @@ 
   "TARGET_SSE_MATH
    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
-  "* return output_fp_compare (insn, operands, 1, 1);"
+  "* return output_fp_compare (insn, operands, true, true);"
   [(set_attr "type" "ssecomi")
    (set_attr "prefix" "maybe_vex")
    (set (attr "mode")
@@ -1630,7 +1630,7 @@ 
    && TARGET_CMOVE
    && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
-  "* return output_fp_compare (insn, operands, 1, 1);"
+  "* return output_fp_compare (insn, operands, true, true);"
   [(set_attr "type" "fcmp")
    (set (attr "mode")
      (cond [(match_operand:SF 1 "" "")
@@ -4478,7 +4478,7 @@ 
    && !((SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
 	 && (TARGET_64BIT || <MODE>mode != DImode))
 	&& TARGET_SSE_MATH)"
-  "* return output_fix_trunc (insn, operands, 1);"
+  "* return output_fix_trunc (insn, operands, true);"
   [(set_attr "type" "fisttp")
    (set_attr "mode" "<MODE>")])
 
@@ -4562,7 +4562,7 @@ 
   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
    && !TARGET_FISTTP
    && !(TARGET_64BIT && SSE_FLOAT_MODE_P (GET_MODE (operands[1])))"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fistp")
    (set_attr "i387_cw" "trunc")
    (set_attr "mode" "DI")])
@@ -4617,7 +4617,7 @@ 
   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
    && !TARGET_FISTTP
    && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fistp")
    (set_attr "i387_cw" "trunc")
    (set_attr "mode" "<MODE>")])
@@ -11077,7 +11077,7 @@ 
   ""
 {
   ix86_expand_call (NULL, operands[0], operands[1],
-		    operands[2], NULL, 0);
+		    operands[2], NULL, false);
   DONE;
 })
 
@@ -11088,7 +11088,7 @@ 
   ""
 {
   ix86_expand_call (NULL, operands[0], operands[1],
-		    operands[2], NULL, 1);
+		    operands[2], NULL, true);
   DONE;
 })
 
@@ -11185,7 +11185,7 @@ 
   "!TARGET_64BIT"
 {
   ix86_expand_call (NULL, operands[0], operands[1],
-		    operands[2], operands[3], 0);
+		    operands[2], operands[3], false);
   DONE;
 })
 
@@ -11251,7 +11251,7 @@ 
   ""
 {
   ix86_expand_call (operands[0], operands[1], operands[2],
-		    operands[3], NULL, 0);
+		    operands[3], NULL, false);
   DONE;
 })
 
@@ -11263,7 +11263,7 @@ 
   ""
 {
   ix86_expand_call (operands[0], operands[1], operands[2],
-		    operands[3], NULL, 1);
+		    operands[3], NULL, true);
   DONE;
 })
 
@@ -11367,7 +11367,7 @@ 
   "!TARGET_64BIT"
 {
   ix86_expand_call (operands[0], operands[1], operands[2],
-		    operands[3], operands[4], 0);
+		    operands[3], operands[4], false);
   DONE;
 })
 
@@ -11455,7 +11455,7 @@ 
 				 : X86_64_MS_SSE_REGPARM_MAX)
 			      : X86_32_SSE_REGPARM_MAX)
 		    	     - 1),
-		    NULL, 0);
+		    NULL, false);
 
   for (i = 0; i < XVECLEN (operands[2], 0); i++)
     {
@@ -14370,7 +14370,7 @@ 
 		   UNSPEC_FIST))
    (clobber (match_scratch:XF 2 "=&1f"))]
   "TARGET_USE_FANCY_MATH_387"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fpspc")
    (set_attr "mode" "DI")])
 
@@ -14429,7 +14429,7 @@ 
 	(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "f")]
 			   UNSPEC_FIST))]
   "TARGET_USE_FANCY_MATH_387"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fpspc")
    (set_attr "mode" "<MODE>")])
 
@@ -14619,7 +14619,7 @@ 
    (clobber (match_scratch:XF 4 "=&1f"))]
   "TARGET_USE_FANCY_MATH_387
    && flag_unsafe_math_optimizations"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fistp")
    (set_attr "i387_cw" "floor")
    (set_attr "mode" "DI")])
@@ -14676,7 +14676,7 @@ 
    (use (match_operand:HI 3 "memory_operand" "m"))]
   "TARGET_USE_FANCY_MATH_387
    && flag_unsafe_math_optimizations"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fistp")
    (set_attr "i387_cw" "floor")
    (set_attr "mode" "<MODE>")])
@@ -14876,7 +14876,7 @@ 
    (clobber (match_scratch:XF 4 "=&1f"))]
   "TARGET_USE_FANCY_MATH_387
    && flag_unsafe_math_optimizations"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fistp")
    (set_attr "i387_cw" "ceil")
    (set_attr "mode" "DI")])
@@ -14933,7 +14933,7 @@ 
    (use (match_operand:HI 3 "memory_operand" "m"))]
   "TARGET_USE_FANCY_MATH_387
    && flag_unsafe_math_optimizations"
-  "* return output_fix_trunc (insn, operands, 0);"
+  "* return output_fix_trunc (insn, operands, false);"
   [(set_attr "type" "fistp")
    (set_attr "i387_cw" "ceil")
    (set_attr "mode" "<MODE>")])
Index: config/i386/i386-protos.h
===================================================================
--- config/i386/i386-protos.h	(revision 173832)
+++ config/i386/i386-protos.h	(working copy)
@@ -67,8 +67,8 @@  extern void split_double_mode (enum mach
 extern const char *output_set_got (rtx, rtx);
 extern const char *output_387_binary_op (rtx, rtx*);
 extern const char *output_387_reg_move (rtx, rtx*);
-extern const char *output_fix_trunc (rtx, rtx*, int);
-extern const char *output_fp_compare (rtx, rtx*, int, int);
+extern const char *output_fix_trunc (rtx, rtx*, bool);
+extern const char *output_fp_compare (rtx, rtx*, bool, bool);
 extern const char *output_adjust_stack_and_probe (rtx);
 extern const char *output_probe_stack_range (rtx, rtx);
 
@@ -114,7 +114,7 @@  extern bool ix86_expand_fp_vcond (rtx[])
 extern bool ix86_expand_int_vcond (rtx[]);
 extern void ix86_expand_sse_unpack (rtx[], bool, bool);
 extern bool ix86_expand_int_addcc (rtx[]);
-extern rtx ix86_expand_call (rtx, rtx, rtx, rtx, rtx, int);
+extern rtx ix86_expand_call (rtx, rtx, rtx, rtx, rtx, bool);
 extern void ix86_split_call_vzeroupper (rtx, rtx);
 extern void x86_initialize_trampoline (rtx, rtx, rtx);
 extern rtx ix86_zero_extend_to_Pmode (rtx);
@@ -127,9 +127,9 @@  extern bool ix86_check_movabs (rtx, int)
 extern void ix86_split_idivmod (enum machine_mode, rtx[], bool);
 
 extern rtx assign_386_stack_local (enum machine_mode, enum ix86_stack_slot);
-extern int ix86_attr_length_immediate_default (rtx, int);
+extern int ix86_attr_length_immediate_default (rtx, bool);
 extern int ix86_attr_length_address_default (rtx);
-extern int ix86_attr_length_vex_default (rtx, int, int);
+extern int ix86_attr_length_vex_default (rtx, bool, bool);
 
 extern enum machine_mode ix86_fp_compare_mode (enum rtx_code);
 
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 173832)
+++ config/i386/i386.c	(working copy)
@@ -11517,7 +11517,7 @@  ix86_expand_split_stack_prologue (void)
     }
   call_insn = ix86_expand_call (NULL_RTX, gen_rtx_MEM (QImode, fn),
 				GEN_INT (UNITS_PER_WORD), constm1_rtx,
-				NULL_RTX, 0);
+				NULL_RTX, false);
   add_function_usage_to (call_insn, call_fusage);
 
   /* In order to make call/return prediction work right, we now need
@@ -15196,7 +15196,7 @@  emit_i387_cw_initialization (int mode)
    operand may be [SDX]Fmode.  */
 
 const char *
-output_fix_trunc (rtx insn, rtx *operands, int fisttp)
+output_fix_trunc (rtx insn, rtx *operands, bool fisttp)
 {
   int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
   int dimode_p = GET_MODE (operands[0]) == DImode;
@@ -15261,7 +15261,7 @@  output_387_ffreep (rtx *operands ATTRIBU
    should be used.  UNORDERED_P is true when fucom should be used.  */
 
 const char *
-output_fp_compare (rtx insn, rtx *operands, int eflags_p, int unordered_p)
+output_fp_compare (rtx insn, rtx *operands, bool eflags_p, bool unordered_p)
 {
   int stack_top_dies;
   rtx cmp_op0, cmp_op1;
@@ -21961,7 +21961,7 @@  construct_plt_address (rtx symbol)
 rtx
 ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
 		  rtx callarg2,
-		  rtx pop, int sibcall)
+		  rtx pop, bool sibcall)
 {
   rtx use = NULL, call;
 
@@ -22326,7 +22326,7 @@  memory_address_length (rtx addr)
 /* Compute default value for "length_immediate" attribute.  When SHORTFORM
    is set, expect that insn have 8bit immediate alternative.  */
 int
-ix86_attr_length_immediate_default (rtx insn, int shortform)
+ix86_attr_length_immediate_default (rtx insn, bool shortform)
 {
   int len = 0;
   int i;
@@ -22436,8 +22436,7 @@  ix86_attr_length_address_default (rtx in
    2 or 3 byte VEX prefix and 1 opcode byte.  */
 
 int
-ix86_attr_length_vex_default (rtx insn, int has_0f_opcode,
-			      int has_vex_w)
+ix86_attr_length_vex_default (rtx insn, bool has_0f_opcode, bool has_vex_w)
 {
   int i;
 
@@ -22504,10 +22503,10 @@  ix86_issue_rate (void)
     }
 }
 
-/* A subroutine of ix86_adjust_cost -- return true iff INSN reads flags set
+/* A subroutine of ix86_adjust_cost -- return TRUE iff INSN reads flags set
    by DEP_INSN and nothing set by DEP_INSN.  */
 
-static int
+static bool
 ix86_flags_dependent (rtx insn, rtx dep_insn, enum attr_type insn_type)
 {
   rtx set, set2;
@@ -22517,7 +22516,7 @@  ix86_flags_dependent (rtx insn, rtx dep_
       && insn_type != TYPE_ICMOV
       && insn_type != TYPE_FCMOV
       && insn_type != TYPE_IBR)
-    return 0;
+    return false;
 
   if ((set = single_set (dep_insn)) != 0)
     {
@@ -22533,20 +22532,20 @@  ix86_flags_dependent (rtx insn, rtx dep_
       set2 = SET_DEST (XVECEXP (PATTERN (dep_insn), 0, 0));
     }
   else
-    return 0;
+    return false;
 
   if (!REG_P (set) || REGNO (set) != FLAGS_REG)
-    return 0;
+    return false;
 
   /* This test is true if the dependent insn reads the flags but
      not any other potentially set register.  */
   if (!reg_overlap_mentioned_p (set, PATTERN (insn)))
-    return 0;
+    return false;
 
   if (set2 && reg_overlap_mentioned_p (set2, PATTERN (insn)))
-    return 0;
+    return false;
 
-  return 1;
+  return true;
 }
 
 /* Return true iff USE_INSN has a memory address with operands set by