This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: NORMAL MODE PATCH for Gcc 3.3


Hi Kazu,
Sorry for the late reply.
Please find the updated normal mode patch as per CVS-head and the change log
entries for them.
"offset -= 2" is necessary to access the parameters on stack.
I have tested it on LEM 3664(H8/300HT).

-Regards,
vijay

Changelog:
2002-11-07  Vijay L. Khuspe  <vijayk1@kpit.com>
        *config/h8300/h8300.c (h8300_init_once):Allow -mn switch only if -mh
or -ms present.
        (h8300_tiny_constant_address_p):Extended support for normal mode.
        (h8300_eightbit_constant_address_p):Extended support for normal
mode.
	  *config/h8300/h8300.h (TARGET_NORMAL_MODE):New.
        (POINTER_SIZE): Added 16 bit pointer for normal mode.
        (Pmode):Kept HI for normal mode.
        (SIZE_TYPE):Kept unsigned int for normal mode.
        (PTRDIFF_TYPE):Kept int for normal mode.
        (ASM_WORD_OP):Kept word for normal mode.
        *config/h8300/h8300.md (tablejump_normal_mode):New.
        (indirect_jump_normal_mode):New.
        *config/h8300/t-h8300 (MULTILIB_OPTIONS):Passing normal mode option
to directory.       	  (MULTILIB_DIRNAMES):Create target dependent directory
'normal'.
        (MULTILIB_EXCEPTIONS):Extended support for normal mode.
        *doc/invoke.texi (gccoptlist): Description of switch for normal
mode.


Index: config/h8300/h8300.h
============================================================================
================
*** ../gcc/gcc/config/h8300/h8300.h.org	Fri Nov 15 14:29:09 2002
--- ../gcc/gcc/config/h8300/h8300.h	Fri Nov 15 14:25:59 2002
***************
*** 47,50 ****
--- 47,54 ----
  	  builtin_assert ("cpu=h8300h");		\
  	  builtin_assert ("machine=h8300h");		\
+ 	  if (TARGET_NORMAL_MODE)                       \
+ 	    {                                           \
+ 	     builtin_define("__NORMAL_MODE__");         \
+ 	    }                                           \
  	}						\
        else if (TARGET_H8300S)				\
***************
*** 53,56 ****
--- 57,64 ----
  	  builtin_assert ("cpu=h8300s");		\
  	  builtin_assert ("machine=h8300s");		\
+ 	  if (TARGET_NORMAL_MODE)                       \
+ 	    {                                           \
+ 	     builtin_define("__NORMAL_MODE__");         \
+ 	    }                                           \
  	}						\
        else						\
***************
*** 96,99 ****
--- 104,108 ----
  #define MASK_H8300H		0x00001000
  #define MASK_ALIGN_300		0x00002000
+ #define MASK_NORMAL_MODE 	0x00000500

  /* Macros used in the machine description to test the flags.  */
***************
*** 120,123 ****
--- 129,133 ----
  #define TARGET_H8300H	(target_flags & MASK_H8300H)
  #define TARGET_H8300S	(target_flags & MASK_H8300S)
+ #define TARGET_NORMAL_MODE (target_flags & MASK_NORMAL_MODE)

  /* mac register and relevant instructions are available.  */
***************
*** 153,156 ****
--- 163,167 ----
    {"rtl-dump",		 MASK_RTL_DUMP, NULL},				    \
    {"h",			 MASK_H8300H, N_("Generate H8/300H code")},	    \
+   {"n",                  MASK_NORMAL_MODE,N_("Enable Normal Mode   ")},
\
    {"no-h",		-MASK_H8300H, N_("Do not generate H8/300H code")},  \
    {"align-300",		 MASK_ALIGN_300, N_("Use H8/300 alignment rules")}, \
***************
*** 160,163 ****
--- 171,175 ----
  #undef TARGET_H8300H
  #undef TARGET_H8300S
+ #undef TARGET_NORMAL_MODE
  /* If compiling libgcc2, make these compile time constants based on what
     flags are we actually compiling with.  */
***************
*** 172,175 ****
--- 184,192 ----
  #define TARGET_H8300S	0
  #endif
+ #ifdef __NORMAL_MODE__
+ #define TARGET_NORMAL_MODE 1
+ #else
+ #define  TARGET_NORMAL_MODE 0
+ #endif
  #endif /* !IN_LIBGCC2 */

***************
*** 975,985 ****
     After generation of rtl, the compiler makes no further distinction
     between pointers and any other objects of this machine mode.  */
! #define Pmode (TARGET_H8300H || TARGET_H8300S ? SImode : HImode)

  /* ANSI C types.
     We use longs for the H8/300H and the H8S because ints can be 16 or 32.
     GCC requires SIZE_TYPE to be the same size as pointers.  */
! #define SIZE_TYPE (TARGET_H8300 ? "unsigned int" : "long unsigned int")
! #define PTRDIFF_TYPE (TARGET_H8300 ? "int" : "long int")

  #define WCHAR_TYPE "short unsigned int"
--- 992,1004 ----
     After generation of rtl, the compiler makes no further distinction
     between pointers and any other objects of this machine mode.  */
! #define Pmode ((TARGET_H8300H || TARGET_H8300S) && !TARGET_NORMAL_MODE ?
SImode : HImode)

  /* ANSI C types.
     We use longs for the H8/300H and the H8S because ints can be 16 or 32.
     GCC requires SIZE_TYPE to be the same size as pointers.  */
! #define SIZE_TYPE (TARGET_H8300 || TARGET_NORMAL_MODE ? "unsigned int" :
"long unsigned int")
! #define PTRDIFF_TYPE (TARGET_H8300 || TARGET_NORMAL_MODE ? "int" : "long
int")
!
! #define POINTER_SIZE ((TARGET_H8300H || TARGET_H8300S) &&
!TARGET_NORMAL_MODE ? 32 : 16)

  #define WCHAR_TYPE "short unsigned int"
***************
*** 1069,1073 ****

  /* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H.
*/
! #define ASM_WORD_OP	(TARGET_H8300 ? "\t.word\t" : "\t.long\t")

  #define TEXT_SECTION_ASM_OP "\t.section .text"
--- 1088,1092 ----

  /* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H.
*/
! #define ASM_WORD_OP	(TARGET_H8300 || TARGET_NORMAL_MODE ? "\t.word\t" :
"\t.long\t")

  #define TEXT_SECTION_ASM_OP "\t.section .text"
Index: config/h8300/h8300.c
============================================================================
================
*** ../gcc/gcc/config/h8300/h8300.c.org	Thu Nov 14 13:33:49 2002
--- ../gcc/gcc/config/h8300/h8300.c	Thu Nov 14 13:48:40 2002
***************
*** 315,318 ****
--- 315,324 ----
        target_flags |= 1;
      }
+
+   if (TARGET_H8300 && TARGET_NORMAL_MODE)
+     {
+       error("-mn used without -mh or -ms");
+       target_flags ^=MASK_NORMAL_MODE;
+     }

    /* Some of the shifts are optimized for speed by default.
***************
*** 1640,1644 ****
  	offset += UNITS_PER_WORD;	/* Skip saved PC */
      }
!   return offset;
  }

--- 1646,1654 ----
  	offset += UNITS_PER_WORD;	/* Skip saved PC */
      }
!
!  if ((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
!    offset -= 2;
!
!  return offset;
  }

***************
*** 3882,3886 ****

    return (0
! 	  || (TARGET_H8300  && IN_RANGE (addr, n1, n2))
  	  || (TARGET_H8300H && IN_RANGE (addr, h1, h2))
  	  || (TARGET_H8300S && IN_RANGE (addr, s1, s2)));
--- 3892,3896 ----

    return (0
! 	  || ((TARGET_H8300 || TARGET_NORMAL_MODE) && IN_RANGE (addr, n1, n2))
  	  || (TARGET_H8300H && IN_RANGE (addr, h1, h2))
  	  || (TARGET_H8300S && IN_RANGE (addr, s1, s2)));
***************
*** 3909,3915 ****

    return (0
! 	  || (TARGET_H8300H
  	      && (IN_RANGE (addr, h1, h2) || IN_RANGE (addr, h3, h4)))
! 	  || (TARGET_H8300S
  	      && (IN_RANGE (addr, s1, s2) || IN_RANGE (addr, s3, s4))));
  }
--- 3919,3925 ----

    return (0
! 	  || ((TARGET_H8300H && !TARGET_NORMAL_MODE)
  	      && (IN_RANGE (addr, h1, h2) || IN_RANGE (addr, h3, h4)))
! 	  || ((TARGET_H8300S && !TARGET_NORMAL_MODE)
  	      && (IN_RANGE (addr, s1, s2) || IN_RANGE (addr, s3, s4))));
  }

Index: config/h8300/h8300.md
============================================================================
================
*** ../gcc/gcc/config/h8300/h8300.md.org	Tue Nov 12 10:48:45
2002
--- ../gcc/gcc/config/h8300/h8300.md	Tue Nov 12 11:32:53
2002
***************
*** 1524,1527 ****
--- 1524,1535 ----
    [(set_attr "cc" "none")
     (set_attr "length" "2")])
+
+ (define_insn "tablejump_normal_mode"
+    [(set(pc)(match_operand:HI 0 "register_operand" "r"))
+    (use(label_ref(match_operand 1 "" "")))]
+    "(TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE"
+    "jmp @%S0"
+    [(set_attr "cc" "none")
+     (set_attr "length" "2")])

  ;; This is a define expand, because pointers may be either 16 or 32 bits.
***************
*** 1543,1546 ****
--- 1551,1561 ----
    "TARGET_H8300H || TARGET_H8300S"
    "jmp @%0"
+   [(set_attr "cc" "none")
+    (set_attr "length" "2")])
+
+ (define_insn "indirect_jump_normal_mode"
+   [(set (pc) (match_operand:HI 0 "jump_address_operand" "Vr"))]
+   "(TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE"
+   "jmp @%S0"
    [(set_attr "cc" "none")
     (set_attr "length" "2")])


Index: doc/invoke.texi
============================================================================
================
*** ../gcc/gcc/doc/invoke.texi.org	Wed Nov 13 14:55:37 2002
--- ../gcc/gcc/doc/invoke.texi	Wed Nov 13 14:59:45 2002
***************
*** 551,555 ****
  @emph{H8/300 Options}
  @gccoptlist{
! -mrelax  -mh  -ms  -mint32  -malign-300}

  @emph{SH Options}
--- 551,555 ----
  @emph{H8/300 Options}
  @gccoptlist{
! -mrelax  -mh  -ms  -mn -mint32  -malign-300}

  @emph{SH Options}
***************
*** 8585,8588 ****
--- 8585,8592 ----
  @opindex ms
  Generate code for the H8S@.
+
+ @item -mn
+ @opindex mn
+ Generate code for the H8S and H8/300H in Normal mode. This switch must be
used either with -mh or -ms.

  @item -ms2600

Index: config/h8300/t-h8300
============================================================================
================
*** ../gcc/gcc/config/h8300/t-h8300.org	Tue Nov 12 10:49:16
2002
--- ../gcc/gcc/config/h8300/t-h8300	Tue Nov 12 10:52:44 2002
***************
*** 27,32 ****

  MULTILIB_OPTIONS = mh/ms mint32
! MULTILIB_DIRNAMES = h8300h h8300s int32
! MULTILIB_EXCEPTIONS = mint32

  LIBGCC = stmp-multilib
--- 27,32 ----

  MULTILIB_OPTIONS = mh/ms mint32
! MULTILIB_DIRNAMES = h8300h h8300s normal int32
! MULTILIB_EXCEPTIONS = mint32 mn mn/mint32

  LIBGCC = stmp-multilib




-----Original Message-----
From: Kazu Hirata [mailto:kazu@cs.umass.edu]
Sent: Thursday, September 26, 2002 5:21 PM
To: Vijay Khuspe
Cc: gcc-patches@gcc.gnu.org; gnuh8@gnuh8.org.uk
Subject: Re: NORMAL MODE PATCH for Gcc 3.3


X-Scanned-By: MIMEDefang 2.19 (www . roaringpenguin . com / mimedefang)

Hi Vijay,

> > Now, why do you still have to have "offset -= 2;" even though you
> > have pretty complete support for Pmode, POINTER_SIZE, etc?  This
> > seems to be a hack a little bit.
>
> -This part I have referred from earlier patches on normal mode. I
> agree, this is not needed to manipulate now.

Well, you seem to have just removed "offset -= 2;"?  Did you test the
patched gcc one more time?  The original normal mode patch only did
"offset -= 2;" to adjust the number of bytes pushed to store the
program counter of a caller of a function, so this is very important
piece, isn't it?

>       			     (POINTER_SIZE): 16 bit pointer for normal mode
>      				     (CONSTANT_ADDRESS_P):extended support for normal mode
>   				     (EIGHTBIT_CONSTANT_ADDRESS_P):extended support for normal mode

Could you use exactly one tab at the beginning of each line?

* config/h8300/h8300.md((define_insn "tablejump_normal_mode"): new

This should be

* config/h8300/h8300.md (tablejump_normal_mode): New.

The description of the change should start with upper case letters.
Things between parentheses should be function names, macro names, or
insn pattern names, etc.  You might find the entries in ChangeLog
helpful.

Kazu Hirata

--
GNUH8 Mailing List | If you encounter difficulties using this service
                   | email: listmaster@gnuh8.org.uk
                   | http://www.gnuh8.org.uk/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]