cgen fundamentals

Frank Ch. Eigler fche@redhat.com
Thu Dec 19 04:51:00 GMT 2002


Hi -


On Wed, Dec 18, 2002 at 06:23:41PM -0500, David Carney wrote:
> [...] I'm still confused about 
> the exactly purpose of cgen.  I.e. what's the purpose of a 'gas' versus an 
> 'opcodes' port?  

Opcodes contains table-driven kernels for assemblers and disassemblers.
CGEN can generate these parts entirely.  The assembler needs some further
hand-made code, which goes into gas/config/tc-*.  A normal assembler will
produce relocatable object files, which requires further hand-made code
in bfd/* to handle.

> What does cgen actually produce (and how do I produce and use it) ?

In general, think of CGEN like a parser generator or a state machine
translator thingie.  It can create table-driven parts of the system,
but you still need to come up with the interface code.  This is normally
done by copying another existing simple port, then modifying it to taste.

> How do files created with cgen interface with binutils? [...]

Unfortunately, the interfaces between cgen-generated code and their
callers/callees is not clearly designed.  If you were interested in the
gory details, you'd need to run the assembler under gdb while it's at
work.  It has an inner beauty, I suppose, an ugly one.


- FChE



More information about the Cgen mailing list