avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [AVR] RTL prologue/epilogue


From: Denis Chertykov
Subject: Re: [avr-libc-dev] [AVR] RTL prologue/epilogue
Date: 26 Jun 2006 18:51:22 +0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Anatoly Sokolov" <address@hidden> writes:

> > Hello.
> > 
> > Attached is modifed Andy Hutchinson patch that changes AVR GCC to use RTL 
> > prologue/epilogue generation. 
> > Original patch: http://gcc.gnu.org/ml/gcc/2005-03/msg00923.html
> > 
> > New pach is for GCC 4.2.

This patch seems wrong for me:
1. Use 'prologue' instead of 'prolog';
2. insn "incstackhi" must be part of addhi
   (even more I would to have addhi sp,
    -1 push
    -2 rcall
    -3 push + rcall
    -4 rcall + rcall
    -5 rcall + rcall + push
    -6 rcall + rcall + rcall);
3. insn "enable_interrupt" and many others must uses unspec constants
   (like strlenhi use UNSPEC_STRLEN);
4. Strange insn:
(define_insn "disable_interrupt"
  [(unspec [(const_int 0)] 2)]
  ""
  ;; Disable Interrupts
  "*
  {
    rtx ops[4];
    output_asm_insn (\"cli\", ops);
    return \"\";
  }"
  [(set_attr "length" "1")
  (set_attr "cc" "none")
  ])

why not ?

;; Disable Interrupts
(define_insn "disable_interrupt"
  [(unspec [(const_int 0)] UNSPEC_CLI)]
  ""
  "cli"
  [(set_attr "length" "1")
  (set_attr "cc" "none")])
5. Wrong "jump_exit" - use '%~jmp exit' template instead of C code.
   Also, better to generate real jump insn and label 'exit'.
6. The insn:
(define_insn "input"
  [(set (match_operand:QI 0 "register_operand" "") 
       (match_operand:QI 1 "memory_operand" ""))
   (unspec:QI [(const_int 0)] 9) ]
--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  seems strange for me !

Better to teach movqi to output __SP_L__, __SP_H__, etc for
appropriate addresses.
7. Wrong way:
;; unspec pop  - use for r0/r1 etc.
;; Required so gcc wont try to delete from prologue/epilogue
;;
(define_insn "pop_regqi"

This is a wrong way. GCC have RTX_FRAME_RELATED_P() macro which must
be used for such insns instead of unspecs.

`RTX_FRAME_RELATED_P (X)'
     Nonzero in an `insn', `call_insn', `jump_insn', `barrier', or
     `set' which is part of a function prologue and sets the stack
     pointer, sets the frame pointer, or saves a register.  This flag
     should also be set on an instruction that sets up a temporary
     register to use in place of the frame pointer.  Stored in the
     `frame_related' field and printed as `/f'.

     In particular, on RISC targets where there are limits on the sizes
     of immediate constants, it is sometimes impossible to reach the
     register save area directly from the stack pointer.  In that case,
     a temporary register is used that is near enough to the register
     save area, and the Canonical Frame Address, i.e., DWARF2's logical
     frame pointer, register must (temporarily) be changed to be this
     temporary register.  So, the instruction that sets this temporary
     register must be marked as `RTX_FRAME_RELATED_P'.

     If the marked instruction is overly complex (defined in terms of
     what `dwarf2out_frame_debug_expr' can handle), you will also have
     to create a `REG_FRAME_RELATED_EXPR' note and attach it to the
     instruction.  This note should contain a simple expression of the
     computation performed by this instruction, i.e., one that
     `dwarf2out_frame_debug_expr' can handle.

     This flag is required for exception handling support on targets
     with RTL prologues.



Denis.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]