This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Many questions
- From: Solra Bizna <sbizna at tejat dot net>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 26 Oct 2003 18:15:44 -0700
- Subject: Many questions
I have been assigned to find or create a C compiler, assembler, linker,
etc. for the TCS architecture. Rather than writing my own compiler
(something I do not look forward to trying) I would like to add TCS
support to GCC (and binutils) if possible. However, I have several
questions:
* Odd calling conventions
TCS function parameters and variables are stored in registers when
possible. The TCS has 16 general-purpose registers, all are 64-bit
integers. RE and RF are reserved for the frame pointer and stack
pointer, respectively, and R0 is reserved for function return values.
That leaves 13 registers for parameters and variables. Only the first
13 parameters are stored in registers, however, after that all are
pushed onto the stack.
Varargs functions' parameters are loaded up to the last "static"
argument, then pushed left-to-right.
Variables go after parameters in registers.
Now, these calling conventions cause problems. For example, what
happens if the number of static arguments and variables exceeds 13?
They should be swapped onto the stack, but GCC may have to be modified
to compensate. Where would I perform the modifications allowing for
these weird calling conventions? Also, when making a function call, GCC
must emit code like the following
PUR 1,5 (if five registers used)
before the call and
POR 1,5
afterward. That, I think, shouldn't really be that hard to implement,
but help would be welcome.
* Odd immediates
TCS instructions are 32 bits long. The low 16 bits (second in memory)
store the instruction opcode, the high 16-bits store its operands. Each
operand is 4-bit, allowing for instructions of the type
MA R2,R2,R4,R3 ; Multiply Add word
to be stored without trouble. Unfortunately, that limits immediates to
either 4 or 12 bits (depending on the instruction). As a consequence,
immediates must be embedded with code similiar to:
LPC R0
.inline (low 32 bits as hex string)
LPCH R0
.inline (high 32 bits as hex string)
or, if it's a 32-bit constant:
LPC R0
.inline (constant as hex string)
CH R0
Where do I muck about to get THAT working?
* No libraries
GCC (+binutils) must be able to generate raw, headerless binaries. Can
GCC executables do without libraries? (libc, etc.) And what about
crt*.o? What, exactly, would I need to put into that?
* Compiling 64-bit on 32-bit
Can GCC compile for 64-bit architectures on a 32-bit one?
(specifically: powerpc-linux-gnu or powerpc-apple-darwin)
* Machine descriptions
I can no longer seem to find the machine description documentation. How
do I write machine descriptions?
Any help on this topic would be greatly appreciated. I would like to
make as few GCC source code modifications as possible. (TCS is
big-endian, by the way)
- :sigma.SB