Monday, February 22, 2010

I've now hit the annoying part of the GCC port. I'm pretty much done with everything except word-to-byte conversions, multiply, divide and elimination of the frame pointer register. I'm afraid I might have to do a lot of trial-and-error since I haven't found a template I can use for the remaining instructions.

I'm currently working on the word-to-byte conversion. GCC wants to use a "subreg" expression to do this, and eventually uses "movqi" regardless of the other, more exact instruction matches. There is a "truncMN2" format which should be used for this, but it's not being used. Poop.

Sunday, February 14, 2010

I have most of the 16 and 8 bit operations working now. I'm missing mul, div, type conversion, move and set. But it looks pretty good.

I've started looking at 32-bit operations, and that is not going smoothly. The compiler bails at init_move_cost.

UPDATE:
That was caused by not respecting the difference between Rn, *Rn, and @x(Rn). The instruction was assuming a Rn, when a *Rn was actually called for. I need to update all "o" condtions with "R" and "Q" and respect the consequences of each.

Sunday, February 7, 2010

Since I last updated the worklog, I've been working on a GCC port for the TMS9900. I made up my mind on this after I realized the ton of work required to maintain the source code if it all stays as assembly. Additionally, if I fool myself into thinking anyone else would be interested in using this thing when I'm done, C programming would be much more inviting.

So here's where I'm at right now:

I've got GCC sort of ported at the moment, the TMS9900 is a valid target, the call interface is working, as are the shift instructions. I'm currently working on the conditional jumps.

Out of curiosity, I looked at Tursi's port, and it looks like he just used the PDP11 stuff, but changed the opcode names. Works OK I suppose, but suboptimal.

I used concepts from the ARM, M68HC11 and PDP11 implementations, since I wasn't sure where to start. As a result, I've had a heck of a time with the call interface, since the pieces I used didn't play well together. Tracking down the bugs is challenging, since there is a lot going on and it's still not clear to me how all the machine-specific parts get used.

I want to have parameters passed in the registers, and am trying to keep the file "tios_abi.txt" current regarding the internals of the implementation.

Back to work...