Saaa wrote:
Which kind of optimizations are located in the front-end?
Not the -O ones, right?

Which ones are the -O ones? You can see which optimizations are applied in the front end in optimize.c

For example this:

---
int foo(int x) {
  return x * 2 * 2;
}

int bar(int x) {
  return 2 * 2 * x;
}
---

is transformed to this:

---
int foo(int x) {
  return x * 2 * 2;
}

int bar(int x) {
  return 4 * x;
}
---

So it seems the optimize.c code just optimizes left subexpressions. I wonder if -O does more that. Because if not, there's still a lof of room for optimization in the compiler.

Where can I find a version of obj2asm for Windows to see what's going on in those cases?


Saaa wrote:
How do you generate the compile-time view?
Since Descent has a Java port of the DMD frontend inside, it probably just runs the semantics passes on the AST and prints it back out...


Reply via email to