Xref: utzoo comp.compilers:1730 comp.unix.questions:28901 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!wuarchive!uunet!world!iecc!compilers-sender From: mike@vlsivie.tuwien.ac.at (Michael K. Gschwind) Newsgroups: comp.compilers,comp.unix.questions Subject: Re: Documentation for re-targeting GNU C compiler Keywords: GCC, code, question Message-ID: <2336@tuvie.UUCP> Date: 21 Feb 91 09:15:58 GMT References: <2395@taurus.BITNET> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: mike@vlsivie.tuwien.ac.at (Michael K. Gschwind) Followup-To: comp.compilers Organization: Vienna University of Technology Lines: 75 Approved: compilers@iecc.cambridge.ma.us 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: /* 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@vlsivie.tuwien.ac.at, mike@vlsivie.uucp, e182202@awituw01.bitnet Voice: (++43).1.58801 8144, Fax: (++43).1.569697 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request. Brought to you by Super Global Mega Corp .com