RFC: additions to the machine-definition language

Dan Nicolaescu dann@godzilla.ICS.UCI.EDU
Mon May 7 18:10:00 GMT 2001


Hi!

I was looking for some bugs in a machine definition & associated files
and  it occured to me that a lot of the #define gobbledygook needed to
described a processor could be moved to the .md file and be made
smaller and cleaner in the process. 

So I did a proof-of-concept implementation of this in emacs-lisp. 
(Why? Because it's really easy to do, and everybody 
has emacs, and I was bored... :) 

The implemented features are: 

(define-register "REGNAME")
(define-register-class (REGISTER_LIST))
(define-pic-offset-table-reg "REGNAME")
(define-arg-pointer-reg "REGNAME")
(define-frame-pointer-reg "REGNAME")
(define-fixed-registers "REGNAME")
(define-call-used-registers "REGNAME")
(define-reg-alloc-order REGISTER_LIST OR REG_CLASS_LIST)
(define-leaf-reg-alloc-order REGISTER_LIST OR REG_CLASS_LIST)

The current implementation will output the following: 

#define REGISTER_NAMES ...
#define FIRST_PSEUDO_REGISTER ... 
#define FRAME_POINTER_REGNUM ...
#define ARG_POINTER_REGNUM ... 
#define PIC_OFFSET_TABLE_REGNUM ... 
enum regclass ... 
#define N_REG_CLASSES ... 
#define REG_CLASS_NAMES ... 
#define REG_CLASS_CONTENTS ... 
#define FIXED_REGISTERS ... 
#define CALL_USED_REGISTERS ... 
#define REG_ALLOC_ORDER  ...
#define REG_LEAF_ALLOC_ORDER ...

The main advantage is that it's a lot easier and less error prone to
define these things in the .md file that to

To try it, save the attachments as def-reg.el (the actual
implementation) and sparc.el (shows how to use it for the SPARC
processor)

and in emacs do:

M-x load-file RET def-reg.el RET
M-x load-file RET sparc.el RET

Create an empty buffer and do:

M-x dr-output RET

What do you think?  
Please ignore that the syntax is not always orthogonal, this was done
having minimum effort as a priorty (besides it's easily fixable). The
current elisp code is intended as a fast prototyping tool and as a
proof-of-concept to have all the warts figured out before actually
doing a C implementation. 

Is this worthwile pursuing?  Comments, ideas are always welcome. 

--dan 




More information about the Gcc mailing list