Extending RTL expansion and CG with a new operation

Thomas Bernard tbernard@science.uva.nl
Fri Jun 22 17:46:00 GMT 2007


Hello

I am extending the backend of GCC 4.1 with a new operation which maps 
directly from a keyword in the language. So far I extended the frontend 
and middleend in order to handle this new keyword. I managed to generate 
the GIMPLE form and a valid CFG and a RTL object for this keyword. 
Basically this keyword is handled as a jump-like instruction within the 
RTL language.


Within the backend, I updated the following files to support this new 
operation which is a kinda specific jump with a condition 'cre'.
- tree.def: the tree code for the keyword
- rtl.def: my new rtl operators
- optabs.h / .c:  declaration of operators tables for tree-to-rtl 
translations
- expr.c: expansion of trees into RTL expressions
- I also extended the files alpha.c/.d and alpha.md which the 
architecture I target
- jump.c: handle the condition of my new jump
- dojump.c: handle the new jump I define


The 'expansion' is performed correctly (the RTL file is valid) and the 
'cg' stage gives the following error:
-------------------------------------------------------------------------------------------------------------
kerneltest.c:22: error: unrecognizable insn:
(jump_insn 26 25 29 3 (set (pc)
        (create_body_after (cre (reg:DI 75)
                (const_int 0 [0x0]))
            (label_ref 13)
            (pc))) -1 (nil)
    (nil))
kerneltest.c:22: internal compiler error: in extract_insn, at recog.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
-------------------------------------------------------------------------------------------------------------

Basically it says the new isns I added have not been recognized. Within 
the function 'extract_insn', the function 'recog_memoized is called. The 
code can be found in the file "recog.h" (cf following).

---recog.h----------------------------------------------------------------------------------------------------------

static inline int
recog_memoized (rtx insn)
{
  if (INSN_CODE (insn) < 0)
    INSN_CODE (insn) = recog (PATTERN (insn), insn, 0);
  return INSN_CODE (insn);
}
#endif
-------------------------------------------------------------------------------------------------------------

The function 'recog' is coded in a file 'insn-recog.c' which is 
generated at bootstrap-time by the file 'genrecog.c'
Does anyone have a clue for solving the problem? I am really open to any 
suggestions. ;-)

Thanks in advance,
Thomas



More information about the Gcc mailing list