> (define_expand "zero_extendqihi2"
>   [(set (match_operand:HI                 0 "nonimmediate_operand")
>         (zero_extend:HI (match_operand:QI 1 "general_operand")))]
>   ""
>   "if (rl78_force_nonfar_2 (operands, gen_zero_extendqihi2))
>      DONE;"
>   )

You should be able to simply rl78_nonfar_operand etc and skip
the indirect expansion business.  I don't know when you started
the port but Richard Sandiford's expansion cleanup dated 2011-03-23
should have fixed whatever you're working around in this file.

>     if (CONST_INT_P (operand1) && ! IN_RANGE (INTVAL (operand1), (-1 << 8) + 
> 1, (1 << 8) - 1))
>       FAIL;

Huh?  This would be an assert, not a FAIL.  But why have it?

It sounds like something that should have been caught way up
the chain...

> (define_expand "umulqihi3"
>   [(set (match_operand:HI 0 "register_operand")
>         (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand"))
>                  (zero_extend:HI (match_operand:QI 2 "register_operand"))))]
>   "0"
>   ""
> )

Just delete it?

> (define_expand "addsi3"
>   [(set (match_operand:SI          0 "register_operand" "=&v")
>         (plus:SI (match_operand:SI 1 "nonmemory_operand" "vi")
>                  (match_operand    2 "nonmemory_operand" "vi")))
>    ]
>   ""
>   "if (!nonmemory_operand (operands[1], SImode))
>      operands[1] = force_reg (SImode, operands[1]);
>    if (!nonmemory_operand (operands[1], SImode))
>      operands[2] = force_reg (SImode, operands[2]);"
> )

Drop the register constrains in the expander.  Use register_operand
in the expander and drop the force_reg bits.

Presumably you're doing the force_reg thing for optimization?  Cause
it sure looks like your _internal function can handle immediates.
It sure looks like you can drop the expander entirely and rename the
insn to "addsi3".

I'm somewhat surprised you don't implement subsi3 as well...

It sure looks like 99% of the *_real and *_virt insn patterns should
have "*" names so that they don't generate unused expanders.

>   if (cfun->machine->trampolines_used)
>     emit_insn (gen_trampoline_uninit ());

Do you have another way to uninit, based on stack level?  Otherwise
this feature is incompatible with longjmp or nonlocal goto.  Not
that it isn't a fairly decent plan in the circumstances...

> #define FAILED
> #define MAYBE_OK(insn) if (insn_ok_now (insn)) return;

That non-fallback FAILED probably still ought to be gcc_unreachable.

I didn't review the devirt pass in detail.  I'm somewhat surprised
that you still get decent debug info post-devirt, since I would think
you'd need to copy more of the REG_ATTRs data into the new hard regs.

The port as a whole looks pretty good though.


r~

Reply via email to