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]

Re: EH on i960 (and nested functions)


> Date: Tue, 21 Apr 1998 13:23:28 -0700
> From: Jim Wilson <wilson@cygnus.com>

> In addition to the changes you mentioned, you presumably also need
> to do something about STATIC_CHAIN_REGNUM. [ ... ]  I don't know
> what to do to solve this though.  I suspect we may need to make an
> ABI change that will affect non-nested functions too.

I am nearly done...  I should have the STATIC_CHAIN_REGNUM restored
properly.  No abi changes seem necessary, though one will need to
recompile all code that had non-local gotos in them (which is ok,
because that code didn't work before).

These changes aren't done, addition work (make sure -O doesn't screw
the code, nonlocal_goto's interface is different) is needed.  Nobody
said how hot kenenr was for the fixes, so I provide them here, just in
case he needs them in the nearer term.  I'll spruce them up and
resubmit them later.  Kenner, if you want to verify these fix the
problem you saw, you can take a look at sparc/sparc.md's nonlocal_goto
pattern for the right operand ordering, the one below was current as
of two years back, and just avoid -O.  If they don't work, let me know
what's missing and I will fix it for you.

Doing diffs in i960.h.~1~:
*** i960.h.~1~	Thu Apr 16 15:03:46 1998
--- i960.h	Thu Apr 16 15:04:24 1998
*************** extern struct rtx_def *gen_compare_reg (
*** 1472,1477 ****
--- 1472,1482 ----
  		  CXT);							\
  }
  
+ /* Generate RTL to flush the register windows so as to make arbitrary frames
+    available.  */
+ #define SETUP_FRAME_ADDRESSES()		\
+   emit_insn (gen_flush_register_windows ())
+ 
  #if 0
  /* Promote char and short arguments to ints, when want compatibility with
     the iC960 compilers.  */
--------------
Doing diffs in i960.md.~1~:
*** i960.md.~1~	Thu Apr 16 15:03:54 1998
--- i960.md	Mon Apr 20 18:05:15 1998
***************
*** 2419,2424 ****
--- 2419,2485 ----
    "* return i960_output_ret_insn (insn);"
    [(set_attr "type" "branch")])
  
+ (define_insn "ret"
+   [(use (reg:SI 16))
+    (unspec_volatile [(const_int 0)] 3)]
+   ""
+   "ret"
+   [(set_attr "type" "branch")
+    (set_attr "length" "1")])
+ 
+ (define_insn "call1f"
+   [(unspec_volatile [(const_int 0)] 4)]
+   ""
+   "call    1f\;1:"
+   [(set_attr "type" "misc")
+    (set_attr "length" "1")])
+ 
+ (define_expand "nonlocal_goto"
+   [(match_operand:SI 0 "" "")
+    (match_operand:SI 1 "general_operand" "")
+    (match_operand:SI 2 "general_operand" "")
+    (match_operand:SI 3 "general_operand" "")]
+   ""
+   "
+ {
+   rtx fp = operands[0];
+   rtx chain = operands[1];
+   rtx stack = operands[2];
+   rtx lab = operands[3];
+ 
+   if (GET_CODE (fp) != REG)
+     fp = force_reg (Pmode, fp);
+ #if 0  
+   /* Is this needed?  */
+   emit_move_insn (virtual_stack_vars_rtx, fp);
+ #endif
+   if (GET_CODE (lab) != REG)
+     lab = force_reg (Pmode, lab);
+   if (GET_CODE (chain) != REG)
+     chain = force_reg (Pmode, chain);
+   emit_insn (gen_call1f ());
+   emit_insn (gen_flush_register_windows ());
+   emit_move_insn (gen_rtx (MEM, SImode,
+ 			   plus_constant (fp, 8-STARTING_FRAME_OFFSET)),
+ 		  chain);
+   emit_move_insn (gen_rtx (MEM, SImode,
+ 			   plus_constant (fp, 12-STARTING_FRAME_OFFSET)),
+ 		  lab);
+   emit_move_insn (gen_rtx (REG, SImode, 16),
+ 		  plus_constant (fp, -STARTING_FRAME_OFFSET));
+   emit_insn (gen_ret ());
+   emit_barrier ();
+   DONE;
+ }")
+ 
+ ;; Special insn to flush register windows.
+ (define_insn "flush_register_windows"
+   [(unspec_volatile [(const_int 0)] 1)]
+   ""
+   "flushreg"
+   [(set_attr "type" "misc")
+    (set_attr "length" "1")])
+ 
  (define_insn "nop"
    [(const_int 0)]
    ""
--------------


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