OSDN Git Service

Remove inclusion of loop.h
[pf3gnuchains/gcc-fork.git] / gcc / config / c4x / c4x.c
index f1863cb..aeacecb 100644 (file)
@@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA.  */
 #include "optabs.h"
 #include "libfuncs.h"
 #include "flags.h"
-#include "loop.h"
 #include "recog.h"
 #include "ggc.h"
 #include "cpplib.h"
@@ -50,6 +49,7 @@ Boston, MA 02111-1307, USA.  */
 #include "tm_p.h"
 #include "target.h"
 #include "target-def.h"
+#include "langhooks.h"
 
 rtx smulhi3_libfunc;
 rtx umulhi3_libfunc;
@@ -194,7 +194,7 @@ static int c4x_label_ref_used_p (rtx, rtx);
 static tree c4x_handle_fntype_attribute (tree *, tree, tree, int, bool *);
 const struct attribute_spec c4x_attribute_table[];
 static void c4x_insert_attributes (tree, tree *);
-static void c4x_asm_named_section (const char *, unsigned int);
+static void c4x_asm_named_section (const char *, unsigned int, tree);
 static int c4x_adjust_cost (rtx, rtx, rtx, int);
 static void c4x_globalize_label (FILE *, const char *);
 static bool c4x_rtx_costs (rtx, int, int, int *);
@@ -236,9 +236,6 @@ static tree c4x_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 #undef TARGET_SCHED_ADJUST_COST
 #define TARGET_SCHED_ADJUST_COST c4x_adjust_cost
 
-#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE
-#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE hook_int_void_1
-
 #undef TARGET_ASM_GLOBALIZE_LABEL
 #define TARGET_ASM_GLOBALIZE_LABEL c4x_globalize_label
 
@@ -469,7 +466,7 @@ c4x_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
 int
 c4x_hard_regno_rename_ok (unsigned int regno1, unsigned int regno2)
 {
-  /* We can not copy call saved registers from mode QI into QF or from
+  /* We cannot copy call saved registers from mode QI into QF or from
      mode QF into QI.  */
   if (IS_FLOAT_CALL_SAVED_REGNO (regno1) && IS_INT_CALL_SAVED_REGNO (regno2))
     return 0;
@@ -733,12 +730,20 @@ c4x_gimplify_va_arg_expr (tree valist, tree type,
                          tree *post_p ATTRIBUTE_UNUSED)
 {
   tree t;
+  bool indirect;
+
+  indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+  if (indirect)
+    type = build_pointer_type (type);
 
   t = build (PREDECREMENT_EXPR, TREE_TYPE (valist), valist,
-            build_int_2 (int_size_in_bytes (type), 0));
+            build_int_cst (NULL_TREE, int_size_in_bytes (type)));
   t = fold_convert (build_pointer_type (type), t);
   t = build_fold_indirect_ref (t);
 
+  if (indirect)
+    t = build_fold_indirect_ref (t);
+
   return t;
 }
 
@@ -2254,7 +2259,7 @@ c4x_rptb_nop_p (rtx insn)
   Before we can create a repeat block looping instruction we have to
   verify that there are no jumps outside the loop and no jumps outside
   the loop go into this loop. This can happen in the basic blocks reorder
-  pass. The C4x cpu can not handle this.  */
+  pass. The C4x cpu cannot handle this.  */
 
 static int
 c4x_label_ref_used_p (rtx x, rtx code_label)
@@ -2299,7 +2304,7 @@ c4x_rptb_valid_p (rtx insn, rtx start_label)
     if (insn == start_label)
       break;
 
-  /* Note found then we can not use a rptb or rpts.  The label was
+  /* Note found then we cannot use a rptb or rpts.  The label was
      probably moved by the basic block reorder pass.  */
   if (! insn)
     return 0;
@@ -2368,7 +2373,7 @@ c4x_rptb_insert (rtx insn)
   
   if (! c4x_rptb_valid_p (insn, start_label))
     {
-      /* We can not use the rptb insn.  Replace it so reorg can use
+      /* We cannot use the rptb insn.  Replace it so reorg can use
          the delay slots of the jump insn.  */
       emit_insn_before (gen_addqi3 (count_reg, count_reg, constm1_rtx), insn);
       emit_insn_before (gen_cmpqi (count_reg, const0_rtx), insn);
@@ -3336,7 +3341,7 @@ tsrc_operand (rtx op, enum machine_mode mode)
 }
 
 
-/* Check src operand of two operand non immedidate instructions.  */
+/* Check src operand of two operand non immediate instructions.  */
 
 int
 nonimmediate_src_operand (rtx op, enum machine_mode mode)
@@ -3348,7 +3353,7 @@ nonimmediate_src_operand (rtx op, enum machine_mode mode)
 }
 
 
-/* Check logical src operand of two operand non immedidate instructions.  */
+/* Check logical src operand of two operand non immediate instructions.  */
 
 int
 nonimmediate_lsrc_operand (rtx op, enum machine_mode mode)
@@ -3542,7 +3547,7 @@ c4x_address_conflict (rtx op0, rtx op1, int store0, int store1)
   if (! TARGET_DEVEL && base0 == base1 && (incdec0 || incdec1))
     return 1;
 
-  /* We can not optimize the case where op1 and op2 refer to the same
+  /* We cannot optimize the case where op1 and op2 refer to the same
      address.  */
   if (base0 == base1 && disp0 == disp1 && index0 == index1)
     return 1;
@@ -3926,7 +3931,6 @@ legitimize_operands (enum rtx_code code, rtx *operands, enum machine_mode mode)
          && TARGET_HOIST
          && optimize > 0
          && GET_CODE (operands[1]) == CONST_INT 
-         && preserve_subexpressions_p ()
          && rtx_cost (operands[1], code) > 1)
        operands[1] = force_reg (mode, operands[1]);
       
@@ -3944,7 +3948,6 @@ legitimize_operands (enum rtx_code code, rtx *operands, enum machine_mode mode)
       && TARGET_HOIST
       && optimize > 1
       && GET_CODE (operands[2]) == CONST_INT
-      && preserve_subexpressions_p ()
       && rtx_cost (operands[2], code) > 1)
     operands[2] = force_reg (mode, operands[2]);
 
@@ -4759,41 +4762,52 @@ c4x_init_builtins (void)
 {
   tree endlink = void_list_node;
 
-  builtin_function ("fast_ftoi",
-                   build_function_type 
-                   (integer_type_node,
-                    tree_cons (NULL_TREE, double_type_node, endlink)),
-                   C4X_BUILTIN_FIX, BUILT_IN_MD, NULL, NULL_TREE);
-  builtin_function ("ansi_ftoi",
-                   build_function_type 
-                   (integer_type_node, 
-                    tree_cons (NULL_TREE, double_type_node, endlink)),
-                   C4X_BUILTIN_FIX_ANSI, BUILT_IN_MD, NULL, NULL_TREE);
+  lang_hooks.builtin_function ("fast_ftoi",
+                              build_function_type 
+                              (integer_type_node,
+                               tree_cons (NULL_TREE, double_type_node,
+                                          endlink)),
+                              C4X_BUILTIN_FIX, BUILT_IN_MD, NULL, NULL_TREE);
+  lang_hooks.builtin_function ("ansi_ftoi",
+                              build_function_type 
+                              (integer_type_node, 
+                               tree_cons (NULL_TREE, double_type_node,
+                                          endlink)),
+                              C4X_BUILTIN_FIX_ANSI, BUILT_IN_MD, NULL,
+                              NULL_TREE);
   if (TARGET_C3X)
-    builtin_function ("fast_imult",
-                     build_function_type
-                     (integer_type_node, 
-                      tree_cons (NULL_TREE, integer_type_node,
-                                 tree_cons (NULL_TREE,
-                                            integer_type_node, endlink))),
-                     C4X_BUILTIN_MPYI, BUILT_IN_MD, NULL, NULL_TREE);
+    lang_hooks.builtin_function ("fast_imult",
+                                build_function_type
+                                (integer_type_node, 
+                                 tree_cons (NULL_TREE, integer_type_node,
+                                            tree_cons (NULL_TREE,
+                                                       integer_type_node,
+                                                       endlink))),
+                                C4X_BUILTIN_MPYI, BUILT_IN_MD, NULL,
+                                NULL_TREE);
   else
     {
-      builtin_function ("toieee",
-                       build_function_type 
-                       (double_type_node,
-                        tree_cons (NULL_TREE, double_type_node, endlink)),
-                       C4X_BUILTIN_TOIEEE, BUILT_IN_MD, NULL, NULL_TREE);
-      builtin_function ("frieee",
-                       build_function_type
-                       (double_type_node, 
-                        tree_cons (NULL_TREE, double_type_node, endlink)),
-                       C4X_BUILTIN_FRIEEE, BUILT_IN_MD, NULL, NULL_TREE);
-      builtin_function ("fast_invf",
-                       build_function_type 
-                       (double_type_node, 
-                        tree_cons (NULL_TREE, double_type_node, endlink)),
-                       C4X_BUILTIN_RCPF, BUILT_IN_MD, NULL, NULL_TREE);
+      lang_hooks.builtin_function ("toieee",
+                                  build_function_type 
+                                  (double_type_node,
+                                   tree_cons (NULL_TREE, double_type_node,
+                                              endlink)),
+                                  C4X_BUILTIN_TOIEEE, BUILT_IN_MD, NULL,
+                                  NULL_TREE);
+      lang_hooks.builtin_function ("frieee",
+                                  build_function_type
+                                  (double_type_node, 
+                                   tree_cons (NULL_TREE, double_type_node,
+                                              endlink)),
+                                  C4X_BUILTIN_FRIEEE, BUILT_IN_MD, NULL,
+                                  NULL_TREE);
+      lang_hooks.builtin_function ("fast_invf",
+                                  build_function_type 
+                                  (double_type_node, 
+                                   tree_cons (NULL_TREE, double_type_node,
+                                              endlink)),
+                                  C4X_BUILTIN_RCPF, BUILT_IN_MD, NULL,
+                                  NULL_TREE);
     }
 }
 
@@ -4909,7 +4923,8 @@ c4x_init_libfuncs (void)
 }
 
 static void
-c4x_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED)
+c4x_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED,
+                      tree decl ATTRIBUTE_UNUSED)
 {
   fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
 }