Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About constants
#9
LCD Wrote:
boriel Wrote:You can see the 'b' variable is useless: You don't use if for anything. If you use -o2 it will be removed.
In your listing you're having the same problem because the compiler does not know anything about the asm level. This problem also exists in other compilers and it's usually fixed with a directive.
You can avoid this by using -o1 compiler option, or just do something like:
Code:
REM this code will be optimized and removed
dummy = source
dummy = dest
Which will prevent "source" and "dest" to be removed.

I'm also studying the PRINT library inclusion (this is due to a reorder of the attributes routines for higher speed). Will fix it in 1.1.1.

Yes, its true, I was using -o 2, you arguments are absolutly correct, but I was not expecting that if I use these Variables with ASM, they will be stripped away (they are used ad least in ASM). Maybe this problem could be adressed in one of the future releases. If the variables are used in ASM code, the optimisation must not strip the variables. It will be very useful to have optimisation level 2 together with the possibility to use the variables directly in ASM of a SUB.
The workaround works, thank you.
By now -o2 only stripes variables! Tongue so you can delay using it.
Parsing accessed labels from the asm layer back to the compiler is a really really hard task! :?
What I've seen with GNU C an others is to declare variables in a way that tell the compiler no to optimize them (for example, "volatile" in C or something like that).

See here an example for the GNU C compiler, and some problems (warning, too technical, it's just an example). So it's not a trivial task. :?

Quote:By the way, I wrote a very positive article about the Compiler for a german fanzine
Thanks a lot! Do you have the URL?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)