x86 backend update

Matthew Fluet fluet@research.nj.nec.com
Thu, 6 Jul 2000 19:14:09 -0400 (EDT)


> > Well, I'm still a bit away from spitting out code ready for the assembler,
> > but I think I've got a good ammount of the framework down. Currently, I've
> > written (most of) the translation from the MachineOutput IL to the
> > pseudo-assembly IL. 
> 
> Looks great.  I have a couple of minor suggestions.
> 
> * Could you output the MachineOutput operands in the comments?
> 
> * It might be nice to write a separate pass that checks to see if a
>   program your IL is valid X86 assembly.  Having this knowledge
>   codified in one place would be good, and running this pass just
>   before spitting out assembly would probably help to catch some errors.

Well, my email seems to be up and running again.

It shouldn't be a problem to output the operand in the comments.
It might be easiest to move the "toString" functions in c-codegen back up
to MachineOutput and then they would be available.

I just finished up a pass that verifies that a sequence of assembly
instructions is valid x86.  Nothing fancy and no analysis, but I claim
that anything that gets by the x86Validate function won't raise
 Error: operands given don't match any known 386 instruction
or
 Error: no such 386 instruction: foo
during assembly.

At first, I was trying to combine this with the register allocation phase,
but I like this better.  It let's me keep some nice invariants.  For
example, under the current system, the translation from MachineOutput IL
to pseudo Assembly produces a sequence of assembly instructions that only
have immediates, labels, and memory locations as operands.  Likewise, the
validate function assumes/verifies that all instructions have immediates,
labels, registers and addresses as operands.  The register allocator will
do the translation from memory locations to registers and addresses.

I've already got a good portion of the register allocator written, there
are just a few tricky instructions left to deal with.  Moving the
validation phase out of the register allocation should clean that code up
a bit.