Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Long Li <long21st@yahoo.com>
To: linux-mips@linux-mips.org
Subject: register declared variable for no optimization
Date: Thu, 30 Jan 2003 15:11:19 -0800 (PST)	[thread overview]
Message-ID: <20030130231119.65802.qmail@web40412.mail.yahoo.com> (raw)

Hi,

I have a question on the GCC optimization. I am using
GCC3.0.4 MIPS crosscompiler on Redhat 7.1. In a
function I did the following:

init()
{
  register unsigned int temp;
      .
      .
  temp = devict.dev1.devtc
      .
} 

I compiled the code with optimization level 0 and
found something weird about the register variable
temp. This is shows in the disassembly file:

for temp = devict.dev1.devtc
    lui $3, 0xb801
    lw  $3, 28($3)

This is right since the CPU loads the
devict.dev1.devtc value from memory to the register 3.
However, after the above instructions, I found:

     nop
     sw $3, 0($30)
     lw $2, 0($30)

now the compiler asked the CPU to store the register
in the stack. However, I declared the variable as a
register, how come it still needs to go to the stack?
I compiled the same code with gcc-2.8.1, optimization
level 0, and did not find the same issue there. 

Why the gcc-3.0.4 did the weird stuff? Do I have to
use at least level 1 to make the register declared
work for it?

Thanks a lot!


Long

 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

             reply	other threads:[~2003-01-30 23:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-30 23:11 Long Li [this message]
2003-01-31  2:20 ` register declared variable for no optimization Ralf Baechle

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=20030130231119.65802.qmail@web40412.mail.yahoo.com \
    --to=long21st@yahoo.com \
    --cc=linux-mips@linux-mips.org \
    /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