m68hc11 cleanup/problems (was Re: Patches waiting for review)
Zack Weinberg
zackw@Stanford.EDU
Mon Mar 26 19:31:00 GMT 2001
On Mon, Mar 26, 2001 at 06:28:25PM +0200, Stephane Carrez wrote:
> Hi!
>
> Zack Weinberg a ?crit :
> >
> > "xm-files: m68hc11"
> > http://gcc.gnu.org/ml/gcc-patches/2001-03/msg01214.html
> >
> This one is ok for me.
I thought it'd be a good idea to try to build a m68hc11 cross-compiler
before applying this, at the very least. This exposed a few more
places where there was code conditioned on GCC_VERSION. I cleaned
that up - revised patch below. This gets me as far as libgcc, at
which point it blows up:
./xgcc -B./ -B/usr/local/m68hc11-none/bin/ -isystem
/usr/local/m68hc11-none/include -Os -DUSE_GAS -DIN_GCC -DIN_LIBGCC2
-I. -I. -I../../../gcc_m68hc11/gcc
-I../../../gcc_m68hc11/gcc/. -I../../../gcc_m68hc11/gcc/config
-I../../../gcc_m68hc11/gcc/../include -DL_negdi2 -c
../../../gcc_m68hc11/gcc/libgcc2.c -o libgcc/./_negdi2.o
../../../gcc_m68hc11/gcc/libgcc2.c: In function `__negdi2':
../../../gcc_m68hc11/gcc/libgcc2.c:64: Internal compiler error in
gen_highpart, at emit-rtl.c:1108
This looks unrelated, and I don't know how to fix it. Do you still
want the patch applied?
zw
* config.gcc (m68hc11-*-*, m68hc12-*-*): Convert to new tm.h
inclusion style. xm-m68hc11.h no longer exists.
* config/m68hc11/xm-m68hc11.h: Delete file.
* config/m68hc11/m68hc12.h: Convert to new tm.h inclusion style.
* config/m68hc11/m68hc11.h: Convert to new tm.h inclusion style.
Don't define GCC_VERSION, N_, or PARAMS; don't include
gansidecl.h or stdio.h. Define inhibit_libc here.
Make code conditioned on #if GCC_VERSION > 2095 unconditional.
Delete code conditioned on #if GCC_VERSION == 2095.
* config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c:
Make code conditioned on #if GCC_VERSION > 2095 unconditional.
Delete code conditioned on #if GCC_VERSION == 2095.
===================================================================
Index: config.gcc
--- config.gcc 2001/03/25 13:23:30 1.44
+++ config.gcc 2001/03/27 03:24:03
@@ -1595,17 +1595,15 @@ m32r-*-elf*)
;;
# m68hc11 and m68hc12 share the same machine description.
m68hc11-*-*|m6811-*-*)
- tm_file="m68hc11/m68hc11.h"
- xm_file="m68hc11/xm-m68hc11.h"
+ tm_file="elfos.h m68hc11/m68hc11.h"
tm_p_file="m68hc11/m68hc11-protos.h"
md_file="m68hc11/m68hc11.md"
out_file="m68hc11/m68hc11.c"
tmake_file="m68hc11/t-m68hc11-gas"
;;
m68hc12-*-*|m6812-*-*)
- tm_file="m68hc11/m68hc12.h"
+ tm_file="m68hc11/m68hc12.h elfos.h m68hc11/m68hc11.h"
tm_p_file="m68hc11/m68hc11-protos.h"
- xm_file="m68hc11/xm-m68hc11.h"
md_file="m68hc11/m68hc11.md"
out_file="m68hc11/m68hc11.c"
tmake_file="m68hc11/t-m68hc11-gas"
===================================================================
Index: config/m68hc11/m68hc11-protos.h
--- config/m68hc11/m68hc11-protos.h 2000/09/08 20:54:44 1.1
+++ config/m68hc11/m68hc11-protos.h 2001/03/27 03:24:03
@@ -53,11 +53,8 @@ extern void m68hc11_encode_section_info
#endif
#ifdef RTX_CODE
-#if GCC_VERSION > 2095
extern rtx m68hc11_compare_op0;
extern rtx m68hc11_compare_op1;
-#endif
-
extern rtx m68hc11_soft_tmp_reg;
extern rtx iy_reg;
extern rtx d_reg;
@@ -165,10 +162,9 @@ extern void m68hc11_function_epilogue PA
#endif /* TREE_CODE */
-#if GCC_VERSION > 2095
extern HOST_WIDE_INT m68hc11_min_offset;
extern HOST_WIDE_INT m68hc11_max_offset;
-#endif
+
#endif /* HAVE_MACHINE_MODES */
#endif /* RTX_CODE */
===================================================================
Index: config/m68hc11/m68hc11.c
--- config/m68hc11/m68hc11.c 2001/03/22 18:48:49 1.3
+++ config/m68hc11/m68hc11.c 2001/03/27 03:24:04
@@ -37,9 +37,7 @@ Note:
#include "system.h"
#include "rtl.h"
#include "tree.h"
-#if GCC_VERSION > 2095
#include "tm_p.h"
-#endif
#include "regs.h"
#include "hard-reg-set.h"
#include "real.h"
@@ -52,16 +50,8 @@ Note:
#include "expr.h"
#include "toplev.h"
#include "basic-block.h"
-#if GCC_VERSION > 2095
#include "function.h"
#include "ggc.h"
-#else
-#include "m68hc11-protos.h"
-#endif
-
-#if GCC_VERSION == 2095
-extern char *version_string;
-#endif
static void print_options PARAMS ((FILE *));
static void emit_move_after_reload PARAMS ((rtx, rtx, rtx));
@@ -140,7 +130,6 @@ static void m68hc11_add_gc_roots PARAMS
static int nb_soft_regs;
-#if GCC_VERSION > 2095
/* Flag defined in c-decl.c
Nonzero means don't recognize the non-ANSI builtin functions.
@@ -151,16 +140,13 @@ static int nb_soft_regs;
conflict with newlib definition. Don't define as external to
avoid a link problem for f77. */
int flag_no_nonansi_builtin;
-#endif
int
m68hc11_override_options ()
{
m68hc11_add_gc_roots ();
-#if GCC_VERSION > 2095
flag_no_nonansi_builtin = 1;
-#endif
memset (m68hc11_reg_valid_for_index, 0,
sizeof (m68hc11_reg_valid_for_index));
@@ -1324,8 +1310,6 @@ m68hc11_function_arg (cum, mode, type, n
return NULL_RTX;
}
-#if GCC_VERSION > 2095
-
/* The "standard" implementation of va_start: just assign `nextarg' to
the variable. */
void
@@ -1393,7 +1377,6 @@ m68hc11_va_arg (valist, type)
return addr;
}
-#endif
/* If defined, a C expression which determines whether, and in which direction,
to pad out an argument with extra space. The value should be of type
@@ -4588,49 +4571,6 @@ m68hc11_reassign_regs (first)
}
}
-#if GCC_VERSION == 2095
-/* Split all insns in the function. If UPD_LIFE, update life info after. */
-
-static int
-m68hc11_split_all_insns (first)
- rtx first;
-{
- rtx insn;
- int split_done = 0;
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- rtx last;
-
- if (INSN_DELETED_P (insn))
- continue;
- if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
- continue;
-
- last = try_split (PATTERN (insn), insn, 1);
-
- /* When not optimizing, the old insn will be still left around
- with only the 'deleted' bit set. Transform it into a note
- to avoid confusion of subsequent processing. */
- if (INSN_DELETED_P (insn))
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- split_done = 1;
- }
-
- if (last != insn)
- {
- PUT_CODE (insn, NOTE);
- NOTE_SOURCE_FILE (insn) = 0;
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- split_done = 1;
- }
- }
- return split_done;
-}
-#endif /* GCC_VERSION == 2095 */
void
m68hc11_reorg (first)
@@ -4641,20 +4581,14 @@ m68hc11_reorg (first)
z_replacement_completed = 0;
z_reg = gen_rtx (REG, HImode, HARD_Z_REGNUM);
-#if GCC_VERSION > 2095
/* Some RTX are shared at this point. This breaks the Z register
replacement, unshare everything. */
unshare_all_rtl_again (first);
-#endif
/* Force a split of all splitable insn. This is necessary for the
Z register replacement mechanism because we end up with basic insns. */
-#if GCC_VERSION > 2095
split_all_insns (0);
split_done = 1;
-#else
- split_done = m68hc11_split_all_insns (first);
-#endif
z_replacement_completed = 1;
m68hc11_reassign_regs (first);
@@ -4668,14 +4602,8 @@ m68hc11_reorg (first)
description to use the best assembly directives. */
if (optimize)
{
-#if GCC_VERSION > 2095
find_basic_blocks (first, max_reg_num (), 0);
life_analysis (first, 0, PROP_REG_INFO | PROP_DEATH_NOTES);
-#else
- find_basic_blocks (first, max_reg_num (), 0, 1);
- life_analysis (first, max_reg_num (), 0,
- 1 /* SCz: dead code elim fails. Must investigate. */ );
-#endif
}
z_replacement_completed = 2;
@@ -4684,11 +4612,7 @@ m68hc11_reorg (first)
split after Z register replacement. This gives more opportunities
for peephole (in particular for consecutives xgdx/xgdy). */
if (optimize > 0)
-#if GCC_VERSION > 2095
split_all_insns (0);
-#else
- m68hc11_split_all_insns (first);
-#endif
/* Once insns are split after the z_replacement_completed == 2,
we must not re-run the life_analysis. The xgdx/xgdy patterns
@@ -4996,9 +4920,6 @@ m68hc11_rtx_costs (x, code, outer_code)
/* print_options - called at the start of the code generation for a
module. */
-#if GCC_VERSION == 2095
-extern char *main_input_filename;
-#endif
extern char *asm_file_name;
#include <time.h>
@@ -5052,7 +4973,6 @@ m68hc11_asm_file_start (out, main_file)
static void
m68hc11_add_gc_roots ()
{
-#if GCC_VERSION > 2095
ggc_add_rtx_root (&m68hc11_soft_tmp_reg, 1);
ggc_add_rtx_root (&ix_reg, 1);
ggc_add_rtx_root (&iy_reg, 1);
@@ -5062,5 +4982,4 @@ m68hc11_add_gc_roots ()
ggc_add_rtx_root (&z_reg_qi, 1);
ggc_add_rtx_root (&stack_push_word, 1);
ggc_add_rtx_root (&stack_pop_word, 1);
-#endif
}
===================================================================
Index: config/m68hc11/m68hc11.h
--- config/m68hc11/m68hc11.h 2001/01/01 20:35:30 1.4
+++ config/m68hc11/m68hc11.h 2001/03/27 03:24:04
@@ -33,18 +33,6 @@ Note:
*/
-#undef GCC_VERSION
-#if 1 /* def N_*/
-# define GCC_VERSION 2096
-#else
-# define GCC_VERSION 2095
-
-/* NLS support in 2.96 */
-# define N_(X) X
-#endif
-
-#include "elfos.h"
-
/*****************************************************************************
**
** Controlling the Compilation Driver, `gcc'
@@ -85,22 +73,9 @@ Note:
/* Names to predefine in the preprocessor for this target machine. */
#define CPP_PREDEFINES "-Dmc68hc1x"
-
-
-#ifndef IN_LIBGCC2
-# include <stdio.h>
-#endif
-
-#include "gansidecl.h"
-#if GCC_VERSION == 2095
-#ifndef PARAMS
-#if defined(ANSI_PROTOTYPES) || defined(__cplusplus)
-#define PARAMS(args) args
-#else
-#define PARAMS(args) ()
-#endif
-#endif
+/* As an embedded target, we have no libc. */
+#define inhibit_libc
/* Forward type declaration for prototypes definitions.
rtx_ptr is equivalent to rtx. Can't use the same name. */
@@ -113,9 +88,7 @@ typedef union tree_node *tree_ptr;
/* We can't declare enum machine_mode forward nor include 'machmode.h' here.
Prototypes defined here will use an int instead. It's better than no
prototype at all. */
-
typedef int enum_machine_mode;
-#endif
/*****************************************************************************
**
@@ -1297,11 +1270,7 @@ extern enum reg_class m68hc11_index_reg_
/* Internal macro, return 1 if REGNO is a valid base register. */
-#if GCC_VERSION == 2095
-# define REG_VALID_P(REGNO) ((REGNO) >= 0)
-#else
-# define REG_VALID_P(REGNO) (1) /* ? */
-#endif
+#define REG_VALID_P(REGNO) (1) /* ? */
extern unsigned char m68hc11_reg_valid_for_base[FIRST_PSEUDO_REGISTER];
#define REG_VALID_FOR_BASE_P(REGNO) \
@@ -1882,14 +1851,3 @@ extern int debug_m6811;
extern int z_replacement_completed;
extern int current_function_interrupt;
extern int current_function_trap;
-
-#if GCC_VERSION == 2095
-extern rtx_ptr iy_reg;
-extern rtx_ptr iy_reg;
-extern rtx_ptr d_reg;
-extern rtx_ptr m68hc11_soft_tmp_reg;
-extern rtx_ptr m68hc11_compare_op0;
-extern rtx_ptr m68hc11_compare_op1;
-extern long m68hc11_min_offset;
-extern long m68hc11_max_offset;
-#endif
===================================================================
Index: config/m68hc11/m68hc12.h
--- config/m68hc11/m68hc12.h 2000/09/08 20:54:44 1.1
+++ config/m68hc11/m68hc12.h 2001/03/27 03:24:05
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler, for m68hc12.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@worldnet.fr).
This file is part of GNU CC.
@@ -38,6 +38,3 @@ Boston, MA 02111-1307, USA. */
#define TARGET_DEFAULT (MASK_M6812)
#define TARGET_M68HC12
-
-#include "m68hc11/m68hc11.h"
-
===================================================================
Index: config/m68hc11/xm-m68hc11.h
--- config/m68hc11/xm-m68hc11.h Mon Mar 26 19:24:07 2001
+++ config/m68hc11/xm-m68hc11.h Tue May 5 13:32:27 1998
@@ -1,22 +0,0 @@
-/* Configuration for GNU C-compiler for Motorola 68HC11 and 68HC12.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
- Contributed by Stephane Carrez (stcarrez@worldnet.fr)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#define inhibit_libc
More information about the Gcc-patches
mailing list