PreviousUpNext

15.3.85  src/lib/compiler/back/low/code/compile-register-moves.api

# compile-register-moves.api

# Given N source registers S and N destination registers D,
# generate an instruction sequence that will copy each Si to Di
# without anything getting clobbered.
#
# In general S and D may overlap, in which case a temporary
# reqister may be needed -- the simplest case is when swapping
# the contents of two registers.  (Yes, there is the "XOR trick",
# but it is too slow for production use.)
#
# Compare to:
#     src/lib/compiler/back/low/intel32/code/compile-register-moves-intel32.api
#     src/lib/compiler/back/low/pwrpc32/code/compile-register-moves-pwrpc32.api
#     src/lib/compiler/back/low/sparc32/code/compile-register-moves-sparc32.api

# Compiled by:
#     src/lib/compiler/back/low/lib/lowhalf.lib

stipulate
    package rkj =  registerkinds_junk;                                                  # registerkinds_junk    is from   src/lib/compiler/back/low/code/registerkinds-junk.pkg
herein

    api Compile_Register_Moves {
        #
        package mcf: Machcode_Form;                                                     # Machcode_Form         is from   src/lib/compiler/back/low/code/machcode-form.api

        Parallel_Register_Moves
          =
          { tmp:  Null_Or( mcf::Effective_Address ),                                                    # Temporary register if needed.
            dst:  List( rkj::Codetemp_Info ),                                           # Move values in these registers...
            src:  List( rkj::Codetemp_Info )                                                    # ... into these registers. Lists must be same length.
          };

        compile_int_register_moves:    Parallel_Register_Moves -> List( mcf::Machine_Op );
        compile_float_register_moves:  Parallel_Register_Moves -> List( mcf::Machine_Op );
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext