[erlang-questions] R12B-0 HiPE option no_remove_comments

Roger Larsson roger.larsson@REDACTED
Thu Dec 6 02:38:13 CET 2007


I have a script that can be used to look at hipe steps.

----
#!/bin/sh
erlc +native +\{hipe,\[no_remove_comments,pp_all\]\} $1
---- fac.erl
-module(fac).
-export([fac/2]).

fac(A,0)->A;
fac(A,N)->fac(A*N,N-1).
----

This does not work in R12B, it is the no_remove_comments fault.
bash> ./get_icode.sh fac.erl
  label 1:
    {func_info,{atom,fac},{atom,fac},2}
  label 2:
    {test,is_eq_exact,{f,3},[{x,1},{integer,0}]}
    return
  label 3:
    {gc_bif,'*',{f,0},2,[{x,0},{x,1}],{x,0}}
    {gc_bif,'-',{f,0},2,[{x,1},{integer,1}],{x,1}}
    {call_only,2,{fac,fac,2}}

fac:fac/2(v0, v5) ->
%% Info:['Not a closure','Leaf function']
1:
    _ := redtest() (primop)
    if is_{integer,0}(v5) then 3 (0.50) else 6
3:
    return(v0)
6:
    v0 := '*'(v0, v5) (primop)
    v8 := 1
    v5 := '-'(v5, v8) (primop)
    % self_tail_recursive
    goto 1
%% Data:
<HiPE (v 3.6.4)> EXITED with reason {{case_clause,
{comment,self_tail_recursive}},[{hipe_icode_range,analyse_insn,3},
{hipe_icode_range,analyse_BB,5},{hipe_icode_range,analyse_block,4},
{hipe_icode_range,analyse_blocks,3},{hipe_icode_range,analyse,2},
{hipe_icode_range,do_analysis,3},{hipe_icode_range,concurrent_cfg,4},
{hipe_main,icode_range_analysis,3}]} @hipe:907

=ERROR REPORT==== 6-Dec-2007::02:31:49 ===
<HiPE (v 3.6.4)> Error: [hipe:906]: ERROR: {{case_clause,
                                             {comment,self_tail_recursive}},
                                            
[{hipe_icode_range,analyse_insn,3},
                                             {hipe_icode_range,analyse_BB,5},
                                             {hipe_icode_range,analyse_block,
                                              4},
                                             {hipe_icode_range,
                                              analyse_blocks,3},
                                             {hipe_icode_range,analyse,2},
                                             {hipe_icode_range,do_analysis,3},
                                             {hipe_icode_range,
                                              concurrent_cfg,4},
                                             {hipe_main,icode_range_analysis,
                                              3}]}

=ERROR REPORT==== 6-Dec-2007::02:31:49 ===
Error in process <0.27.0> with exit value: {{hipe,907,{{case_clause,
{comment,self_tail_recursive}},[{hipe_icode_range,analyse_insn,3},
{hipe_icode_range,analyse_BB,5},{hipe_icode_range,analyse_block,4},
{hipe_icode_range,analyse_blocks,3},{hipe_icode_range,analyse...

./fac.erl:none: internal error in native_compile;
crash reason: {{hipe,907,
                     {{case_clause,{comment,self_tail_recursive}},
                      [{hipe_icode_range,analyse_insn,3},
                       {hipe_icode_range,analyse_BB,5},
                       {hipe_icode_range,analyse_block,4},
                       {hipe_icode_range,analyse_blocks,3},
                       {hipe_icode_range,analyse,2},
                       {hipe_icode_range,do_analysis,3},
                       {hipe_icode_range,concurrent_cfg,4},
                       {hipe_main,icode_range_analysis,3}]}},
               [{hipe,finalize_fun_sequential,2},
                {hipe,'-finalize_fun_concurrent/2-fun-3-',3}]}

But there is a remove_comments option!
erl> hipe:help_options().
HiPE Compiler Options
 Boolean-valued options generally have corresponding aliases `no_...',
 - - -
   o2 = {'O',2} = [rtl_lcm,icode_range,icode_ssa_const_prop,
                   icode_ssa_copy_prop,icode_ssa_struct_reuse,icode_type,
                   icode_inline_bifs,rtl_ssa,rtl_ssa_const_prop,
                   spillmin_color,use_indexing,remove_comments,
                   concurrent_comp] ++ o1,

/RogerL



More information about the erlang-questions mailing list