[erlang-questions] compile:file

Björn Gustavsson bgustavsson@REDACTED
Wed Aug 3 16:08:39 CEST 2011


On Mon, Aug 1, 2011 at 3:41 PM, Andrew Kondratovich
<andrew.kondratovich@REDACTED> wrote:
> Hi.
> Docs says, that compile:file("m.erl", ['S']) produces a listing of the
> assembler code in the file m.S.
> Also, docs says, that compile:file("m.S", [asm]) compiles the code
> from input file, which is expected to be assembler code.
>
> So, these two steps identically to simple compile:file("m.erl").

Yes, except that optimizations are run twice, and that causes
problems in this case.

> But, why I can't to compile code from assembler, when it has
> operations with floating points. For example:

The floating point optimization pass introduces instructions
that the earlier live optimization pass does not handle. That
only becomes a problem if the optimizations are run twice.

Use the no_postopt option to prevent assembly language
optimizations from being run twice:

compile:file("m.S", [asm,no_postopt]).

Note that there are test cases (e.g. guard_SUITE:tuple_size/1)
that depend on optimizations being run even when the input
file is assembly code, so I cannot simply change the 'asm'
options not to run the optimizations passes.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list