Re: Documentation for re-targeting GNU C compiler (Michael K. Gschwind)
21 Feb 91 09:15:58 GMT

          From comp.compilers

Related articles
Documentation for re-targeting GNU C compiler (1991-02-17)
Re: Documentation for re-targeting GNU C compiler (1991-02-21)
| List of all articles for this month |

Newsgroups: comp.compilers,comp.unix.questions
From: (Michael K. Gschwind)
Followup-To: comp.compilers
Keywords: GCC, code, question
Organization: Vienna University of Technology
References: <2395@taurus.BITNET>
Date: 21 Feb 91 09:15:58 GMT

In article <2395@taurus.BITNET> <> writes:
>To my disappointment, I found the documentation availble with the GCC sources
>to be lacking in the area of writing a new machine description.

yes, it is definitely lacking. And even the one that's there is
sometimes wrong. Basically, you have to read the source. Especially
looking at other md (machine description) and tm (target machine) files
is expedient. (Do not look at the SPARC file it's an ugly hack to handle
instruction scheduling!!!)

> 1. Is there any other document I am missing?

Probably not, there is only the texinfo file :-(

> 2. Did anyone yet write an article describing his experience?

I've been meaning to write one for aeons ;-)

>[I suspect that you're supposed to read the source code, guided by the hints
>in the manual. Also, if your target machine is not byte addressable with
>32 bit words, you'll probably find that the current GCC is chock full of
>inconvenient assumptions. -John]

I did one with 16 bit and one with 32 bit as smallest addressible unit
- it worked OK for most stuff... One of the problems is the
documentation, it confuses the terms "smallest addressable memory unit"
and "byte (8 bit)" - so if you want to do anything like it, you'll
_definitely_ have to read source.

The following already gets you far:

#define CHAR_TYPE_SIZE 16
#define SHORT_TYPE_SIZE 16
#define INT_TYPE_SIZE 16
#define LONG_TYPE_SIZE 32

#define FLOAT_TYPE_SIZE 32

/* target machine storage layout */

/* number of bits in an addressible storage unit */
#define BITS_PER_UNIT 16

/* Width in bits of a "word", which is the contents of a machine register.
      Note that this is not necessarily the width of data type `int';
      if using 16-bit ints on a 68000, this would still be 32.
      But on a machine with 16-bit registers, this would be 16. */
/* This is a machine with 16-bit registers */
#define BITS_PER_WORD 16

/* Width of a word, in units (bytes). */
#define UNITS_PER_WORD 1

/* Width in bits of a pointer.
      See also the macro `Pmode' defined below. */
#define POINTER_SIZE 16

hope this helps,

Michael K. Gschwind, Institute for VLSI-Design, Vienna University of Technology, mike@vlsivie.uucp, e182202@awituw01.bitnet
Voice: (++43).1.58801 8144, Fax: (++43).1.569697


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.