This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Loop unrolling Problem !!


hi,

I compiler the source main.c with m68k-elf-gcc(gcc-3.0.4 and binutils-2.12)
and  dissemble the binary file, we can find that the code inside the
infinte
loop while(1) j = 10 and i = 10 have two copy in binary file.
Is there any option to avoid this kind of duplication and
where to find the source related with.


thanks,

By the way, I compiled the source with following command
m68k-elf-gcc -m68000 -nostartfiles -gstabs+ -nostdlib -fno-unroll-loops  -c
main.c

SOURCE: main.c
================================
main ()
{
  int j = 10;
  int i = 10;
  while(1)
  {
    j = 10;
    i = 10;
  }

}



Disassemble:
========================================
main ()
{
 400:   4e56 fff8       linkw %fp,#-8
  int j = 10;
 404:   700a            moveq #10,%d0
 406:   2d40 fffc       movel %d0,%fp@(-4)
  int i = 10;
 40a:   2d40 fff8       movel %d0,%fp@(-8)
  while(1)
  {
    j = 10;
 40e:   2d40 fffc       movel %d0,%fp@(-4)
    i = 10;
 412:   2d40 fff8       movel %d0,%fp@(-8)
 416:   700a            moveq #10,%d0
 418:   2d40 fffc       movel %d0,%fp@(-4)
 41c:   2d40 fff8       movel %d0,%fp@(-8)
 420:   60f4            bras 416 <main+0x16>
  }



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