flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > What such of optimization have FASM compiler? |
Author |
|
sakeniwefu 09 Apr 2008, 19:32
FASM optimizes for opcode size automagically. The code will always be the smallest possible. In fact, that could cause you problems if you are trying to do alignation using opcode size. Other than that it is all up to you. Of course, if you learn fasm syntax and macros that will help you implement your compiler optimizations more easily.
|
|||
09 Apr 2008, 19:32 |
|
jorge 09 Apr 2008, 21:09
thank sakeniwefu, I have another question.FASM have a 'proc' macro. Do you know if FASM do some Interprocedural Optimization or inline procedures.If not, if you know some tecnique,important reference or serious literature please help me with that.In general tell me if you know the theme of Compiler Optimization and how can you help me with that.
|
|||
09 Apr 2008, 21:09 |
|
sakeniwefu 10 Apr 2008, 00:04
About macros, you should read the manual and specific macros' code. You can also ask in the macro forum.
About code: TRY THIS(I recently rediscovered it and solved all my doubts about modern CPU optimization). |
|||
10 Apr 2008, 00:04 |
|
revolution 10 Apr 2008, 00:24
jorge wrote: thank sakeniwefu, I have another question.FASM have a 'proc' macro. Do you know if FASM do some Interprocedural Optimization or inline procedures.If not, if you know some tecnique,important reference or serious literature please help me with that.In general tell me if you know the theme of Compiler Optimization and how can you help me with that. So what does it optimise: 1) jmp and jcc use the two byte form where possible. 2) immediate values use the signed byte form where possible and the zero byte form for zero values. 3) no spurious generation of nops in the code stream, like some older assemblers would do. 4) optimal PE header size based upon the number of sections. 5) probably a few more things that are generally based upon single instructions or output file shrinking. |
|||
10 Apr 2008, 00:24 |
|
vid 10 Apr 2008, 06:04
Quote: The code will always be the smallest possible This is not true, this would require "exhaustive search" of all possibilities. FASM just tends to create small code, but doesn't always produce smallest possible code. |
|||
10 Apr 2008, 06:04 |
|
sakeniwefu 10 Apr 2008, 09:29
For a single instruction it generates the shortest equivalent opcode, or have I got it wrong?
|
|||
10 Apr 2008, 09:29 |
|
vid 10 Apr 2008, 09:39
Well, for single instruction input it does. But it doesn't always find shortest possible solution for some complex cases
|
|||
10 Apr 2008, 09:39 |
|
revolution 10 Apr 2008, 09:45
sakeniwefu wrote: For a single instruction it generates the shortest equivalent opcode, or have I got it wrong? |
|||
10 Apr 2008, 09:45 |
|
bitRAKE 10 Apr 2008, 14:40
revolution wrote: So what does it optimise: 1) jmp and jcc use the two byte form where possible. 2) immediate values use the signed byte form where possible and the zero byte form for zero values. 3) no spurious generation of nops in the code stream, like some older assemblers would do. 4) optimal PE header size based upon the number of sections. 5) probably a few more things that are generally based upon single instructions or output file shrinking. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
10 Apr 2008, 14:40 |
|
jorge 14 Apr 2008, 15:52
Can any body help me with the theme of Compiler Optimization in the sense of the code that this compiler take as front-end, not only the optimizations of the intruccions that it give as back-end. If any body can tell me any literature that can help me I'm would be very pleasure. sakeniwefu I'm very happy with your help, thank for all.
|
|||
14 Apr 2008, 15:52 |
|
f0dder 14 Apr 2008, 16:01
Here's a few:
The Compiler Design Handbook: Optimizations and Machine Code Generation Compilers: Principles, Techniques, and Tools Modern Compiler Design EDIT: sanitized links. |
|||
14 Apr 2008, 16:01 |
|
bitRAKE 14 Apr 2008, 16:58
Google Scholar is pretty good.
CiteSeerX (alpha) Modern compilers generate an intermediate code (between front and back end) and then most optimization algorithms are applied to this middle code. Reason being that the front end language becomes more flexible (even multiple languages). _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
14 Apr 2008, 16:58 |
|
f0dder 14 Apr 2008, 17:03
Oh, and be sure to throw this one into the mix: http://llvm.org/
|
|||
14 Apr 2008, 17:03 |
|
jorge 14 Apr 2008, 19:21
Thank for your help(f0dder,bitRAKE) but the my problem is more dificult than download those books or paper, I'm cuban student and if some of you know the situacion of my country you will know that is imposible for me to pay those excellent books, I implement all about parising and chek semantic, also I implement a program generator that generate the fasm code, of any program that is ok with the gramar and semantic of my language, but the most important fase of my thesis is the theme of optimization and I'm a baby with that theme, only I know the basic element. You know my real problem, again if any body can help me, tell me how
|
|||
14 Apr 2008, 19:21 |
|
bitRAKE 14 Apr 2008, 20:24
There is a lot of active research in the area of optimization - no need to buy books on the topic. Through Google Scholar I'm often able to find costly IEEE papers availible from the author for free. I've read some about the topic, but do not understand completely.
At the highly abstract level optimizations are transformations to compact a DAG representation of the program. Graph nodes expand with more detail, and contracts through different phases of optimization. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
14 Apr 2008, 20:24 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.