This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Porting gcc for F-CPU without direct JMP


Hello,

I just tried to port GCC 3.2 to free CPU design
(www.f-cpu.org). The cpu is different in sense that
there is no direct jump (only indirect jump to preloaded
address in register).
When I use:
;;(define_expand "jump"
;; [(set (match_dup 1) (label_ref (match_operand:QI 0 "" "")))
;;  (set (pc) (match_dup 1))]
;;  "" "operands[1]=gen_reg_rtx(Pmode);")

it fails during jump optimization while simplifying complex
jumps into simpler ones - endless loop ! I break it:
#0  0x080c120e in gen_sequence () at emit-rtl.c:4620
#1  0x081176bc in gen_jump (operand0=0x4014f708) at insn-emit.c:1392
#2  0x080a63ed in try_redirect_by_replacing_jump (e=0x82d61ac,
target=0x82d60f0) at cfgrtl.c:735
#3  0x080a6632 in redirect_edge_and_branch (e=0x82d61ac, target=0x82d60f0)
at cfgrtl.c:832
#4  0x081b10ef in try_optimize_cfg (mode=17) at cfgcleanup.c:1658

Basically it prevents all non-constant target jumps to be optimized
because jump redirecting needs to change the label constant in jump insn.
Handling jump at assembler is not the ideal way because the
address load insn has some latency which can be hidden by
gcc scheduler. Also it can pull invariant address load out
of the loops.
I was thinking (and I'd appreciate your comments) about changing
jump.c in such way that it looks for appropriate label constant
load insn (probably pointer from jump insn) and does the label change
there.
But I'm not sure if is it enough :( Can someone give me some
hints ?

thanks, devik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]