i86: add targetm based on i386.c
authorDaniel Verkamp <daniel.verkamp@gmail.com>
Tue, 24 Jul 2007 17:55:34 +0000 (13:55 -0400)
committerDaniel Verkamp <daniel.verkamp@gmail.com>
Tue, 24 Jul 2007 17:55:34 +0000 (13:55 -0400)
gcc/config/i86/i86.c
gcc/config/i86/i86.h
gcc/config/i86/i86.md

index d73bfeb..9ad5980 100644 (file)
@@ -80,6 +80,13 @@ i86_const_ok_for_letter_p(int v, int c)
 
 #define DEBUG 0
 
+/* g: general-purpose
+   b: base
+   i: index
+   s: stack
+
+   ax dx cx bx si di bp sp
+*/
 static char packreg[] = "gggbiibs";
 static char *
 pack_rtx(rtx r, char *buf, char *ebuf, int strict)
@@ -147,7 +154,7 @@ static const char *valid_addr_list[] = {
 };
 
 int
-i86_valid_addr(enum machine_mode mode, rtx x, int strict)
+i86_valid_addr(enum machine_mode mode ATTRIBUTE_UNUSED, rtx x, int strict)
 {
   int i;
   char packed[20];
@@ -181,7 +188,7 @@ i86_valid_addr(enum machine_mode mode, rtx x, int strict)
 }
 
 void
-i86_notice_update_cc(rtx e)
+i86_notice_update_cc(rtx e ATTRIBUTE_UNUSED)
 {
   CC_STATUS_INIT;
 }
@@ -202,7 +209,7 @@ i86_function_prolog(FILE *file, int size)
 }
 
 void
-i86_function_epilog(FILE *file, int size)
+i86_function_epilog(FILE *file, int size ATTRIBUTE_UNUSED)
 {
   int regno;
   fprintf(file, "\n");
@@ -273,3 +280,205 @@ i86_print_operand_address(FILE *s, rtx x)
   i86_print_operand(s,XEXP(x,0),0);
   putc(']', s);
 }
+
+
+static void
+i86_file_start (void)
+{
+  default_file_start ();
+
+  fputs ("\tBITS 16\n", asm_out_file);
+}
+
+
+/* Table of valid machine attributes.  */
+static const struct attribute_spec i86_attribute_table[] =
+{
+#ifdef SUBTARGET_ATTRIBUTE_TABLE
+  SUBTARGET_ATTRIBUTE_TABLE,
+#endif
+  { NULL,        0, 0, false, false, false, NULL }
+};
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_ATTRIBUTE_TABLE
+#define TARGET_ATTRIBUTE_TABLE i86_attribute_table
+
+/*#undef TARGET_COMP_TYPE_ATTRIBUTES
+#define TARGET_COMP_TYPE_ATTRIBUTES i86_comp_type_attributes*/
+
+/*#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS i86_init_builtins
+#undef TARGET_EXPAND_BUILTIN
+#define TARGET_EXPAND_BUILTIN ix86_expand_builtin*/
+
+/*#undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
+#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION i86_builtin_vectorized_function
+#undef TARGET_VECTORIZE_BUILTIN_CONVERSION
+#define TARGET_VECTORIZE_BUILTIN_CONVERSION i86_builtin_conversion*/
+
+#undef TARGET_ASM_FUNCTION_EPILOGUE
+#define TARGET_ASM_FUNCTION_EPILOGUE i86_function_epilog
+
+/*#undef TARGET_ENCODE_SECTION_INFO
+#ifndef SUBTARGET_ENCODE_SECTION_INFO
+#define TARGET_ENCODE_SECTION_INFO i86_encode_section_info
+#else
+#define TARGET_ENCODE_SECTION_INFO SUBTARGET_ENCODE_SECTION_INFO
+#endif*/
+
+#undef TARGET_ASM_OPEN_PAREN
+#define TARGET_ASM_OPEN_PAREN "("
+#undef TARGET_ASM_CLOSE_PAREN
+#define TARGET_ASM_CLOSE_PAREN ")"
+
+#undef TARGET_ASM_ALIGNED_HI_OP
+#define TARGET_ASM_ALIGNED_HI_OP ASM_SHORT
+/*#undef TARGET_ASM_ALIGNED_SI_OP
+#define TARGET_ASM_ALIGNED_SI_OP ASM_LONG
+#ifdef ASM_QUAD
+#undef TARGET_ASM_ALIGNED_DI_OP
+#define TARGET_ASM_ALIGNED_DI_OP ASM_QUAD
+#endif
+*/
+
+#undef TARGET_ASM_UNALIGNED_HI_OP
+#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP
+/*#undef TARGET_ASM_UNALIGNED_SI_OP
+#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP
+#undef TARGET_ASM_UNALIGNED_DI_OP
+#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
+*/
+
+/*
+#undef TARGET_SCHED_ADJUST_COST
+#define TARGET_SCHED_ADJUST_COST i86_adjust_cost
+#undef TARGET_SCHED_ISSUE_RATE
+#define TARGET_SCHED_ISSUE_RATE i86_issue_rate
+#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
+#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD \
+  i86_multipass_dfa_lookahead
+*/
+
+/*
+#undef TARGET_FUNCTION_OK_FOR_SIBCALL
+#define TARGET_FUNCTION_OK_FOR_SIBCALL ix86_function_ok_for_sibcall
+*/
+
+/*#ifdef HAVE_AS_TLS
+#undef TARGET_HAVE_TLS
+#define TARGET_HAVE_TLS true
+#endif
+*/
+
+/*#undef TARGET_CANNOT_FORCE_CONST_MEM
+#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem
+#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
+#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_rtx_true
+*/
+
+/*
+#undef TARGET_DELEGITIMIZE_ADDRESS
+#define TARGET_DELEGITIMIZE_ADDRESS ix86_delegitimize_address
+*/
+
+/*
+#undef TARGET_MS_BITFIELD_LAYOUT_P
+#define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p
+*/
+
+/*#undef TARGET_ASM_OUTPUT_MI_THUNK
+#define TARGET_ASM_OUTPUT_MI_THUNK x86_output_mi_thunk
+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK x86_can_output_mi_thunk
+*/
+
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START i86_file_start
+
+/*#undef TARGET_DEFAULT_TARGET_FLAGS
+#define TARGET_DEFAULT_TARGET_FLAGS    \
+  (TARGET_DEFAULT                      \
+   | TARGET_SUBTARGET_DEFAULT          \
+   | TARGET_TLS_DIRECT_SEG_REFS_DEFAULT)
+*/
+
+/*#undef TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION ix86_handle_option
+*/
+
+/*#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS ix86_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST ix86_address_cost
+*/
+
+/*#undef TARGET_FIXED_CONDITION_CODE_REGS
+#define TARGET_FIXED_CONDITION_CODE_REGS ix86_fixed_condition_code_regs
+#undef TARGET_CC_MODES_COMPATIBLE
+#define TARGET_CC_MODES_COMPATIBLE ix86_cc_modes_compatible
+*/
+
+/*#undef TARGET_MACHINE_DEPENDENT_REORG
+#define TARGET_MACHINE_DEPENDENT_REORG ix86_reorg
+*/
+
+/*#undef TARGET_BUILD_BUILTIN_VA_LIST
+#define TARGET_BUILD_BUILTIN_VA_LIST ix86_build_builtin_va_list
+*/
+
+/*#undef TARGET_MD_ASM_CLOBBERS
+#define TARGET_MD_ASM_CLOBBERS ix86_md_asm_clobbers
+*/
+
+#undef TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+/*#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX ix86_struct_value_rtx
+#undef TARGET_SETUP_INCOMING_VARARGS
+#define TARGET_SETUP_INCOMING_VARARGS ix86_setup_incoming_varargs
+#undef TARGET_MUST_PASS_IN_STACK
+#define TARGET_MUST_PASS_IN_STACK ix86_must_pass_in_stack
+#undef TARGET_PASS_BY_REFERENCE
+#define TARGET_PASS_BY_REFERENCE ix86_pass_by_reference
+#undef TARGET_INTERNAL_ARG_POINTER
+#define TARGET_INTERNAL_ARG_POINTER ix86_internal_arg_pointer
+#undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
+#define TARGET_DWARF_HANDLE_FRAME_UNSPEC ix86_dwarf_handle_frame_unspec
+#undef TARGET_STRICT_ARGUMENT_NAMING
+#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
+*/
+
+/*#undef TARGET_GIMPLIFY_VA_ARG_EXPR
+#define TARGET_GIMPLIFY_VA_ARG_EXPR ix86_gimplify_va_arg
+
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
+#define TARGET_SCALAR_MODE_SUPPORTED_P ix86_scalar_mode_supported_p
+
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
+#define TARGET_VECTOR_MODE_SUPPORTED_P ix86_vector_mode_supported_p
+
+#ifdef HAVE_AS_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL i386_output_dwarf_dtprel
+#endif
+
+#ifdef SUBTARGET_INSERT_ATTRIBUTES
+#undef TARGET_INSERT_ATTRIBUTES
+#define TARGET_INSERT_ATTRIBUTES SUBTARGET_INSERT_ATTRIBUTES
+#endif
+
+#undef TARGET_MANGLE_FUNDAMENTAL_TYPE
+#define TARGET_MANGLE_FUNDAMENTAL_TYPE ix86_mangle_fundamental_type
+
+#undef TARGET_STACK_PROTECT_FAIL
+#define TARGET_STACK_PROTECT_FAIL ix86_stack_protect_fail
+*/
+
+/*#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE ix86_function_value
+#define TARGET_FUNCTION_VALUE(RET_TYPE, FN_DECL_OR_TYPE, OUTGOING) \
+  gen_rtx_REG (TYPE_MODE( RET_TYPE ), 0)
+*/
+
+struct gcc_target targetm = TARGET_INITIALIZER;
index ab8410e..97fe4d3 100644 (file)
@@ -10,6 +10,12 @@ extern int target_flags;
 
 #define TARGET_VERSION fprintf(stderr, " (i86, DOS, DJ)");
 
+/* Target CPU builtins.  */
+#define TARGET_CPU_CPP_BUILTINS()      \
+do {                                   \
+       builtin_define ("__x86_64__");  \
+} while (0)
+
 /* Storage Layout */
 
 #define BITS_BIG_ENDIAN                0
@@ -155,7 +161,7 @@ extern enum reg_class regclass_map[];       /* smallest class containing REGNO */
   gen_rtx (REG, TYPE_MODE (VALTYPE), 0)*/
 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
 #define LIBCALL_VALUE(MODE) \
-  gen_rtx (REG, MODE, 0)
+  gen_rtx_REG (MODE, 0)
 
 /* Addressing Modes */
 
@@ -235,6 +241,7 @@ extern enum reg_class regclass_map[];       /* smallest class containing REGNO */
 
 /* Output of Uninitialized Variables */
 
+/*
 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
 ( fputs ("\tglobal ", (FILE)),                 \
   assemble_name ((FILE), (NAME)),              \
@@ -249,10 +256,12 @@ extern enum reg_class regclass_map[];     /* smallest class containing REGNO */
 
 #define ASM_OUTPUT_LABEL(FILE,NAME)    \
   (assemble_name (FILE, NAME), fputs (":\n", FILE))
+*/
 
 /*#define ASM_GLOBALIZE_LABEL(FILE,NAME)       \
   (fputs ("\n\tglobal\t", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))*/
 
+/*
 #define ASM_OUTPUT_LABELREF(FILE,NAME) fprintf (FILE, "_%s", NAME)
 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,BUF)    \
   fprintf (FILE, "%s", (BUF))
@@ -261,6 +270,7 @@ extern enum reg_class regclass_map[];       /* smallest class containing REGNO */
 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),   \
   sprintf ((OUTPUT), "%s.%d", (NAME), (int)(LABELNO)))
+*/
 
 #define ASM_OUTPUT_ADDR_VEC_ELT(s,v)   fprintf (s, "\tdw L%d\n", v)
 
index 4f2c87e..6f41d49 100644 (file)
@@ -1,13 +1,13 @@
 
 (define_insn ""
-  [(set (match_operand:HI 0 "push_operand" "=<")
+  [(set (match_operand:HI 0 "push_operand"   "=<")
         (match_operand:HI 1 "memory_operand" "m"))]
   ""
   "push        word %1"
   )
 
 (define_insn ""
-  [(set (match_operand:HI 0 "push_operand" "=<,<")
+  [(set (match_operand:HI 0 "push_operand"     "=<,<")
         (match_operand:HI 1 "nonmemory_operand" "r,i"))]
   ""
   "@
@@ -32,7 +32,7 @@
 
 (define_insn ""
   [(set (match_operand:QI 0 "general_operand" "=q,m,m")
-       (match_operand:QI 1 "general_operand" "g,q,n"))]
+       (match_operand:QI 1 "general_operand" " g,q,n"))]
   "(GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
   "@
    mov %L0,%L1
@@ -42,7 +42,7 @@
 
 ;; (define_insn ""
 ;;   [(set (match_operand:QI 0 "general_operand" "=q")
-;;     (match_operand:HI 1 "general_operand" "q"))]
+;;     (match_operand:HI 1 "general_operand"    " q"))]
 ;;   ""
 ;;   "mov      %L0,%L1"
 ;;  )
@@ -64,7 +64,7 @@
 
 (define_insn ""
   [(set (match_operand:HI 0 "general_operand" "=r,m,m")
-       (match_operand:HI 1 "general_operand" "g,r,i"))]
+       (match_operand:HI 1 "general_operand" " g,r,i"))]
   "(GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
   "@
    mov %0,%1
@@ -73,7 +73,7 @@
   )
 
 (define_insn "addhi3"
-  [(set (match_operand:HI 0 "general_operand" "=r,rm")
+  [(set (match_operand:HI 0 "general_operand" "=r,=rm")
        (plus:HI (match_operand:HI 1 "general_operand" "0,0")
                 (match_operand:HI 2 "general_operand" "rm,ri")))]
   ""
@@ -81,7 +81,7 @@
   )
 
 (define_insn "subhi3"
-  [(set (match_operand:HI 0 "general_operand" "=r,rm")
+  [(set (match_operand:HI 0 "general_operand" "=r,=rm")
        (minus:HI (match_operand:HI 1 "general_operand" "0,0")
                  (match_operand:HI 2 "general_operand" "rm,ri")))]
   ""
   )
 
 (define_insn "ashlhi3"
-  [(set (match_operand:HI 0 "general_operand" "=rm,=rm")
+  [(set (match_operand:HI 0 "general_operand" "=rm,rm")
        (ashift:HI (match_operand:HI 1 "general_operand" "0,0")
                   (match_operand:QI 2 "general_operand" "I,c")))]
   ""