This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Several newbie questions (+any simple .md available?)
- From: Sami Khawam <S dot Khawam at ee dot ed dot ac dot uk>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 16 Jul 2004 15:35:15 +0100
- Subject: Several newbie questions (+any simple .md available?)
Hi all,
I am sure these questions have been asked in the
past, however I was unable to find any response in
the archive. Any help would be appreciated.
Basically I am trying to port gcc to a custom cpu
architecture. Does anyone know if there is a simple
.md description of a cpu with the basic instruction
set so I could start with it? I had a look at the
'stormy16' and 'camille' descriptions which seem to
be quite simple, however whenever I try to make any
modifications I get a number of errors related to
reloading etc.
Secondly, is there a way to output the internal RTL
description of a compiled file?
Finally, one constraint I have in my CPU
architecture is that constants (immediate operands)
are not allowed in arithmetic instructions, thus
operations like:
ADD r5, #5
have to become:
MOV r4, #5
ADD r5, r4
I tried to limit the insn definitions to fit this,
but the compiler does not seem to be able to
decompose the "ADD r5, #5" instruction and
complains that there is no insn of a plus with const:
Sections of the .md file:
(define_expand "movhi"
[(set (match_operand 0 "register_operand" "")
(match_operand 1 "general_operand" ""))]
""
"")
(define_insn "*mov_all_modes"
[(set (match_operand 0
"nonimmediate_nonstack_operand" "")
(match_operand 1 "general_operand"
""))]
""
"MOV %0, %1")
(define_expand "addhi3"
[(set (match_operand:HI 0
"register_operand" "")
(plus:HI (match_operand:HI 1
"general_operand" "")
(match_operand:HI 2
"general_operand" "")))]
""
"")
(define_insn "*add_all_modes"
[(set (match_operand 0 "register_operand"
"=r")
(plus (match_operand 1
"register_operand" "0")
(match_operand 2
"general_operand" "ri")))]
""
"ADD %0, %2")
And the error generated by the compiler is:
dct_simple.c:89: error: unrecognizable insn:
(insn/f 412 411 413 0 (parallel [
(set (reg/f:HI 15 sp)
(plus:HI (reg/f:HI 15 sp)
(const_int 12 [0xc])))
(clobber (reg:BI 16 carry))
]) -1 (nil)
(expr_list:REG_UNUSED (reg:BI 16 carry)
(nil)))
dct_simple.c:89: internal compiler error: in
extract_insn, at recog.c:2083
Any help would be really appreciated!
Regards,
Sami Khawam
The University of Edinburgh
http://www.see.ed.ac.uk/~sxk