PreviousUpNext

15.4.313  src/lib/compiler/back/low/main/pwrpc32/pseudo-instructions-pwrpc32-g.pkg

## pseudo-instructions-pwrpc32-g.pkg

# Compiled by:
#     src/lib/compiler/mythryl-compiler-support-for-pwrpc32.lib

# We are invoked from:
#
#     src/lib/compiler/back/low/main/pwrpc32/backend-lowhalf-pwrpc32.pkg

stipulate
    package frr =  nextcode_ramregions;                                         # nextcode_ramregions           is from   src/lib/compiler/back/low/main/nextcode/nextcode-ramregions.pkg
herein

    generic package   pseudo_instructions_pwrpc32_g   (
        #             =============================
        #
        package mcf: Machcode_Pwrpc32                                           # Machcode_Pwrpc32              is from   src/lib/compiler/back/low/pwrpc32/code/machcode-pwrpc32.codemade.api
                     where
                         rgn == nextcode_ramregions;                            # "rgn" == "region".
    )
    : (weak) Pseudo_Instructions_Pwrpc32                                        # Pseudo_Instructions_Pwrpc32   is from   src/lib/compiler/back/low/pwrpc32/treecode/pseudo-instructions-pwrpc32.api
    {
        # Exported to client packages:
        #
        package mcf =  mcf;                                                     # "mcf" == "machcode_form" (abstract machine code).

        stipulate
            package rgk =  mcf::rgk;                                            # "rgk" == "registerkinds".
        herein

            stack = frr::stack;

            cvti2d_tmp_off   = 4096+16;                                         #  runtime system dependent 
            cvti2d_const_off = 4096+8;                                          #             ''             

            sp = rgk::stackptr_r;

            # Cute little trick -- go figure 
            #
            fun cvti2d { reg, fd }
                =
                {
                    tmp_r = rgk::make_int_codetemp_info  ();
                    tmp_f = rgk::make_float_codetemp_info ();

                    map  mcf::BASE_OP
                       [ mcf::ARITHI { oper => mcf::XORIS, rt=> tmp_r, ra=>reg,     im=> mcf::IMMED_OP 32768 },
                         mcf::ST     { st   => mcf::STW,   rs=> tmp_r, ra=>sp,      d=>  mcf::IMMED_OP (cvti2d_tmp_off+4), ramregion => stack },
                         mcf::ARITHI { oper => mcf::ADDIS, rt=> tmp_r, ra=>rgk::r0, im=> mcf::IMMED_OP (0x4330) },
                         mcf::ST     { st   => mcf::STW,   rs=> tmp_r, ra=>sp,      d=>  mcf::IMMED_OP (cvti2d_tmp_off),   ramregion => stack },
                         mcf::LF     { ld   => mcf::LFD,   ft=> fd,    ra=>sp,      d=>  mcf::IMMED_OP (cvti2d_tmp_off),   ramregion => stack },
                         mcf::LF     { ld   => mcf::LFD,   ft=> tmp_f, ra=>sp,      d=>  mcf::IMMED_OP (cvti2d_const_off), ramregion => stack },
                         mcf::FARITH { oper => mcf::FSUB,  ft=> fd,    fa=>fd,      fb=> tmp_f, rc=>FALSE }
                       ];
                };
        end;
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext