## compile-register-moves-sparc32-g.pkg
# Compiled by:
#
src/lib/compiler/back/low/sparc32/backend-sparc32.lib# We are invoked from:
#
#
src/lib/compiler/back/low/main/sparc32/backend-lowhalf-sparc32.pkgstipulate
package lem = lowhalf_error_message; # lowhalf_error_message is from
src/lib/compiler/back/low/control/lowhalf-error-message.pkg package rkj = registerkinds_junk; # registerkinds_junk is from
src/lib/compiler/back/low/code/registerkinds-junk.pkg package w = one_word_unt; # one_word_unt is from
src/lib/std/one-word-unt.pkgherein
generic package compile_register_moves_sparc32_g (
# ================================
#
mcf: Machcode_Sparc32 # Machcode_Sparc32 is from
src/lib/compiler/back/low/sparc32/code/machcode-sparc32.codemade.api )
: (weak) Compile_Register_Moves_Sparc32 # Compile_Register_Moves_Sparc32 is from
src/lib/compiler/back/low/sparc32/code/compile-register-moves-sparc32.api {
package mcf = mcf; # "mcf" == "machcode_form" (abstract machine code).
stipulate
package crm = compile_register_moves_g( mcf ); # compile_register_moves_g is from
src/lib/compiler/back/low/code/compile-register-moves-g.pkg herein
Parallel_Register_Moves
=
{ tmp: Null_Or( mcf::Effective_Address ),
dst: List( rkj::Codetemp_Info ),
src: List( rkj::Codetemp_Info )
};
fun error msg
=
lem::error("compile_register_moves_sparc32_g", msg);
always_zero_register
=
null_or::the # We know it exists on sparc32!
(mcf::rgk::get_always_zero_register rkj::INT_REGISTER);
fun move { src=>mcf::DIRECT rs, dst=>mcf::DIRECT rt }
=>
[mcf::arith { a=>mcf::OR, r=>always_zero_register, i=>mcf::REG rs, d=>rt } ];
move { src=>mcf::DISPLACE { base, disp, ramregion }, dst=>mcf::DIRECT rt }
=>
[mcf::load { l=>mcf::LD, r=>base, i=>mcf::LAB disp, d=>rt, ramregion } ];
move { src=>mcf::DIRECT rs, dst=>mcf::DISPLACE { base, disp, ramregion }}
=>
[mcf::store { s=>mcf::ST, r=>base, i=>mcf::LAB disp, d=>rs, ramregion } ];
move _ => error "move";
end;
fun fmove { src=>mcf::FDIRECT fs, dst=>mcf::FDIRECT fd }
=>
[mcf::fpop1 { a=>mcf::FMOVD, r=>fs, d=>fd } ];
fmove { src=>mcf::DISPLACE { base, disp, ramregion }, dst=>mcf::FDIRECT ft }
=>
[mcf::fload { l=>mcf::LDDF, r=>base, i=>mcf::LAB disp, d=>ft, ramregion } ];
fmove { src=>mcf::FDIRECT fs, dst=>mcf::DISPLACE { base, disp, ramregion }}
=>
[mcf::fstore { s=>mcf::STDF, r=>base, i=>mcf::LAB disp, d=>fs, ramregion } ];
fmove _ => error "fmove";
end;
compile_int_register_moves = crm::compile_int_register_moves { move_instruction => move, ea => mcf::DIRECT };
compile_float_register_moves = crm::compile_int_register_moves { move_instruction => fmove, ea => mcf::FDIRECT };
end;
};
end;