public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Anitha Boyapati <anitha.boyapati@gmail.com>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>,
	"Petr Hluzín" <petr.hluzin@gmail.com>,
	binutils@sourceware.org, gdb@sourceware.org, chertykov@gmail.com,
	aesok@post.ru, eric.weddington@atmel.com
Subject: Re: [avr] gas support for cfi info
Date: Thu, 17 Feb 2011 16:05:00 -0000	[thread overview]
Message-ID: <4D5D4712.8000405@redhat.com> (raw)
In-Reply-To: <AANLkTi=8217mc0JSsoiR2=9uKYaxYSnXiV_AbYW1JPCJ@mail.gmail.com>

On 02/17/2011 07:35 AM, Anitha Boyapati wrote:
> Can you please explain the logic behind the following lines in gcc patch:
> 
> 
> -         offset = -cfa_store.offset;
> +         if (GET_CODE (XEXP (dest, 0)) == POST_DEC)
> +           offset += -cfa_store.offset;
> +         else
> +           offset = -cfa_store.offset;

This is differentiating between pre-dec and post-dec.

		pre-dec		post-dec
before		stuff		stuff
		stuff	<-sp	trash	<-sp
		trash

after		stuff		stuff
		stuff		value
		value	<-sp	trash	<-sp

We've just decremented cfa_store.offset by the size of the pushed
value, and we're computing the offset of VALUE from the CFA.  For
pre-decrement, the value is stored at the CFA offset (the else);
for post-decrement, the value is stored just above the CFA offset.

I admit the logic is confusing here, because we're storing some
quantities as positive offsets, and some quantities as negative
offsets, and we're also using the same variable for two different
things over two sections of code.  Perhaps it would have been less
obtuse if I had written

	offset = -(cfa_store.offset - offset);

> However I have one simple question with regarding the output: The CFI
> instructions for registers have changed only after the prologue. (For
> convenience I have attached disassembly too). As far as I understand,
> DWARF2 spec emits CFI instructions immediately. (Appendix 5 of DWARF2
> specification)

GCC is attempting to minimize the number of advance opcodes by grouping
the DW_CFA_offset opcodes.  We can delay emission of such until the 
registers in question are actually clobbered.  In this case this delay
tactic failed because of the push -- we cannot delay changes to the CFA.

> The other scenario is - how about functions with signals/interrupts?
> The compiler will give an ICE compiling a function as below:
> 
> void my_interrupt_handler() __attribute__ (("interrupt"));

It's a bug in the avr backend; the enable_interrupt insn should not be
marked as frame-related.  We should fix this separately.


r~

      reply	other threads:[~2011-02-17 16:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTim6hyXysiV-025BDgNJ84qaqTnkRdHi+e7bF2gx@mail.gmail.com>
     [not found] ` <AANLkTi=Rnu-wb2W8FejN=XQHmHuTq7rZovKuDdO-QLwi@mail.gmail.com>
     [not found]   ` <AANLkTimOXF1V__SSFs1gtqJh5nc183EdeHm5NoeU6YXs@mail.gmail.com>
     [not found]     ` <AANLkTike2osnZS=sUphuN_=oFQLCDUs54uuGCWL6cLVQ@mail.gmail.com>
2011-02-15 17:41       ` Testing Call frame information in .debug_frame section Richard Henderson
2011-02-15 18:02         ` Richard Henderson
2011-02-15 22:13           ` Petr Hluzín
2011-02-16 16:51             ` Richard Henderson
2011-02-15 18:09         ` Anitha Boyapati
2011-02-15 18:48           ` Richard Henderson
2011-02-15 19:15             ` Anitha Boyapati
2011-02-15 19:03         ` [avr] gas support for cfi info Richard Henderson
2011-02-15 22:45           ` Petr Hluzín
2011-02-16 17:59             ` Richard Henderson
2011-02-16 22:49               ` Petr Hluzín
2011-02-17 16:12                 ` Richard Henderson
2011-02-17 16:16                   ` Tristan Gingold
2011-02-17 15:35               ` Anitha Boyapati
2011-02-17 16:05                 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D5D4712.8000405@redhat.com \
    --to=rth@redhat.com \
    --cc=aesok@post.ru \
    --cc=anitha.boyapati@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=chertykov@gmail.com \
    --cc=eric.weddington@atmel.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb@sourceware.org \
    --cc=petr.hluzin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).