PreviousUpNext

15.4.281  src/lib/compiler/back/low/main/intel32/backend-intel32-g.pkg

## backend-intel32-g.pkg

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


# execode (absolute binary machine code) generation for intel32 architecture.
#
# The Linux ( / *bsd /...) and Win32 backends reference us in
#
#     src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-posix.pkg
#     src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-win32.pkg
#
# respectively.
#
# Our generic parameters serve to encapsulate the
# differences between the Linux / *bsd / ... an the Win32
# fn-call conventions and related platform-specific issues.
#
# "backend_tophalf_g" does the "high-level" (machine-independent)
# code optimizations and transformations.
#
# "backend_lowhalf_intel32_g" does the "low-level" (machine-dependent)
# code optimizations and transformations.

# Our sole entrypoint
#
#     translate_anormcode_to_execode
#
# gets runtime-invoked from
#
#     src/lib/compiler/toplevel/main/translate-raw-syntax-to-execode-g.pkg
#
#

stipulate
    package csb =  code_segment_buffer;                                                 # code_segment_buffer   is from   src/lib/compiler/execution/code-segments/code-segment-buffer.pkg
herein

    # This generic is compiletime-invoked from:
    #
    #     src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-posix.pkg
    #     src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-win32.pkg
    #
    generic package  backend_intel32_g   (
        #            =================
        #
        package cp:  api {  frame_alignment:               Int;
                            return_small_structs_in_registers:  Bool;                   # OSX (i.e., Darwin) returns structs <= 8 bytes in eax/edx. FALSE on other platforms.
                         };

        abi_variant:           Null_Or( String );
    )
# Added for clarity, then removed because it is not defined here: -- 2011-06-01 CrT 
#    : (weak) Backend                                                                   # Backend                               is from   src/lib/compiler/toplevel/main/backend.api
    =
    backend_tophalf_g (                                                                 # backend_tophalf_g                     is from   src/lib/compiler/back/top/main/backend-tophalf-g.pkg
        #
        package blh                                                                     # "blh" == "backend_lowhalf".
            =
            backend_lowhalf_intel32_g (                                                 # backend_lowhalf_intel32_g             is from   src/lib/compiler/back/low/main/intel32/backend-lowhalf-intel32-g.pkg
                #
                package cp = cp;                                                        # "cp" == "ccall_parameters".
                #
                my abi_variant                                                          # NULL everywhere except on intel mac, where it is (THE "Darwin").
                 = abi_variant;
            );

        fun harvest_code_segment  entrypoint_thunk
            =
            {   blh::squash_jumps_and_write_all_machine_code_and_data_bytes_into_code_segment_buffer ();
                #
                csb::harvest_code_segment_buffer (entrypoint_thunk ());
            };
    );
end;

## Copyright (c) 2006 by The Fellowship of SML/NJ
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext