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]

Machine Description for Freedom CPU


   I'm currently working on writing a machine description for the Freedom CPU.
One of the particular little quirks of the F-CPU is that it has no PC-relative
branch instruction. Instead, such branches must be done by first loading
(PC + displacement) into a register (of which there exists a dedicated
instruction to do) and then doing an indirect jump through that register.

   Currently I have this described via a define_expand that maps:
(set (pc) (label_ref ...))

to:

(set (reg ...) (label_ref ...))
(set (pc) (reg ...))

and a corresponding define_insn to handle the (set (reg ...) (label_ref ...))
case.

   This scheme works fine and dandy and even emits correct code in the absence
of optimizations. However, the second optimization is turned on, the
transitive use of the label_ref is transformed into a direct use, i.e.
the (set (pc) (label_ref ...)) I was trying to get rid of in the first place.

   So, the essential questions here:
1) How do I stop GCC from performing this transformation or otherwise how
   can I get it to undo it after optimization? The first choice is preferred
   because the registers holding labels should ideally be moved outside
   of loops, but can GCC still do the analyses it needs to do without getting
   rid of indirect jumps (even if it knows the value of the particular
   register)?

2) Can this be done at all? :)

				Lee Salzman (lsalzman+@andrew.cmu.edu)

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