Local variables optimization

2005-07-23 Thread Hanzac Chen

Hi,

Some idea: Maybe local stack use in the code compiled by GCC should be
optimized 'cause some local variables are conditional. If the condition
is not satisfied, then these variables don't need to be allocated from
the stack (e.g. sub $VAR_SIZE, %esp).

For example:

int *func(unsigned int cond, unsigned i)
{
  switch (cond)
  {
case 1:
{  int d[0x10];
   i = memset(d, i, 0x10);
}
case 2:
{  int e[0x10];
   i = memset(e, i, 0x10);
}
case 3:
{  int f[0x10];
   i = memset(f, i, 0x10);
}
default:
  break;
  }
  return 1;
}

After compiled by GCC, you'll see GCC allocated all the local variables
in case 1/case 2/case 3, this is stupid.

Hanzac


Re: Local variables optimization

2005-07-23 Thread Hanzac Chen

Ian Lance Taylor wrote:

You neglected to mention which version of gcc you were using, or which
target.  The description and test case sound like GCC PR 9997:
http://gcc.gnu.org/PR9997
which was fixed for the 4.0 release.

Sorry, I'm using GCC 3.4.4, haven't tested on 4.0.X.
I saw the PR 9997, yes, that's it.

Thanks,
Hanzac



The comment start symbol for arm assembler

2005-10-30 Thread Hanzac Chen
Hi,

Is the comment symbol for arm "@"? But the intermediate code
(assembler code)  generated by GCC 4.1.0 (gcc-4.1-20051022) can't be
assembled by the latest release of binutils (binutils-2.16.1).

Which is the correct line-comment symbol for arm assembler?

Thanks,
Hanzac


Re: The comment start symbol for arm assembler

2005-10-30 Thread Hanzac Chen
On 10/31/05, Hanzac Chen wrote:
> Hi,
>
> Is the comment symbol for arm "@"? But the intermediate code
> (assembler code)  generated by GCC 4.1.0 (gcc-4.1-20051022) can't be
> assembled by the latest release of binutils (binutils-2.16.1).
>
> Which is the correct line-comment symbol for arm assembler?

Sorry, I found that if I change the comment symbol from  "@" to ";@",
it will work fine.


arm-aout_h-comment.patch
Description: Binary data