Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/27/08 14:20
Read: times


 
#161172 - Good compilers gives "random" code
Responding to: ???'s previous message
The better the compiler, the more "random" the code generation will look.

The compiler will analyze all C statements and substatements and see which statements that may swap places to better reuse registers or memory accesses. And it will look for common subexpressions that it can precompute.

And if you optimize for size, the compiler may notice multiple C functions that produces identical clean-up code and may then end one function with a jump into the middle of the generated code for another function. So you may have multiple entry points for a function.

Returning with a jump instead of a normal return can also happen when a function ends with a call to another function - instead of adding one more stack return level, it is easier to just jump to the new function.

In the end, you can have a function start that is never accessed by a call - only by a jump. And you can have a jump into a function that does not represent the start of the function. And you can obviously have many exit points for a function.

PC compilers often introduce copyright messages into the application but for embedded systems, every single byte counts. It can be hard to deduce which compiler was used and which code blocks that represents functions from the standard C library. You can't even be sure that all CRTL functions are stored side-by-side. The 8051 linkers are mighty clever because they have to fight with a problematic chip - they quite often not just link but actually rewrite part of the code during the linking.

List of 15 messages in thread
TopicAuthorDate
8051/2 ASM to C code            01/01/70 00:00      
   You don't            01/01/70 00:00      
      8051 ASM to C            01/01/70 00:00      
         No, not possible            01/01/70 00:00      
            Not worth the effort            01/01/70 00:00      
               bribe the original programmer            01/01/70 00:00      
         There is no quick way            01/01/70 00:00      
            origional code c or asm            01/01/70 00:00      
               erratic and not logical            01/01/70 00:00      
                  Good compilers gives "random" code            01/01/70 00:00      
         starting from scratch with knowledge            01/01/70 00:00      
   Start from scratch            01/01/70 00:00      
      it'll cost 'em more, but they get what they deserve            01/01/70 00:00      
   ASM ---> C            01/01/70 00:00      
      RE: whats the problem with ASM            01/01/70 00:00      

Back to Subject List