Thanks. I modified the related macros, like reg_class, REG_CLASS_FROM_LETTER(CHAR) and so on. But I have a problem on define_peephole2.
After I modified the related macros, I replaced the "r" in "custom_inii" with "c". (define_insn "custom_inii" [(set (match_operand:SI 0 "register_operand" "=c") (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") (match_operand:SI 2 "register_operand" "c") (match_operand:SI 3 "register_operand" "c")] CUSTOM_INII))] "" "custom\\t%1, %0, %2, %3" [(set_attr "type" "custom")]) And I defined the peephole as (define_peephole2 [(set (match_operand:SI 0 "register_operand" "") (plus:SI (match_operand:SI 1 "register_operand" "") (match_operand:SI 2 "arith_operand" "")))] "REG_P(operands[2])" [(set (match_operand:SI 0 "register_operand" "=c") (unspec_volatile:SI [(match_operand:SI 3 "custom_insn_opcode" "N") (match_operand:SI 1 "register_operand" "c") (match_operand:SI 2 "register_operand" "c")] CUSTOM_INII))] " { operands[3] = GEN_INT(100); }") I encounter the following error isqrt.c: In function `usqrt': isqrt.c:65: error: insn does not satisfy its constraints: (insn 118 41 36 1 0x1002f390 (set (reg/v:SI 4 r4 [82]) (unspec_volatile:SI [ (const_int 100 [0x64]) (reg:SI 4 r4 [86]) (reg:SI 3 r3 [88]) ] 117)) 75 {custom_inii} (nil) (expr_list:REG_DEAD (reg:SI 3 r3 [88]) (nil))) isqrt.c:65: internal compiler error: in build_def_use, at regrename.c:782 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.altera.com/mysupport> for instructions. I think the reason it failed is there's no more define_insn "custom_inii" with general registers because I already changed the "r" to "c". However, it seems very difficult here. The old insn patterns are all general registers, but the new insn patterns are defined as custom registers. Can I use something like operands[0] = gen_rtx_REG (DImode, REGNO(operands[0])); here to force all the operands to be a different kind? Or how can I define the peephole? On 7/28/05, James E Wilson <[EMAIL PROTECTED]> wrote: > Liu Haibin wrote: > > (match_operand:SI 2 "register_operand" "r") > > But the problem is it uses normal register, like r8, r9. How can I > > write the define_peephole2 so that it uses custom registers? > > See the "Constraints" section of the documentation. "r" means a general > register. If you want a custom register, then you need to use a > contraint letter that maps to a custom register. > > If the port does not already support custom registers, then you need to > modify many of the register allocation related macros to add support for > the custom registers. See the "Registers" and "Register Classes" > sections of the documentation. > -- > Jim Wilson, GNU Tools Support, http://www.specifix.com >