Documentation for re-targeting GNU C compiler
Michael K. Gschwind
mike at vlsivie.tuwien.ac.at
Thu Feb 21 20:15:58 AEST 1991
In article <2395 at taurus.BITNET> <orr%math.tau.ac.il at CUNYVM.CUNY.EDU> 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:
/* TYPE SIZES */
#define CHAR_TYPE_SIZE 16
#define SHORT_TYPE_SIZE 16
#define INT_TYPE_SIZE 16
#define LONG_TYPE_SIZE 32
#define LONG_LONG_TYPE_SIZE 32
#define FLOAT_TYPE_SIZE 32
#define DOUBLE_TYPE_SIZE 32
#define LONG_DOUBLE_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,
mike
Michael K. Gschwind, Institute for VLSI-Design, Vienna University of Technology
mike at vlsivie.tuwien.ac.at, mike at vlsivie.uucp, e182202 at awituw01.bitnet
Voice: (++43).1.58801 8144, Fax: (++43).1.569697
--
Send compilers articles to compilers at iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
More information about the Comp.unix.questions
mailing list