Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

2 Neutral
  1. Yes, exactly that. I initially used it for a class diagram tool.
  2. Hi, I implemented Sugiyama here: https://github.com/VilleKrumlinde/zgameeditor/blob/master/tools/ZDesigner/3rdparty/SugiyamaLayout.pas It is fully defined in a single unit. I've used it in several projects and it is very fast, robust, and as far as I know bugfree :). Let me know if you need help with using it! You create a subclass and override ExtractNodes and ApplyNodes methods. See this unit for an example (the TMyLayout class).
  3. When optimizations are turned off in Delphi IDE the code is worse: - Each assign to "sum" variable is a load to register from stack, modify register, store back to stack. Same for loop iteration variable "i". - Loop start is not on aligned address - Loop count upwards instead of downwards requiring a compare at the end instead of just jump if not zero. So the compiler do some optimizations but they are very very basic.
  4. I agree. It seems no LLVM optimizations passes are enabled, which corresponds with what others have reported about the mobile LLVM compilers. And this is very disappointing.
  5. Compiling this simple program: program test; {$OPTIMIZATION ON} {$STACKFRAMES OFF} procedure loop; var i,sum : integer; begin sum := 0; for i := 0 to 1000 do sum := sum + 1; end; begin loop; end. Generates the following code (Delphi Mac 64-bit compiler, release build): __project1_loop PROC push rbp mov rbp, rsp mov dword ptr [rbp-8H], 0 mov dword ptr [rbp-0CH], 1001 ALIGN 16 ?_001: inc dword ptr [rbp-8H] dec dword ptr [rbp-0CH] jnz ?_001 pop rbp ret __project1_loop ENDP Some point to notice: - The loop procedure has a stack frame even though we've turned them off - It does not try to use registers for local variables. Both "i" and "sum" are allocated on the stack. - Since the loop body has no side effects and the result is not used then the whole loop can be optimized away. This happens with the same code written in C and compiled with Clang compiler. Clang is interesting comparison because it also uses LLVM infrastructure so it gives an idea of what kind of optimizations that are possible. - If we were to change the loop so the result variable is used (by printing the content of "sum" variable) then Clang will recognize that the loop can be evaluated at compile time and replace it with the equivalent code of printing that constant. Again, Delphi does not do this. See result of Clang here.