Commit affee2db authored by Michael Beck's avatar Michael Beck
Browse files

- removed unused immediate fp mode

- add architecture for trampoline builder
- implemented trampoline builder for x86

[r24418]
parent 0a7db9ee
......@@ -48,6 +48,18 @@ typedef enum {
ASM_CONSTRAINT_FLAG_INVALID = 0x8000
} asm_constraint_flags_t;
/**
* Build a Trampoline for the closure.
* @param block the block where to build the trampoline
* @param mem memory
* @param trampoline address of a trampoline region
* @param env address of the environment
* @param callee address of the function to call
*
* @return modified memory
*/
typedef ir_node *(create_trampoline_fkt)(ir_node *block, ir_node *mem, ir_node *trampoline, ir_node *env, ir_node *callee);
/**
* This structure contains parameters that should be
* propagated to the libFirm parameter set.
......@@ -57,8 +69,6 @@ typedef struct backend_params {
unsigned do_dw_lowering:1;
/** If set, the backend supports inline assembly. */
unsigned support_inline_asm:1;
/** If set, the target architecture use an immediate floating point mode. */
unsigned has_imm_fp_mode:1;
/** Settings for architecture dependent optimizations. */
const ir_settings_arch_dep_t *dep_param;
......@@ -72,9 +82,14 @@ typedef struct backend_params {
/** Backend settings for if-conversion. */
const ir_settings_if_conv_t *if_conv_info;
/** The immediate floating point mode. Temporaries are calculated using
* this mode. */
ir_mode *imm_fp_mode;
/** Size of the trampoline code. */
unsigned trampoline_size;
/** Alignment of the trampoline code. */
unsigned trampoline_align;
/** If non-zero, build the trampoline. */
create_trampoline_fkt *build_trampoline;
} backend_params;
/**
......
......@@ -549,12 +549,13 @@ static const backend_params *TEMPLATE_get_backend_params(void) {
static backend_params p = {
0, /* no dword lowering */
0, /* no inline assembly */
0, /* no immediate floating point mode. */
NULL, /* will be set later */
NULL, /* no creator function */
NULL, /* context for create_intrinsic_fkt */
NULL, /* parameter for if conversion */
NULL /* no immediate fp mode */
0, /* no trampoline support: size 0 */
0, /* no trampoline support: align 0 */
NULL /* no trampoline support: no trampoline builder */
};
return &p;
}
......
......@@ -1120,12 +1120,13 @@ static const backend_params *arm_get_libfirm_params(void) {
static backend_params p = {
1, /* need dword lowering */
0, /* don't support inline assembler yet */
0, /* no immediate floating point mode. */
NULL, /* will be set later */
NULL, /* but yet no creator function */
NULL, /* context for create_intrinsic_fkt */
NULL, /* will be set below */
NULL /* no immediate fp mode */
0, /* no trampoline support: size 0 */
0, /* no trampoline support: align 0 */
NULL /* no trampoline support: no trampoline builder */
};
p.dep_param = &ad;
......
......@@ -344,12 +344,13 @@ int be_parse_arg(const char *arg) {
static const backend_params be_params = {
0, /* need dword lowering */
0, /* don't support inline assembler yet */
0, /* no immediate floating point mode. */
NULL, /* will be set later */
NULL, /* but yet no creator function */
NULL, /* context for create_intrinsic_fkt */
NULL, /* no if conversion settings */
NULL /* no immediate fp mode */
0, /* no trampoline support: size 0 */
0, /* no trampoline support: align 0 */
NULL /* no trampoline support: no trampoline builder */
};
/* Perform schedule verification if requested. */
......
......@@ -2298,6 +2298,33 @@ static int ia32_is_valid_clobber(const void *self, const char *clobber)
return ia32_get_clobber_register(clobber) != NULL;
}
/**
* Create the trampoline code.
*/
static ir_node *ia32_create_trampoline_fkt(ir_node *block, ir_node *mem, ir_node *trampoline, ir_node *env, ir_node *callee)
{
ir_graph *irg = get_Block_irg(block);
ir_node *st, *p = trampoline;
ir_mode *mode = get_irn_mode(p);
/* mov ecx,<env> */
st = new_r_Store(irg, block, mem, p, new_Const_long(mode_Bu, 0xb9));
mem = new_r_Proj(irg, block, st, mode_M, pn_Store_M);
p = new_r_Add(irg, block, p, new_Const_long(mode_Iu, 1), mode);
st = new_r_Store(irg, block, mem, p, env);
mem = new_r_Proj(irg, block, st, mode_M, pn_Store_M);
p = new_r_Add(irg, block, p, new_Const_long(mode_Iu, 4), mode);
/* jmp <callee> */
st = new_r_Store(irg, block, mem, p, new_Const_long(mode_Bu, 0xe9));
mem = new_r_Proj(irg, block, st, mode_M, pn_Store_M);
p = new_r_Add(irg, block, p, new_Const_long(mode_Iu, 1), mode);
st = new_r_Store(irg, block, mem, p, callee);
mem = new_r_Proj(irg, block, st, mode_M, pn_Store_M);
p = new_r_Add(irg, block, p, new_Const_long(mode_Iu, 4), mode);
return mem;
}
/**
* Returns the libFirm configuration parameter for this backend.
*/
......@@ -2319,12 +2346,13 @@ static const backend_params *ia32_get_libfirm_params(void) {
static backend_params p = {
1, /* need dword lowering */
1, /* support inline assembly */
0, /* no immediate floating point mode. */
NULL, /* will be set later */
ia32_create_intrinsic_fkt,
&intrinsic_env, /* context for ia32_create_intrinsic_fkt */
NULL, /* will be set below */
NULL /* will be set below */
12, /* size of trampoline code */
4, /* alignment of trampoline code */
ia32_create_trampoline_fkt,
};
ia32_setup_cg_config();
......
......@@ -777,12 +777,13 @@ static const backend_params *mips_get_libfirm_params(void) {
static backend_params p = {
1, /* need dword lowering */
0, /* don't support inline assembler yet */
0, /* no immediate floating point mode. */
NULL, /* will be set later */
NULL, /* but yet no creator function */
NULL, /* context for create_intrinsic_fkt */
NULL, /* no if conversion settings */
NULL /* no immediate fp mode */
0, /* no trampoline support: size 0 */
0, /* no trampoline support: align 0 */
NULL /* no trampoline support: no trampoline builder */
};
return &p;
......
......@@ -820,12 +820,13 @@ static const backend_params *ppc32_get_libfirm_params(void) {
static backend_params p = {
1, /* need dword lowering */
0, /* don't support inline assembler yet */
0, /* no immediate floating point mode. */
NULL, /* will be set later */
NULL, /* but yet no creator function */
NULL, /* context for create_intrinsic_fkt */
NULL, /* no if conversion settings */
NULL /* no immediate fp mode */
0, /* no trampoline support: size 0 */
0, /* no trampoline support: align 0 */
NULL /* no trampoline support: no trampoline builder */
};
return &p;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment