[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Question about tcc (C67) assembler code.
From: |
Kim Lux |
Subject: |
Re: [Tinycc-devel] Question about tcc (C67) assembler code. |
Date: |
Thu, 15 Dec 2005 16:29:36 -0700 |
Comments below.
On Thu, 2005-12-15 at 18:54 -0500, Dave Dodge wrote:
> On Thu, Dec 15, 2005 at 02:35:54PM -0700, Kim Lux wrote:
> > What are the "<<23"s about ?
> [...]
> > C67_g((0 << 29) | //creg
> > (0 << 28) | //inv
> > (C67_map_regn(c) << 23) | //dst
> > (C67_map_regn(b) << 18) | //src2 (possible x path)
> > (C67_map_regn(a) << 13) | //src1
> > (xpath << 12) | //x cross path if opposite sides
> > (0x7b << 5) | //opcode
> > (0x6 << 2) | //opcode fixed
> > (C67_map_regs(c) << 1) | //side of dest
> > (0 << 0)); //parallel
>
> I don't know anything about C67, but this appears to be a simple
> bitfield packing function. I assume C67_map_regn(c) returns a 5-bit
> value in the range [0,31], which is then shifted 23 bits so that it
> ends up in bits 24-28 of the resulting machine word.
I need to look at this closer before I ask more questions.
> > If one is writing a new assembler, should it be done in the same way ?
>
> That probably depends on the machine architecture. Each system will
> have its own special issues and requirements. C67 looks like a simple
> design with 32-bit instructions and not a lot of variation in the
> instruction formats. Other architectures are not so simple, for
> example:
<snip>
We are writing for Freescale 9S12, 9S12X and Xgate. Small instruction
sets, fairly simple, etc.
xgate has about 150 instruction/addressing combos, for example.
We already have assemblers for all of our targets.
I *really* like the fact that the tcc assembler will do C pre
processing, even if it is non standard.
--
Kim Lux, Diesel Research Inc.